Package org.openfaces.component.table

Examples of org.openfaces.component.table.DataTable


        String imageUrl;
        if (sortingToggleMode == SortingToggleMode.AUTODETECT) {
            String columnId = column.getId();
            Boolean ascending = null;
            if (table instanceof DataTable) {
                DataTable dataTable = (DataTable) table;
                RowGrouping rowGrouping = dataTable.getRowGrouping();
                if (rowGrouping != null)
                    ascending = isColumnSortedAscending(columnId, rowGrouping.getGroupingRules());
            }
            if (ascending == null)
                ascending = isColumnSortedAscending(columnId, table.getSortingRules());
View Full Code Here


        super.encodeBegin(context, component);
        if (!component.isRendered())
            return;
        DataTablePaginator paginator = ((DataTablePaginator) component);

        DataTable table = paginator.getTable();

        boolean explicitIdSpecified = false;
        UIComponent immediateFacetChild = null;
        for (UIComponent c = paginator; c != null; c = c.getParent()) {
            if (Rendering.isExplicitIdSpecified(c)) {
                explicitIdSpecified = true;
                break;
            }
            if (c.getParent() == table) {
                immediateFacetChild = c;
                break;
            }
        }
        if (!explicitIdSpecified) {
            if (table.getAbove() == immediateFacetChild || table.getBelow() == immediateFacetChild)
                throw new FacesException("You should explicitly specify id for your <o:dataTablePaginator> or its " +
                        "container which resides in the table's \"above\" or \"below\" facet. See the documentation for " +
                        "details: http://openfaces.org/documentation/developersGuide/datatable.html#DataTable-Specifyingthecontentofthe%22above%22and%22below%22facets");
        }


        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("table", component);
        writer.writeAttribute("border", "0", null);
        writer.writeAttribute("cellspacing", "0", null);
        writer.writeAttribute("cellpadding", "0", null);
        writeIdAttribute(context, component);

        String style = paginator.getStyle();
        String styleClass = paginator.getStyleClass();

        boolean dontShow = (table.getPageCount() < 2 && !paginator.getShowIfOnePage());
        String className = Styles.getCSSClass(context, component, style, DEFAULT_CLASS, styleClass);
        if (dontShow)
            writer.writeAttribute("style", "display: none", null);
        else
            writer.writeAttribute("class", className, null);
View Full Code Here

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

        DataTablePaginator paginator = ((DataTablePaginator) component);
        DataTable table = paginator.getTable();
        int pageCount = table.getPageCount();
        if (pageCount < 2 && !paginator.getShowIfOnePage())
            return;
        int pageSize = table.getPageSize();
        if (pageSize == 0)
            throw new IllegalStateException("DataTablePaginator can't be placed into a dataTable whose pagination is " +
                    "not activated. Set dataTable's pageSize to a non-zero value. dataTable's clientId is: " + table.getClientId(context));

        boolean firstLinkActive = canSelectFirstPage(table);
        boolean lastLinkActive = canSelectLastPage(table);
        boolean nextLinkActive = canSelectNextPage(table);
        boolean previousLinkActive = canSelectPreviousPage(table);

        List<UIComponent> children = component.getChildren();
        children.clear();
        boolean useAjax = table.getUseAjax();
        String actionFieldName = getActionFieldName(context, paginator);
        List<String> preloadImages = new ArrayList<String>();
        createAndAddActionLink(context, children, paginator, actionFieldName, "selectFirstPage",
                getFirstImageUrl(context, paginator, firstLinkActive), getFirstText(paginator),
                FIRST_PAGE_COMPONENT, useAjax, table, firstLinkActive);
        preloadImages.add(getFirstImageUrl(context, paginator, !firstLinkActive));
        boolean showDisabledImages = paginator.getShowDisabledImages();
        if ((firstLinkActive && previousLinkActive) || showDisabledImages)
            children.add(Components.createOutputText(context, HTML.NBSP_ENTITY, false));
        createAndAddActionLink(context, children, paginator, actionFieldName, "selectPrevPage",
                getPreviousImageUrl(context, paginator, previousLinkActive), getPreviousText(paginator),
                PREV_PAGE_COMPONENT, useAjax, table, previousLinkActive);
        preloadImages.add(getPreviousImageUrl(context, paginator, !previousLinkActive));

        if (firstLinkActive || previousLinkActive || showDisabledImages)
            children.add(Components.createOutputText(context, HTML.NBSP_ENTITY + HTML.NBSP_ENTITY, false));

        String pageNumberPrefix = paginator.getPageNumberPrefix();
        if (pageNumberPrefix == null)
            pageNumberPrefix = DEFAULT_PAGE_NUMBER_PREFIX;
        if (pageNumberPrefix.length() > 0)
            children.add(Components.createOutputText(context, pageNumberPrefix + HTML.NBSP_ENTITY, false));

        HtmlInputText inputText = (HtmlInputText) context.getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);
        inputText.setId(Components.generateIdWithSuffix(component, "pageNo"));
        String pageNo = String.valueOf(table.getPageIndex() + 1);
        inputText.setValue(pageNo);
        inputText.setStyle(paginator.getPageNumberFieldStyle());
        String fieldClass = Styles.getCSSClass(
                context, component, null, DEFAULT_FIELD_CLASS, paginator.getPageNumberFieldClass());
        inputText.setStyleClass(fieldClass);
View Full Code Here

        super.decode(context, component);
        Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
        DataTablePaginator paginator = (DataTablePaginator) component;
        String clientId = getActionFieldName(context, paginator);
        String actionStr = requestParams.get(clientId);
        DataTable table = paginator.getTable();
        if (actionStr == null || actionStr.length() == 0) {
            String pageIndexId = getPageNoFieldName(context, paginator);
            String newPageIndex = requestParams.get(pageIndexId);
            if (newPageIndex == null) {
                return;
View Full Code Here

    protected void encodeAdditionalFeaturesSupport(
            FacesContext context,
            AbstractTable table) throws IOException {
        super.encodeAdditionalFeaturesSupport(context, table);

        DataTable dataTable = (DataTable) table;

        RowGrouping rowGrouping = dataTable.getRowGrouping();
        if (rowGrouping != null)
            rowGrouping.encodeAll(context);
    }
View Full Code Here

    @Override
    public void decode(FacesContext context, UIComponent uiComponent) {
        super.decode(context, uiComponent);
        if (!uiComponent.isRendered())
            return;
        DataTable table = (DataTable) uiComponent;
        decodePagination(context, table);

        RowGrouping rowGrouping = table.getRowGrouping();
        if (rowGrouping != null)
            rowGrouping.processDecodes(context);
    }
View Full Code Here

            DataTablePaginatorRenderer.executePaginationAction(context, table, pagingAction);
    }

    @Override
    protected boolean getUseKeyboardForPagination(AbstractTable table) {
        DataTable dataTable = (DataTable) table;
        return dataTable.getPageSize() > 0 && dataTable.isPaginationKeyboardSupport();
    }
View Full Code Here

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

        TableStructure tableStructure = TableStructure.getCurrentInstance(table);
        Set<BaseColumn> visibleAndGroupedColumns = new LinkedHashSet<BaseColumn>(tableStructure.getColumns());
        List<GroupingRule> groupingRules = rowGrouping.getGroupingRules();
        if (groupingRules != null)
            for (GroupingRule groupingRule : groupingRules) {
                String columnId = groupingRule.getColumnId();
                BaseColumn column = table.getColumnById(columnId);
                visibleAndGroupedColumns.add(column);
            }

        String tableClientId = table.getClientId(context);
        List<String> activeColumnIds = new ArrayList<String>();
        List<String> groupableColumnIds = new ArrayList<String>();
        for (BaseColumn column : visibleAndGroupedColumns) {
            Object headerContent = TableHeader.getHeaderOrFooterCellContent(column, true);
            HeaderCell cell = new HeaderCell(column, headerContent, "div",
View Full Code Here

    }

    private void decodeGroupingRules(FacesContext context, RowGrouping rowGrouping) {
        Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
        DataTable table = (DataTable) rowGrouping.getParent();
        String paramName = table.getClientId(context) + "::setGroupingRules";
        String groupingRulesStr = requestParameterMap.get(paramName);
        if (Rendering.isNullOrEmpty(groupingRulesStr)) return;

        List<GroupingRule> groupingRules = new ArrayList<GroupingRule>();
        try {
View Full Code Here

        tabbedPane.getChildren().add(new SubPanel(
                Components.createOutputText(context, "Console"),
                createLogPageContent(context, debug)
        ));
        DataTable elementProperties = (DataTable) Components.createChildComponent(
                context, debug, DataTable.COMPONENT_TYPE, "elementProperties");
        tabbedPane.getChildren().add(new SubPanel(
                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);
        Column col2 = new Column();
        col2.setHeader(Components.createOutputText(context, "Value"));
        elementProperties.getChildren().add(col2);
    }
View Full Code Here

TOP

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

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.