Package javax.faces.component

Examples of javax.faces.component.UIData$State


    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        validateParameters(context, component);

        AllRowsSelectorComponent allRowsSelector = (AllRowsSelectorComponent) component;

        UIData data = getTargetUIData(allRowsSelector);
        RowSelectorComponent rowSelector = getRowSelector(data);
        if (rowSelector.getMode() != RowSelectorComponent.Mode.multi) {
            log.error("An allRowsSelector component was specified for dataTable component " + data
                    + ", which has a rowSelector with mode 'single', "
                    + "but allRowsSelector components can only be used with rowSelectors with mode 'multi'. "
View Full Code Here


        RowSelectorComponent rowSelector = rowSelectors.get(0);
        return rowSelector;
    }

    private UIData getTargetUIData(AllRowsSelectorComponent allRowsSelector) {
        UIData data;
        String dataTableId = allRowsSelector.getDataTableId();
        if (dataTableId != null) {
            data = (UIData) allRowsSelector.findComponent(dataTableId);
            if (data == null) {
                throw new IllegalStateException("UIData component (i.e. h:dataTable or rich:*dataTable) with id '" + dataTableId + "' not found within naming scope of component "
View Full Code Here

        }
        super.encodeEnd(context, component);
    }

    private PageControl getPageControl(UIComponent component) {
        UIData enclosingTable = getEnclosingData(component);
        PagedListDataModel pagedListDataModel = (PagedListDataModel)enclosingTable.getValue();
        return pagedListDataModel.getPageControl();
    }
View Full Code Here

        PagedListDataModel pagedListDataModel = (PagedListDataModel)enclosingTable.getValue();
        return pagedListDataModel.getPageControl();
    }

    private UIData getEnclosingData(UIComponent component) {
        UIData data = FacesComponentUtility.getAncestorOfType(component, UIData.class);
        if (data == null) {
            throw new IllegalStateException("No data!");
        }
        return data;
    }
View Full Code Here

    public void decode(FacesContext context, UIComponent component) {
        validateParameters(context, component);

        RowSelectorComponent rowSelector = (RowSelectorComponent) component;

        UIData data = getEnclosingData(rowSelector);

        // We store the List of selected data objects in a request context attribute and add to it as the data table's
        // rows are iterated during the updateModelValues phase. If the row is selected, we add the corresponding
        // data object to the List.
        List selectedDataObjects = getSelectedRowDataObjects(context, data);

        // Always set the submitted value, so that, even if no rows were selected, the setter on the managed bean will
        // still be passed an empty List, rather than null.
        rowSelector.setSubmittedValue(selectedDataObjects);

        Set<String> selectedRowKeys = getSelectedRowKeys(context, data, rowSelector);

        String rowKeyString = getRowKeyAsString(context, component, data);
        if (selectedRowKeys.contains(rowKeyString)) {
            // The current row is selected - add the row's data object to our List.
            Object rowData = data.getRowData();
            selectedDataObjects.add(rowData);
        }
    }
View Full Code Here

        writer.writeAttribute("type", type, "type");

        String clientId = component.getClientId(context);
        writer.writeAttribute("name", clientId, "clientId");

        UIData data = getEnclosingData(rowSelector);
        Object rowKey = getRowKey(data);
        writer.writeAttribute("value", rowKey, null);

        // TODO: Write 'checked' attribute to allow checkbox to be selected by default? Probably overkill.
View Full Code Here

        }
    }

    @NotNull
    private UIData getEnclosingData(UIComponent component) {
        UIData data = FacesComponentUtility.getAncestorOfType(component, UIData.class);
        if (data == null) {
            throw new IllegalStateException("Enclosing UIData component (i.e. h:dataTable or rich:*dataTable) not found for component "
                    + component + ".");
        }
        return data;
View Full Code Here

        }

        private void sort(SortableColumnHeaderComponent sortableColumnHeader) {
            String sortBy = sortableColumnHeader.getSortBy();

            UIData data = FacesComponentUtility.getAncestorOfType(sortableColumnHeader, UIData.class);
            PagedListDataModel<?> model = (PagedListDataModel<?>) data.getValue();

            PageControl pageControl = model.getPageControl();
            pageControl.sortBy(sortBy);
            // Even though its the same PageControl instance, call setPageControl() so the updated version gets
            // persisted.
View Full Code Here

     * @return our client id
     */
    @Override
    public String getClientId(FacesContext context) {
        // Get our enclosing data table.
        UIData data = FacesComponentUtility.getAncestorOfType(this, UIData.class);

        String baseClientId;       
        if (data instanceof UIDataAdaptor) {
            // It's a RichFaces data table, which conveniently provides a public method that returns its base client id.
            UIDataAdaptor dataAdaptor = (UIDataAdaptor) data;
            baseClientId = dataAdaptor.getBaseClientId(context);           
        } else {
            // It's not a RichFaces data table.
            int originalRowIndex = data.getRowIndex();
            // Temporarily set its row index to -1 to force it to return a client id for itself that doesn't include the
            // row index.
            data.setRowIndex(-1);
            baseClientId = data.getClientId(context);
            data.setRowIndex(originalRowIndex);
        }

        // Now append our id.
        String id = getId();
        if (id == null) {
View Full Code Here

        return true;
    }

    private PageControl getPageControl(UIComponent component) {
        try {
            UIData enclosingTable = getEnclosingUIData(component);

            UIComponent facet = enclosingTable.getFacet("PageControlView");
            String viewName = facet.getId();

            PageControlView currentView = PageControlView.valueOf(viewName);
            WebUser user = EnterpriseFacesContextUtility.getWebUser();
            WebUserPreferences preferences = user.getWebPreferences();
View Full Code Here

TOP

Related Classes of javax.faces.component.UIData$State

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.