T
- The class implementing a ContentPrototype. It represents a tab
that can create one similar to itself using the prototype pattern.public class MultiContent<T extends ContentPrototype>
extends java.lang.Object
Constructor and Description |
---|
MultiContent(T contentPrototype)
Create a new multi-content frame based on a content prototype.
|
MultiContent(T contentPrototype,
CompositeEntity model)
The constructor takes a model that is parsed for elements with
location attributes.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.HashMap<java.lang.String,TabDefinition> |
_getContents()
Return the content mapping.
|
protected java.util.ArrayList<java.lang.String> |
_getOrder()
Return the order of the contents.
|
protected void |
_initializeContents(ContentPrototype contentPrototype,
CompositeEntity model)
Parse the model and create the multiple content areas.
|
void |
addElement(java.lang.String tabTag,
PositionableElement element)
Add an element to a specific content area.
|
java.lang.String |
addTab(ComponentEntity topLevel,
java.lang.String tabName)
Add a new content area to the MultiContent.
|
java.lang.String |
addTab(ComponentEntity topLevel,
java.lang.String tabName,
ContentPrototype content)
Add a new content area to the MultiContent.
|
java.lang.String |
addTab(ComponentEntity topLevel,
java.lang.String tabTag,
java.lang.String tabName)
Add a new content area to the MultiContent.
|
java.lang.String |
addTab(ComponentEntity topLevel,
java.lang.String tabTag,
java.lang.String tabName,
ContentPrototype content)
Add a new content area to the MultiContent with a specific content.
|
void |
clear()
Clear all data.
|
java.util.ArrayList<TabDefinition> |
getAllTabs()
Get all content areas as a list.
|
java.lang.Object |
getContent(java.lang.String tabTag)
Get a content area based on a unique tag value.
|
PositionableElement |
getElement(NamedObj object)
Return a positionable element if the named object is in any of the tabs.
|
void |
removeElement(PositionableElement element)
Remove an element from all content areas.
|
void |
removeTab(java.lang.String tag)
Remove a content area from the contents.
|
void |
setNameAt(int position,
java.lang.String text)
Rename a content area at a given position.
|
public MultiContent(T contentPrototype)
contentPrototype
- A prototype of the content area. This
prototype is used to create multiple content areas on demand.public MultiContent(T contentPrototype, CompositeEntity model) throws IllegalActionException, NameDuplicationException
model
- The model to be parsed.contentPrototype
- A prototype of the content area. This
prototype is used to create multiple content areas on demand.IllegalActionException
- If any of the elements can't be places
into a content area.NameDuplicationException
- If multiple elements exist with the
same name. Element names within a workspace must be unique.public java.lang.String addTab(ComponentEntity topLevel, java.lang.String tabTag, java.lang.String tabName, ContentPrototype content) throws IllegalActionException, NameDuplicationException
topLevel
- The container containing all tab definitions. If the
container does not have the attribute that contains all tab definition
information, it will be created.tabTag
- The tag identifier used for the content area.tabName
- Name of the tab. Can be used for visualization.content
- The specific content for the new tab.NameDuplicationException
- If the name coincides with an
attribute already in the container.IllegalActionException
- If the attribute is not of an acceptable
class for the container, if the name contains a period, or if a content
area with the same tag already exist.public java.lang.String addTab(ComponentEntity topLevel, java.lang.String tabTag, java.lang.String tabName) throws IllegalActionException, NameDuplicationException
topLevel
- The container containing all tab definitions. If the
container does not have the attribute that contains all tab definition
information, it will be created.tabTag
- The tag identifier used for the content area.tabName
- Name of the tab. Can be used for visualization.NameDuplicationException
- If the name coincides with an
attribute already in the container.IllegalActionException
- If the attribute is not of an acceptable
class for the container, if the name contains a period, or if a content
area with the same tag already exist.public java.lang.String addTab(ComponentEntity topLevel, java.lang.String tabName, ContentPrototype content) throws NameDuplicationException, IllegalActionException
topLevel
- The container containing all tab definitions. If the
container does not have the attribute that contains all tab definition
information, it will be created.tabName
- Name of the tab. Can be used for visualization.content
- The content to use in the new tab.NameDuplicationException
- If the name coincides with an
attribute already in the container.IllegalActionException
- If the tab could not be created in the model.public java.lang.String addTab(ComponentEntity topLevel, java.lang.String tabName) throws NameDuplicationException, IllegalActionException
topLevel
- The container containing all tab definitions. If the
container does not have the attribute that contains all tab definition
information, it will be created.tabName
- Name of the tab. Can be used for visualization.NameDuplicationException
- If the name coincides with an
attribute already in the container.IllegalActionException
- If the tab could not be created in the model.public void addElement(java.lang.String tabTag, PositionableElement element) throws IllegalActionException
tabTag
- The tag identifying the content area.element
- The element to be added to the content area.IllegalActionException
- If the content area is not set.public void removeElement(PositionableElement element)
element
- The element to be removed.public java.lang.Object getContent(java.lang.String tabTag)
tabTag
- The tag that identifies a content area.public java.util.ArrayList<TabDefinition> getAllTabs()
public void removeTab(java.lang.String tag)
tag
- The identifier of the tab to be removed.public void setNameAt(int position, java.lang.String text) throws IllegalActionException
position
- The position of the tab.text
- The new title of the tab.IllegalActionException
- If the new name is not accepted by the model.public void clear()
public PositionableElement getElement(NamedObj object)
object
- The named object to check.protected java.util.HashMap<java.lang.String,TabDefinition> _getContents()
protected java.util.ArrayList<java.lang.String> _getOrder()
protected void _initializeContents(ContentPrototype contentPrototype, CompositeEntity model) throws IllegalActionException, NameDuplicationException
contentPrototype
- A prototype of the content area. This
prototype is used to create multiple content areas on demand.model
- The model to be parsed.IllegalActionException
- If any of the elements can't be places
into a content area.NameDuplicationException
- If multiple elements exist with the
same name. Element names within a workspace must be unique.