public interface ModelComponent extends HasProperties, HierarchyNode, Scannable
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()
Called by the system after this component is added to the
component hierarchy (i.e., when it is added as a child of another
CompositeComponent).
|
void |
disconnectFromHierarchy()
Called by the system after this component is removed from the component
hierarchy (i.e., when it is 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 |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
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 |
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
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()
When this method is called, getParent()
will return
the new parent component; the system will have set this beforehand.
void disconnectFromHierarchy()
When this
method is called, getParent()
will still return this original
parent component; the system will set this to null
after.
boolean isSelected()
void setSelected(boolean selected)
selected
- if true, this component is selectedboolean isMarked()
void setMarked(boolean marked)
marked
- if true, this component is markedboolean 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 postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
scan()
method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan()
call.tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.java.io.IOException
- if an error is encountered (such as a reference to a
non-existent component)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.isConnected()
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.