Package dk.gtz.graphedit.viewmodel
Class ViewModelEdge
- All Implemented Interfaces:
IFocusable,IHoverable,IInspectable,ISelectable,javafx.beans.Observable,javafx.beans.property.Property<ViewModelEdge>,javafx.beans.property.ReadOnlyProperty<ViewModelEdge>,javafx.beans.value.ObservableValue<ViewModelEdge>,javafx.beans.value.WritableValue<ViewModelEdge>
public class ViewModelEdge
extends AutoProperty<ViewModelEdge>
implements IInspectable, ISelectable, IHoverable, IFocusable
The ViewModel representation of a graph edge.
Edges connects vertices with other vertices.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionViewModelEdge(UUID uuid, ModelEdge edge) Constructs a new view model edge instance based on a model edge instanceViewModelEdge(UUID uuid, UUID source, UUID target) Constructs a new view model edge instanceViewModelEdge(UUID uuid, javafx.beans.property.ObjectProperty<UUID> source, javafx.beans.property.ObjectProperty<UUID> target) Constructs a new view model edge instance -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFocusListener(Runnable focusEventHandler) Add an event listener for when the focus is stolenvoidaddHoverListener(javafx.beans.value.ChangeListener<javafx.scene.Node> consumer) Add a changelistener that will be invoked whenIHoverable.hover(javafx.scene.Node)is being called.voiddeselect()Deselect the objectbooleanvoidfocus()Steal the focusGets a list of objects that should be inspectable by anInspectorControllerviewjavafx.beans.property.BooleanPropertyGet the observable property that determines if the object is selected or not.getName()getValue()inthashCode()voidhover(javafx.scene.Node hoverDisplay) Trigger a hover event and display the provided node in the hover effect.id()Get the id of the edgebooleanCheck if the hover effect is currently showing.booleanisSourceValid(UUID source, ViewModelGraph graph) Check if the proposed source vertex is a valid source.booleanisTargetValid(UUID target, ViewModelGraph graph) Check if the proposed target vertex is a valid target.voidselect()Select the objectjavafx.beans.property.ObjectProperty<UUID>source()Get the source propertyjavafx.beans.property.ObjectProperty<UUID>target()Get the target propertytoModel()Constructs a new model edge instance based on the current view model valuesvoidunhover()Stop showing the hover effect.Methods inherited from class dk.gtz.graphedit.viewmodel.AutoProperty
addListener, addListener, bind, bindBidirectional, getBean, isBound, loadFields, removeListener, removeListener, setValue, unbind, unbindBidirectionalMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javafx.beans.value.ObservableValue
flatMap, map, orElse, when
-
Field Details
-
source
Property pointing to the source vertex id -
target
Property pointing to the target vertex id
-
-
Constructor Details
-
ViewModelEdge
public ViewModelEdge(UUID uuid, javafx.beans.property.ObjectProperty<UUID> source, javafx.beans.property.ObjectProperty<UUID> target) Constructs a new view model edge instance- Parameters:
uuid- The id of the edgesource- the syntactic element where the edge originates fromtarget- the syntactic element where the edge targets
-
ViewModelEdge
Constructs a new view model edge instance based on a model edge instance- Parameters:
uuid- The id of the edgeedge- the model edge to convert
-
ViewModelEdge
Constructs a new view model edge instance- Parameters:
uuid- The id of the edgesource- the syntactic element where the edge originates fromtarget- the syntactic element where the edge targets
-
-
Method Details
-
toModel
Constructs a new model edge instance based on the current view model values- Returns:
- a new model edge instance
-
source
Get the source property- Returns:
- the source
UUIDproperty
-
target
Get the target property- Returns:
- the target
UUIDproperty
-
id
Get the id of the edge- Returns:
- the unique identifier of the edge
-
isTargetValid
Check if the proposed target vertex is a valid target. Use this in your syntax plugins to limit which vertices can be targeted by edges- Parameters:
target- The proposed vertex id to targetgraph- The graph containing this edge and the proposed target vertex- Returns:
- true if the target is a valid target vertex for this edge, false otherwise
-
isSourceValid
Check if the proposed source vertex is a valid source. Use this in your syntax plugins to limit which vertices can have edges- Parameters:
source- The proposed vertex id to sourcegraph- The graph containing this edge and the proposed source vertex- Returns:
- true if the source is a valid source vertex for this edge, false otherwise
-
getIsSelected
public javafx.beans.property.BooleanProperty getIsSelected()Description copied from interface:ISelectableGet the observable property that determines if the object is selected or not. This is useful if you want to add event listeners to handle when the property changes.- Specified by:
getIsSelectedin interfaceISelectable- Returns:
trueif the object is currently selected, otherwisefalse
-
select
public void select()Description copied from interface:ISelectableSelect the object- Specified by:
selectin interfaceISelectable
-
deselect
public void deselect()Description copied from interface:ISelectableDeselect the object- Specified by:
deselectin interfaceISelectable
-
addFocusListener
Description copied from interface:IFocusableAdd an event listener for when the focus is stolen- Specified by:
addFocusListenerin interfaceIFocusable- Parameters:
focusEventHandler- the handler to call
-
focus
public void focus()Description copied from interface:IFocusableSteal the focus- Specified by:
focusin interfaceIFocusable
-
getInspectableObjects
Gets a list of objects that should be inspectable by anInspectorControllerview- Specified by:
getInspectableObjectsin interfaceIInspectable- Returns:
- An unmodifiable list of inspectable objects
-
getName
- Specified by:
getNamein interfacejavafx.beans.property.ReadOnlyProperty<ViewModelEdge>
-
getValue
- Specified by:
getValuein interfacejavafx.beans.value.ObservableValue<ViewModelEdge>- Specified by:
getValuein interfacejavafx.beans.value.WritableValue<ViewModelEdge>
-
hover
public void hover(javafx.scene.Node hoverDisplay) Description copied from interface:IHoverableTrigger a hover event and display the provided node in the hover effect.- Specified by:
hoverin interfaceIHoverable- Parameters:
hoverDisplay- The javafx node to show in the hover window.
-
unhover
public void unhover()Description copied from interface:IHoverableStop showing the hover effect.- Specified by:
unhoverin interfaceIHoverable
-
isHovering
public boolean isHovering()Description copied from interface:IHoverableCheck if the hover effect is currently showing.- Specified by:
isHoveringin interfaceIHoverable- Returns:
- True if the hover effect is currently being shown, false otherwise.
-
addHoverListener
public void addHoverListener(javafx.beans.value.ChangeListener<javafx.scene.Node> consumer) Description copied from interface:IHoverableAdd a changelistener that will be invoked whenIHoverable.hover(javafx.scene.Node)is being called.- Specified by:
addHoverListenerin interfaceIHoverable- Parameters:
consumer- The changelistener to add.
-
equals
-
hashCode
public int hashCode()
-