Package org.richfaces.component

Examples of org.richfaces.component.AbstractCollapsibleSubTable


    ;

    protected void doDecode(FacesContext facesContext, UIComponent component) {
        super.doDecode(facesContext, 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), getFirstRowClass(context, parentId), component
            .getAttributes().get(ROW_CLASS));
        encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
        UIComponent parent = component.getParent();
        if (parent instanceof AbstractCollapsibleSubTable && Boolean.TRUE.equals(parent.getAttributes().get("isNested"))) {
            AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) parent;
            if (!subTable.isExpanded()) {
                writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
            }
        }
    }
View Full Code Here

        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, parentId + ":" + currentRow + ":b", null);
        String styleClass = concatClasses(getRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
        encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
        UIComponent parent = component.getParent();
        if (parent instanceof AbstractCollapsibleSubTable && Boolean.TRUE.equals(parent.getAttributes().get("isNested"))) {
            AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable) parent;
            if (!subTable.isExpanded()) {
                writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
            }
        }
    }
View Full Code Here

            }
        }
    }

    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 parent = findParent(subTable);
        if (parent instanceof AbstractDataTable) {
            writer.startElement(HtmlConstants.TBODY_ELEMENT, null);
            writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
                parent.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);
        }
        // stash whether or not this subTable is nested in the attribute map for later retrieval
        subTable.getAttributes().put("isNested", (parent instanceof AbstractCollapsibleSubTable));
    }
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(subTable);
        String formId = nestingForm != null ? nestingForm.getClientId(facesContext) : "";
        AjaxOptions ajaxOptions = AjaxRendererUtils.buildEventOptions(facesContext, subTable);

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("ajaxEventOptions", ajaxOptions.getParameters());
        options.put("stateInput", subTable.getClientId(facesContext) + STATE);
        options.put("optionsInput", subTable.getClientId(facesContext) + OPTIONS);
        boolean isNested = Boolean.TRUE.equals(subTable.getAttributes().get("isNested"));
        String expandMode = isNested ? "client" : subTable.getExpandMode();
        options.put("expandMode", expandMode);
        options.put("isNested", isNested);
        options.put("eventOptions", AjaxRendererUtils.buildEventOptions(facesContext, subTable));

        JSFunction jsFunction = new JSFunction("new RichFaces.ui.CollapsibleSubTable");
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.