Package org.openfaces.component.table.impl

Examples of org.openfaces.component.table.impl.NodeInfoForRow


        setUnavailableRowIndexes(unavailableRowIndexes);

        int[] oldIndexes = rri.getOldIndexes();
        List<NodeInfoForRow> newNodeInfoForRows = new ArrayList<NodeInfoForRow>(oldIndexes.length);
        for (int oldIndex : oldIndexes) {
            NodeInfoForRow nodeInfo = oldIndex != -1 ? nodeInfoForRows.get(oldIndex) : null;
            newNodeInfoForRows.add(nodeInfo);
        }
        nodeInfoForRows = newNodeInfoForRows;
    }
View Full Code Here


        if (nodeInfoForRows == null || index >= nodeInfoForRows.size()) {
            // can be the case when pre-rendering TreeTable inspections are made by the filters
            return null;
        }

        NodeInfoForRow nodeInfoForRow = nodeInfoForRows.get(index);
        if (nodeInfoForRow == null)
            return null;
        TreePath indexPath = nodeInfoForRow.getNodeIndexPath();
        return indexPathToStr(indexPath);
    }
View Full Code Here


    @Override
    public int getRowIndexByClientSuffix(String id) {
        for (int i = 0, count = nodeInfoForRows.size(); i < count; i++) {
            NodeInfoForRow nodeInfoForRow = nodeInfoForRows.get(i);
            TreePath nodeIndexPath = nodeInfoForRow.getNodeIndexPath();
            String indexPathStr = indexPathToStr(nodeIndexPath);
            if (id.equals(indexPathStr))
                return i;
        }
        return -1;
View Full Code Here

    }

    public int loadSubNodes(int rowIndex) {
        if (!isRowAvailableAfterRestoring(rowIndex))
            return 0;
        NodeInfoForRow nodeInfo = nodeInfoForRows.get(rowIndex);

        if (!nodeInfo.getNodeHasChildren())
            throw new IllegalArgumentException("The node at this rowIndex doesn't have children: " + rowIndex);
        if (nodeInfo.getChildrenPreloaded())
            throw new IllegalArgumentException("The node at this rowIndex already has its children preloaded: " + rowIndex);
        TreeStructure treeStructure = findTreeStructureChild();
        TreePath nodeKeyPath = nodeInfo.getNodeKeyPath();
        TreePath nodePath = nodeInfo.getNodePath();
        TreePath nodeIndexPath = nodeInfo.getNodeIndexPath();
        if (!locateNodeChildrenByKeyPath(treeStructure, nodeKeyPath))
            return 0; // the node has probably been removed (can be the case here in server-side state saving)

        List<NodeInfoForRow> nodeInfoForRows = new ArrayList<NodeInfoForRow>();
        List<NodeInfoForRow> nodeInfoForRows_unfiltered = new ArrayList<NodeInfoForRow>();
        int sortLevel = getSortLevel();
        List<Filter> filters = getActiveFilters();
        deepestLevel = 0;
        int childNodeCount = collectTreeNodeDatas(treeStructure, filters, nodeInfoForRows, null, nodeInfoForRows_unfiltered,
                nodeKeyPath.getLevel() + 1, sortLevel, nodePath, nodeKeyPath, nodeIndexPath, true);
        nodeInfo.setChildNodeCount(childNodeCount);
        nodeInfo.setChildrenPreloaded(true);
        this.nodeInfoForRows.addAll(rowIndex + 1, nodeInfoForRows);
        this.nodeInfoForRows_unfiltered.addAll(nodeInfoForRows_unfiltered);


        if (isRendered()) {
            Map<Object, NodeInfoForRow> newRowIndexToExpansionData = new HashMap<Object, NodeInfoForRow>();

            int addedRowCount = nodeInfoForRows.size();
            List<Object> addedRowDatas = new ArrayList<Object>(addedRowCount);
            List<TreePath> addedRowKeys = new ArrayList<TreePath>(addedRowCount);
            for (int i = 0; i < addedRowCount; i++) {
                NodeInfoForRow ni = nodeInfoForRows.get(i);
                addedRowDatas.add(ni.getNodeData());
                addedRowKeys.add(ni.getNodeKeyPath());
                newRowIndexToExpansionData.put(rowIndex + 1 + i, ni);
            }

            getModel().addRows(rowIndex + 1, addedRowDatas, addedRowKeys);
View Full Code Here

        if (!isRendered())
            return;

        Map<Object, NodeInfoForRow> rowIndexToExpansionData = new HashMap<Object, NodeInfoForRow>();
        if (rootNodeCount != -1) {
            NodeInfoForRow nodeInfoForRow = new NodeInfoForRow(null, null, null, -1, true, false);
            nodeInfoForRow.setNodeHasChildren(rootNodeCount > 0);
            nodeInfoForRow.setChildrenPreloaded(true);
            nodeInfoForRow.setChildNodeCount(rootNodeCount);
            rowIndexToExpansionData.put("root", nodeInfoForRow);
        }
        for (int rowIndex = 0; rowIndex < nodeInfoForRows.size(); rowIndex++) {
            NodeInfoForRow nodeInfoForRow = nodeInfoForRows.get(rowIndex);
            if (nodeInfoForRow.getNodeHasChildren())
                rowIndexToExpansionData.put(rowIndex, nodeInfoForRow);
        }
        this.rowIndexToExpansionData = rowIndexToExpansionData;
    }
View Full Code Here

            TreePath nodeIndexPath = new TreePath(nodeIndex, parentNodeIndexPath);
            boolean nodeExpanded = isNodeExpanded(nodeKeyPath);
            if (nodeExpanded && !preloadingState.isPreloaded(nodePath)) {
                preloadingState.addPreloadedTreePath(nodePath);
            }
            NodeInfoForRow nodeInfo = new NodeInfoForRow(nodePath, nodeKeyPath, nodeIndexPath, level, nodeExpanded, thisLevelInitiallyVisible);
            boolean preloadChildren = nodeHasChildren && (
                    preloadingState.isPreloaded(nodePath) || (preloadedNodes != null && preloadedNodes.getPreloadChildren(nodeKeyPath))
            );
            TempNodeParams thisNodeParams = new TempNodeParams(nodeData, nodeInfo, nodeExpanded, preloadChildren);
            boolean[] flagsArray = new boolean[activeFilters.size()];
            boolean rowAccepted = TableDataModel.filterRow(activeFilters, thisNodeParams, flagsArray);
            thisNodeParams.setRowAccepted(rowAccepted);
            thisNodeParams.setFilteringFlags(flagsArray);

            boolean lookForFilteredSubrows =
                    activeFilters.size() > 0 &&
                    !rowAccepted && /* when some filters are active we shouldn't extract invisible nodes if parent node satisfies filtering criteria */
                    !treeStructure.isEnteringInfiniteRecursion() /* avoid searching the endlessly-recurring hierarchies */;

            if (isRowValuesForFilteringNeeded() || lookForFilteredSubrows || preloadChildren) {
                treeStructure.goToChildLevel();
                List<NodeInfoForRow> subtreeNodeInfosForRendering = new ArrayList<NodeInfoForRow>();
                List<NodeInfoForRow> subtreeNodeInfosAllFiltered = new ArrayList<NodeInfoForRow>();
                List<NodeInfoForRow> subtreeNodeInfos_unfiltered = new ArrayList<NodeInfoForRow>();
                int filteredChildCount = collectTreeNodeDatas(
                        treeStructure, activeFilters, subtreeNodeInfosForRendering, subtreeNodeInfosAllFiltered, subtreeNodeInfos_unfiltered,
                        level + 1, sortLevel, nodePath, nodeKeyPath, nodeIndexPath, thisLevelInitiallyVisible && nodeExpanded);
                nodeInfo.setNodeHasChildren(filteredChildCount > 0);
                nodeInfo.setChildrenPreloaded(preloadChildren);
                nodeInfo.setChildNodeCount(filteredChildCount);
                thisNodeParams.setSubtreeNodeInfosForRendering(subtreeNodeInfosForRendering);
                thisNodeParams.setSubtreeNodeInfosAllFiltered(subtreeNodeInfosAllFiltered);
                thisNodeParams.setSubtreeNodeInfos_unfiltered(subtreeNodeInfos_unfiltered);
                treeStructure.goToParentLevel();
            } else {
                nodeInfo.setNodeHasChildren(nodeHasChildren);
                nodeInfo.setChildrenPreloaded(false);
                nodeInfo.setChildNodeCount(0);
            }

            thisLevelNodeParams.add(thisNodeParams);
        }
        if (sortLevel == -1 || level == sortLevel)
            sortNodes(thisLevelNodeParams, level);

        List<boolean[]> thisLevelNodeFilteringFlags = new ArrayList<boolean[]>();
        List<TempNodeParams> filteredNodeParams = new ArrayList<TempNodeParams>();
        for (TempNodeParams rowObj : thisLevelNodeParams) {
            thisLevelNodeFilteringFlags.add(rowObj.getFilteringFlags());
            if (rowObj.isRowAccepted())
                filteredNodeParams.add(rowObj);
        }

        for (TempNodeParams nodeParams : filteredNodeParams) {
            NodeInfoForRow nodeInfoForRow = nodeParams.getNodeInfoForRow();
            nodeInfoForRow.setAcceptedByFilters(true);
        }

        int passedChildCount = 0;
        for (int i = 0; i < thisLevelNodeParams.size(); i++) {
            TempNodeParams nodeParams = thisLevelNodeParams.get(i);
            boolean[] nodeFilteringFlags = thisLevelNodeFilteringFlags.get(i);
            NodeInfoForRow nodeInfoForRow = nodeParams.getNodeInfoForRow();
            nodeInfoForRow.setNodeFilteringFlags(nodeFilteringFlags);
            List<NodeInfoForRow> subtreeNodeInfos_unfiltered = nodeParams.getSubtreeNodeInfos_unfiltered();
            nodeInfos_unfiltered.add(nodeInfoForRow);
            if (subtreeNodeInfos_unfiltered != null)
                nodeInfos_unfiltered.addAll(subtreeNodeInfos_unfiltered);

            List<NodeInfoForRow> subtreeNodeInfosForRendering = nodeParams.getSubtreeNodeInfosForRendering();
            List<NodeInfoForRow> subtreeNodeInfosAllFiltered = nodeParams.getSubtreeNodeInfosAllFiltered();
            if (nodeInfoForRow.isAcceptedByFilters() || (subtreeNodeInfosAllFiltered != null && subtreeNodeInfosAllFiltered.size() > 0)) {
                nodeInfosForRendering.add(nodeInfoForRow);
                if (nodeInfosAllFiltered != null)
                    nodeInfosAllFiltered.add(nodeInfoForRow);
                passedChildCount++;
                boolean preloadChildrenToClient = nodeParams.getPreloadChildrenToClient();
View Full Code Here

     */
    public Runnable populateSortingExpressionParams(final String var, final Map<String, Object> requestMap, Object collectionObject) {
//        protected Runnable populateSortingExpressionParams(final Map<String, Object> requestMap, Object collectionObject) {
            TempNodeParams nodeParams = (TempNodeParams) collectionObject;
            Object nodeData = nodeParams.getNodeData();
            NodeInfoForRow nodeInfo = nodeParams.getNodeInfoForRow();

            requestMap.put(var, nodeData);
            final Object prevNodePathVarValue;
            if (nodePathVar != null)
                prevNodePathVarValue = requestMap.put(nodePathVar, nodeInfo.getNodePath());
            else
                prevNodePathVarValue = null;
            final Object prevNodeHasChildrenVarValue;
            if (nodeHasChildrenVar != null)
                prevNodeHasChildrenVarValue = requestMap.put(nodeHasChildrenVar, nodeInfo.getNodeHasChildren());
            else
                prevNodeHasChildrenVarValue = null;
            String nodeParamsKey = TempNodeParams.class.getName();
            final Object prevNodeParamsValue = requestMap.put(nodeParamsKey, nodeParams);
            return new Runnable() {
View Full Code Here

    }

    public Object getNodeKey(int rowIndex) {
        if (!isRowAvailableAfterRestoring(rowIndex))
            return null;
        NodeInfoForRow nodeInfo = nodeInfoForRows.get(rowIndex);
        return nodeInfo.getNodeKey();
    }
View Full Code Here

    }

    public Object getNodeData(int rowIndex) {
        if (!isRowAvailableAfterRestoring(rowIndex))
            return null;
        NodeInfoForRow nodeInfo = nodeInfoForRows.get(rowIndex);
        return nodeInfo.getNodeData();
    }
View Full Code Here

        if (nodeInfoForRows == null)
            return 0;
        int rowIndex = getRowIndex();
        if (rowIndex == -1)
            return 0;
        NodeInfoForRow nodeInfo = nodeInfoForRows.get(rowIndex);
        return nodeInfo.getNodeLevel();
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.table.impl.NodeInfoForRow

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.