public interface ModelComponent extends HasProperties, HierarchyNode, PostScannable
Modifier and Type | Interface and Description |
---|---|
static class |
ModelComponent.NavpanelVisibility
Controls the visibility of this component in the navigation panel.
|
Modifier and Type | Method and Description |
---|---|
void |
connectToHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is added to the component hierarchy (i.e., added as
a child of another CompositeComponent).
|
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is removed from the component hierarchy (i.e., removed as a
child of its parent).
|
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
java.lang.String |
getName()
Gets the name of this component.
|
ModelComponent.NavpanelVisibility |
getNavpanelVisibility() |
int |
getNumber()
Gets the number of this component.
|
CompositeComponent |
getParent()
Returns the current parent of this ModelComponent, if any.
|
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
boolean |
hasState()
Queries if this component has state.
|
boolean |
isFixed()
Returns true if this model component is fixed.
|
boolean |
isMarked()
Returns true if this model component is marked.
|
boolean |
isSelected()
Returns true if this model component is selected.
|
void |
notifyParentOfChange(ComponentChangeEvent e)
Notifies the parent of this component (if any) of changes within in its
descendants.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setFixed(boolean fixed)
Fixes or unfixes this component.
|
void |
setMarked(boolean marked)
Marks or unmarks this component.
|
void |
setName(java.lang.String name)
Sets the name of this component.
|
void |
setNumber(int num)
Sets the number of this component.
|
void |
setParent(CompositeComponent parent)
Sets the parent for this component.
|
void |
setSelected(boolean selected)
Selects or deselects this component.
|
void |
setWritable(boolean writable)
Sets this component to be writable or non-writable.
|
void |
updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
May be called by the system if any of the soft references for
this component are removed from the the component hierarchy.
|
getAllPropertyInfo, getProperty
getChildren, hasChildren
postscan
isWritable, write
java.lang.String getName()
void setName(java.lang.String name) throws java.lang.IllegalArgumentException
notifyParentOfChange
with a NameChangeEvent
so that it's
parent can update the name map entry and other ancestors can adjust for
the new name.
Component names can be specified as null. However, if not null, they
should have non-zero length and should not begin with a digit or contain
the characters '.' or '/'. Implementations can use ModelComponentBase.checkName()
to determine if a proposed name is valid.
name
- new component namejava.lang.IllegalArgumentException
- if the name does not have a valid formatint getNumber()
void setNumber(int num)
num
- new component numberCompositeComponent getParent()
getParent
in interface HierarchyNode
void setParent(CompositeComponent parent)
null
is specified when the component is being removed from the hierarchy.
This method is intended for internal use by the system only.
parent
- new parent component, or null
.void connectToHierarchy(CompositeComponent hcomp)
When this method is called, getParent()
will return the new
parent component; the system will have set this beforehand.
hcomp
- hierarchy component to which this component,
or its ancestor, was attachedvoid disconnectFromHierarchy(CompositeComponent hcomp)
When this method is called, getParent()
will still return this
original parent component; the system will set this to null
after.
hcomp
- hierarchy component from which this component,
or its ancestor, was detachedboolean isSelected()
void setSelected(boolean selected)
selected
- if true, this component is selectedboolean isMarked()
void setMarked(boolean marked)
marked
- if true, this component is markedvoid setWritable(boolean writable)
Some components may be intrinsicly non-writable, in which case calling this method will have no effect.
writable
- if true, component is made writableboolean isFixed()
void setFixed(boolean fixed)
fixed
- if true, this component will be fixed to its parent.ModelComponent.NavpanelVisibility getNavpanelVisibility()
void notifyParentOfChange(ComponentChangeEvent e)
componentChanged
method.e
- optional argument giving specific information about the changevoid getHardReferences(java.util.List<ModelComponent> refs)
refs
- list to which hard references are appendedvoid getSoftReferences(java.util.List<ModelComponent> refs)
updateReferences()
method will
be called to update its internal reference information.refs
- list to which soft references are appendedboolean hasState()
true
if this component has statevoid scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
Scannable
write
.void updateReferences(boolean undo, java.util.Deque<java.lang.Object> undoInfo)
undo
equal to false
,
this component should then examine its soft references and
use ComponentUtils.areConnected()
to determine which of them have been disconnected from the hierarchy.
Disconnected references should be removed, and sufficient information
should be appended to undoInfo
to allow this update
to be undone if this method is called later with undo
equal to true
. When undoing an update, the undo
information should be removed from the front of undoInfo
.undo
- if true
, indicates that the most
recent reference update should be undone, using the supplied
undo information.undoInfo
- if undo
is false
, should be used
to store information allowing the reference update to be undone.
Otherwise, if undo
is true
, then this
supplied information to undo the most recent update.