|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pnp.xfeature.models.AbstractComponentModel
com.pnp.xfeature.models.FeatureDiagramModel
public class FeatureDiagramModel
Class representing a feature model. It contains method that manipulates the feature model and provides information about the model
| Field Summary | |
|---|---|
static int |
HORIZONTAL_GAP_BETWEEN_SIBLINGS
horizontal space bewtween two nodes |
static int |
HORIZONTAL_TEXT_EXTENT_MARGIN
space around the text inside the node |
static java.lang.String |
PROPERTY_CONNECTION
event identifier |
static java.lang.String |
PROPERTY_FILE_LOADED
event identifier |
static java.lang.String |
PROPERTY_NODE_ADDED
event identifier |
static java.lang.String |
PROPERTY_NODE_AND_CONNECTION_ADDED
event identifier |
static java.lang.String |
PROPERTY_NODE_REMOVED
event identifier |
SchemaParser |
schemaParser
parser of the meta-model |
static int |
TV_LEFTMARGIN
Left margin to shift the tree to right |
static int |
TV_NODEHEIGHT
default node height |
static int |
TV_NODEWIDTH
default node width |
static int |
VERTICAL_GAP
vertical space bewtween parent and child |
static int |
VERTICAL_TEXT_EXTENT_MARGIN
space around the text inside the node |
| Constructor Summary | |
|---|---|
FeatureDiagramModel()
creates feature model and instantiates XML parser |
|
| Method Summary | |
|---|---|
org.w3c.dom.Element |
addCardinality(FeatureNodeModel parent,
java.lang.String newNodeType,
int nodePosition)
Adds a cardinality to the parent node. |
void |
addComponent(java.lang.Object component)
adds node to list of all nodes |
org.w3c.dom.Element |
addConstraint(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition)
Adds a new ExcludesConstraint. |
org.w3c.dom.Element |
addConstraintElement(org.w3c.dom.Node parentNode,
org.w3c.dom.Element addedFeatureNodeModelElement,
int constraintPathType)
|
FeatureNodeModel |
addNode(FeatureNodeModel parent,
java.lang.String newNodeType,
int nodePosition,
java.lang.String propertySet)
Adds a new node. |
org.w3c.dom.Element |
addProperty(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition,
java.lang.String propertySet,
org.w3c.dom.Node propertySetNode)
Adds a new property. |
org.w3c.dom.Element |
addPropertySet(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition)
Adds a new property set. |
void |
addUniqueId(org.w3c.dom.Document doc)
adds temporal attribute to every element in the DOM model, this attribute is not saved to the XML file when performing doSave() or doSaveAs() operations |
boolean |
cutSubtree(FeatureNodeModel root)
removes node from the feature model and calls removeSubtree() to remove all its children too |
boolean |
displayNode(java.lang.String nodeName)
states whether the passed node name specifies a displayable node |
void |
domTreeToList(org.w3c.dom.Node node,
java.util.List list,
FeatureNodeModel parent,
boolean recursiveCall)
Linearizes the DOM tree whose root is the passed node. |
java.lang.String |
elementToXPath(org.w3c.dom.Element current)
|
boolean |
expandCollapseNode(FeatureNodeModel node)
repaints the node with transparet-like color and hides the subtree of the node |
java.util.List |
getComponents()
getter method |
org.w3c.dom.Document |
getDiagramModel()
getter method |
org.w3c.dom.Document |
getDisplayModel()
getter method |
int |
getDOMTreeWidth(org.w3c.dom.Node node,
boolean recursiveCall)
returns the width of the DOM tree whose root is the passed node, calls recursively itself |
FeatureNodeModel |
getFeatureNodeModel(long id)
searches for and returns a node specified by its unique ID |
java.lang.String |
getFileName()
getter method |
org.w3c.dom.Document |
getGlobalConstraintsDocument()
getter method |
org.w3c.dom.Element |
getGlobalConstraintsElement()
getter method; if the globalConstraints Document doesnt exist, it creates one |
java.util.List |
getChildren()
returns the root element of the feature model |
org.w3c.dom.Document |
getMetaModel()
getter method |
java.lang.String |
getName()
getter method |
org.w3c.dom.Element |
idToElement(long id)
return DOM Element of the node that has xfeatureUniqueId attribute value equal to the parameter |
org.w3c.dom.Element |
idToElement(java.lang.String id)
return DOM Element of the node that has xfeatureUniqueId attribute value equal to the parameter |
boolean |
insertNodeToDomAt(org.w3c.dom.Element child,
org.w3c.dom.Node parent,
int nodePosition)
inserts W3C DOM Element object to specifed index int the list of child elements of the parent node |
boolean |
insertNodeToDomAt(FeatureNodeModel child,
FeatureNodeModel parent,
int nodePosition)
inserts XML representation of the node to specifed index int the list of child elements of the parent node |
boolean |
isDirty()
|
void |
linearize(org.w3c.dom.Document diagram,
java.util.List list)
takes a DOM tree produced by a XML parser and transforms it into a list of FeatureNodeModel objects - each holding a reference to its corresponding DOM tree node |
boolean |
load(IPath location)
loads the whole feature model, i.e. the model file itself, the metamodel, the display model, and possible layout file (.pos) |
void |
loadConstraints(IPath location)
loads the layout of the feature model diagram from the *.pos file |
boolean |
loadDisplayModel(java.lang.String filename)
loads the display model specified by the filename |
boolean |
loadGlobalConstraintsModel(java.lang.String filename)
loads the display model specified by the filename |
boolean |
loadMetaModel(java.lang.String filename)
loads the meta-model specified by the filename |
boolean |
loadSubtreeConstraints(java.io.DataInputStream sin,
org.w3c.dom.Node node)
reads the position and size of nodes from *.pos file |
org.w3c.dom.Document |
loadXMLDocument(java.lang.String uri)
reads the XML document specified by its name and parses it and saves it to an internal structure W3C DOM Document object |
boolean |
pasteSubtree(FeatureNodeModel node,
FeatureNodeModel parent,
int nodePosition)
inserts the node to the feature model as a child node of the selcted parent node and fires an event to update the graphical and outline views |
int |
removeCardinality(org.w3c.dom.Node node,
FeatureNodeModel parent)
Removes a cardinality from the node. |
boolean |
removeConnection(FeatureNodeModel node,
FeatureNodeModel parent)
removes connection between two nodes of the feature model |
org.w3c.dom.Element |
removeConstraint(org.w3c.dom.Element constraint)
removes constraint Element from the root element of the globalConstrant Document |
boolean |
removeNode(FeatureNodeModel node)
Removes an existing node from the model. |
int |
removeProperty(org.w3c.dom.Node node,
FeatureNodeModel parent,
java.lang.String propertySet)
Removes a property from the node. |
int |
removePropertySet(org.w3c.dom.Node node,
FeatureNodeModel parent)
Removes a property set from the node. |
void |
removeSubtree(FeatureNodeModel root,
int level)
removes the children and itself from the feature model |
void |
returnCardinality(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition)
Returns the cardinality to its original position in the DOM model, updates the feature model and fires an event to inform Eclipse that graphical, outline and property views must be updated |
void |
returnConstraint(org.w3c.dom.Element constraint,
org.w3c.dom.Element parent,
org.w3c.dom.Element next)
|
void |
returnNode(FeatureNodeModel returnedNode,
FeatureNodeModel parentNode)
returns previously deletd constraint Element back to the root element of the globalConstrant Document |
void |
returnProperty(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition,
java.lang.String propertySet)
Returns the property to its original position in the DOM model and updates the feature model |
void |
returnPropertySet(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition)
Returns the cardinality to its original position in the DOM model and updates the feature model. |
void |
saveConstraints(IPath location)
saves the feature model diagram layout to a *.pos file |
void |
saveModel(IPath location)
Saves the model, i.e. serializes the diagramModel XML document. |
boolean |
saveSubtreeConstraints(java.io.DataOutputStream sout,
org.w3c.dom.Node node)
saves position and size of nodes to *.pos file |
void |
setDirty(boolean dirty)
|
void |
setFileName(java.lang.String fileName)
setter method |
void |
setName(java.lang.String name)
setter method |
java.lang.String |
toString()
returns name of the feature model |
int |
unAddCardinality(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode)
calls removeCardinality() method |
void |
unAddNode(FeatureNodeModel removedNode,
FeatureNodeModel parentNode)
Removes the newly added node. |
int |
unAddProperty(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode,
java.lang.String propertySet)
calls removeProperty() method |
int |
unAddPropertySet(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode)
|
boolean |
uncutSubtree(FeatureNodeModel node,
FeatureNodeModel parent)
returns the node to the DOM model and feature model, then calls recusive method unremoveSubtree() to return all its children too |
boolean |
unpasteSubtree(FeatureNodeModel root)
removes the node from it parent, calls recursive method removeSubtree(), and fires an event to update the graphical and outline views |
void |
unremoveSubtree(FeatureNodeModel node,
FeatureNodeModel parent,
int level)
returns previously removed nodes to the feature model and calls itself recursively to return children too |
void |
updateModel(org.w3c.dom.Document diagram,
java.util.List list)
Deprecated. |
| Methods inherited from class com.pnp.xfeature.models.AbstractComponentModel |
|---|
addPropertyChangeListener, firePropertyChange, getEditableValue, getPropertyDescriptors, getPropertyValue, isPropertySet, removePropertyChangeListener, resetPropertyValue, setPropertyValue |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int TV_LEFTMARGIN
public static final int TV_NODEWIDTH
public static final int TV_NODEHEIGHT
public static final int HORIZONTAL_TEXT_EXTENT_MARGIN
public static final int VERTICAL_TEXT_EXTENT_MARGIN
public static final int HORIZONTAL_GAP_BETWEEN_SIBLINGS
public static final int VERTICAL_GAP
public static final java.lang.String PROPERTY_NODE_ADDED
public static final java.lang.String PROPERTY_NODE_REMOVED
public static final java.lang.String PROPERTY_FILE_LOADED
public static final java.lang.String PROPERTY_CONNECTION
public static final java.lang.String PROPERTY_NODE_AND_CONNECTION_ADDED
public SchemaParser schemaParser
| Constructor Detail |
|---|
public FeatureDiagramModel()
| Method Detail |
|---|
public java.lang.String getName()
public void setName(java.lang.String name)
public void addComponent(java.lang.Object component)
public java.util.List getComponents()
public org.w3c.dom.Document getDisplayModel()
public org.w3c.dom.Document getMetaModel()
public org.w3c.dom.Document getDiagramModel()
public org.w3c.dom.Document loadXMLDocument(java.lang.String uri)
public boolean load(IPath location)
public void addUniqueId(org.w3c.dom.Document doc)
public boolean loadDisplayModel(java.lang.String filename)
public boolean loadGlobalConstraintsModel(java.lang.String filename)
public org.w3c.dom.Element idToElement(java.lang.String id)
id -
public org.w3c.dom.Element idToElement(long id)
id -
public java.lang.String elementToXPath(org.w3c.dom.Element current)
public boolean loadMetaModel(java.lang.String filename)
public void linearize(org.w3c.dom.Document diagram,
java.util.List list)
public int getDOMTreeWidth(org.w3c.dom.Node node,
boolean recursiveCall)
public void domTreeToList(org.w3c.dom.Node node,
java.util.List list,
FeatureNodeModel parent,
boolean recursiveCall)
node - current DOM node; root at the first call; inner node laterlist - resulting list (which is most likely the components variable passed of the class itself (FeatureDiagramModel)parent - parent node of the first parameter noderecursiveCall - parameter that control the initializationpublic boolean displayNode(java.lang.String nodeName)
public FeatureNodeModel addNode(FeatureNodeModel parent,
java.lang.String newNodeType,
int nodePosition,
java.lang.String propertySet)
public void unAddNode(FeatureNodeModel removedNode,
FeatureNodeModel parentNode)
public boolean removeNode(FeatureNodeModel node)
public org.w3c.dom.Element removeConstraint(org.w3c.dom.Element constraint)
constraint -
public void returnConstraint(org.w3c.dom.Element constraint,
org.w3c.dom.Element parent,
org.w3c.dom.Element next)
public void returnNode(FeatureNodeModel returnedNode,
FeatureNodeModel parentNode)
public void saveModel(IPath location)
public FeatureNodeModel getFeatureNodeModel(long id)
public boolean loadSubtreeConstraints(java.io.DataInputStream sin,
org.w3c.dom.Node node)
public boolean saveSubtreeConstraints(java.io.DataOutputStream sout,
org.w3c.dom.Node node)
public void saveConstraints(IPath location)
public void loadConstraints(IPath location)
public void updateModel(org.w3c.dom.Document diagram,
java.util.List list)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List getChildren()
public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
public boolean removeConnection(FeatureNodeModel node,
FeatureNodeModel parent)
public boolean insertNodeToDomAt(FeatureNodeModel child,
FeatureNodeModel parent,
int nodePosition)
public boolean insertNodeToDomAt(org.w3c.dom.Element child,
org.w3c.dom.Node parent,
int nodePosition)
public org.w3c.dom.Element addCardinality(FeatureNodeModel parent,
java.lang.String newNodeType,
int nodePosition)
public int unAddCardinality(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode)
public int removeCardinality(org.w3c.dom.Node node,
FeatureNodeModel parent)
public void returnCardinality(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition)
public org.w3c.dom.Element addPropertySet(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition)
public int unAddPropertySet(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode)
public int removePropertySet(org.w3c.dom.Node node,
FeatureNodeModel parent)
public void returnPropertySet(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition)
public org.w3c.dom.Element addProperty(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition,
java.lang.String propertySet,
org.w3c.dom.Node propertySetNode)
public int unAddProperty(org.w3c.dom.Element removedNode,
FeatureNodeModel parentNode,
java.lang.String propertySet)
public int removeProperty(org.w3c.dom.Node node,
FeatureNodeModel parent,
java.lang.String propertySet)
public void returnProperty(org.w3c.dom.Element returnedNode,
FeatureNodeModel parentNode,
int elementLastPosition,
java.lang.String propertySet)
public boolean expandCollapseNode(FeatureNodeModel node)
public boolean cutSubtree(FeatureNodeModel root)
public void removeSubtree(FeatureNodeModel root,
int level)
public boolean uncutSubtree(FeatureNodeModel node,
FeatureNodeModel parent)
public void unremoveSubtree(FeatureNodeModel node,
FeatureNodeModel parent,
int level)
public boolean pasteSubtree(FeatureNodeModel node,
FeatureNodeModel parent,
int nodePosition)
public boolean unpasteSubtree(FeatureNodeModel root)
public org.w3c.dom.Element addConstraintElement(org.w3c.dom.Node parentNode,
org.w3c.dom.Element addedFeatureNodeModelElement,
int constraintPathType)
public org.w3c.dom.Element addConstraint(org.w3c.dom.Node parent,
java.lang.String newNodeType,
int nodePosition)
public org.w3c.dom.Element getGlobalConstraintsElement()
public org.w3c.dom.Document getGlobalConstraintsDocument()
public boolean isDirty()
public void setDirty(boolean dirty)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||