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 Details

    • source

      public final javafx.beans.property.ObjectProperty<UUID> source
      Property pointing to the source vertex id
    • target

      public final javafx.beans.property.ObjectProperty<UUID> 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 edge
      source - the syntactic element where the edge originates from
      target - the syntactic element where the edge targets
    • ViewModelEdge

      public ViewModelEdge(UUID uuid, ModelEdge edge)
      Constructs a new view model edge instance based on a model edge instance
      Parameters:
      uuid - The id of the edge
      edge - the model edge to convert
    • ViewModelEdge

      public ViewModelEdge(UUID uuid, UUID source, UUID target)
      Constructs a new view model edge instance
      Parameters:
      uuid - The id of the edge
      source - the syntactic element where the edge originates from
      target - the syntactic element where the edge targets
  • Method Details

    • toModel

      public ModelEdge toModel()
      Constructs a new model edge instance based on the current view model values
      Returns:
      a new model edge instance
    • source

      public javafx.beans.property.ObjectProperty<UUID> source()
      Get the source property
      Returns:
      the source UUID property
    • target

      public javafx.beans.property.ObjectProperty<UUID> target()
      Get the target property
      Returns:
      the target UUID property
    • id

      public UUID id()
      Get the id of the edge
      Returns:
      the unique identifier of the edge
    • isTargetValid

      public boolean isTargetValid(UUID target, ViewModelGraph graph)
      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 target
      graph - 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

      public boolean isSourceValid(UUID source, ViewModelGraph graph)
      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 source
      graph - 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: 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<ViewModelEdge>
    • getValue

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

      public void hover(javafx.scene.Node hoverDisplay)
      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:
      hoverDisplay - The javafx node to show in the hover window.
    • unhover

      public void unhover()
      Description copied from interface: IHoverable
      Stop showing the hover effect.
      Specified by:
      unhover in interface IHoverable
    • 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.
    • 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.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object