public interface GraphEditor
Example:
GModel model = GraphFactory.eINSTANCE.createGModel();
GraphEditor graphEditor = new DefaultGraphEditor();
graphEditor.setModel(model);
Region view = graphEditor.getView();
The view is a Region and can be added to the JavaFX scene graph in the usual way. For large graphs, the
editor can be put inside a GraphEditorContainer instead.
The editor updates its underlying model via EMF commands. This means any user action should be undoable. Helper
methods for common operations are provided in the Commands class, such as:
Look & feel can be customised by setting custom skin classes. The default skins can also be customised to some extent via CSS. See defaults.css in the core module for more information.
| Type | Property and Description |
|---|---|
javafx.beans.property.ObjectProperty<de.tesis.dynaware.grapheditor.model.GModel> |
model
The property containing the graph model being edited.
|
| Modifier and Type | Method and Description |
|---|---|
de.tesis.dynaware.grapheditor.model.GModel |
getModel()
Gets the graph model that is currently being edited.
|
GraphEditorProperties |
getProperties()
Gets the properties of the editor.
|
SelectionManager |
getSelectionManager()
Gets the selection manager.
|
SkinLookup |
getSkinLookup()
Gets the skin lookup.
|
javafx.scene.layout.Region |
getView()
Gets the view where the graph is displayed and edited.
|
javafx.beans.property.ObjectProperty<de.tesis.dynaware.grapheditor.model.GModel> |
modelProperty()
The property containing the graph model being edited.
|
void |
reload()
Reloads the graph model currently being edited.
|
void |
setConnectionSkin(java.lang.String type,
java.lang.Class<? extends GConnectionSkin> skin)
Sets the custom connection skin for a particular connection type.
|
void |
setConnectorSkin(java.lang.String type,
java.lang.Class<? extends GConnectorSkin> skin)
Sets the custom connector skin for a particular connector type.
|
void |
setConnectorValidator(java.lang.Class<? extends GConnectorValidator> validator)
Sets the custom connector validator class.
|
void |
setJointSkin(java.lang.String type,
java.lang.Class<? extends GJointSkin> skin)
Sets the custom joint skin for a particular joint type.
|
void |
setModel(de.tesis.dynaware.grapheditor.model.GModel model)
Sets the graph model to be edited.
|
void |
setNodeSkin(java.lang.String type,
java.lang.Class<? extends GNodeSkin> skin)
Sets the custom node skin for a particular node type.
|
void |
setOnConnectionCreated(CommandAppender<de.tesis.dynaware.grapheditor.model.GConnection> appender)
Sets a method to be called when a connection is created in the editor.
|
void |
setOnConnectionRemoved(CommandAppender<de.tesis.dynaware.grapheditor.model.GConnection> appender)
Sets a method to be called when a connection is removed in the editor.
|
void |
setProperties(GraphEditorProperties properties)
Sets the properties of the editor.
|
void |
setTailSkin(java.lang.String type,
java.lang.Class<? extends GTailSkin> skin)
Sets the custom tail skin for a particular connector type.
|
javafx.beans.property.ObjectProperty<de.tesis.dynaware.grapheditor.model.GModel> modelProperty
getModel(),
setModel(GModel)void setNodeSkin(java.lang.String type,
java.lang.Class<? extends GNodeSkin> skin)
All GNode model elements that have a 'Type' attribute equal to type set here will be
rendered using this skin.
type - the GNode type for which this skin should be usedskin - a custom skin class that extends GNodeSkinvoid setConnectorSkin(java.lang.String type,
java.lang.Class<? extends GConnectorSkin> skin)
All GConnector model elements that have a 'Type' attribute equal to type set here will be
rendered using this skin.
type - the GConnector type for which this skin should be usedskin - a custom skin class that extends GConnectorSkinvoid setConnectionSkin(java.lang.String type,
java.lang.Class<? extends GConnectionSkin> skin)
All GConnection model elements that have a 'Type' attribute equal to type set here will
be rendered using this skin.
type - the GConnection type for which this skin should be usedskin - a custom skin class that extends GConnectionSkinvoid setJointSkin(java.lang.String type,
java.lang.Class<? extends GJointSkin> skin)
All GJoint model elements that have a 'Type' attribute equal to type set here will be
rendered using this skin.
type - the GJoint type for which this skin should be usedskin - a custom skin class that extends GJointSkinvoid setTailSkin(java.lang.String type,
java.lang.Class<? extends GTailSkin> skin)
All GConnector model elements that have a 'Type' attribute equal to type set here will
have their tails rendered using this skin.
type - the GConnector type for which this skin should be usedskin - a custom skin class that extends GTailSkinvoid setConnectorValidator(java.lang.Class<? extends GConnectorValidator> validator)
This will be used to decide which connections are allowed / forbidden during drag & drop events in the editor.
validator - a custom validator class that implements GConnectorValidatorvoid setModel(de.tesis.dynaware.grapheditor.model.GModel model)
model - the GModel to be editedde.tesis.dynaware.grapheditor.model.GModel getModel()
GModel being edited, or null if no model was ever setvoid reload()
Note:
If the model is updated via EMF commands, as is recommended, it should rarely be necessary to call this method.
The model will be reloaded automatically via a command-stack listener.
javafx.beans.property.ObjectProperty<de.tesis.dynaware.grapheditor.model.GModel> modelProperty()
getModel(),
setModel(GModel)javafx.scene.layout.Region getView()
The view is a JavaFX Region. It should be added to the scene graph in the usual way.
Region where the graph is displayed and editedGraphEditorProperties getProperties()
This provides access to global properties such as:
GraphEditorProperties instance containing the properties of the editorvoid setProperties(GraphEditorProperties properties)
properties - an GraphEditorProperties instance specifying a set of properties for the editorSkinLookup getSkinLookup()
The skin lookup is used to get any skin instance associated to a model element instance.
SkinLookup used to lookup skinsSelectionManager getSelectionManager()
This provides access to actions like 'select all', 'delete selection', cut, copy, paste, and so on.
void setOnConnectionCreated(CommandAppender<de.tesis.dynaware.grapheditor.model.GConnection> appender)
This can be used to append additional commands to the one that created the connection.
appender - the CommandAppender to be calledvoid setOnConnectionRemoved(CommandAppender<de.tesis.dynaware.grapheditor.model.GConnection> appender)
This can be used to append additional commands to the one that removed the connection.
appender - the CommandAppender to be calledCopyright © 2014 TESIS DYNAware. All Rights Reserved.