Package org.openfaces.component.filter

Examples of org.openfaces.component.filter.CompositeFilter$ConditionConverter


    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        component.setId(component.getId());
        if (!component.isRendered()) return;

        CompositeFilter compositeFilter = (CompositeFilter) component;

        AjaxUtil.prepareComponentForAjax(context, component);

        synchronizeFilterRowsWithCriteria(compositeFilter);
        ResponseWriter writer = context.getResponseWriter();
        String clientId = compositeFilter.getClientId(context);
        writer.startElement("div", compositeFilter);
        writer.writeAttribute("id", clientId, "id");
        String styleClass = Styles.getCSSClass(context,
                compositeFilter, compositeFilter.getStyle(), "clearfix", compositeFilter.getStyleClass());
        writer.writeAttribute("class", styleClass, null);
        writer.flush();
    }
View Full Code Here


    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered()) return;
        super.encodeEnd(context, component);
        CompositeFilter compositeFilter = (CompositeFilter) component;
        ResponseWriter writer = context.getResponseWriter();

        writer.endElement("div");

        String _for = compositeFilter.getFor();
        if (_for != null) {
            UICommand applyButton = Components.getOrCreateFacet(context, compositeFilter, HtmlCommandButton.COMPONENT_TYPE, "applyButton", UICommand.class);
            if (applyButton.getValue() == null)
                applyButton.setValue("Apply");
            applyButton.getAttributes().put("onclick", new ScriptBuilder().O$(compositeFilter).dot().functionCall("apply").append(";return false;").toString());
            applyButton.encodeAll(context);

            String ajaxForApplyId = Components.generateIdWithSuffix(compositeFilter, "ajaxForApply");
            Ajax ajaxForApply = (Ajax) compositeFilter.findComponent(ajaxForApplyId);
            if (ajaxForApply == null) {
                ajaxForApply = new Ajax();
                ajaxForApply.setId(ajaxForApplyId);
                ajaxForApply.setExecute(new ArrayList<String>(Collections.singletonList(":" + compositeFilter.getClientId(context))));
                ajaxForApply.setRender(new ArrayList<String>(Collections.singletonList(_for)));
                ajaxForApply.setStandalone(true);
                compositeFilter.getChildren().add(ajaxForApply);
            }
            ajaxForApply.encodeAll(context);
        }

View Full Code Here

    }


    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered()) return;
        CompositeFilter compositeFilter = (CompositeFilter) component;
        if (compositeFilter.isEmpty()) {
            encodeNoFilterRow(context, compositeFilter);
        } else {
            for (FilterRow filterRow : compositeFilter.getFilterRows()) {
                filterRow.encodeRow(context, compositeFilter);
            }
        }
    }
View Full Code Here

    public boolean getRendersChildren() {
        return true;
    }

    public JSONObject encodeAjaxPortion(FacesContext context, UIComponent component, String portionName, JSONObject jsonParam) throws IOException, JSONException {
        CompositeFilter compositeFilter = (CompositeFilter) component;
        String operation = (String) jsonParam.get("operation");
        if (operation == null) {
        } else if (operation.equals("add")) {
            FilterRow filterRow = compositeFilter.addFilterRow();
            filterRow.encodeRow(context, compositeFilter);
        } else if (operation.equals("clear")) {
            compositeFilter.clear();
            encodeNoFilterRow(context, compositeFilter);
        } else if (operation.equals("remove")) {
            int index = (Integer) jsonParam.get("index");
            compositeFilter.removeFilterRow(index);
            if (compositeFilter.isEmpty()) {
                encodeNoFilterRow(context, compositeFilter);
            }
        } else if (operation.equals("propertyChange")) {
            int index = (Integer) jsonParam.get("index");
            FilterRow filterRow = compositeFilter.getFilterRow(index);
            filterRow.encodeOperationSelector(context, compositeFilter);
        } else if (operation.equals("operationChange")) {
            int index = (Integer) jsonParam.get("index");
            FilterRow filterRow = compositeFilter.getFilterRow(index);
            filterRow.encodeParametersEditor(context, compositeFilter);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.filter.CompositeFilter$ConditionConverter

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.