package com.onaro.util.jfc.grouping; /** * A node in the navigation tree of the grouping table. The nodes are created * by the grouping process which also cause them to calculate the summary. Also * nodes are used when displaying the navigation tree. */ public interface Node { /** * Gets the name of this node. The name is displayed to the user at the grouping column. * @return the name of this node */ public Object getName(); /** * Gets the identifier of this node. Used to distinguish brother nodes. * @return the identifier of this node */ public Object getIdentifier(); /** * Gets the number of childs this node has * @return the number of childs */ public int getChildCount(); /** * Gets the total number of descendant leafs of this node. * @return the sum of all the leafs below this node */ public int getDescendantLeafCount(); /** * Get a child of this node by its index. * @param index the index of the requested child * @return the child or null if it doesn't exist */ public Node getChild(int index); /** * Gets a child of this node by its identifier. * @param identifier identifies the requested child * @return the child or null if it doesn't exist */ public Node getChildByIdentifier(Object identifier); /** * Gets the value for the requested column. * @param column requested column number, 0 is the navigtion column and 1,2,... * are columns 0,1,... of the encapsulated table-model * @return the value at the requested column */ public Object getValueAt(int column); /** * Used by the summarizers to set the values of columns of group nodes. * @param column the column to set the value in * @param value the value */ public void setValueAt(int column, Object value); /** * Gets the value of this node for the requested criterion (column). * @param criterion the grouping criterion number as an index in the * {@link GroupingModel#groupingCriteria} * @return the value that is common to all the rows in this group and sub-groups * for the requested criterion */ public Object getCriterionValue(int criterion); /** * Adds a child to this node. * @param depth the depth of this node in the hierarchy, used for finding the * grouping criterion to use * @param child the child to add */ public void addChild(int depth, Node child); /** * Update the summary of this node and all its descendant. */ public void updateSummary(); /** * Ask the node to recursively sort its descendants. First the node is required * to ask each of its descendants to sort and only than it should sort itself too. */ public void doSort(); /** * Determine if a cell in a node is editable by the user */ public boolean isCellEditable(int column); }