int eventCount = 0;  if ( buttonGroup!=null ) {   for ( int i=0; i<values.length; i++ ) {     String value = values[i];   if ( value.length() < 3 ) { continue;  }      if ( !value.startsWith(super.getLowLevelEventId()) ) { continue; }    switch ( value.charAt(value.length()-1) ) { case '1': requestSelection = true; ++eventCount; break; case '0': requestSelection = false; ++eventCount; break; } } } else { for ( int i=0; i<values.length; i++ ) { requestSelection = parseSelectionToggle(values[0]); ++eventCount; }
if ( value.length() < 3 ) { continue;  }      if ( !value.startsWith(super.getLowLevelEventId()) ) { continue; }    switch ( value.charAt(value.length()-1) ) { case '1': requestSelection = true; ++eventCount; break; case '0': requestSelection = false; ++eventCount; break;
    public void processLowLevelEvent(String action, String[] values) {                boolean requestSelection = isSelected();                 int eventCount = 0;        if ( buttonGroup!=null ) {            // button group prefix is shared, so maybe more than one value is            // delivered in a form             for ( int i=0; i<values.length; i++ ) {                // with button group the value has a special encoding...                // this is because in a form the name of a parameter for                // buttons in a buttongroup must be the same...                String value = values[i];                // illegal format                if ( value.length() < 3 ) { continue;  }                // no uid DIVIDER                // value.charAt(value.length()-2)!=UID_DIVIDER ) { break; }                // not for me                if ( !value.startsWith(super.getLowLevelEventId()) ) { continue; }                // last character is indicator, if button should be                 // selected or not                switch ( value.charAt(value.length()-1) ) {                case '1':                    requestSelection = true;                    ++eventCount;                    break;                case '0':                    requestSelection = false;                    ++eventCount;                    break;                }            }        }         else {            for ( int i=0; i<values.length; i++ ) {                requestSelection = parseSelectionToggle(values[0]);                ++eventCount;            }        }        /*         * Checkboxes in HTML-forms write two form components:         * one hidden input, containing the deselect-command (value='0'),         * and one <input type="checkbox".. value="1">.         * This is, because browsers send the checkbox-variable         * only if it is set, not if it is not set.         * So, if we get two events with the same name, then the checkbox         * actually got selected; if we only got one event (from the hidden         * input), then it was a deselect-event (select event value = '1',         * deselect value = '0').         * This is just in case, the browser sends the both events         * in the wrong order (select and then deselect).         */        if ( eventCount==2 ) {            requestSelection = true;        }        if ( isSelected()!=requestSelection ) {            if ( buttonGroup!=null ) {                buttonGroup.setDelayEvents(true);                setSelected(requestSelection);                buttonGroup.setDelayEvents(false);            } else {                setSelected(requestSelection);            }                        SForm.addArmedComponent(this);        }    }