Class ViewModelVertex

java.lang.Object
dk.gtz.graphedit.viewmodel.AutoProperty<ViewModelVertex>
dk.gtz.graphedit.viewmodel.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 Details

    • position

      public final ViewModelPoint position
      The position of the vertex
  • Constructor Details

    • ViewModelVertex

      public ViewModelVertex(UUID uuid, ViewModelPoint position, ViewModelVertexShape shape)
      Constructs a new view model vertex based on a position and a shape
      Parameters:
      uuid - The id of the vertex
      position - The point at which the vertex is located
      shape - The shape at which edges should follow
    • ViewModelVertex

      public ViewModelVertex(UUID uuid, ModelVertex vertex, ViewModelVertexShape shape)
      Constructs a new view model vertex based on a model vertex and a shape
      Parameters:
      uuid - The id of the vertex
      vertex - The model vertex to base on
      shape - The shape at which edges should follow
    • ViewModelVertex

      public ViewModelVertex(UUID uuid, ModelVertex vertex)
      Constructs a new view model vertex based on a model vertex
      Parameters:
      uuid - The id of the vertex
      vertex - The model vertex to base on
  • Method Details

    • toModel

      public ModelVertex toModel()
      Constructs a new model vertex instance based on the current view model values
      Returns:
      A new model vertex instance
    • position

      public ViewModelPoint position()
      Get the position of the vertex
      Returns:
      A view model point
    • shape

      public ViewModelVertexShape shape()
      Get the shape of the vertex
      Returns:
      A view model shape
    • id

      public UUID 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: ISelectable
      Get 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:
      getIsSelected in interface ISelectable
      Returns:
      true if the object is currently selected, otherwise false
    • select

      public void select()
      Description copied from interface: ISelectable
      Select the object
      Specified by:
      select in interface ISelectable
    • deselect

      public void deselect()
      Description copied from interface: ISelectable
      Deselect the object
      Specified by:
      deselect in interface ISelectable
    • addFocusListener

      public void addFocusListener(Runnable focusEventHandler)
      Description copied from interface: IFocusable
      Add an event listener for when the focus is stolen
      Specified by:
      addFocusListener in interface IFocusable
      Parameters:
      focusEventHandler - the handler to call
    • focus

      public void focus()
      Description copied from interface: IFocusable
      Steal the focus
      Specified by:
      focus in interface IFocusable
    • getInspectableObjects

      public List<InspectableProperty> getInspectableObjects()
      Gets a list of objects that should be inspectable by an InspectorController view
      Specified by:
      getInspectableObjects in interface IInspectable
      Returns:
      An unmodifiable list of inspectable objects
    • getName

      public String getName()
      Specified by:
      getName in interface javafx.beans.property.ReadOnlyProperty<ViewModelVertex>
    • getValue

      public ViewModelVertex getValue()
      Specified by:
      getValue in interface javafx.beans.value.ObservableValue<ViewModelVertex>
      Specified by:
      getValue in interface javafx.beans.value.WritableValue<ViewModelVertex>
    • hover

      public void hover(javafx.scene.Node node)
      Description copied from interface: IHoverable
      Trigger a hover event and display the provided node in the hover effect.
      Specified by:
      hover in interface IHoverable
      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: IHoverable
      Add a changelistener that will be invoked when IHoverable.hover(javafx.scene.Node) is being called.
      Specified by:
      addHoverListener in interface IHoverable
      Parameters:
      consumer - The changelistener to add.
    • isHovering

      public boolean isHovering()
      Description copied from interface: IHoverable
      Check if the hover effect is currently showing.
      Specified by:
      isHovering in interface IHoverable
      Returns:
      True if the hover effect is currently being shown, false otherwise.
    • unhover

      public void unhover()
      Description copied from interface: IHoverable
      Stop showing the hover effect.
      Specified by:
      unhover in interface IHoverable
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object