Package org.openfaces.component.table

Examples of org.openfaces.component.table.AbstractTable



    private FilterProperty getColumnFilterProperty(FilterableComponent filteredComponent, BaseColumn column) {
        final BaseColumn.ExpressionData columnExpressionData = column.getColumnExpressionData();
        if (columnExpressionData == null) {
            AbstractTable table = column.getTable();
            String var = table.getVar();
            throw new FacesException(
                    "Can't find column output component (UIOutput component with a value expression containing variable \"" +
                            var + "\") for column with id: \"" + column.getId() + "\"; table id: \"" + table.getId() +
                            "\" ; consider declaring the filter expression explicitly if you're using a filter component in this column.");
        }
        ValueExpression expression = columnExpressionData.getValueExpression();
        if (expression == null) return null;
        PropertyLocatorFactory factory = new FilterableComponentPropertyLocatorFactory(filteredComponent);
View Full Code Here


        if (filterProperties == null) {
            if (getFor() != null && getAutoDetect()) {
                FilterableComponent filteredComponent = getFilteredComponent();
                if (filteredComponent instanceof AbstractTable) {
                    filterProperties = new ArrayList<FilterProperty>();
                    AbstractTable abstractTable = (AbstractTable) filteredComponent;
                    List<BaseColumn> columns = abstractTable.getAllColumns();
                    for (BaseColumn column : columns) {
                        if (column instanceof SelectionColumn || column instanceof CheckboxColumn) continue;
                        FilterProperty filterProperty = getColumnFilterProperty(filteredComponent, column);
                        if (filterProperty != null) {
                            filterProperties.add(filterProperty);
View Full Code Here

    }

    private void updateMenuItems(FacesContext context, ColumnVisibilityMenu cvm) {
        List<UIComponent> menuChildren = cvm.getChildren();
        menuChildren.clear();
        AbstractTable table = getTable(cvm);
        cvm.getAttributes().put(PopupMenuRenderer.ATTR_DEFAULT_INDENT_CLASS, "o_popup_menu_indent o_columnVisibilityMenuIndent");

        List<BaseColumn> visibleColumns = table.getRenderedColumns();
        List<BaseColumn> allColumns = table.getAllColumns();
        for (int i = 0, count = allColumns.size(); i < count; i++) {
            BaseColumn column = allColumns.get(i);
            MenuItem menuItem = Components.createComponent(context, MenuItem.COMPONENT_TYPE, MenuItem.class, cvm, "col" + i);
            menuItem.setValue(column.getColumnHeader());
            boolean columnVisible = visibleColumns.contains(column);
View Full Code Here

        while (parent != null && (parent instanceof MenuItem || parent instanceof PopupMenu))
            parent = parent.getParent();
        if (!(parent instanceof AbstractTable))
            throw new FacesException("<o:columnVisibilityMenu> can only be inserted into the \"columnMenu\" facet of " +
                    "the <o:dataTable> or <o:treeTable> components (either directly or as its sub-menu).");
        AbstractTable table = (AbstractTable) parent;
        return table;
    }
View Full Code Here

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        super.encodeEnd(context, component);
        ColumnVisibilityMenu cvm = (ColumnVisibilityMenu) component;
        AbstractTable table = getTable(cvm);
        final List<BaseColumn> allColumns = table.getAllColumns();
        final List<String> allColumnsIds = new ArrayList<String>(allColumns.size());
        for (BaseColumn each : allColumns) {
            allColumnsIds.add(each.getId());
        }
        Rendering.renderInitScript(context, new ScriptBuilder().initScript(context,
View Full Code Here

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

        AbstractTable table = getTable((BaseColumn) component);
        if (table == null) {
            throw new IllegalStateException("SelectionColumn must be nested inside a DataTable/TreeTable component");
        }
        AbstractTableSelection selection = table.getSelection();
        if (selection == null) {
            throw new IllegalStateException("<o:selectionColumn> must be inserted into a DataTable/TreeTable with selection enabled. table id: " + table.getClientId(context));
        }
        AbstractTableSelection.Mode selectionMode = selection.getSelectionMode();
        boolean rowSelection = true; // selection instanceof RowSelection
        /*if (!rowSelection)
            throw new IllegalStateException("<o:selectionColumn> can only be inserted into a DataTable/TreeTable with row selection. table id: " + table.getClientId(context));
View Full Code Here

        UIComponent component = selectRowCheckbox.getParent();
        while (component != null) {
            if (component instanceof BaseColumn) {
                BaseColumn column = (BaseColumn) component;
                AbstractTable table = Components.getParentWithClass(column, AbstractTable.class);
                if (table == null)
                    throw new FacesException("<o:selectRowCheckbox> can only be used in columns of table components " +
                            "(<o:dataTable> or <o:treeTable)");

                AbstractTableSelection selection = table.getSelection();
                if (selection == null)
                    throw new IllegalStateException("<o:selectRowCheckbox> can only be used in a DataTable or " +
                            "TreeTable with multiple selection. clientId = " + selectRowCheckbox.getClientId(context));
                boolean multipleRowSelection = selection.isMultipleSelectionAllowed();
                if (!multipleRowSelection)
View Full Code Here

    }

    private JSONObject getCommonHeaderParam(TableStructure tableStructure) throws JSONException {
        JSONObject result = new JSONObject();
        FacesContext context = FacesContext.getCurrentInstance();
        AbstractTable table = ((AbstractTable) tableStructure.getComponent());
        String commonHeaderClass = Styles.getCSSClass(context, tableStructure.getComponent(),
                isHeader ? table.getCommonHeaderRowStyle() : table.getCommonFooterRowStyle(),
                isHeader ? table.getCommonHeaderRowClass() : table.getCommonFooterRowClass());
        if (!Rendering.isNullOrEmpty(commonHeaderClass))
            result.put("className", commonHeaderClass);
        return result;
    }
View Full Code Here

    }

    private JSONObject getSubHeaderParam(TableStructure tableStructure) throws JSONException {
        JSONObject result = new JSONObject();
        FacesContext context = FacesContext.getCurrentInstance();
        AbstractTable table = ((AbstractTable) tableStructure.getComponent());
        String className = Styles.getCSSClass(context, table, getSubHeaderRowStyle(table),
                StyleGroup.regularStyleGroup(), getSubHeaderRowClass(table), DEFAULT_SUBHEADER_ROW_CELLS_CLASS);
        if (!Rendering.isNullOrEmpty(className))
            result.put("className", className);
View Full Code Here

    }

    private String getSubHeaderRowClass(TableStyles tableStyles) {
        if (!(tableStyles instanceof AbstractTable))
            return null;
        AbstractTable table = ((AbstractTable) tableStyles);
        return table.getSubHeaderRowClass();
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.table.AbstractTable

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.