boolean isButton = false; for (Iterator iter = ieButtonFixClasses.iterator(); iter .hasNext();) { Class bla = (Class)iter.next(); isButton |= bla.isAssignableFrom(gl.getClass()); }
boolean isButton = ((SComponent)gl).getCG() instanceof MSIEButtonFix;
    public boolean dispatch(String name, String[] values) {        if (log.isDebugEnabled())            log.debug("dispatch " + name + " = " + Arrays.asList(values));        boolean result = false;        int dividerIndex = name.indexOf(SConstants.UID_DIVIDER);        String epoch = null;        boolean isIE = SessionManager.getSession().getUserAgent().getBrowserType() == BrowserType.IE;        // no Alias        if (dividerIndex > 0) {            epoch = name.substring(0, dividerIndex);            name = name.substring(dividerIndex + 1);        }        // make ImageButtons work in Forms .. browsers return        // the click position as .x and .y suffix of the name        if (name.endsWith(".x") || name.endsWith(".X")) {            name = name.substring(0, name.length() - 2);        } else if (name.endsWith(".y") || name.endsWith(".Y")) {            // .. but don't process the same event twice.            log.debug("discard '.y' part of image event");            return false;        }                // is value encoded in name ? Then append it to the values we have.        int p = name.indexOf(SConstants.UID_DIVIDER);        if (p > -1) {            String v = name.substring(p + 1);            name = name.substring(0, p);            String[] va = new String[values.length + 1];            System.arraycopy(values, 0, va, 0, values.length);            va[values.length] = v;            values = va;        }        /*         * This is a workaround for IE's buggy button tag support.         * (Might change with IE7)         *          * Normal behavior is to send only the pressed button's name value         * pair. IE sends all buttons in a form, no matter which one was         * pressed. Also, it doesn't send the values, but instead their         * innerHtml property.         *          * So what we do is when a button is pressed in IE, we attach a hidden         * field to the form using javascript, containing info about the         * pressed button. This is read here and the event processing is         * triggered.         *          * Below in the normal event dispatching, we discard all events         * originating from Components which are represented by buttons.         * These are right now:         *   - SButton         *   - SToggleButton         */        if (isIE && name.equals(SConstants.IEFIX_BUTTONACTION)) {            String buttonId = values[0];            String[] vals = new String[] {""};            int pos = buttonId.indexOf(SConstants.UID_DIVIDER);            if (pos > -1) {                String val = buttonId.substring(pos + 1);                buttonId = buttonId.substring(0, pos);                vals[0] = val;            }            List l = (List) listeners.get(buttonId);            if (l != null && l.size() > 0) {                if (log.isDebugEnabled()) {                    log.debug("process special IE workaround event '" + epoch + SConstants.UID_DIVIDER + name + "'");                }                for (int i = 0; i < l.size(); ++i) {                    LowLevelEventListener gl = (LowLevelEventListener) l.get(i);                    if (gl.isEnabled()) {                        if (checkEpoch(epoch, buttonId, gl)) {                            if (log.isDebugEnabled()) {                                log.debug("process event '" + buttonId + "' by " +                                        gl.getClass() + "(" + gl.getLowLevelEventId() +                                        ")");                            }                            gl.processLowLevelEvent(buttonId,vals);                            result = true;                        }                    }                }            }        }        List l = (List) listeners.get(name);        if (l != null && l.size() > 0) {            log.debug("process event '" + epoch + SConstants.UID_DIVIDER + name + "'");            for (int i = 0; i < l.size(); ++i) {                LowLevelEventListener gl = (LowLevelEventListener) l.get(i);                if (gl.isEnabled()) {                    if (checkEpoch(epoch, name, gl)) {                        if (isIE) {                            // see comment above, is this a form event?                            boolean isFormEvent = ((SComponent)gl).getResidesInForm() && ((SComponent)gl).getShowAsFormComponent();                             if (isFormEvent) {                                // was the button represented by a button html tag?                                boolean isButton = false;                                for (Iterator iter = ieButtonFixClasses.iterator(); iter                                        .hasNext();) {                                    Class bla = (Class)iter.next();                                    isButton |= bla.isAssignableFrom(gl.getClass());                                }                                if (isButton) {                                    log.debug("circumventing IE bug, not processing event '" + name + "' by " +                                            gl.getClass() + "(" + gl.getLowLevelEventId() +                                            ")");                                } else {                                    log.debug("process form event not caused by a button tag'" + name + "' by " +                                            gl.getClass() + "(" + gl.getLowLevelEventId() +                                            ")");                                    gl.processLowLevelEvent(name, values);                                    result = true;                                }                            } else {                                log.debug("process event '" + name + "' by " +                                        gl.getClass() + "(" + gl.getLowLevelEventId() +                                        ")");                                gl.processLowLevelEvent(name, values);                                result = true;                            }                        } else {                            log.debug("process event '" + name + "' by " +                                    gl.getClass() + "(" + gl.getLowLevelEventId() +                                    ")");                            gl.processLowLevelEvent(name, values);                            result = true;                        }                    }                }            }        }        return result;    }