Class PropCnrEditorProperties

java.lang.Object
com.iizigo.prop.PropCnrEditorProperties

public class PropCnrEditorProperties extends Object
The definition of the properties to edit for a property component.

An instance may be read from more than one thread: its items are filled when it is created and never changed afterwards, and the list it hands out cannot be changed. Its only state that can change later is the flag for group buttons.

Building a definition never changes a property tree. A definition that holds the rows of a child container the edited property container does not have (the Styles of a component without its $styles container) says so: getAbsentParentPropertyName().

Author:
Christopher Mindus
  • Field Details

    • EMPTY

      public static final PropCnrEditorProperties EMPTY
      Instance for empty settings.
    • list

      protected final List<PropertyEditorInfo> list
      The info items in the order of the setup: an unmodifiable view, an attempt to change it throws UnsupportedOperationException.
  • Constructor Details

    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropertyEditorSetup pes, Object[] setup)
      Creates the instance of the EditProperties for a property component.
      Parameters:
      pes - The setup data for the Designer or the Plug-in.
      setup - This array contains the name of the property followed by a "required flag".
    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropertyEditorSetup pes, Object[] setup, String itemAppender)
      Creates the instance of the EditProperties for a property component.
      Parameters:
      pes - The setup data for the Designer or the Plug-in.
      setup - This array contains the name of the property followed by a "required flag".
    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropCnrEditorProperties existing, Object[] setup)
      Creates the instance of the EditProperties for a property component from an existing definition that can receive additional setup.
      Parameters:
      existing - An existing instance to add new data to.
    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropCnrEditorProperties existing, boolean useGroupButtons)
      Creates the instance of the EditProperties for a property component from an existing definition that can receive additional setup.
      Parameters:
      existing - An existing instance to add new data to.
      useGroupButtons - Flag to use group buttons or not.
    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropCnrEditorProperties existing, PropCnr parent, PropCnrEditorProperties pes)
      Create a new instance and adds the definitions from another edited property container.
    • PropCnrEditorProperties

      public PropCnrEditorProperties(PropCnrEditorProperties existing, PropCnr parent, PropCnr owner, PropCnrEditorProperties pes)
      Create a new instance and adds the definitions from another edited property container, which may be one that is in no property tree: a container made for the call, because the property container being edited has none of that name. Nothing is added to a property tree here. The rows of such a container are part of the definition all the same, and the definition says so: getAbsentParentPropertyName().
      Parameters:
      existing - An existing instance to add new data to.
      parent - The container whose definitions are added: its name is the parent property of the added rows.
      owner - The property container being edited when parent is in no property tree: it is asked in the place of parent's parent (see getPropertyEditorInfos(PropCnr,PropCnr)). Null when parent is a child of the property container being edited.
      pes - The definitions of parent.
  • Method Details

    • getOriginalSetup

      public final Object[] getOriginalSetup()
      Returns the original setup data.
      Returns:
      The original setup data, null if not present.
    • useGroupButtons

      public final boolean useGroupButtons()
      Gets the flag for group buttons.
    • setUseGroupButtons

      public final void setUseGroupButtons(boolean on)
      Sets the flag for group buttons. The definition a setup class keeps is shared by every caller: a change of its flag is seen by all of them.
    • getPropertyEditorInfos

      public List<PropertyEditorInfo> getPropertyEditorInfos(PropCnr pc)
      Gets the PropertyEditorInfo array for the property editor for a single property.
      Parameters:
      pc - The property container being edited.
      Returns:
      A new list at every call, never null: the caller may change it, this definition is not affected.
    • getPropertyEditorInfos

      public List<PropertyEditorInfo> getPropertyEditorInfos(PropCnr pc, PropCnr owner)
      Gets the PropertyEditorInfo array for a property container that is in no property tree, with the property container named that would be its parent. A definition whose rows depend on the parent of the edited container (the Styles: the component is asked for its supported styles) overrides this method and asks owner instead. This implementation asks no parent: it answers getPropertyEditorInfos(PropCnr).
      Parameters:
      pc - The property container being edited, in no property tree.
      owner - The property container that would be its parent.
      Returns:
      A new list at every call, never null: the caller may change it, this definition is not affected.
    • getAbsentParentPropertyName

      public final String getAbsentParentPropertyName()
      Gets the name of the parent property whose container the edited property container did not have when this definition was built, e.g. "$styles" for a component without its Styles container. The rows of that container are in this definition, built from a container that is in no property tree, and getPropertyEditorInfos(PropCnr) keeps them while the edited property container has no such container. They can only be edited once the container is there: the property view creates it before it shows the rows.
      Returns:
      The name of the parent property, null when no container was absent.
    • getAllPropertyEditorInfos

      public final List<PropertyEditorInfo> getAllPropertyEditorInfos()
      Gets all the PropertyEditorInfo items of this definition, in the order of the setup: every row, the property name ("$") and the rows with a parent property included, whatever property container is edited. getPropertyEditorInfos(PropCnr) is the list for one container.
      Returns:
      An unmodifiable view of the items, never null; empty for EMPTY.
    • getPropertyEditorInfo

      public final PropertyEditorInfo getPropertyEditorInfo(Atom atom)
      Gets a PropertyEditorInfo from a property Atom.
      Parameters:
      atom - The atom.
      Returns:
      An instance of PropertyEditorInfo if the atom is found, null otherwise.
    • getEmptySettingsMessage

      public String getEmptySettingsMessage(PropCnr property)
      When the group is not editable, this message is shown.
    • getEmptySettingsImage

      public Image getEmptySettingsImage(PropCnr property)
      When the group is not editable, this image is shown.
      Returns:
      null for none.