Class ClassModel

java.lang.Object
lu.kbra.modelizer_next.domain.ClassModel
All Implemented Interfaces:
IdOwner, NamesOwner, StyleOwner, VisibilityOwner

public class ClassModel extends Object implements VisibilityOwner, IdOwner, StyleOwner, NamesOwner
Persistent model of a diagram class/table. It owns display names, style, visibility, and the ordered list of fields.
  • Constructor Details

    • ClassModel

      public ClassModel()
      Creates a class model instance.
  • Method Details

    • getField

      public FieldModel getField(int i, PanelType panelType)
      Returns the field.
      Parameters:
      i - zero-based index to read or update
      panelType - diagram panel type whose model or layout should be used
      Returns:
      the field
    • getFieldCount

      public int getFieldCount(PanelType panelType)
      Returns the field count.
      Parameters:
      panelType - diagram panel type whose model or layout should be used
      Returns:
      the field count
    • getFieldIndex

      public int getFieldIndex(String fieldId)
      Returns the field index.
      Parameters:
      fieldId - id of the field to look up or modify
      Returns:
      the field index
    • getFieldIndex

      public int getFieldIndex(String fieldId, PanelType panelType)
      Returns the field index.
      Parameters:
      fieldId - id of the field to look up or modify
      panelType - diagram panel type whose model or layout should be used
      Returns:
      the field index
    • getFields

      public List<FieldModel> getFields()
      Returns the fields.
      Returns:
      the fields
    • getFields

      public List<FieldModel> getFields(PanelType panelType)
      Returns the fields.
      Parameters:
      panelType - diagram panel type whose model or layout should be used
      Returns:
      the fields
    • getId

      public String getId()
      Returns the ID.
      Specified by:
      getId in interface IdOwner
      Returns:
      the ID
    • getNames

      public ElementNames getNames()
      Returns the names.
      Specified by:
      getNames in interface NamesOwner
      Returns:
      the names
    • getStyle

      public ElementStyle getStyle()
      Returns the style.
      Specified by:
      getStyle in interface StyleOwner
      Returns:
      the style
    • getVisibility

      public LayerVisibility getVisibility()
      Returns the visibility.
      Specified by:
      getVisibility in interface VisibilityOwner
      Returns:
      the visibility
    • setFields

      public void setFields(List<FieldModel> fields)
      Sets the fields.
      Parameters:
      fields - values for fields
    • setId

      public void setId(String id)
      Sets the ID.
      Specified by:
      setId in interface IdOwner
      Parameters:
      id - stable id of the model element
    • setNames

      public void setNames(ElementNames names)
      Sets the names.
      Specified by:
      setNames in interface NamesOwner
      Parameters:
      names - name values to use
    • setStyle

      public void setStyle(ElementStyle style)
      Sets the style.
      Specified by:
      setStyle in interface StyleOwner
      Parameters:
      style - style value used by the operation
    • setVisibility

      public void setVisibility(LayerVisibility visibility)
      Sets the visibility.
      Specified by:
      setVisibility in interface VisibilityOwner
      Parameters:
      visibility - visibility value used by the operation
    • toString

      public String toString()
      Builds a debug string for this class model.
      Overrides:
      toString in class Object
      Returns:
      a debug string for this object