|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttemplates.model.v3.TemplateDesign
public class TemplateDesign
Implementation of TemplateModel.
| Nested Class Summary | |
|---|---|
protected static class |
TemplateDesign.TemplateDesignDescriptor
Descriptor of the template design type of model. |
| Field Summary | |
|---|---|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
annotations
A map with the annotations of this element. |
protected java.util.Set<TemplateComponent> |
components
The set of TemplateComponents in the model. |
protected long |
freeComponentId
Next available id for TemplateComponents. |
protected long |
freeLinkId
Next available id for TemplateLinks. |
protected java.util.Set<TemplateLink> |
links
The set of TemplateLinks in the model. |
static TemplateDesign.TemplateDesignDescriptor |
myDescriptor
Maintains an instance of the descriptor of the template design type. |
protected java.lang.String |
name
The name of the model. |
protected boolean |
needsSave
Keeps track if the model is "dirty", i.e., needs to be saved. |
protected ides.api.plugin.model.ParentModel |
parent
Maintains a pointer to the parent model of this model. |
| Fields inherited from interface templates.model.TemplateModel |
|---|
FSA_NAME_PREFIX |
| Fields inherited from interface ides.api.core.Annotable |
|---|
COMPOSED_OF, COMPOSED_OF_NAMES, CONTROL_MAP, FILE, LAYOUT, TEXT_ANNOTATION |
| Constructor Summary | |
|---|---|
TemplateDesign(java.lang.String name)
Construct a new template design with the given name. |
|
| Method Summary | |
|---|---|
void |
addComponent(TemplateComponent component)
Add a TemplateComponent to the model. |
void |
addLink(TemplateLink link)
Add a TemplateLink to the model. |
void |
addSubscriber(ides.api.plugin.model.DESModelSubscriber subscriber)
|
void |
addSubscriber(TemplateModelSubscriber subscriber)
Attaches the given subscriber to this publisher. |
TemplateComponent |
assembleComponent()
Create a new TemplateComponent which can be then added to the
model without breaking the model consistency (e.g., it has a unique id). |
TemplateLink |
assembleLink(long leftId,
long rightId)
Create a new TemplateLink which can be then added to the model
without breaking the model consistency (e.g., it has a unique id). |
void |
assignFSA(long componentId,
ides.api.model.fsa.FSAModel fsa)
Assign an FSAModel to the TemplateComponent with the
given id. |
protected boolean |
containsComponentId(long id)
Checks if the model contains a TemplateComponent with the given
id. |
protected boolean |
containsLinkId(long id)
Checks if the model contains a TemplateLink with the given id. |
TemplateComponent |
createComponent()
Create a new TemplateComponent and add it to the model. |
TemplateLink |
createLink(long leftId,
long rightId)
Create a new TemplateLink and add it to the model. |
boolean |
existsLink(long channelId,
long moduleId)
Check if there is a TemplateLink between the
TemplateComponents with the given ids. |
void |
fireTemplateModelStructureChanged(TemplateModelMessage message)
Triggers a notification to all subscribers that the structure of the TemplateModel has changed. |
java.util.Collection<TemplateLink> |
getAdjacentLinks(long componentId)
Retrieve all the TemplateLinks connected to the
TemplateComponent with the given id. |
java.lang.Object |
getAnnotation(java.lang.String key)
|
java.util.Collection<TemplateComponent> |
getChannels()
Retrieve all the TemplateComponents in the model which are
channels. |
ides.api.plugin.model.DESModel |
getChildModel(java.lang.String arg0)
|
java.lang.String |
getChildModelId(ides.api.plugin.model.DESModel arg0)
|
TemplateComponent |
getComponent(long id)
Return the TemplateComponent with the given id. |
int |
getComponentCount()
Return the number of TemplateComponents in the model. |
java.util.Collection<TemplateComponent> |
getComponents()
Retrieve all the TemplateComponents in the model. |
protected TemplateComponent |
getComponentWithFSA(ides.api.model.fsa.FSAModel fsa)
Retrieve the TemplateComponent containing the given
FSAModel. |
java.util.Collection<TemplateComponent> |
getCover(long channelId)
Retrieve all the modules linked to the channel with the given id. |
ides.api.plugin.model.DESModelSubscriber[] |
getDESModelSubscribers()
|
ides.api.plugin.model.DESEventSet |
getEventSet()
|
TemplateLink |
getLink(long id)
Return the TemplateLink with the given id. |
java.util.Collection<TemplateLink> |
getLinks()
Retrieve all the TemplateLinks in the model. |
java.util.Collection<TemplateLink> |
getLinks(long leftId,
long rightId)
Retrieve the TemplateLinks between the TemplateComponents
with the given ids. |
ides.api.plugin.model.DESModelType |
getModelType()
|
java.util.Collection<TemplateComponent> |
getModules()
Retrieve all the TemplateComponents in the model which are
modules. |
java.lang.String |
getName()
|
ides.api.plugin.model.ParentModel |
getParentModel()
|
TemplateModelSubscriber[] |
getTemplateModelSubscribers()
Returns all current subscribers to this publisher. |
boolean |
hasAnnotation(java.lang.String key)
|
void |
metadataChanged()
|
void |
modelNameChanged(ides.api.plugin.model.DESModelMessage arg0)
|
void |
modelSaved()
|
boolean |
needsSave()
|
void |
removeAnnotation(java.lang.String key)
|
void |
removeComponent(long id)
Remove the TemplateComponent with the given id. |
void |
removeFSA(long componentId)
Remove the FSAModel assigned to the TemplateComponent
with the given id. |
void |
removeLink(long id)
Remove the TemplateLink with the given id. |
void |
removeSubscriber(ides.api.plugin.model.DESModelSubscriber subscriber)
|
void |
removeSubscriber(TemplateModelSubscriber subscriber)
Removes the given subscriber from this publisher. |
void |
saveStatusChanged(ides.api.plugin.model.DESModelMessage arg0)
|
void |
setAnnotation(java.lang.String key,
java.lang.Object annotation)
|
void |
setComponentType(long componentId,
int type)
Set the type (module or channel) of the TemplateComponent with the given id. |
void |
setName(java.lang.String name)
|
protected void |
setNeedsSave(boolean b)
Set the "dirty" state of the model and announce to listeners if the state changed. |
void |
setParentModel(ides.api.plugin.model.ParentModel arg0)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable<java.lang.String,java.lang.Object> annotations
protected boolean needsSave
public static TemplateDesign.TemplateDesignDescriptor myDescriptor
protected java.lang.String name
protected java.util.Set<TemplateComponent> components
TemplateComponents in the model.
protected java.util.Set<TemplateLink> links
TemplateLinks in the model.
protected long freeComponentId
TemplateComponents.
protected long freeLinkId
TemplateLinks.
protected ides.api.plugin.model.ParentModel parent
null.
| Constructor Detail |
|---|
public TemplateDesign(java.lang.String name)
name - the name for the new template design| Method Detail |
|---|
public java.lang.Object getAnnotation(java.lang.String key)
getAnnotation in interface ides.api.core.Annotablepublic boolean hasAnnotation(java.lang.String key)
hasAnnotation in interface ides.api.core.Annotablepublic void removeAnnotation(java.lang.String key)
removeAnnotation in interface ides.api.core.Annotable
public void setAnnotation(java.lang.String key,
java.lang.Object annotation)
setAnnotation in interface ides.api.core.Annotablepublic void addSubscriber(ides.api.plugin.model.DESModelSubscriber subscriber)
addSubscriber in interface ides.api.plugin.model.DESModelPublisherpublic void removeSubscriber(ides.api.plugin.model.DESModelSubscriber subscriber)
removeSubscriber in interface ides.api.plugin.model.DESModelPublisherpublic ides.api.plugin.model.DESModelSubscriber[] getDESModelSubscribers()
getDESModelSubscribers in interface ides.api.plugin.model.DESModelPublisherpublic void addSubscriber(TemplateModelSubscriber subscriber)
TemplateModelPublisher
addSubscriber in interface TemplateModelPublishersubscriber - the subscriber to be addedpublic void removeSubscriber(TemplateModelSubscriber subscriber)
TemplateModelPublisher
removeSubscriber in interface TemplateModelPublishersubscriber - the subscriber to be removedpublic TemplateModelSubscriber[] getTemplateModelSubscribers()
TemplateModelPublisher
getTemplateModelSubscribers in interface TemplateModelPublisherpublic void fireTemplateModelStructureChanged(TemplateModelMessage message)
TemplateModelPublisherTemplateModel has changed.
fireTemplateModelStructureChanged in interface TemplateModelPublishermessage - message with additional info about the changepublic boolean needsSave()
needsSave in interface ides.api.plugin.model.DESModelprotected void setNeedsSave(boolean b)
b - the new "dirty" state of the modelpublic ides.api.plugin.model.DESModelType getModelType()
getModelType in interface ides.api.plugin.model.DESModelprotected boolean containsComponentId(long id)
TemplateComponent with the given
id.
id - the id of the component
true if the model contains a
TemplateComponent with the given id; false
otherwiseprotected boolean containsLinkId(long id)
TemplateLink with the given id.
id - the id of the link
true if the model contains a TemplateLink
with the given id; false otherwisepublic void addComponent(TemplateComponent component)
TemplateModelTemplateComponent to the model.
addComponent in interface TemplateModelcomponent - the TemplateComponent to be addedpublic void addLink(TemplateLink link)
TemplateModelTemplateLink to the model.
addLink in interface TemplateModellink - the TemplateLink to be added
public TemplateLink createLink(long leftId,
long rightId)
TemplateModelTemplateLink and add it to the model.
createLink in interface TemplateModelleftId - the id of the first TemplateComponent to be linkedrightId - the id of the second TemplateComponent to be linked
TemplateLink which was added to the modelpublic TemplateComponent createComponent()
TemplateModelTemplateComponent and add it to the model.
createComponent in interface TemplateModelTemplateComponent which was added to the modelpublic java.util.Collection<TemplateComponent> getComponents()
TemplateModelTemplateComponents in the model.
getComponents in interface TemplateModelTemplateComponents in the modelpublic java.util.Collection<TemplateLink> getLinks()
TemplateModelTemplateLinks in the model.
getLinks in interface TemplateModelTemplateLinks in the modelpublic TemplateComponent getComponent(long id)
TemplateModelTemplateComponent with the given id.
getComponent in interface TemplateModelid - the id of the TemplateComponent
TemplateComponent with the given id;
null if there is no TemplateComponent with
such an idpublic java.util.Collection<TemplateComponent> getModules()
TemplateModelTemplateComponents in the model which are
modules.
getModules in interface TemplateModelTemplateComponents in the model
which are modulespublic java.util.Collection<TemplateComponent> getChannels()
TemplateModelTemplateComponents in the model which are
channels.
getChannels in interface TemplateModelTemplateComponents in the model
which are channelspublic TemplateLink getLink(long id)
TemplateModelTemplateLink with the given id.
getLink in interface TemplateModelid - the id of the TemplateLink
TemplateLink with the given id; null if
there is no TemplateLink with such an idpublic int getComponentCount()
TemplateModelTemplateComponents in the model.
getComponentCount in interface TemplateModelTemplateComponents in the modelpublic void removeComponent(long id)
TemplateModelTemplateComponent with the given id.
removeComponent in interface TemplateModelid - the id of the TemplateComponent to be removedpublic void removeLink(long id)
TemplateModelTemplateLink with the given id.
removeLink in interface TemplateModelid - the id of the TemplateLink to be removedpublic java.lang.String getName()
getName in interface ides.api.plugin.model.DESModelpublic void metadataChanged()
metadataChanged in interface ides.api.plugin.model.DESModelpublic void modelSaved()
modelSaved in interface ides.api.plugin.model.DESModelpublic void setName(java.lang.String name)
setName in interface ides.api.plugin.model.DESModel
public boolean existsLink(long channelId,
long moduleId)
TemplateModelTemplateLink between the
TemplateComponents with the given ids.
existsLink in interface TemplateModelchannelId - the id of the first TemplateComponentmoduleId - the id of the second TemplateComponent
true if there is a TemplateLink between the
TemplateComponents with the given ids; false
otherwisepublic java.util.Collection<TemplateLink> getAdjacentLinks(long componentId)
TemplateModelTemplateLinks connected to the
TemplateComponent with the given id.
getAdjacentLinks in interface TemplateModelcomponentId - the id of the TemplateComponent
TemplateLinks connected to the
TemplateComponent with the given idpublic java.util.Collection<TemplateComponent> getCover(long channelId)
TemplateModel
getCover in interface TemplateModelchannelId - the id of the channel TemplateComponent
TemplateComponent
with the given id is not a channel
public java.util.Collection<TemplateLink> getLinks(long leftId,
long rightId)
TemplateModelTemplateLinks between the TemplateComponents
with the given ids.
getLinks in interface TemplateModelleftId - the id of the first TemplateComponentrightId - the id of the second TemplateComponent
TemplateLinks between the
TemplateComponents with the given idsprotected TemplateComponent getComponentWithFSA(ides.api.model.fsa.FSAModel fsa)
TemplateComponent containing the given
FSAModel.
fsa - the FSAModel to be used in the search
TemplateComponent containing the given
FSAModel (if more than one TemplateComponents
contains the FSAModel, returns one of them arbitrarily);
null if not TemplateComponent contains the
given FSAModel
public void assignFSA(long componentId,
ides.api.model.fsa.FSAModel fsa)
TemplateModelFSAModel to the TemplateComponent with the
given id.
assignFSA in interface TemplateModelcomponentId - the id of the TemplateComponentfsa - the FSAModel to be assignedpublic void removeFSA(long componentId)
TemplateModelFSAModel assigned to the TemplateComponent
with the given id.
removeFSA in interface TemplateModelcomponentId - the id of the TemplateComponent whose FSAModel
is to be removedpublic TemplateComponent assembleComponent()
TemplateModelTemplateComponent which can be then added to the
model without breaking the model consistency (e.g., it has a unique id).
assembleComponent in interface TemplateModelTemplateComponent which can be then added to the
model without breaking the model consistency
public TemplateLink assembleLink(long leftId,
long rightId)
TemplateModelTemplateLink which can be then added to the model
without breaking the model consistency (e.g., it has a unique id).
assembleLink in interface TemplateModelleftId - the id of the first TemplateComponent to be linkedrightId - the id of the second TemplateComponent to be linked
TemplateLink which can be then added to the model
without breaking the model consistencypublic ides.api.plugin.model.DESModel getChildModel(java.lang.String arg0)
getChildModel in interface ides.api.plugin.model.ParentModel
public java.lang.String getChildModelId(ides.api.plugin.model.DESModel arg0)
throws java.lang.IllegalArgumentException
getChildModelId in interface ides.api.plugin.model.ParentModeljava.lang.IllegalArgumentExceptionpublic ides.api.plugin.model.ParentModel getParentModel()
getParentModel in interface ides.api.plugin.model.DESModelpublic void setParentModel(ides.api.plugin.model.ParentModel arg0)
setParentModel in interface ides.api.plugin.model.DESModelpublic void modelNameChanged(ides.api.plugin.model.DESModelMessage arg0)
modelNameChanged in interface ides.api.plugin.model.DESModelSubscriberpublic void saveStatusChanged(ides.api.plugin.model.DESModelMessage arg0)
saveStatusChanged in interface ides.api.plugin.model.DESModelSubscriber
public void setComponentType(long componentId,
int type)
TemplateModelTemplateComponent with the given id.
setComponentType in interface TemplateModelcomponentId - the id of the TemplateComponent whose type is to be
changedtype - the type to be set (TemplateComponent.TYPE_MODULE or
TemplateComponent.TYPE_CHANNEL)public ides.api.plugin.model.DESEventSet getEventSet()
getEventSet in interface ides.api.plugin.model.DESModel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||