Package org.openfaces.component.table

Examples of org.openfaces.component.table.ColumnResizing


    public static void writeColumnTags(
            FacesContext context,
            UIComponent component,
            List<BaseColumn> columns) throws IOException {

        ColumnResizing columnResizing = (component instanceof AbstractTable) ?
                ((AbstractTable) component).getColumnResizing() : null;
        ColumnResizingState columnResizingState = columnResizing != null ? columnResizing.getResizingState() : null;
        ResponseWriter writer = context.getResponseWriter();
        for (BaseColumn column : columns) {
            String colWidth = columnResizingState != null ? columnResizingState.getColumnWidth(column.getId()) : null;
            if (colWidth == null)
                colWidth = column.getWidth();
View Full Code Here


                Components.createOutputText(context, "Element Inspector"),
                elementProperties
        ));
        elementProperties.setStyle("width: 100%; height: 100%;");
        elementProperties.getChildren().add(new Scrolling());
        elementProperties.getChildren().add(new ColumnResizing());
        elementProperties.setVerticalGridLines("1px solid gray");
        Column col1 = new Column();
        col1.setStyle("width: 150px");
        col1.setHeader(Components.createOutputText(context, "Property"));
        elementProperties.getChildren().add(col1);
View Full Code Here

        DataTable logTable = (DataTable) Components.createChildComponent(
                context, panelGrid, DataTable.COMPONENT_TYPE, "log");
        Scrolling scrolling = new Scrolling();
        logTable.getChildren().add(scrolling);
        logTable.getChildren().add(new ColumnResizing());
        if (Environment.isExplorer())
            logTable.setStyle("width: 100%");
        else
            logTable.setStyle("width: 100%; height: 100%;");
        logTable.setVerticalGridLines("1px solid gray");
View Full Code Here

*/
public class ColumnResizingRenderer extends RendererBase {
    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        super.encodeBegin(context, component);
        ColumnResizing columnResizing = (ColumnResizing) component;
        if (!columnResizing.isEnabled())
            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) {
                JSONObject thisColumnParams = new JSONObject();
                try {
                    if (!resizable)
                        thisColumnParams.put("resizable", resizable);
                    if (minResizingWidth != null)
                        thisColumnParams.put("minWidth", minResizingWidth);
                    columnParams.put(String.valueOf(i), thisColumnParams);
                } catch (JSONException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        boolean autoSaveState = columnResizing.getAutoSaveState();
        if (autoSaveState) {
            ValueExpression ve = columnResizing.getValueExpression("resizingState");
            ELContext elContext = context.getELContext();
            if (ve == null || ve.isReadOnly(elContext))
                autoSaveState = false;
        }


        ScriptBuilder buf = new ScriptBuilder().initScript(context, table, "O$.Table._initColumnResizing",
                columnResizing.getRetainTableWidth(),
                columnResizing.getMinColWidth(),
                columnResizing.getResizeHandleWidth(),
                columnParams,
                autoSaveState);

        Rendering.renderInitScript(context, buf);
    }
View Full Code Here

        }
        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

TOP

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

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.