Record Class SelectedElement

java.lang.Object
java.lang.Record
lu.kbra.modelizer_next.ui.canvas.datastruct.SelectedElement
Record Components:
type - type value that selects the operation mode
classId - id of the class to look up or modify
fieldId - id of the field to look up or modify
commentId - id of the comment to look up or modify
linkId - id of the link to look up or modify

public record SelectedElement(SelectedElement.SelectedType type, String classId, String fieldId, String commentId, String linkId) extends Record
Identifier of the currently selected model element and its kind.
  • Constructor Details

    • SelectedElement

      public SelectedElement(SelectedElement.SelectedType type, String classId, String fieldId, String commentId, String linkId)
      Creates an instance of a SelectedElement record class.
      Parameters:
      type - the value for the type record component
      classId - the value for the classId record component
      fieldId - the value for the fieldId record component
      commentId - the value for the commentId record component
      linkId - the value for the linkId record component
  • Method Details

    • forClass

      public static SelectedElement forClass(String classId)
      Creates the default style for class elements.
      Parameters:
      classId - id of the class to look up or modify
      Returns:
      the for class result
    • forField

      public static SelectedElement forField(String classId, String fieldId)
      Creates the default style for field elements.
      Parameters:
      classId - id of the class to look up or modify
      fieldId - id of the field to look up or modify
      Returns:
      the for field result
    • forComment

      public static SelectedElement forComment(String commentId)
      Creates the default style for comment elements.
      Parameters:
      commentId - id of the comment to look up or modify
      Returns:
      the for comment result
    • forLink

      public static SelectedElement forLink(String linkId)
      Creates the default style for link elements.
      Parameters:
      linkId - id of the link to look up or modify
      Returns:
      the for link result
    • getActualId

      public String getActualId()
      Returns the actual ID on the active canvas.
      Returns:
      the actual ID
    • hashCode

      public final int hashCode()
      Computes the hash code that matches this object's equality rules on the active canvas.
      Specified by:
      hashCode in class Record
      Returns:
      the hash code for this object
    • asLiveEditElement

      public LiveEditElement asLiveEditElement(boolean alternative)
      Converts this selected element into a live edit element.
      Parameters:
      alternative - whether alternative is enabled
      Returns:
      the as live edit element result
    • asLiveEditElement

      public LiveEditElement asLiveEditElement(boolean alternative, boolean style)
      Converts this selected element into a live edit element.
      Parameters:
      alternative - whether alternative is enabled
      style - whether style is enabled
      Returns:
      the as live edit element result
    • asStyleEditElement

      public LiveEditElement asStyleEditElement(boolean alternative, Object currentStyle)
      Converts this selected element into a style edit target.
      Parameters:
      alternative - whether alternative is enabled
      currentStyle - current style value used by the operation
      Returns:
      the as style edit element result
    • equals

      public final boolean equals(Object other)
      Compares this selected element with another object for value equality on the active canvas.
      Specified by:
      equals in class Record
      Parameters:
      other - other value used by the operation
      Returns:
      true when the condition is met; otherwise false
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • type

      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • classId

      public String classId()
      Returns the value of the classId record component.
      Returns:
      the value of the classId record component
    • fieldId

      public String fieldId()
      Returns the value of the fieldId record component.
      Returns:
      the value of the fieldId record component
    • commentId

      public String commentId()
      Returns the value of the commentId record component.
      Returns:
      the value of the commentId record component
    • linkId

      public String linkId()
      Returns the value of the linkId record component.
      Returns:
      the value of the linkId record component