Class EditorStyles

All Implemented Interfaces:
IExtendsSelection, IPropDesigner, IPropUndoContext, ITransferContainerProps, EventListener, IFontConsumer, IGProp<GProp<?>[]>, IPropCnr, Cloneable, IAdaptable

public class EditorStyles extends Styles implements IPropDesigner, IPropUndoContext, IExtendsSelection, ITransferContainerProps
This Styles property container for the Editor.
  • Field Details

    • PREDEFINED_NAME_DESCR

      public static String[] PREDEFINED_NAME_DESCR
      Predefined class names.

      The entries are stored in pairs of strings. The first string is the name of the style without the '*' where null indicates it's a group. The second string is the description.

  • Constructor Details

    • EditorStyles

      public EditorStyles()
      Creates the screen identification property container without a name. The name must be set in all cases using the setPropertyAtom call.
    • EditorStyles

      public EditorStyles(Atom propertyAtom)
      Creates the screen identification property container with the specified name. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - the name of the component, unique within its parent.
  • Method Details

    • getDesigner

      public StylesDesignerProp getDesigner()
      Gets the Designer Extension for Properties.
      Specified by:
      getDesigner in interface IPropDesigner
      Returns:
      The instance of the Designer Extension.
    • getUndoContext

      public IUndoContext getUndoContext()
      Gets the undo context.
      Specified by:
      getUndoContext in interface IPropUndoContext
      Returns:
      The undo context for the Editor part(s) for this container.
    • clone

      Clone must be overridden.
      Overrides:
      clone in class PropCnr
      Throws:
      CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
    • isPropSaveRelevant

      protected boolean isPropSaveRelevant()
      Checks if a change to this Styles container marks the file it is saved in as changed.

      An EMPTY Styles container that extends nothing is not save-relevant: it holds no style, so it is not a change of the file, whether it is there or not. The Designer makes such a container by itself: the $styles of a component whose class does not predefine it is created when the property view shows the component (computing a property sheet creates nothing; the view needs the container for the rows of its Styles group) - after the copy of the file was taken that the dirty check compares with. Without this rule a panel in which a component was only selected compared as changed.

      A real change still counts: the save comparison (PropCnr.equalsTree) takes a property that is save-relevant on EITHER side, so the first style added (this side holds one) and the last style removed (the loaded side holds one) both mark the file changed, and so does an extends set or cleared. A state styles container is always save-relevant: the user adds it ("Add state style"), empty at first, and that is a change of the file.

      The save does not ask this method: an empty container is written as before when the file is saved for another reason.

      Overrides:
      isPropSaveRelevant in class GProp<GProp<?>[]>
      Returns:
      true if a change to this container alone marks its file changed.
    • getExtendsPossibleClasses

      public Class<?>[] getExtendsPossibleClasses()
      Gets the possible classes this container supports for the Extends Framework. The default implementation is to return null.
      Specified by:
      getExtendsPossibleClasses in interface IPropCnr
      Overrides:
      getExtendsPossibleClasses in class Styles
      Returns:
      List of supported classes, or null for none.
    • getSelectPropDialogTitle

      public String getSelectPropDialogTitle()
      Gets the title for selection dialog.
      Specified by:
      getSelectPropDialogTitle in interface IExtendsSelection
    • getSelectPropViewerFilter

      public ViewerFilter getSelectPropViewerFilter()
      Gets the viewer filter for the tree in the dialog for selecting extends property name.
      Specified by:
      getSelectPropViewerFilter in interface IExtendsSelection
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property container. The check performed is the extension of classes and that no circular reference is present.
      Specified by:
      verify in interface IGProp<GProp<?>[]>
      Overrides:
      verify in class PropCnr
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.
    • getStyles

      public ArrayList<CSSStyle> getStyles(boolean includeUndefined)
      Gets the styles as a list of CSS styles.
      Parameters:
      includeUndefined - Flag to include undefined styles.
      Returns:
      Array of styles.
    • onPropInvalidateCache

      protected void onPropInvalidateCache()
      Invalidates a potential cache in this property. This method is called during a synchronized state of the property. Subclasses override this method to provide a robust caching mechanism.
      Overrides:
      onPropInvalidateCache in class GProp<GProp<?>[]>
    • getFontInfo

      public FontInfo getFontInfo()
      Returns the font information for this styles instance.
      Returns:
      The cached font information.
    • getCNDescriptionType

      public String getCNDescriptionType()
      Provide a type description for the status bar view, if available.
      Specified by:
      getCNDescriptionType in interface ITransferContainerProps
      Returns:
      A type description for the status bar view, or null if not available.
    • getTransferProps

      public Object[] getTransferProps()
      Returns the list of properties that are transferable between layout managers.
      Specified by:
      getTransferProps in interface ITransferContainerProps
      Returns:
      The list of String's or Atom's that are transferable, null for none.
    • getMainStyles

      public EditorStyles getMainStyles()
      Returns the main (parent) styles.
      Overrides:
      getMainStyles in class Styles
      Returns:
      The main styles instance. This is the same instance in case it's not a state-styles instance.