Package dk.gtz.graphedit.viewmodel
Class ViewModelGraph
- All Implemented Interfaces:
javafx.beans.Observable,javafx.beans.property.Property<ViewModelGraph>,javafx.beans.property.ReadOnlyProperty<ViewModelGraph>,javafx.beans.value.ObservableValue<ViewModelGraph>,javafx.beans.value.WritableValue<ViewModelGraph>
View model representation of a graphedit graph
-
Constructor Summary
ConstructorsConstructorDescriptionViewModelGraph(ModelGraph graph, ISyntaxFactory syntaxFactory) Constructs a new view model graph instance based on a model graph instanceViewModelGraph(javafx.beans.property.StringProperty declarations, javafx.beans.property.MapProperty<UUID, ViewModelVertex> vertices, javafx.beans.property.MapProperty<UUID, ViewModelEdge> edges) Construct a new instance -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(javafx.beans.value.ChangeListener<? super ViewModelGraph> listener) javafx.beans.property.StringPropertyGet the declarations portion of the graph.javafx.beans.property.MapProperty<UUID,ViewModelEdge> edges()Get the edges mappinggetName()getValue()booleanisEmpty()Check if the graph contains no syntactic elementsbooleanisValid()Checks that all the edges' sources and edges are present in the vertices collection.voidremoveListener(javafx.beans.value.ChangeListener<? super ViewModelGraph> listener) toModel()Constructs a new model graph instance based on the current view model valuesjavafx.beans.property.MapProperty<UUID,ViewModelVertex> vertices()Get the vertices mappingMethods inherited from class dk.gtz.graphedit.viewmodel.AutoProperty
addListener, bind, bindBidirectional, getBean, isBound, loadFields, removeListener, setValue, unbind, unbindBidirectionalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javafx.beans.value.ObservableValue
flatMap, map, orElse, when
-
Constructor Details
-
ViewModelGraph
public ViewModelGraph(javafx.beans.property.StringProperty declarations, javafx.beans.property.MapProperty<UUID, ViewModelVertex> vertices, javafx.beans.property.MapProperty<UUID, ViewModelEdge> edges) Construct a new instance- Parameters:
declarations- A string that can contain extraneous textual syntax such as variable declarations, readme data, value ranges, functions etc.vertices- A mapping of vertex ids to model vertex-valuesedges- A mapping of edge ids to model edge-values
-
ViewModelGraph
Constructs a new view model graph instance based on a model graph instance- Parameters:
graph- The model graph to convertsyntaxFactory- The associated syntax factory
-
-
Method Details
-
declarations
public javafx.beans.property.StringProperty declarations()Get the declarations portion of the graph. The declarations are a string that can contain extraneous textual syntax such as variable declarations, readme data, value ranges, functions etc.- Returns:
- The string property value of the declarations
-
vertices
Get the vertices mapping- Returns:
- The mapping of vertex ids to viewmodel entries
-
edges
Get the edges mapping- Returns:
- The mapping of edge ids to viewmodel entries
-
isValid
public boolean isValid()Checks that all the edges' sources and edges are present in the vertices collection.- Returns:
- True if the graph is valid, otherwise false.
-
toModel
Constructs a new model graph instance based on the current view model values- Returns:
- a new model graph instance
-
isEmpty
public boolean isEmpty()Check if the graph contains no syntactic elements- Returns:
- true if there are no declarations, vertices or edges
-
getName
-
addListener
- Specified by:
addListenerin interfacejavafx.beans.value.ObservableValue<ViewModelGraph>- Overrides:
addListenerin classAutoProperty<ViewModelGraph>
-
removeListener
- Specified by:
removeListenerin interfacejavafx.beans.value.ObservableValue<ViewModelGraph>- Overrides:
removeListenerin classAutoProperty<ViewModelGraph>
-
getValue
-