Examples of AbstractTogglePanel


Examples of org.richfaces.component.AbstractTogglePanel

    protected static final String BEFORE_ITEM_CHANGE = "beforeitemchange";
    private static final String ON = "on";

    @Override
    protected void doDecode(FacesContext context, UIComponent component) {
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

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

        // Get the new panel value to show
        String newValue = requestParameterMap.get(getValueRequestParamName(context, component));
        if (newValue != null) {
            panel.setSubmittedActiveItem(newValue);

            if (isSubmitted(context, panel)) {
                PartialViewContext pvc = context.getPartialViewContext();

                pvc.getRenderIds().add(
View Full Code Here

Examples of org.richfaces.component.AbstractTogglePanel

    @Override
    protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
        FormUtil.throwEnclFormReqExceptionIfNeed(context, component);

        super.doEncodeBegin(writer, context, component);
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

        writer.startElement(HtmlConstants.INPUT_ELEM, component);
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getValueRequestParamName(context, component), null);
        writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getValueRequestParamName(context, component), null);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
        writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panel.getActiveItem(), null);
        writer.endElement(HtmlConstants.INPUT_ELEM);

        writeJavaScript(writer, context, component);
    }
View Full Code Here

Examples of org.richfaces.component.AbstractTogglePanel

            component));
    }

    @Override
    protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("activeItem", panel.getActiveItem());
        options.put("cycledSwitching", panel.isCycledSwitching());
        options.put("ajax", getAjaxOptions(context, panel));

        addEventOption(context, panel, options, ITEM_CHANGE);
        addEventOption(context, panel, options, BEFORE_ITEM_CHANGE);
View Full Code Here

Examples of org.richfaces.component.AbstractTogglePanel

        return AbstractTogglePanel.class;
    }

    public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) throws IOException {
        if (AbstractTogglePanel.ACTIVE_ITEM_META_COMPONENT.equals(metaComponentId)) {
            AbstractTogglePanel panel = (AbstractTogglePanel) component;
            int itemIndex = panel.getIndexByName(panel.getActiveItem());

            if (itemIndex >= 0) {
                encodeActiveItem(panel, itemIndex);
            } else {
                partialStart(context, component.getClientId(context));
                component.encodeAll(context);
                partialEnd(context);
                addOnCompleteParam(context, panel.getActiveItem(), panel.getClientId(context));
            }
        } else {
            throw new IllegalArgumentException(metaComponentId);
        }
    }
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

    public static AbstractTogglePanel getEnclosedPanel(UIComponent comp) {
        if (comp == null) {
            return null;
        }

        AbstractTogglePanel panel = ComponentIterators.getParent(comp, AbstractTogglePanel.class);
        if (panel == null) {
            throw new FacesException("Parent panel for control (id=" + comp.getClientId(FacesContext.getCurrentInstance())
                + ") has not been found.");
        }
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

    protected static final String BEFORE_ITEM_CHANGE = "beforeitemchange";
    private static final String ON = "on";

    @Override
    protected void doDecode(FacesContext context, UIComponent component) {
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

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

        // Get the new panel value to show
        String newValue = requestParameterMap.get(getValueRequestParamName(context, component));
        if (newValue != null) {
            panel.setSubmittedActiveItem(newValue);

            if (isSubmitted(context, panel)) {
                PartialViewContext pvc = context.getPartialViewContext();

                pvc.getRenderIds().add(
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

    @Override
    protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
        FormUtil.throwEnclFormReqExceptionIfNeed(context, component);

        super.doEncodeBegin(writer, context, component);
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

        writer.startElement(HtmlConstants.INPUT_ELEM, component);
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getValueRequestParamName(context, component), null);
        writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getValueRequestParamName(context, component), null);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
        writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panel.getActiveItem(), null);
        writer.endElement(HtmlConstants.INPUT_ELEM);

        writeJavaScript(writer, context, component);
    }
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

    }

    @Override
    protected void doEncodeChildren(final ResponseWriter writer, final FacesContext context, UIComponent component) throws IOException
    {
        final AbstractTogglePanel abstractTogglePanel = (AbstractTogglePanel) component;
        if (abstractTogglePanel.getValue() != null) {
                    try {
                        writer.startElement(HtmlConstants.DIV_ELEM, null);
                        writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-crl-sl", "class");
                        DataVisitor visitor = new AbstractTogglePanelItemVisitor(abstractTogglePanel, new AbstractTogglePanelItemVisitor.TabVisitorCallback() {
                            @Override
                            public DataVisitResult visit(AbstractTogglePanelItemInterface item)
                            {
                                try {
                                    ((UIComponent) item).encodeAll(context);
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                return DataVisitResult.CONTINUE;
                            }
                        });
                        abstractTogglePanel.walk(context, visitor, null);
                        writer.endElement(HtmlConstants.DIV_ELEM);
                    } finally {
                        abstractTogglePanel.setRowKey(context, null);
                    }
        } else {
            renderChildren(context, component);
        }
    }
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

            component));
    }

    @Override
    protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
        AbstractTogglePanel panel = (AbstractTogglePanel) component;

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("activeItem", panel.getActiveItem());
        options.put("cycledSwitching", panel.isCycledSwitching());
        options.put("ajax", getAjaxOptions(context, panel));

        addEventOption(context, panel, options, ITEM_CHANGE);
        addEventOption(context, panel, options, BEFORE_ITEM_CHANGE);
View Full Code Here

Examples of org.richfaces.sandbox.component.AbstractTogglePanel

        return AbstractTogglePanel.class;
    }

    public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) throws IOException {
        if (AbstractTogglePanel.ACTIVE_ITEM_META_COMPONENT.equals(metaComponentId)) {
            AbstractTogglePanel panel = (AbstractTogglePanel) component;
            AbstractTogglePanelItemInterface item = panel.getItem(panel.getActiveItem());

            if (item != null) {
                partialStart(context, ((UIComponent) item).getClientId(context));
                ((UIComponent) item).encodeAll(context);
                partialEnd(context);
                addOnCompleteParam(context, item.getName(), panel.getClientId(context));
            } else {
                partialStart(context, component.getClientId(context));
                component.encodeAll(context);
                partialEnd(context);
                addOnCompleteParam(context, panel.getActiveItem(), panel.getClientId(context));
            }
        } else {
            throw new IllegalArgumentException(metaComponentId);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.