public class Table extends Object implements ITable, ICloneable
ITable interface.| Constructor and Description |
|---|
Table()
Default constructor that creates an empty table.
|
| Modifier and Type | Method and Description |
|---|---|
ILabel |
addLabel(IStripe owner,
String text,
ILabelModelParameter layoutParameter,
ILabelStyle style,
SizeD preferredSize,
Object tag)
Add a label to the given owner using the text as the initial label text and label model parameter and style.
|
void |
addLabelAddedListener(IEventHandler<ItemEventArgs<ILabel>> labelAddedEvent)
Adds the given listener for the
LabelAdded event that occurs when a label has been added to this graph
instance. |
void |
addLabelChangedListener(IEventHandler<ItemEventArgs<ILabel>> labelChangedEvent)
Adds the given listener for the
LabelChanged event that occurs when a label has been changed, for instance, if
its style has been replaced. |
void |
addLabelRemovedListener(IEventHandler<LabelEventArgs> labelRemovedEvent)
Adds the given listener for the
LabelRemoved event that occurs when a label has been removed from this graph
instance. |
void |
addStripeChangedListener(IEventHandler<StripeEventArgs> stripeChangedEvent)
Adds the given listener for the
StripeChanged event that occurs when a stripe has been changed, for instance, if
its style has been replaced. |
void |
addStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
Adds the given listener for the
StripeCreated event that occurs when a stripe has been added. |
void |
addStripeRemovedListener(IEventHandler<StripeEventArgs> stripeRemovedEvent)
Adds the given listener for the
StripeRemoved event that occurs when a stripe has been removed from its parent. |
Table |
clone()
Creates a copy of this object and returns it.
|
protected IColumn |
copyColumn(IColumn column)
Called during
clone() to create a copy of . |
protected IStripeDefaults |
copyDefaults(IStripeDefaults originalDefaults)
Called during
clone() to create a copy of . |
protected IRow |
copyRow(IRow row)
Called during
clone() to create a copy of . |
IColumn |
createColumn(IColumn owner,
double width,
double minWidth,
InsetsD insets,
IStripeStyle style,
Object tag,
int index)
Create a new column as the
indexth child of owner with the given parameters. |
protected IStripeDefaults |
createColumnDefaults()
Callback method that creates the Column defaults.
|
IRow |
createRow(IRow owner,
double height,
double minHeight,
InsetsD insets,
IStripeStyle style,
Object tag,
int index)
Create a new row as the
indexth child of owner with the given parameters. |
protected IStripeDefaults |
createRowDefaults()
Callback method that creates the row defaults.
|
IStripeDefaults |
getColumnDefaults()
Gets the defaults for Columns.
|
IEnumerable<IColumn> |
getColumns()
The toplevel
IColumns in this table. |
static IContextLookup |
getDefaultColumnLookup()
Gets an
IContextLookup that provides the default implementations returned by an IColumn's lookup. |
static IContextLookup |
getDefaultRowLookup()
Gets an
IContextLookup that provides the default implementations returned by an IRow's lookup. |
static IContextLookup |
getDefaultStripeLookup()
Gets an
IContextLookup that provides the default implementations returned by an IStripe's lookup. |
InsetsD |
getInsets()
Gets the insets for this table.
|
IRectangle |
getLayout()
Gets the relative layout of the table.
|
PointD |
getRelativeLocation()
Gets the relative location of the upper left corner of the table.
|
IColumn |
getRootColumn()
Gets the virtual root of the column hierarchy.
|
IRow |
getRootRow()
Gets the virtual root of the row hierarchy.
|
IStripeDefaults |
getRowDefaults()
Gets the defaults for rows.
|
IEnumerable<IRow> |
getRows()
The toplevel
IRows in this table. |
static void |
installDynamicUndoSupport(IGraph graph)
Installs the undo support for use with all tables that are bound to nodes in
graph. |
static void |
installStaticUndoSupport(IGraph graph)
Installs the undo support for use with all tables that are bound to nodes in
graph. |
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null. |
protected void |
onLabelAdded(ILabel label)
Called after a label has been added to a stripe.
|
protected void |
onLabelChanged(ILabel label)
Callback that is invoked after a label has changed.
|
protected void |
onLabelRemoved(ILabelOwner owner,
ILabel label)
Called after a label has been removed from its stripe.
|
protected void |
onStripeChanged(IStripe owner,
IStripe stripe,
ITable oldTable)
Callback that is invoked after a stripe has changed.
|
protected void |
onStripeCreated(IStripe stripe)
Called after a stripe has been created and added to a table.
|
protected void |
onStripeRemoved(IStripe owner,
IStripe stripe)
Called after a stripe has been removed from its owner.
|
void |
remove(ILabel label)
Removes the given label from its owner.
|
void |
remove(IStripe stripe)
Removes
stripe from its parent container. |
void |
removeLabelAddedListener(IEventHandler<ItemEventArgs<ILabel>> labelAddedEvent)
Removes the given listener for the
LabelAdded event that occurs when a label has been added to this graph
instance. |
void |
removeLabelChangedListener(IEventHandler<ItemEventArgs<ILabel>> labelChangedEvent)
Removes the given listener for the
LabelChanged event that occurs when a label has been changed, for instance,
if its style has been replaced. |
void |
removeLabelRemovedListener(IEventHandler<LabelEventArgs> labelRemovedEvent)
Removes the given listener for the
LabelRemoved event that occurs when a label has been removed from this graph
instance. |
void |
removeStripeChangedListener(IEventHandler<StripeEventArgs> stripeChangedEvent)
Removes the given listener for the
StripeChanged event that occurs when a stripe has been changed, for instance,
if its style has been replaced. |
void |
removeStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
Removes the given listener for the
StripeCreated event that occurs when a stripe has been added. |
void |
removeStripeRemovedListener(IEventHandler<StripeEventArgs> stripeRemovedEvent)
Removes the given listener for the
StripeRemoved event that occurs when a stripe has been removed from its
parent. |
void |
setColumnDefaults(IStripeDefaults value)
Sets the defaults for Columns.
|
void |
setInsets(InsetsD value)
Sets the insets for this table.
|
void |
setLabelLayoutParameter(ILabel label,
ILabelModelParameter layoutParameter)
Sets the label model parameter for the given label.
|
void |
setLabelPreferredSize(ILabel label,
SizeD preferredSize)
Sets the preferred size of the label.
|
void |
setLabelText(ILabel label,
String text)
Sets the label text of the given label.
|
void |
setMinimumSize(IStripe stripe,
double minimumSize)
Sets the minimum size of
stripe. |
void |
setParent(IColumn owner,
IColumn column,
int index)
Sets
owner as new parent of column, inserting column at the given index. |
void |
setParent(IRow owner,
IRow row,
int index)
Sets
owner as new parent of row, inserting row at the given index. |
void |
setRelativeLocation(PointD value)
Sets the relative location of the upper left corner of the table.
|
void |
setRowDefaults(IStripeDefaults value)
Sets the defaults for rows.
|
void |
setSize(IStripe stripe,
double size)
Sets the actual size of
stripe. |
void |
setStripeInsets(IStripe stripe,
InsetsD insets)
Sets the insets of
stripe. |
void |
setStyle(ILabel label,
ILabelStyle style)
Assigns the given style instance by reference to the label.
|
void |
setStyle(IStripe stripe,
IStripeStyle style)
Sets the style of
stripe. |
static void |
uninstallDynamicUndoSupport(IGraph graph)
Uninstalls the undo support that has previously been installed with
installDynamicUndoSupport(IGraph). |
static void |
uninstallStaticUndoSupport(IGraph graph)
Uninstalls the undo support that has previously been installed with
installStaticUndoSupport(IGraph). |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLabel, addLabel, addLabel, addLabel, adjustLabelPreferredSize, calculateLabelPreferredSize, clear, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createColumn, createGrid, createLabelLayoutParameter, createLabelStyle, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, createRow, findColumn, findRow, findStripe, findStripes, findStripes, getAccumulatedInsets, getCellBounds, removeRecursively, removeRecursivelyWithResize, removeWithResize, setParent, setParentcreateDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookuppublic ILabel addLabel(IStripe owner, String text, ILabelModelParameter layoutParameter, ILabelStyle style, SizeD preferredSize, Object tag)
ITableaddLabel in interface ITableowner - the owner to add the label to.text - the initial text of the labellayoutParameter - The label model parameter instance to use.style - The style to use for the labelpreferredSize - The initial values to use for the PreferredSize.tag - the initial Tag to assign.ITable.setLabelText(ILabel, String),
ITable.setLabelLayoutParameter(ILabel, ILabelModelParameter),
ITable.setStyle(ILabel, ILabelStyle)public final void addLabelAddedListener(IEventHandler<ItemEventArgs<ILabel>> labelAddedEvent)
ITableLabelAdded event that occurs when a label has been added to this graph
instance.addLabelAddedListener in interface ITablelabelAddedEvent - The listener to add.ITable.addLabel(IStripe, String, ILabelModelParameter, ILabelStyle, SizeD, Object),
ITable.removeLabelAddedListener(IEventHandler)public final void addLabelChangedListener(IEventHandler<ItemEventArgs<ILabel>> labelChangedEvent)
ITableLabelChanged event that occurs when a label has been changed, for instance, if
its style has been replaced.addLabelChangedListener in interface ITablelabelChangedEvent - The listener to add.ITable.setStyle(ILabel, ILabelStyle),
ITable.removeLabelChangedListener(IEventHandler)public final void addLabelRemovedListener(IEventHandler<LabelEventArgs> labelRemovedEvent)
ITableLabelRemoved event that occurs when a label has been removed from this graph
instance.
This event will also be triggered, prior to the removal of the owner of the label.
Implementations may choose to use the LabelEventArgs to carry additional label owner information. The Owner
property will be set to the the owner of the label that owned it before the removal.
addLabelRemovedListener in interface ITablelabelRemovedEvent - The listener to add.ITable.remove(ILabel),
ITable.removeLabelRemovedListener(IEventHandler)public final void addStripeChangedListener(IEventHandler<StripeEventArgs> stripeChangedEvent)
ITableStripeChanged event that occurs when a stripe has been changed, for instance, if
its style has been replaced.addStripeChangedListener in interface ITablestripeChangedEvent - The listener to add.ITable.setStyle(IStripe, IStripeStyle),
ITable.setStripeInsets(IStripe, InsetsD),
ITable.setSize(IStripe, double),
ITable.setMinimumSize(IStripe, double),
ITable.removeStripeChangedListener(IEventHandler)public final void addStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
ITableStripeCreated event that occurs when a stripe has been added.addStripeCreatedListener in interface ITablestripeCreatedEvent - The listener to add.ITable.createRow(IRow, double, double, InsetsD, IStripeStyle, Object, int),
ITable.createColumn(IColumn, double, double, InsetsD, IStripeStyle, Object, int),
ITable.removeStripeCreatedListener(IEventHandler)public final void addStripeRemovedListener(IEventHandler<StripeEventArgs> stripeRemovedEvent)
ITableStripeRemoved event that occurs when a stripe has been removed from its parent.addStripeRemovedListener in interface ITablestripeRemovedEvent - The listener to add.ITable.remove(IStripe),
ITable.removeStripeRemovedListener(IEventHandler)public final Table clone()
ICloneableclone in interface ICloneableclone in class ObjectObject.clone()protected IColumn copyColumn(IColumn column)
clone() to create a copy of .column
If column implements the ICloneable interface, the column instance is
ICloneable.clone()d, otherwise, the original instance is returned unchanged.
column - The column that should be copied during a clone operation.column if possible, otherwise the original reference to columnprotected IStripeDefaults copyDefaults(IStripeDefaults originalDefaults)
clone() to create a copy of .originalDefaults
This implementation returns an unchanged reference to originalDefaults. If you need to create a deep clone of
originalDefaults, you'll have to perform the cloning yourself.
originalDefaults - The default settings that should be copied during a clone operation.originalDefaultsprotected IRow copyRow(IRow row)
clone() to create a copy of .row
If row implements the ICloneable interface, the row instance is
ICloneable.clone()d, otherwise, the original instance is returned unchanged.
row - The row that should be copied during a clone operation.row if possible, otherwise the original reference to rowpublic IColumn createColumn(IColumn owner, double width, double minWidth, InsetsD insets, IStripeStyle style, Object tag, int index)
ITableindexth child of owner with the given parameters.createColumn in interface ITableowner - The owner of the new column.width - The actual width of the column.minWidth - The minimal width of the column.insets - The insets of the column.style - The style of the column.tag - The tag of the columnindex - The position in the child list.protected IStripeDefaults createColumnDefaults()
StripeDefaults class which is used for newly created columns.public IRow createRow(IRow owner, double height, double minHeight, InsetsD insets, IStripeStyle style, Object tag, int index)
ITableindexth child of owner with the given parameters.createRow in interface ITableowner - The owner of the new row.height - The actual height of the row.minHeight - The minimal height of the row.insets - The insets of the row.style - The style of the row.tag - The tag of the rowindex - The position in the child list.protected IStripeDefaults createRowDefaults()
StripeDefaults class that is used for newly created rows.public final IStripeDefaults getColumnDefaults()
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
If no value is set explicitly a default will be created using upon first read access.
getColumnDefaults in interface ITablesetColumnDefaults(IStripeDefaults)public final IEnumerable<IColumn> getColumns()
IColumns in this table.public static final IContextLookup getDefaultColumnLookup()
IContextLookup that provides the default implementations returned by an IColumn's lookup.
The provided default implementations can for example be used as fallback when the column lookup is wrapped.
public static final IContextLookup getDefaultRowLookup()
IContextLookup that provides the default implementations returned by an IRow's lookup.
The provided default implementations can for example be used as fallback when the row lookup is wrapped.
public static final IContextLookup getDefaultStripeLookup()
IContextLookup that provides the default implementations returned by an IStripe's lookup.
The provided default implementations can for example be used as fallback when the stripe lookup is wrapped.
public final InsetsD getInsets()
ITableThese insets are applied in addition to any implicit insets provided by the child stripes.
getInsets in interface ITableITable.setInsets(InsetsD)public final IRectangle getLayout()
The upper left corner of the layout always coincides with RelativeLocation.
getLayout in interface ITablegetRelativeLocation()public final PointD getRelativeLocation()
ITableThe actual interpretation of this value depends on the context. If the table is bound to a node, this location is usually interpreted relative to the upper left corner of the node layout.
getRelativeLocation in interface ITableITable.getLayout(),
ITable.setRelativeLocation(PointD)public final IColumn getRootColumn()
ITable
This column should not be queried except for the ParentColumn and the associated
Table
getRootColumn in interface ITableITable.setParent(IColumn, IColumn, int),
ITable.createColumn(IColumn, double, double, InsetsD, IStripeStyle, Object, int)public final IRow getRootRow()
ITable
This row should not be queried except for the ParentRow and the associated
Table
getRootRow in interface ITableITable.setParent(IRow, IRow, int),
ITable.createRow(IRow, double, double, InsetsD, IStripeStyle, Object, int)public final IStripeDefaults getRowDefaults()
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
If no value is set explicitly a default will be created using upon first read access.
getRowDefaults in interface ITablesetRowDefaults(IStripeDefaults)public final IEnumerable<IRow> getRows()
IRows in this table.public static final void installDynamicUndoSupport(IGraph graph)
graph.
This method queries the graph for its undo support dynamically whenever undo support is queried in the table. In
contrast to installStaticUndoSupport(IGraph) the undo support installed with this method will thus always be
the one which is the currently available support for the graph.
graph - The graph where the nodes exist or will be created/changed and where the undo support should come from.uninstallDynamicUndoSupport(IGraph),
installStaticUndoSupport(IGraph)public static final void installStaticUndoSupport(IGraph graph)
graph.
This methods installs the undo support which manages the graph at the time this method is called. In contrast to
installDynamicUndoSupport(IGraph) the installed undo support will not change when the
graph's undo support changes.
This method adds undo support both for existing nodes in graph as well as for newly created or changed nodes.
graph - The graph where the nodes exist or will be created/changed.uninstallStaticUndoSupport(IGraph),
installDynamicUndoSupport(IGraph)public <TLookup> TLookup lookup(Class<TLookup> type)
ILookupnull.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.protected void onLabelAdded(ILabel label)
This method raises the LabelAdded event.
label - The label that has just been added.protected void onLabelChanged(ILabel label)
This method raises the LabelChanged event.
label - The label that has changed.protected void onLabelRemoved(ILabelOwner owner, ILabel label)
This method raises the LabelRemoved event.
label - The label that has just been removed.owner - The old owner of the label.protected void onStripeChanged(IStripe owner, IStripe stripe, ITable oldTable)
This will trigger the StripeChanged event.
owner - The original ownerstripe - The stripe that has changed.oldTable - The original table owner, in case the stripe has been moved between different table instancesprotected void onStripeCreated(IStripe stripe)
This method raises the StripeCreated event.
stripe - The stripe that has just been created.protected void onStripeRemoved(IStripe owner, IStripe stripe)
This method raises the StripeRemoved event.
stripe - The stripe that has just been removed.owner - The old owner of the stripe.public void remove(ILabel label)
This will trigger the corresponding event.
remove in interface ITableIllegalArgumentException - If the label is not associated with this table instance.label - the label to removepublic void remove(IStripe stripe)
ITablestripe from its parent container.
This method reparents all children of stripe to the parent of the stripe.
public final void removeLabelAddedListener(IEventHandler<ItemEventArgs<ILabel>> labelAddedEvent)
ITableLabelAdded event that occurs when a label has been added to this graph
instance.removeLabelAddedListener in interface ITablelabelAddedEvent - The listener to remove.ITable.addLabel(IStripe, String, ILabelModelParameter, ILabelStyle, SizeD, Object),
ITable.addLabelAddedListener(IEventHandler)public final void removeLabelChangedListener(IEventHandler<ItemEventArgs<ILabel>> labelChangedEvent)
ITableLabelChanged event that occurs when a label has been changed, for instance,
if its style has been replaced.removeLabelChangedListener in interface ITablelabelChangedEvent - The listener to remove.ITable.setStyle(ILabel, ILabelStyle),
ITable.addLabelChangedListener(IEventHandler)public final void removeLabelRemovedListener(IEventHandler<LabelEventArgs> labelRemovedEvent)
ITableLabelRemoved event that occurs when a label has been removed from this graph
instance.
This event will also be triggered, prior to the removal of the owner of the label.
Implementations may choose to use the LabelEventArgs to carry additional label owner information. The Owner
property will be set to the the owner of the label that owned it before the removal.
removeLabelRemovedListener in interface ITablelabelRemovedEvent - The listener to remove.ITable.remove(ILabel),
ITable.addLabelRemovedListener(IEventHandler)public final void removeStripeChangedListener(IEventHandler<StripeEventArgs> stripeChangedEvent)
ITableStripeChanged event that occurs when a stripe has been changed, for instance,
if its style has been replaced.removeStripeChangedListener in interface ITablestripeChangedEvent - The listener to remove.ITable.setStyle(IStripe, IStripeStyle),
ITable.setStripeInsets(IStripe, InsetsD),
ITable.setSize(IStripe, double),
ITable.setMinimumSize(IStripe, double),
ITable.addStripeChangedListener(IEventHandler)public final void removeStripeCreatedListener(IEventHandler<ItemEventArgs<IStripe>> stripeCreatedEvent)
ITableStripeCreated event that occurs when a stripe has been added.removeStripeCreatedListener in interface ITablestripeCreatedEvent - The listener to remove.ITable.createRow(IRow, double, double, InsetsD, IStripeStyle, Object, int),
ITable.createColumn(IColumn, double, double, InsetsD, IStripeStyle, Object, int),
ITable.addStripeCreatedListener(IEventHandler)public final void removeStripeRemovedListener(IEventHandler<StripeEventArgs> stripeRemovedEvent)
ITableStripeRemoved event that occurs when a stripe has been removed from its
parent.removeStripeRemovedListener in interface ITablestripeRemovedEvent - The listener to remove.ITable.remove(IStripe),
ITable.addStripeRemovedListener(IEventHandler)public final void setColumnDefaults(IStripeDefaults value)
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
If no value is set explicitly a default will be created using upon first read access.
setColumnDefaults in interface ITablevalue - The ColumnDefaults to set.getColumnDefaults()public final void setInsets(InsetsD value)
ITableThese insets are applied in addition to any implicit insets provided by the child stripes.
setInsets in interface ITablevalue - The Insets to set.ITable.getInsets()public void setLabelLayoutParameter(ILabel label, ILabelModelParameter layoutParameter)
setLabelLayoutParameter in interface ITableIllegalArgumentException - If the parameter cannot be used for this label or if the label is not associated with this table instance.label - The label.layoutParameter - The new parameter.public void setLabelPreferredSize(ILabel label, SizeD preferredSize)
setLabelPreferredSize in interface ITableIllegalArgumentException - If the label is not associated with this table instance.label - The label.preferredSize - The new preferred size.ILabel.getPreferredSize()public void setLabelText(ILabel label, String text)
setLabelText in interface ITableIllegalArgumentException - If the label is not associated with this table instance.label - the label to modifytext - the new text of the labelILabel.getText()public void setMinimumSize(IStripe stripe, double minimumSize)
ITablestripe.
This method sets the MinimumSize of stripe.
setMinimumSize in interface ITablestripe - The stripe to changeminimumSize - The new minimum size of the stripepublic void setParent(IColumn owner, IColumn column, int index)
ITableowner as new parent of column, inserting column at the given index.
The column will be inserted at position index in the child list of the new parent.
public void setParent(IRow owner, IRow row, int index)
ITableowner as new parent of row, inserting row at the given index.
The row will be inserted at position index in the child list of the new parent.
public final void setRelativeLocation(PointD value)
ITableThe actual interpretation of this value depends on the context. If the table is bound to a node, this location is usually interpreted relative to the upper left corner of the node layout.
setRelativeLocation in interface ITablevalue - The RelativeLocation to set.ITable.getLayout(),
ITable.getRelativeLocation()public final void setRowDefaults(IStripeDefaults value)
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
If no value is set explicitly a default will be created using upon first read access.
setRowDefaults in interface ITablevalue - The RowDefaults to set.getRowDefaults()public void setSize(IStripe stripe, double size)
ITablestripe.
This method sets the Size of stripe.
public void setStripeInsets(IStripe stripe, InsetsD insets)
ITablestripe.setStripeInsets in interface ITablestripe - The stripe to changeinsets - The new insets of the stripepublic void setStyle(ILabel label, ILabelStyle style)
Style instances can be shared.
setStyle in interface ITablelabel - The label that will be assigned the new stylestyle - The style instance that will be assigned to the label.ILabel.getStyle()public void setStyle(IStripe stripe, IStripeStyle style)
ITablestripe.public static final void uninstallDynamicUndoSupport(IGraph graph)
installDynamicUndoSupport(IGraph).graph - The graph where the tables are installed for which the undo support should be cleared.public static final void uninstallStaticUndoSupport(IGraph graph)
installStaticUndoSupport(IGraph).graph - The graph where the tables are installed for which the undo support should be cleared.