Package org.openfaces.component.select

Examples of org.openfaces.component.select.SelectBooleanCheckbox


    }

    public void setComponentProperties(FacesContext context, UIComponent component) {
        super.setComponentProperties(context, component);

        SelectBooleanCheckbox sbc = (SelectBooleanCheckbox) component;
        String valueDeclaration = getPropertyValue("value");
        if (!setAsValueExpressionIfPossible(component, "value", valueDeclaration)) {
            if (valueDeclaration.equals("true"))
                sbc.setValue(true);
            else if (valueDeclaration.equals("false"))
                sbc.setValue(false);
            else if (valueDeclaration.equals("undefined"))
                sbc.setValue(null);
            else
                throw new FacesException("Unknown value attribute specification for <o:selectBooleanCheckbox>: " + valueDeclaration + "; it should be either a value binding expression or one of: \"true\", \"false\", or \"undefined\"");
        }

        setStringProperty(component, "accesskey");
View Full Code Here


            throw new IllegalStateException("<o:selectionColumn> can only be inserted into a DataTable/TreeTable with row selection. table id: " + table.getClientId(context));
        */
        ResponseWriter writer = context.getResponseWriter();

        if (selectionMode == AbstractTableSelection.Mode.HIERARCHICAL) {
            SelectBooleanCheckbox checkbox = new SelectBooleanCheckbox();
            if (selection instanceof HierarchicalNodeSelection) {
                checkbox.setTriStateAllowed(true);
                checkbox.setStateList(Arrays.asList(SelectBooleanCheckbox.SELECTED_STATE, SelectBooleanCheckbox.UNSELECTED_STATE));
            }
            checkbox.setSelected(false);
            checkbox.encodeAll(context);

        } else {
            writer.startElement("input", component);
            writer.writeAttribute("type", selectionMode != AbstractTableSelection.Mode.SINGLE ? "checkbox" : "radio", null);
            Styles.renderStyleClasses(context, component);
View Full Code Here

    public void setMirrorTabsetVisible(boolean mirrorTabsetVisible) {
        this.mirrorTabsetVisible = mirrorTabsetVisible;
    }

    public void mirrorTabsetSwitcher(ActionEvent event) {
        SelectBooleanCheckbox checkbox = (SelectBooleanCheckbox) event.getComponent();
        if (checkbox.isSelected()) {
            checkbox.setSelected(false);
            mirrorTabsetVisible = false;
        } else {
            checkbox.setSelected(true);
            mirrorTabsetVisible = true;
        }
    }
View Full Code Here

    private static final String UNSELECTED_CLASS_KEY = "unselectedClass";
    private static final String UNDEFINED_CLASS_KEY = "undefinedClass";

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        SelectBooleanCheckbox checkbox = (SelectBooleanCheckbox) component;
        Components.generateIdIfNotSpecified(component);
        super.encodeBegin(context, component);
        if (!component.isRendered()) return;
        renderInputComponent(context, checkbox);
        Styles.renderStyleClasses(context, checkbox);
View Full Code Here

        renderInitScript(facesContext, checkbox, imagesObj, stylesObj, onchangeFunction, triStateAllowed);
    }

    @Override
    public void decode(FacesContext context, UIComponent component) {
        SelectBooleanCheckbox checkbox = (SelectBooleanCheckbox) component;
        if (checkbox.isDisabled())
            return;

        Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();

        String clientId = checkbox.getClientId(context);
        boolean triStateAllowed = checkbox.isTriStateAllowed();
        if (isRenderedWithImage(checkbox, triStateAllowed)) {
            clientId += STATE_SUFFIX;
        }

        BooleanObjectValue submittedValue;

        if (requestMap.containsKey(clientId)) {
            String requestValue = requestMap.get(clientId);
            if (requestValue.equalsIgnoreCase(SELECTED_STATE) ||
                    requestValue.equalsIgnoreCase("yes") ||
                    requestValue.equalsIgnoreCase("on") ||
                    requestValue.equalsIgnoreCase("true")) {
                submittedValue = BooleanObjectValue.TRUE;
            } else if (triStateAllowed &&
                    (requestValue.equalsIgnoreCase(UNDEFINED_STATE) || requestValue.equalsIgnoreCase("null"))) {
                submittedValue = BooleanObjectValue.NULL; // normal null means no value submitted
            } else {
                submittedValue = BooleanObjectValue.FALSE;
            }
        } else {
            submittedValue = (triStateAllowed ? BooleanObjectValue.NULL : BooleanObjectValue.FALSE);
        }

        checkbox.setSubmittedValue(submittedValue);
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.select.SelectBooleanCheckbox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.