com.sas.graphics.components
Class TableAxisModel

com.sas.graphics.components.TableAxisModel

public class TableAxisModel

The TableAxisModel class stores general appearance settings for a table axis as well as the chart's horizontal grid lines.

Usage

Since a default TableAxisModel is created along with a GraphModel, it is not needed to be instantiated. In a typical use, one needs to get the appropriate TableAxisModel from the GraphModel and then only modify it's properties.
You can access a TableAxisModel in the chart by calling the getTableAxisModel() on the GraphModel.
Ex.
 GanttChart ganttChart = new GanttChart();
 GanttChartModel ganttChartModel = ganttChart.getGraphModel();
 TableAxisModel tableAxisModel = ganttChartModel.getTableAxisModel();
 
Once you get the TableAxisModel, you can modify the properties. Continuing on our previous example, say we want to set the table axis' header background color to white.
Ex.
 tableAxisModel.setHeaderBackgroundColor(Color.WHITE);
 
Changing a property in the TableAxisModel will cause a PropertyChangeEvent to be fired. Changing a property in any of the contained models will also cause the TableAxisModel to fire a PropertyChangeEvent. No matter how deep the contained model is the event will cascade up the containment chain to finally reach the TableAxisModel which will fire an event. The table to which the TableAxisModel is attached, listens to these events and the changes are applied to the table immediately.

Behavior

If you do not get the table model from the chart and just create your own instance, it will have all default values. These may not be same as the properties in the chart as they are modified according to the graph style. Setting a new graph style over rides any previous user settings.

Since:
SAS 9.1.2
See Also:
ModelBase, TextStyle, GanttChartModel, StrokeLineStyle

Constructor Summary
TableAxisModel()
           
 
Method Summary
 void addTableCellPopupMenuItem(com.sas.swing.visuals.treetable.CellAction itemToBeAdded)
          Add an item to the end of the menu.
 void apply(TableAxisModel theOtherObject)
          Utility method to convey properties contained in "theOtherObject" to this object.
 void clearTableColumnEditable()
          Remove all column-editable settings.
 void clearTableRowEditable()
          Remove all row-editable settings.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this TableAxisModel.
 java.util.Iterator getAllLinkedTasks()
          Return an iterator that will produce all tasks for which links are currently set.
 com.sas.measures.BaseLength getCellPadding()
          Returns the vertical padding applied to the table's cell text.
 TableAxisColumn[] getColumns()
          Returns the current table axis displayed columns.
 StrokeLineStyle getGridLineStyle()
          Get the line style for the chart's grid lines.
 HierarchyModel getHierarchyModel()
           
 CellStyle getLabelCellStyle()
          Returns the CellStyle that contains the set of display properties used to define the appearance of the table header including its background color and frame line color.
 TextStyle getLabelTextStyle()
          Return the text attributes for the table header text.
 int getPreferredExpansionDepth()
          Get the expansion depth.
 TextStyle getRowSelectionFontStyle()
          This method if for internal use only.
 com.sas.swing.visuals.treetable.CellAction getTableCellPopupMenuItem(int index)
          Get a single item from the menu; the first item has index 0.
 int getTableCellPopupMenuItemCount()
          Tell how many items are currently in the cell popup menu.
 boolean getTableColumnEditable(java.lang.String colName)
          Tell whether a single column is marked as editable or not.
 boolean getTableRowEditable(java.lang.String taskName)
          Tell whether a single row is marked as editable or not.
 java.lang.String getTaskLink(java.lang.String taskName)
          Get a task link, or null if the task has no link.
 CellStyle getValueCellStyle()
          Returns the CellStyle that contains the set of display properties used to define the appearance of the table cells including its background color and frame line color.
 TextStyle getValueTextStyle()
          Return the text attributes for the table cell text.
 TableAxisZone[] getZones()
          Returns the current table axis zones.
 int hashCode()
          Computes the hash code for this TableAxisModel.
 boolean isGridInFront()
          Returns true if the grid drawn in front of the graph elements.
 boolean isRootVisible()
          Returns if the root of a treetable is visible.
 boolean isTableCellPopupMenuEnabled()
          Is the table's pop-up menu enabled?
 boolean isTableEditable()
          Return the whole-table-editable setting.
 boolean isTableEditableSet()
          Has the whole-table-editable flag been set?
 java.util.Set keySetTableColumnEditable()
          Retrieve the set of keys for all column-editable settings.
 java.util.Set keySetTableRowEditable()
          Retrieve the set of keys for all row-editable settings.
 void putTableColumnEditable(java.lang.String colName, boolean editable)
          Mark a single column as editable or not.
 void putTableRowEditable(java.lang.String taskName, boolean editable)
          Mark a single row as editable or not.
 void removeAllTableCellPopupMenuItems()
          Remove all items from the menu.
 void removeAllTaskLinks()
          Remove all task links.
 void removeTableCellPopupMenuItem(com.sas.swing.visuals.treetable.CellAction itemToBeRemoved)
          Remove an item from the menu.
 void removeTableColumnEditable(java.lang.String colName)
          Remove the column-editable setting for a column.
 void removeTableRowEditable(java.lang.String taskName)
          Remove the row-editable setting for a row.
 void setCellPadding(com.sas.measures.BaseLength newPadding)
          Assigns a new Vertical Padding to be applied to the table's cell text.
 void setColumns(TableAxisColumn[] newColumns)
          Establish the columns to display in the table and the order to display them.
 void setGridInFront(boolean inFront)
          Sets grid lines in front or back of the graph elements.
 void setGridLineStyle(StrokeLineStyle newLineStyle)
          Set the line style for the chart's horizontal grid lines.
 void setHierarchyModel(HierarchyModel newModel)
          Set the hierarchy attributes for the tree.
 void setLabelCellStyle(CellStyle newCellStyle)
          Sets the CellStyle that contains the set of display properties used to define the appearance of the table header including its background color and frame line color.
 void setLabelTextStyle(TextStyle labelTextStyle)
          Set the text attributes for the table header text.
 void setPreferredExpansionDepth(int newDepth)
          Set the number of levels to expand from the top level.
 void setRootVisible(boolean newRootVisible)
          Set if the root row is visible when creating an hierarchical treetable.
 void setRowSelectionFontStyle(TextStyle valueRowSelFontStyle)
          This method if for internal use only.
 void setTableCellPopupMenuEnabled(boolean newEnabled)
          Enable or disable the table's pop-up menu
 void setTableEditable(boolean newEditable)
          Make the whole table editable or non-editable.
 void setTaskLink(java.lang.String taskName, java.lang.String newLink)
          Add/remove a task link.
 void setValueCellStyle(CellStyle newCellStyle)
          Sets the CellStyle that contains the set of display properties used to define the appearance of the table cells including its background color and frame line color.
 void setValueTextStyle(TextStyle valueTextStyle)
          Set the text attributes for the table cell text.
 void setZones(TableAxisZone[] newZones)
          Set the zones to be displayed in the table.
 void unsetTableEditable()
          Retract the whole-table-editable setting.
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Constructor Detail

TableAxisModel

public TableAxisModel()
Method Detail

apply

public void apply(TableAxisModel theOtherObject)
Utility method to convey properties contained in "theOtherObject" to this object.

Note: Contained "models" (i.e. properties that are subclasses of ModelBase) will in turn be called on to convey their properties to the like contained models in the other object. In that respect this can be considered a "tree" type copy.

Also Note: This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances.

Parameters:
theOtherObject - properties applied to this instance

setLabelTextStyle

public void setLabelTextStyle(TextStyle labelTextStyle)
                       throws java.lang.IllegalArgumentException
Set the text attributes for the table header text.

Parameters:
labelTextStyle - the new repository for the header's text attributes
Throws:
java.lang.IllegalArgumentException - if labelTextStyle is null.
See Also:
getLabelTextStyle(), TextStyle.apply(com.sas.graphics.components.TextStyle)

getLabelTextStyle

public TextStyle getLabelTextStyle()
Return the text attributes for the table header text.

Returns:
the axis label text attributes
See Also:
setLabelTextStyle(com.sas.graphics.components.TextStyle)

setValueTextStyle

public void setValueTextStyle(TextStyle valueTextStyle)
                       throws java.lang.IllegalArgumentException
Set the text attributes for the table cell text.

Parameters:
valueTextStyle - the new repository for the axis' cell attributes
Throws:
java.lang.IllegalArgumentException - if valueTextStyle is null.
See Also:
getValueTextStyle(), TextStyle.apply(com.sas.graphics.components.TextStyle)

setRowSelectionFontStyle

public void setRowSelectionFontStyle(TextStyle valueRowSelFontStyle)
                              throws java.lang.IllegalArgumentException
This method if for internal use only. Set the font for the row selection madeFont.

Parameters:
valueRowSelFontStyle - font to be applied for the row selection made.
Throws:
java.lang.IllegalArgumentException - if valueRowSelFontStyle is null.
See Also:
getRowSelectionFontStyle()

getRowSelectionFontStyle

public TextStyle getRowSelectionFontStyle()
This method if for internal use only. Return the font to be applied to the row selection made.

Returns:
the font applied to the row selection.
See Also:
setRowSelectionFontStyle(com.sas.graphics.components.TextStyle)

getValueTextStyle

public TextStyle getValueTextStyle()
Return the text attributes for the table cell text.

Returns:
the axis value text attributes
See Also:
setValueTextStyle(com.sas.graphics.components.TextStyle)

setLabelCellStyle

public void setLabelCellStyle(CellStyle newCellStyle)
Sets the CellStyle that contains the set of display properties used to define the appearance of the table header including its background color and frame line color. However, only the first color in the array of background colors is honored in the CellStyle.setBackgroundColors(Color[] newColors).

Throws:
java.lang.IllegalArgumentException - if newCellStyle is null.
See Also:
getLabelCellStyle()

getLabelCellStyle

public CellStyle getLabelCellStyle()
Returns the CellStyle that contains the set of display properties used to define the appearance of the table header including its background color and frame line color.

Returns:
the CellStyle associated with the table Label cells
See Also:
setLabelCellStyle(com.sas.graphics.components.CellStyle)

setValueCellStyle

public void setValueCellStyle(CellStyle newCellStyle)
Sets the CellStyle that contains the set of display properties used to define the appearance of the table cells including its background color and frame line color. However, only the first color in the array of background colors is honored in the CellStyle.setBackgroundColors(Color[] newColors).

Throws:
java.lang.IllegalArgumentException - if newCellStyle is null.
See Also:
getValueCellStyle()

getValueCellStyle

public CellStyle getValueCellStyle()
Returns the CellStyle that contains the set of display properties used to define the appearance of the table cells including its background color and frame line color.

Returns:
the CellStyle associated with the table value cells
See Also:
setValueCellStyle(com.sas.graphics.components.CellStyle)

setGridLineStyle

public void setGridLineStyle(StrokeLineStyle newLineStyle)
                      throws java.lang.IllegalArgumentException
Set the line style for the chart's horizontal grid lines.

Parameters:
newLineStyle - the new repository for the grid's line attributes
Throws:
java.lang.IllegalArgumentException - if newLineStyle is null.
See Also:
getGridLineStyle(), StrokeLineStyle.apply(com.sas.graphics.components.StrokeLineStyle)

getGridLineStyle

public StrokeLineStyle getGridLineStyle()
Get the line style for the chart's grid lines.

Returns:
line style object for grid lines
See Also:
setGridLineStyle(com.sas.graphics.components.StrokeLineStyle)

isGridInFront

public boolean isGridInFront()
Returns true if the grid drawn in front of the graph elements.

Returns:
is grid drawn in front of the chart elements?
See Also:
setGridInFront(boolean)

setGridInFront

public void setGridInFront(boolean inFront)
Sets grid lines in front or back of the graph elements.

Parameters:
inFront - grid drawn in front of the chart elements?
See Also:
isGridInFront()

setHierarchyModel

public void setHierarchyModel(HierarchyModel newModel)
Set the hierarchy attributes for the tree.

Parameters:
newModel - the new HierarchyModel for the tree
Throws:
java.lang.IllegalArgumentException - if newModel is null.
See Also:
getHierarchyModel()

getHierarchyModel

public HierarchyModel getHierarchyModel()

equals

public boolean equals(java.lang.Object obj)
Determines whether another object is equal to this TableAxisModel.

The result is true if and only if the argument is not null and is a TableAxisModel object that has the same property values as this object.

Overrides:
equals in class ModelBase
Parameters:
obj - the object to test for equality with this TableAxisModel
Returns:
true if the objects are the same; false otherwise.

setRootVisible

public void setRootVisible(boolean newRootVisible)
Set if the root row is visible when creating an hierarchical treetable.

Parameters:
newRootVisible - root node is visible or not.
See Also:
isRootVisible()

isRootVisible

public boolean isRootVisible()
Returns if the root of a treetable is visible.

Returns:
boolean set to root node visibility.
See Also:
setRootVisible(boolean)

setCellPadding

public void setCellPadding(com.sas.measures.BaseLength newPadding)
                    throws java.lang.IllegalArgumentException
Assigns a new Vertical Padding to be applied to the table's cell text. This allows you to control the row height in the table. It pads the space equally on each side the text.

Parameters:
newPadding - padding setting for the table rows
Throws:
java.lang.IllegalArgumentException - if newPadding is null.
See Also:
getCellPadding()

getCellPadding

public com.sas.measures.BaseLength getCellPadding()
Returns the vertical padding applied to the table's cell text.

Returns:
Padding set for the table cell text
See Also:
setCellPadding(com.sas.measures.BaseLength)

addTableCellPopupMenuItem

public void addTableCellPopupMenuItem(com.sas.swing.visuals.treetable.CellAction itemToBeAdded)
Add an item to the end of the menu. An item may appear on the menu more than once; it is up to the calling app to avoid doing that if it is not desired.


removeTableCellPopupMenuItem

public void removeTableCellPopupMenuItem(com.sas.swing.visuals.treetable.CellAction itemToBeRemoved)
Remove an item from the menu. If the item is not on the menu, this is a no-op.


removeAllTableCellPopupMenuItems

public void removeAllTableCellPopupMenuItems()
Remove all items from the menu. An empty menu can still pop up; it is up to the calling app to disable the menu when it should no longer pop-up.


getTableCellPopupMenuItemCount

public int getTableCellPopupMenuItemCount()
Tell how many items are currently in the cell popup menu.


getTableCellPopupMenuItem

public com.sas.swing.visuals.treetable.CellAction getTableCellPopupMenuItem(int index)
                                                                     throws java.lang.IndexOutOfBoundsException
Get a single item from the menu; the first item has index 0. This returns the actual item that the menu uses, not a clone. So any mutable properties of the returned CellAction can be manipulated to effect changes in the pop-up menu. If the given index is less than 0 or greater than the last item's index, throw IndexOutOfBoundsException.

Throws:
java.lang.IndexOutOfBoundsException

setTableCellPopupMenuEnabled

public void setTableCellPopupMenuEnabled(boolean newEnabled)
Enable or disable the table's pop-up menu

Parameters:
newEnabled - allow that menu to pop up?

isTableCellPopupMenuEnabled

public boolean isTableCellPopupMenuEnabled()
Is the table's pop-up menu enabled?

Returns:
true if the pop-up menu is enabled, otherwise false.

setTaskLink

public void setTaskLink(java.lang.String taskName,
                        java.lang.String newLink)
Add/remove a task link. If the task already had a link, this replaces it. Setting a null link on a task removes the existing link from that task, if any.

Parameters:
taskName - - task to set a link on
newLink - - the link to set, null removes an existing link

getTaskLink

public java.lang.String getTaskLink(java.lang.String taskName)
Get a task link, or null if the task has no link.

Parameters:
taskName - - task to set a link on

removeAllTaskLinks

public void removeAllTaskLinks()
Remove all task links.


getAllLinkedTasks

public java.util.Iterator getAllLinkedTasks()
Return an iterator that will produce all tasks for which links are currently set.


setTableEditable

public void setTableEditable(boolean newEditable)
Make the whole table editable or non-editable. Even if the whole table is marked editable here, the cell editor can still refuse to edit any given cell. If the whole table is marked [un]editable like this, then the row- and column-editable settings are ignored.

See Also:
unsetTableEditable(), isTableEditable(), isTableEditableSet(), putTableRowEditable(java.lang.String, boolean), putTableColumnEditable(java.lang.String, boolean)

unsetTableEditable

public void unsetTableEditable()
Retract the whole-table-editable setting. This leaves the decision of whether a cell is editable to the settings for rows and columns, and to the cell editor. Note that this is not the same as setTableEditable(false), which would make the entire table non-editable.

See Also:
setTableEditable(boolean), isTableEditable(), isTableEditableSet()

isTableEditable

public boolean isTableEditable()
Return the whole-table-editable setting. Note that if isTableEditableSet() returns false, then this setting is not used, and some individual rows and columns of the table might be editable while others are not.

See Also:
setTableEditable(boolean), isTableEditableSet(), putTableRowEditable(java.lang.String, boolean), putTableColumnEditable(java.lang.String, boolean)

isTableEditableSet

public boolean isTableEditableSet()
Has the whole-table-editable flag been set? If it has, then the value returned by isTableEditable() method is used in determining whether a cell is editable; otherwise, the row- and column-editable settings are used.

See Also:
setTableEditable(boolean), unsetTableEditable()

putTableRowEditable

public void putTableRowEditable(java.lang.String taskName,
                                boolean editable)
Mark a single row as editable or not. If a row has not been marked either way, then it is editable. Note that the row- and column-editable flags are superceded by the whole-table-editable flag if/when it is set.

Parameters:
taskName - - which row to affect
editable - - can it be edited, or not?

See Also:
setTableEditable(boolean), getTableRowEditable(java.lang.String), removeTableRowEditable(java.lang.String), clearTableRowEditable(), keySetTableRowEditable()

getTableRowEditable

public boolean getTableRowEditable(java.lang.String taskName)
Tell whether a single row is marked as editable or not.

Parameters:
taskName - - which row to affect
See Also:
putTableRowEditable(java.lang.String, boolean)

removeTableRowEditable

public void removeTableRowEditable(java.lang.String taskName)
Remove the row-editable setting for a row. The row will go back to the default setting, which is editable.

Parameters:
taskName - - which row to affect
See Also:
putTableRowEditable(java.lang.String, boolean)

clearTableRowEditable

public void clearTableRowEditable()
Remove all row-editable settings. All rows will go back to the default setting, which is editable.

See Also:
putTableRowEditable(java.lang.String, boolean)

keySetTableRowEditable

public java.util.Set keySetTableRowEditable()
Retrieve the set of keys for all row-editable settings.

See Also:
putTableRowEditable(java.lang.String, boolean)

putTableColumnEditable

public void putTableColumnEditable(java.lang.String colName,
                                   boolean editable)
Mark a single column as editable or not. If a column has not been marked either way, then it is editable. Note that the row- and column-editable flags are superceded by the whole-table-editable flag if/when it is set.

Parameters:
colName - - which column to affect
editable - - can it be edited, or not?

See Also:
setTableEditable(boolean), getTableColumnEditable(java.lang.String), removeTableColumnEditable(java.lang.String), clearTableColumnEditable(), keySetTableColumnEditable()

getTableColumnEditable

public boolean getTableColumnEditable(java.lang.String colName)
Tell whether a single column is marked as editable or not.

Parameters:
colName - - which column to affect
See Also:
putTableColumnEditable(java.lang.String, boolean)

removeTableColumnEditable

public void removeTableColumnEditable(java.lang.String colName)
Remove the column-editable setting for a column. The column will go back to the default setting, which is editable.

Parameters:
colName - - which column to affect
See Also:
putTableColumnEditable(java.lang.String, boolean)

clearTableColumnEditable

public void clearTableColumnEditable()
Remove all column-editable settings. All columns will go back to the default setting, which is editable.

See Also:
putTableColumnEditable(java.lang.String, boolean)

keySetTableColumnEditable

public java.util.Set keySetTableColumnEditable()
Retrieve the set of keys for all column-editable settings.

See Also:
putTableColumnEditable(java.lang.String, boolean)

setPreferredExpansionDepth

public void setPreferredExpansionDepth(int newDepth)
Set the number of levels to expand from the top level. If the root is being shown, the depth 0 means show only the root. If the root is not being shown, then depth 0 means show only the root's immediate children.

Note that the user at the GUI is free to expand and collapse nodes, and no attempt is made to update this model for such changes.

The default value is Integer.MAX_VALUE.

See Also:
getPreferredExpansionDepth()

getPreferredExpansionDepth

public int getPreferredExpansionDepth()
Get the expansion depth. Note that nodes may be expanded and collapsed by the user at the GUI, so the tree state may have changed since this model was applied.

Returns:
the expansion depth
See Also:
setPreferredExpansionDepth(int)

setColumns

public void setColumns(TableAxisColumn[] newColumns)
                throws java.lang.IllegalArgumentException
Establish the columns to display in the table and the order to display them. If no columns are specified, then no columns will be displayed in the table axis. If you want to display a variable twice in the table axis, create a new Variable with the same data because duplicate in two different TableAxisColumn containing the same Variable will cause an IllegalArgumentException to be thrown.

Parameters:
newColumns - Array of TableAxisColumn to be displayed in the table axis, can be null.
Throws:
java.lang.IllegalArgumentException - if array is empty (ie, zero length), or has null TableAxisColumn objects, or has duplicate TableAxisColumn objects, or has duplicate Variable values.
See Also:
getColumns()

getColumns

public TableAxisColumn[] getColumns()
Returns the current table axis displayed columns.

Returns:
Array of TableAxisColumns objects that are the current columns in viewable in the table.
See Also:
setColumns(com.sas.graphics.components.TableAxisColumn[])

setZones

public void setZones(TableAxisZone[] newZones)
              throws java.lang.IllegalArgumentException
Set the zones to be displayed in the table. The order in the array is the order they will be applied. If Variables are used for zoning, the Variable has to also be a visible TableAxisColumn Variable.

Parameters:
newZones - - Array of TableAxisZones to be used to display the table axis, can be null.
Throws:
java.lang.IllegalArgumentException - if newZones is empty (ie, zero length) or if it contains nulls
See Also:
getZones()

getZones

public TableAxisZone[] getZones()
Returns the current table axis zones.

Returns:
Array of TableAxisZone objects that are the current zones set in the table.
See Also:
setZones(com.sas.graphics.components.TableAxisZone[])

hashCode

public int hashCode()
Computes the hash code for this TableAxisModel.

Overrides:
hashCode in class ModelBase
Returns:
a hash code value for this object.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.