Package org.richfaces.component

Examples of org.richfaces.component.AbstractCollapsibleSubTable


    private static final String DISPLAY_NONE = "display: none;";

    private class CollapsibleSubTableHiddenEncodeStrategy implements EncodeStrategy {
        public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object[] params)
            throws IOException {
            AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) component;
            writer.startElement(HtmlConstants.TR_ELEMENT, subTable);
            writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, subTable.getContainerClientId(context) + HIDDEN_CONTAINER_ID,
                null);
            writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
            writer.startElement(HtmlConstants.TD_ELEM, subTable);
        }
View Full Code Here


        context.getPartialViewContext().getRenderIds().add(component.getClientId(context));
    }

    protected void encodeControl(FacesContext context, UIComponent component) throws IOException {
        AbstractCollapsibleSubTableToggler toggleControl = (AbstractCollapsibleSubTableToggler) component;
        AbstractCollapsibleSubTable subTable = findComponent(context, toggleControl);

        if (subTable != null) {
            boolean expanded = subTable.isExpanded();

            ResponseWriter writer = context.getResponseWriter();
            encodeControl(context, writer, toggleControl, expanded, true);
            encodeControl(context, writer, toggleControl, !expanded, false);
View Full Code Here

    }

    ;

    protected void doDecode(FacesContext facesContext, UIComponent component) {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) component;

        String clientId = subTable.getClientId(facesContext);
        Map<String, String> requestMap = facesContext.getExternalContext().getRequestParameterMap();

        String optionsId = clientId + OPTIONS;
        String togglerId = requestMap.get(optionsId);

        String stateId = clientId + STATE;
        String state = (String) requestMap.get(stateId);

        boolean isExpanded = true;
        if (state != null) {
            int newValue = Integer.parseInt(state);

            if (newValue < 1) {
                isExpanded = false;
            }

            if (subTable.isExpanded() != isExpanded) {
                new CollapsibleSubTableToggleEvent(subTable, isExpanded, togglerId).queue();
            }
        }
    }
View Full Code Here

        String styleClass = concatClasses(getRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
        encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
    }

    public void encodeTableFacets(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) dataTable;

        encodeStyle(writer, context, subTable, null);

        encodeHeaderFacet(writer, context, subTable, false);

        String rowClass = getRowSkinClass();
        String cellClass = getCellSkinClass();
        String firstClass = getFirstRowSkinClass();

        rowClass = mergeStyleClasses("rowClass", rowClass, subTable);
        cellClass = mergeStyleClasses("cellClass", cellClass, subTable);
        firstClass = mergeStyleClasses("firstRowClass", firstClass, subTable);

        saveRowStyles(context, subTable.getContainerClientId(context), firstClass, rowClass, cellClass);
    }
View Full Code Here

    }

    @Override
    public void encodeTableBodyStart(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase)
        throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) dataTableBase;

        UIDataTableBase component = findParent(subTable);
        if (component instanceof AbstractDataTable) {
            writer.startElement(HtmlConstants.TBODY_ELEMENT, null);
            writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
                component.getRelativeClientId(facesContext) + ":" + subTable.getId() + TB_ROW, null);
            writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, getTableSkinClass(), null);

            String predefinedStyles = !subTable.isExpanded() ? DISPLAY_NONE : null;
            encodeStyle(writer, facesContext, subTable, predefinedStyles);
        }
    }
View Full Code Here

    }

    @Override
    public void encodeBeforeRows(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase,
        boolean encodeParentTBody, boolean partialUpdate) throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) dataTableBase;
        encodeTableBodyStart(writer, facesContext, subTable);
        encodeSubTableDomElement(writer, facesContext, subTable);
        encodeHeaderFacet(writer, facesContext, subTable, false);
    }
View Full Code Here

    }

    @Override
    public void encodeAfterRows(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase,
        boolean encodeParentTBody, boolean partialUpdate) throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) dataTableBase;
        encodeFooterFacet(writer, facesContext, subTable, false);
    }
View Full Code Here

        return (parent instanceof AbstractDataTable);
    }

    public void encodeHiddenInput(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase)
        throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) dataTableBase;

        String stateId = subTable.getClientId(facesContext) + STATE;

        writer.startElement(HtmlConstants.INPUT_ELEM, subTable);
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, stateId, null);
        writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, stateId, null);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);

        int state = subTable.isExpanded() ? AbstractCollapsibleSubTable.EXPANDED_STATE
            : AbstractCollapsibleSubTable.COLLAPSED_STATE;

        writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, state, null);
        writer.endElement(HtmlConstants.INPUT_ELEM);

        String optionsId = subTable.getClientId(facesContext) + OPTIONS;
        writer.startElement(HtmlConstants.INPUT_ELEM, subTable);
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, optionsId, null);
        writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, optionsId, null);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
        writer.endElement(HtmlConstants.INPUT_ELEM);
View Full Code Here

        return new SimpleHeaderEncodeStrategy();
    }

    public void encodeClientScript(ResponseWriter writer, FacesContext facesContext, UIDataTableBase component)
        throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) component;

        String id = subTable.getClientId(facesContext);

        UIComponent nestingForm = getUtils().getNestingForm(facesContext, subTable);
        String formId = nestingForm != null ? nestingForm.getClientId(facesContext) : "";

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("stateInput", subTable.getClientId(facesContext) + STATE);
        options.put("optionsInput", subTable.getClientId(facesContext) + OPTIONS);
        options.put("expandMode", subTable.getExpandMode());
        options.put("eventOptions", AjaxRendererUtils.buildEventOptions(facesContext, subTable));

        JSFunction jsFunction = new JSFunction("new RichFaces.ui.CollapsibleSubTable");
        jsFunction.addParameter(id);
        jsFunction.addParameter(formId);
View Full Code Here

    }

    @Override
    public void encodeMetaComponent(FacesContext facesContext, UIComponent component, String metaComponentId)
        throws IOException {
        AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) component;

        if (AbstractCollapsibleSubTable.BODY.equals(metaComponentId)) {
            ResponseWriter writer = facesContext.getResponseWriter();
            UIDataTableBase dataTableBase = findParent(subTable);

            String updateId = dataTableBase.getRelativeClientId(facesContext) + ":" + subTable.getId() + TB_ROW;

            partialStart(facesContext, updateId);
            encodeTableRows(writer, facesContext, subTable, false);
            partialEnd(facesContext);
        }
View Full Code Here

TOP

Related Classes of org.richfaces.component.AbstractCollapsibleSubTable

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.