Examples of AbstractTable


Examples of org.openfaces.component.table.AbstractTable

    }

    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

Examples of org.openfaces.component.table.AbstractTable

    }

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

Examples of org.openfaces.component.table.AbstractTable

    }

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

Examples of org.openfaces.component.table.AbstractTable

    private static UIComponent componentById(UIComponent parent, String id, boolean isLastComponentInPath,
                                             boolean preProcessDecodesOnTables, boolean preRenderResponseOnTables,
                                             List<Runnable> restoreDataPointerRunnables) {
        FacesContext context = FacesContext.getCurrentInstance();
        if (id.length() > 0 && (isNumberBasedId(id) || id.startsWith(":")) && parent instanceof AbstractTable) {
            final AbstractTable table = ((AbstractTable) parent);
            if (!isLastComponentInPath) {
                if (preProcessDecodesOnTables)
                    table.invokeBeforeProcessDecodes(context);
                if (preRenderResponseOnTables) {
                    table.invokeBeforeRenderResponse(context);
                    table.setRowIndex(-1); // make the succeeding setRowIndex call provide the just-read actual row data through request-scope variables
                }

                int rowIndex = table.getRowIndexByClientSuffix(id);
                final int prevRowIndex = table.getRowIndex();
                if (prevRowIndex == rowIndex) {
                    // ensure row index setting will be run anew to ensure proper request-scope variable values
                    table.setRowIndex(-1);
                }
                table.setRowIndex(rowIndex);
                if (!table.isRowAvailable()) {
                    table.setRowIndex(-1);
                    String tableClientId = table.getClientId(context);
                    table.setRowIndex(prevRowIndex);
                    throw new IllegalStateException("Couldn't find table row for this Ajax request (row data for the requested row is missing). Table's clientId=" + tableClientId + "; rowIndex=" + rowIndex);
                }
                if (restoreDataPointerRunnables != null)
                    restoreDataPointerRunnables.add(new Runnable() {
                        public void run() {
                            table.setRowIndex(prevRowIndex);
                        }
                    });
            } else {
                int rowIndex = table.getRowIndexByClientSuffix(id);
                final int prevRowIndex = table.getRowIndex();
                if (prevRowIndex == rowIndex) {
                    // ensure row index setting will be run anew to ensure proper request-scope variable values
                    table.setRowIndex(-1);
                }
                table.setRowIndex(rowIndex);
                if (!table.isRowAvailable()) {
                    table.setRowIndex(-1);
                    String tableClientId = table.getClientId(context);
                    table.setRowIndex(prevRowIndex);
                    throw new IllegalStateException("Couldn't find table row for this Ajax request (row data for the requested row is missing). Table's clientId=" + tableClientId + "; rowIndex=" + rowIndex);
                }
                if (restoreDataPointerRunnables != null)
                    restoreDataPointerRunnables.add(new Runnable() {
                        public void run() {
                            table.setRowIndex(prevRowIndex);
                        }
                    });
            }
            return table;
        } else if (isNumberBasedId(id) && parent instanceof UIData) {
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

                else {
                    BaseColumn column = (BaseColumn) parent;
                    if (expression instanceof ValueExpression) {
                        BaseColumn.ExpressionData data = column.getExpressionData((ValueExpression) expression);
                        if (data == 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.");
                        }
                        Class type = data.getValueType();

                        if (String.class.equals(type))
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

            JSONObject stylesObj,
            AnonymousFunction onchangeFunction,
            boolean triStateAllowed) throws IOException {
        super.renderInitScript(facesContext, checkbox, imagesObj, stylesObj, onchangeFunction, triStateAllowed);

        AbstractTable table = getTable(checkbox);
        if (table == null)
            throw new IllegalStateException("SelectionColumn must be nested inside a table");
        BaseColumn col = getColumn(checkbox);

        FacesContext context = FacesContext.getCurrentInstance();
        ScriptBuilder buf = new ScriptBuilder();
        Integer checkboxColIndex = col instanceof CheckboxColumn ? table.getRenderedColumns().indexOf(col) : null;
        buf.initScript(context, checkbox, "O$.Table._initSelectAllCheckbox", table, checkboxColIndex).semicolon();

        Rendering.renderInitScript(context, buf,
                Resources.utilJsURL(context),
                TableUtil.getTableUtilJsURL(context),
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

*/
public class SelectAllCheckboxRenderer extends SelectBooleanCheckboxRenderer {

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        AbstractTable table = getTable(component);
        if (table == null)
            throw new IllegalStateException("SelectionColumn must be nested inside a table");
        BaseColumn col = getColumn(component);
        boolean checkBoxColHeader = col instanceof CheckboxColumn;
        AbstractTableSelection selection;
        if (!checkBoxColHeader) {
            selection = table.getSelection();
            if (selection == null)
                throw new IllegalStateException("<o:selectAllCheckbox> can only be inserted into a DataTable or TreeTable with multiple selection. clientId = " + component.getClientId(context));
            boolean multipleRowSelection = selection.isMultipleSelectionAllowed();
            if (!multipleRowSelection)
                throw new IllegalStateException("<o:selectAllCheckbox> can only be inserted into a DataTable or TreeTable with multiple selection. clientId = " + component.getClientId(context));
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

            return;

        UIComponent parent = component.getParent();
        if (!(parent instanceof AbstractTable))
            throw new IllegalStateException("<o:columnResizing> can only be placed as a child component inside of <o:dataTable> or <o:treeTable> components. Though the following parent component has been encountered: " + parent.getClass().getName());
        AbstractTable table = (AbstractTable) component.getParent();

        JSONObject columnParams = new JSONObject();
        List<BaseColumn> columns = table.getRenderedColumns();
        for (int i = 0; i < columns.size(); i++) {
            BaseColumn column = columns.get(i);
            boolean resizable = column.isResizable();
            String minResizingWidth = column.getMinResizingWidth();
            if (!resizable || minResizingWidth != null) {
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

    @Override
    public void decode(FacesContext context, UIComponent component) {
        super.decode(context, component);
        Map requestParams = context.getExternalContext().getRequestParameterMap();
        AbstractTable table = (AbstractTable) component.getParent();
        String colWidthsFieldName = getColumnWidthsFieldName(context, table);
        String params = (String) requestParams.get(colWidthsFieldName);

        String columnOrderFieldName = getColumnOrderFieldName(context, table);
        String colOrder = (String) requestParams.get(columnOrderFieldName);
        Iterable<String> submittedColumnsOrder = null;
        if (colOrder != null) {
            colOrder += ",";
            submittedColumnsOrder = Arrays.asList(colOrder.split(","));
            if (submittedColumnsOrder != null) {
                table.setColumnsOrder(submittedColumnsOrder);
            }
        }
        if (params == null || params.length() == 0)
            return;
        String[] splitParameters = params.split(":");
        String tableWidth = splitParameters[0];
        String colWidthsArray = splitParameters[1];
        if (tableWidth.length() == 0)
            tableWidth = null;
        JSONArray widthsArray;
        try {
            widthsArray = new JSONArray(colWidthsArray);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
        List<BaseColumn> columns = table.getRenderedColumns();
        if (columns.size() != widthsArray.length())
            throw new IllegalStateException("columns.size() != widthsArray.length(): " + columns.size() + " != " + widthsArray.length());

        ColumnResizing columnResizing = (ColumnResizing) component;
        ColumnResizingState resizingState = columnResizing.getResizingState();
        if (resizingState == null)
            resizingState = new ColumnResizingState();

        resizingState.setTableWidth(tableWidth);

        for (int i = 0, count = columns.size(); i < count; i++) {
            BaseColumn column = columns.get(i);
            String newWidth;
            try {
                newWidth = widthsArray.getString(i);
            } catch (JSONException e) {
                throw new RuntimeException(e);
            }

            resizingState.setColumnWidth(column.getId(), newWidth);
        }

        if (submittedColumnsOrder != null) {
            if (table.getColumnsOrder() != null && ValueBindings.set(table, "columnsOrder", table.getColumnsOrder())) {
                table.setColumnsOrder(null);
            }
        }
        columnResizing.setResizingState(resizingState);
    }
View Full Code Here

Examples of org.openfaces.component.table.AbstractTable

*/
public class ColumnReorderingRenderer extends RendererBase {
    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ColumnReordering cr = (ColumnReordering) component;
        AbstractTable table = cr.getTable();
        StyleParam draggedCellStyle = new StyleParam(cr, "draggedCell", "o_table_draggedColumn");
        StyleParam autoScrollAreaStyle = new StyleParam(cr, "autoScrollArea", "o_headerAutoScrollArea");
        StyleParam dropTargetStyle = new StyleParam(cr, "dropTarget", "o_table_columnDropTarget");
        Styles.renderStyleClasses(context, cr);
        // important: style rendering is made earlier than init function deliberately to allow script to
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.