Package org.openfaces.component.input

Examples of org.openfaces.component.input.DropDownComponent


    }

    @Override
    public void decode(FacesContext context, UIComponent component) {
        Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
        DropDownComponent dropDownComponent = (DropDownComponent) component;
        String fieldId = getFieldClientId(context, dropDownComponent);

        String value = requestMap.get(fieldId);
        String state = requestMap.get(fieldId + PROMPT_VISIBLE_SUFFIX);

        if ("false".equals(state) && value != null) {
            dropDownComponent.setSubmittedValue(value);
        }

    }
View Full Code Here


        writer.endElement("tr");
    }

    @Override
    public void encodeScriptsAndStyles(FacesContext context, UIComponent component) throws IOException {
        DropDownComponent dropDown = (DropDownComponent) component;
        // Set field text by script to prevent field expanding after summit in IE 6.0 (if field text is long)
        //    another way - use "table-layout: fixed", but it causes strange behavior in IE,
        //    if dropdown width is set to 100% and component is placed into table without concrete width.
        String fieldText = getFieldText(context, dropDown);

        renderEndTags(context, dropDown);

        String promptTextClass = Styles.getCSSClass(context,
                dropDown, dropDown.getPromptTextStyle(), StyleGroup.regularStyleGroup(1), dropDown.getPromptTextClass(),
                DEFAULT_PROMPT_CLASS);

        String promptText = dropDown.getPromptText();

        List<String> params = new ArrayList<String>();
        params.add(fieldText);
        params.addAll(getInputStyles(context, dropDown));
        params.add(promptText);
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        if (AjaxUtil.getSkipExtraRenderingOnPortletsAjax(context))
            return;

        DropDownComponent dropDownComponent = (DropDownComponent) component;

        registerJS(context, component);

        String clientId = dropDownComponent.getClientId(context);

        // Start render drop down
        // Render first tag
        ResponseWriter writer = context.getResponseWriter();
        encodeRootElementStart(writer, dropDownComponent);
View Full Code Here

        writer.writeAttribute("cellpadding", "0", null);
    }

    protected void encodeStatePrompt(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        DropDownComponent fieldComponent = (DropDownComponent) component;
        String value = Rendering.convertToString(context, fieldComponent, fieldComponent.getValue());

        writer.startElement("input", fieldComponent);
        writeAttribute(writer, "type", "hidden");
        writeAttribute(writer, "id", getFieldClientId(context, (DropDownComponent) component) + PROMPT_VISIBLE_SUFFIX);
        writeAttribute(writer, "name", getFieldClientId(context, (DropDownComponent) component) + PROMPT_VISIBLE_SUFFIX);
View Full Code Here

            writeAttribute(writer, "value", "true");
        writer.endElement("input");
    }

    protected void encodeField(FacesContext context, UIComponent component) throws IOException {
        DropDownComponent fieldComponent = (DropDownComponent) component;
        ResponseWriter writer = context.getResponseWriter();

        String fieldId = getFieldClientId(context, fieldComponent);

        writer.writeAttribute("style", "width: 100%; height: 100%", null);

        writer.startElement("input", fieldComponent);
        writer.writeAttribute("id", fieldId, null);
        writer.writeAttribute("value", Rendering.convertToString(context, fieldComponent, fieldComponent.getValue())  , "");
        writer.writeAttribute("name", fieldId, null);
        writer.writeAttribute("type", "text", null);
        writer.writeAttribute("autocomplete", "off", null);
        writeDefaultFieldStyle(context, writer, fieldComponent);

        if (fieldComponent.isDisabled())
            writer.writeAttribute("disabled", "disabled", null);

        if (fieldComponent.isReadonly())
            writer.writeAttribute("readonly", "readonly", null);

        writeFieldAttributes(writer, fieldComponent);
        writer.endElement("input");
View Full Code Here

        return clientId + FIELD_SUFFIX;
    }

    protected void encodeButton(FacesContext context, UIComponent component) throws IOException {
        FacesContext currentInstance = FacesContext.getCurrentInstance();
        DropDownComponent fieldComponent = (DropDownComponent) component;
        ResponseWriter writer = context.getResponseWriter();

        // get all ids (main, button, popup)
        String clientId = fieldComponent.getClientId(currentInstance);
        String buttonId = clientId + BUTTON_SUFFIX;

        writer.writeAttribute("nowrap", "nowrap", null);

        // Render drop down button
        writer.writeAttribute("id", buttonId, null);
        writer.writeAttribute("align", "center", null);
        writer.writeAttribute("valign", "middle", null);
        writeAdditionalButtonAttributes(context, writer, fieldComponent);

        String imageUrl;
        if (fieldComponent.isReadonly()) {
            String disabledButtonImageUrl = (String) fieldComponent.getAttributes().get("disabledButtonImageUrl");
            imageUrl = Resources.getURL(context, disabledButtonImageUrl, null, "input/disabledDropButton.gif");
        } else {
            String buttonImageUrl = (String) fieldComponent.getAttributes().get("buttonImageUrl");
            imageUrl = Resources.getURL(context, buttonImageUrl, null, "input/dropButton.gif");
        }
        writer.startElement("img", fieldComponent);
        writer.writeAttribute("id", buttonId + "::img", null);
        writer.writeAttribute("src", imageUrl, null);
View Full Code Here

    @Override
    public void encodeEnd(FacesContext context, UIComponent uiComponent) throws IOException {
        if (AjaxUtil.getSkipExtraRenderingOnPortletsAjax(context))
            return;

        DropDownComponent dropDown = (DropDownComponent) uiComponent;
        ResponseWriter writer = context.getResponseWriter();

        encodeScriptsAndStyles(context, dropDown);
        encodeFieldContentsEnd(writer);
        encodeRootElementEnd(writer);
View Full Code Here

        writer.endElement("td");
        writer.endElement("tr");
    }

    protected void encodeScriptsAndStyles(FacesContext facesContext, UIComponent component) throws IOException {
        DropDownComponent dropDown = (DropDownComponent) component;
        // Set field text by script to prevent field expanding after submit in IE 6.0 (if field text is long)
        //    another way - use "table-layout: fixed", but it causes strange behavior in IE,
        //    if dropdown width is set to 100% and component is placed into table without concrete width.
        String fieldText = getFieldText(facesContext, dropDown);

        renderEndTags(facesContext, dropDown);

        String promptTextClass = Styles.getCSSClass(facesContext,
                dropDown, dropDown.getPromptTextStyle(), StyleGroup.regularStyleGroup(1), dropDown.getPromptTextClass(),
                DEFAULT_PROMPT_CLASS);

        String promptText = dropDown.getPromptText();

        List<Object> params = new ArrayList<Object>();
        params.add(fieldText);
        params.addAll(getInputStyles(facesContext, dropDown));
        params.addAll(getButtonAndListStyles(facesContext, dropDown));
        params.add(dropDown.isDisabled());
        params.add(dropDown.isReadonly());
        params.add(promptText);
        params.add(promptTextClass);

        Object pullPopupFromContainerObj = dropDown.getAttributes().get("pullPopupFromContainer");
        boolean pullPopupFromContainer = pullPopupFromContainerObj != null &&
                (pullPopupFromContainerObj.equals("true") || pullPopupFromContainerObj.equals(Boolean.TRUE));
        params.add(pullPopupFromContainer);
        ScriptBuilder buf = new ScriptBuilder().initScript(facesContext, dropDown, "O$.DropDown._init",
                params.toArray());
View Full Code Here

TOP

Related Classes of org.openfaces.component.input.DropDownComponent

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.