Package dk.gtz.graphedit.viewmodel
Class ViewModelVertex
- All Implemented Interfaces:
IFocusable,IHoverable,IInspectable,ISelectable,javafx.beans.Observable,javafx.beans.property.Property<ViewModelVertex>,javafx.beans.property.ReadOnlyProperty<ViewModelVertex>,javafx.beans.value.ObservableValue<ViewModelVertex>,javafx.beans.value.WritableValue<ViewModelVertex>
public class ViewModelVertex
extends AutoProperty<ViewModelVertex>
implements IInspectable, IHoverable, ISelectable, IFocusable
Viewmodel representation of a
ModelVertex.
A vertex is the most basic part of a graph. It can be connected with other vertices via ModelEdges.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionViewModelVertex(UUID uuid, ModelVertex vertex) Constructs a new view model vertex based on a model vertexViewModelVertex(UUID uuid, ModelVertex vertex, ViewModelVertexShape shape) Constructs a new view model vertex based on a model vertex and a shapeViewModelVertex(UUID uuid, ViewModelPoint position, ViewModelVertexShape shape) Constructs a new view model vertex based on a position and a shape -
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 node) Trigger a hover event and display the provided node in the hover effect.id()Get the id of the vertexbooleanCheck if the hover effect is currently showing.position()Get the position of the vertexvoidselect()Select the objectshape()Get the shape of the vertextoModel()Constructs a new model vertex 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
-
position
The position of the vertex
-
-
Constructor Details
-
ViewModelVertex
Constructs a new view model vertex based on a position and a shape- Parameters:
uuid- The id of the vertexposition- The point at which the vertex is locatedshape- The shape at which edges should follow
-
ViewModelVertex
Constructs a new view model vertex based on a model vertex and a shape- Parameters:
uuid- The id of the vertexvertex- The model vertex to base onshape- The shape at which edges should follow
-
ViewModelVertex
Constructs a new view model vertex based on a model vertex- Parameters:
uuid- The id of the vertexvertex- The model vertex to base on
-
-
Method Details
-
toModel
Constructs a new model vertex instance based on the current view model values- Returns:
- A new model vertex instance
-
position
Get the position of the vertex- Returns:
- A view model point
-
shape
Get the shape of the vertex- Returns:
- A view model shape
-
id
Get the id of the vertex- Returns:
- The unique identifier of the vertex
-
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<ViewModelVertex>
-
getValue
- Specified by:
getValuein interfacejavafx.beans.value.ObservableValue<ViewModelVertex>- Specified by:
getValuein interfacejavafx.beans.value.WritableValue<ViewModelVertex>
-
hover
public void hover(javafx.scene.Node node) Description copied from interface:IHoverableTrigger a hover event and display the provided node in the hover effect.- Specified by:
hoverin interfaceIHoverable- Parameters:
node- The javafx node to show in the hover window.
-
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.
-
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.
-
unhover
public void unhover()Description copied from interface:IHoverableStop showing the hover effect.- Specified by:
unhoverin interfaceIHoverable
-
equals
-
hashCode
public int hashCode()
-