Class ItemNavigatorPresentation

java.lang.Object
com.iizigo.navigator.ItemNavigatorPresentation
All Implemented Interfaces:
INavigatorPresentation

public class ItemNavigatorPresentation extends Object implements INavigatorPresentation
Class wrapping an item for viewers, so that it can be shown using the IIZI LabelProvider with a specific text and image.
Author:
Christopher Mindus
  • Constructor Details

    • ItemNavigatorPresentation

      public ItemNavigatorPresentation(String text, Image image, Object parent)
      Constructs the viewer wrapper. The description is set to the "text" parameter.
    • ItemNavigatorPresentation

      public ItemNavigatorPresentation(String text, Image image, String description, Object parent)
      Constructs the viewer wrapper.
    • ItemNavigatorPresentation

      public ItemNavigatorPresentation(StyledString styledText, Image image, Object parent)
      Constructs the viewer wrapper. The description and plain text is taken from the styledText.
    • ItemNavigatorPresentation

      public ItemNavigatorPresentation(StyledString styledText, Image image, String description, Object parent)
      Constructs the viewer wrapper.
    • ItemNavigatorPresentation

      public ItemNavigatorPresentation(String text, StyledString styledText, Image image, String description, Object parent)
      Constructs the viewer wrapper.
  • Method Details

    • setAdditionalText

      public void setAdditionalText(String text)
      Sets an additional text to display, only for normal text, not using styled text.
    • getCNParent

      public Object getCNParent(int flags)
      Gets the parent for Common Navigator.
      Specified by:
      getCNParent in interface INavigatorPresentation
      Parameters:
      flags - The flag that apply is FLAG_PACKAGE_VIEW.
      Returns:
      The parent object: IProject or DesignerProp, or null if no parent exists (property is not added to a container).
    • getCNCategory

      public int getCNCategory()
      Gets the category of this Common Navigator object, used for sorting. Subclasses can override this method, in order to get the sorting in the viewer to be done within a category.
      Specified by:
      getCNCategory in interface INavigatorPresentation
      Returns:
      This method returns 1000 integer value, i.e. "last" in sort order.
    • getCNComparator

      public IViewerComparator getCNComparator()
      Get the Comparator object to sort the children for the Common Navigator when presented visually in the tree.

      Subclasses are invited to override this method for other sorting schemes.

      Specified by:
      getCNComparator in interface INavigatorPresentation
      Returns:
      The default comparator. Subclasses can inhibit sorting by returning null.
    • hasCNChildren

      public boolean hasCNChildren(int flags)
      Returns whether the given element has children for the Common Navigator.
      Specified by:
      hasCNChildren in interface INavigatorPresentation
      Parameters:
      flags - The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.
      Returns:
      true if the node has children, and false if it has no children.
    • getCNChildren

      public Object[] getCNChildren(int flags)
      Gets the children of this container for Common Navigator.
      Specified by:
      getCNChildren in interface INavigatorPresentation
      Parameters:
      flags - The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.
      Returns:
      An array of children objects or EMPTY_ARRAY for none.
    • getCNImage

      public Image getCNImage(int flags)
      Gets the image for the Common Navigator.
      Specified by:
      getCNImage in interface INavigatorPresentation
      Parameters:
      flags - The flags for the image, see FLAG_IMAGE_*.
      Returns:
      Image or null if there is no image.
    • getCNImage

      public Image getCNImage(int columnIndex, int flags)
      Gets the image for the Common Tree Viewer showing column contents.
      Specified by:
      getCNImage in interface INavigatorPresentation
      Parameters:
      columnIndex - The zero-based index for the column (zero is never used, the method getCNImage() is called instead.
      flags - The flags for the image, see FLAG_IMAGE_*.
      Returns:
      null in this implementation.
    • getCNText

      public String getCNText(int flags)
      Gets the label text for the Common Navigator.
      Specified by:
      getCNText in interface INavigatorPresentation
      Returns:
      String or or null if there is no text.
    • getCNText

      public String getCNText(int columnIndex, int flags)
      Gets the label text for the Common Navigator.
      Specified by:
      getCNText in interface INavigatorPresentation
      Parameters:
      columnIndex - The zero-based index for the column (zero is never used, the method getCNText() is called instead.
      Returns:
      String or or null if there is no text for the given object at columnIndex.
    • getCNStyledText

      public StyledString getCNStyledText(int flags)
      Gets the label text for the Common Navigator.
      Specified by:
      getCNStyledText in interface INavigatorPresentation
      Parameters:
      flags - The flags that apply are FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT and FLAG_ADD_FILE_ITEM_PROJECT.
    • getCNDescription

      public String getCNDescription(int flags)
      Provide a description for the status bar view, if available. A default string of the form "(x) items selected" will be used if this method choose to return null.

      The empty string ("") will be respected as a valid value if returned. Return null if the extension defers to the default method of supplying status bar descriptions.

      Specified by:
      getCNDescription in interface INavigatorPresentation
      Returns:
      A description for the status bar view, or null if not available.
    • add

      public void add(Object child)
      Adds a child node.
      Parameters:
      child - The child node.