Class PropertyEditor

All Implemented Interfaces:
IThemeListener, IFilterListener, Drawable, IPersistable, IPersistableEditor

public class PropertyEditor extends Composite implements IFilterListener, IPersistableEditor, IThemeListener
The Property Editor implemented as an SWT composite.
Author:
Christopher Mindus
  • Constructor Details

    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes, boolean useFilter)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
      useFilter - Use the filtering mechanism/control.
    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes, boolean useFilter, IMemento propsMemento)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
      useFilter - Use the filtering mechanism/control.
      propsMemento - A memento for initialization or null for none.
    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, IMemento propsMemento)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
      pes - The property editor setup.
      useFilter - Use the filtering mechanism/control.
      enableGroups - Enable groups flag.
      propsMemento - A memento for initialization or null for none.
    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, IMemento propsMemento, int style)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
      pes - The property editor setup.
      useFilter - Use the filtering mechanism/control.
      enableGroups - Enable groups flag.
      propsMemento - A memento for initialization or null for none.
      style - Style of the container.
    • PropertyEditor

      public PropertyEditor(IPropertyEditorController controller, Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, IMemento propsMemento, int style, int scrollStyle)
      Creates the properties composite.
      Parameters:
      controller - The property controller.
      parent - The parent composite.
      pes - The property editor setup.
      useFilter - Use the filtering mechanism/control.
      enableGroups - Flag to enable groups.
      propsMemento - A memento for initialization or null for none.
      style - Style of the container.
      scrollStyle - Style for the scrolled container: SWT.H_SCROLL|SWT.V_SCROLL by default, set to SWT.NONE for no scrollbars.
  • Method Details

    • onFilter

      public void onFilter(String text)
      Called when a filter text has been applied.
      Specified by:
      onFilter in interface IFilterListener
      Parameters:
      text - The filter text to apply, null for none (never empty string).
    • redrawProperties

      public void redrawProperties()
      Causes redraw of properties after collapse/expand/filter/multi-edit.
    • onThemeChanged

      public final void onThemeChanged(ApplicationUI appUI)
      Called once the new theme has stabilized after a period of time.
      Specified by:
      onThemeChanged in interface IThemeListener
      Parameters:
      appUI - The new ApplicationUI instance.
    • setTitle

      public void setTitle(Image image, String title)
      Sets the image and title for the property editor, default is "Properties".
      Parameters:
      image - The image to use or null for none.
      title - The title to use or null for none.
    • setFixedTooltips

      public void setFixedTooltips()
      Enables fixed tooltips that are not removed.
    • getHeaderContextMenu

      public IzMenu getHeaderContextMenu()
      Gets the context menu for the headerBackground.
    • restoreState

      public void restoreState(IMemento memento)
      Called with a memento for this editor. The editor can parse the data or save the memento. This method may not be called.
      Specified by:
      restoreState in interface IPersistableEditor
      Parameters:
      memento - the saved state for this editor. May be null.
    • saveState

      public void saveState(IMemento memento)
      Saves the state of the object in the given memento.
      Specified by:
      saveState in interface IPersistable
      Parameters:
      memento - The storage area for object's state.
    • getEditedProperties

      public PropCnr[] getEditedProperties()
      Gets the edited property containers.
      Returns:
      The edited properties if previously edited and displayed, null otherwise.
    • getController

      public IPropertyEditorController getController()
      Gets the controller.
    • setViewerEditedProperties

      public PropCnr[] setViewerEditedProperties(TreeViewer viewer)
      Sets the edited properties from a viewer. The selection must be inside the editor owning this property editor. This method selects all properties really selected in the tree for editing, as opposed to Activator.getSelected... that strips children.
    • setEditedProperties

      public void setEditedProperties(PropCnr[] pcs)
      Sets a new content to the editor. If no component is visible, nothing is done under Windows until later when visibility is back and a new call to this method is done.
      Parameters:
      pcs - The edited properties.
    • setEditedPropertiesForPopupWindows

      public void setEditedPropertiesForPopupWindows(PropCnr[] pcs)
      Sets a new content to the editor for dialog boxes and preference pages, regardless of component visibility under Windows.
      Parameters:
      pcs - The edited properties.
    • setEditedProperties

      public void setEditedProperties(PropCnr pc, ArrayList<PropertyEditorInfo> infos)
      Sets a new content to the editor.
    • addFocusInfo

      public void addFocusInfo(Control c)
      Adds focus info at creation time of controls in the edited part.
      Parameters:
      c - Control to get focus.
    • setFocus

      public boolean setFocus(GProp<?> property, int index, String childName)
      Attempts to set focus to a property currently being edited.
      Parameters:
      property - The property to focus.
      index - Index in multi-property, -1 for none.
      childName - Name of a child property when it doesn't exist in the parent.
      Returns:
      true For success, false for failure.
    • setFocus

      public boolean setFocus(String name)
      Attempts to set focus to a property item with a specific atom.
      Parameters:
      name - Name of property to focus.
      Returns:
      true For success, false for failure.
    • setFocus

      public boolean setFocus(String name, int index)
      Attempts to set focus to a property item with a specific atom.
      Parameters:
      name - Name of property to focus.
      index - Index in multi-property, -1 for none.
      Returns:
      true For success, false for failure.
    • setFocus

      public boolean setFocus(Atom atom)
      Attempts to set focus to a property item with a specific atom.
      Parameters:
      atom - The property atom to focus, null for name.
      Returns:
      true For success, false for failure.
    • setFocus

      public boolean setFocus(Atom atom, int index)
      Attempts to set focus to a property item with a specific atom.
      Parameters:
      atom - The property atom to focus, null for name.
      index - Index in multi-property, -1 for none.
      Returns:
      true For success, false for failure.
    • verifySeverity

      public void verifySeverity()
      Scans the edited property containers for max error level and assigns it to the properties icon. This method scans the edited nodes and not the property errors in order to reflect the same state as the edited properties.
    • getFocusedBaseEditor

      public BaseEditor<?,?> getFocusedBaseEditor()
      Finds the base editor that has focus.
      Returns:
      The BaseEditor having focus, null for none.
    • getKStringInfoProviderAdapter

      public KStringInfoProviderAdapter getKStringInfoProviderAdapter()
      Gets or creates the KStringInfoProviderAdapter used to resolve KString's and others containing KString's (e.g. tooltips, badge).

      This method expects to be called from the SWT thread.

      Returns:
      The KStringInfoProviderAdapter instance.