Class GalleryItem

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
org.eclipse.nebula.widgets.gallery.GalleryItem

public class GalleryItem
extends org.eclipse.swt.widgets.Item

Instances of this class represent a selectable user interface object that represents an item in a gallery.

NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.

See Also:
Gallery
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected org.eclipse.swt.graphics.Color background  
    protected org.eclipse.swt.graphics.Font font  
    protected org.eclipse.swt.graphics.Color foreground  
    protected int hCount  
    protected int height  
    protected GalleryItem[] items
    Children of this item.
    protected int lastIndexOf
    Last result of indexOf( GalleryItem).
    protected int marginBottom  
    protected int[] selectionFlags
    Selection bit flags.
    protected int vCount  
    protected int width
    Size of the group, including its title.
    protected int x
    Bounds of this items in the current Gallery.
    protected int y  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
      GalleryItem​(GalleryItem parent, int style)  
      GalleryItem​(GalleryItem parent, int style, int index)  
    protected GalleryItem​(GalleryItem parent, int style, int index, boolean create)  
      GalleryItem​(Gallery parent, int style)  
      GalleryItem​(Gallery parent, int style, int index)  
    protected GalleryItem​(Gallery parent, int style, int index, boolean create)  
  • Method Summary

    Modifier and Type Method Description
    protected void _addSelection​(GalleryItem item)  
    protected void _deselectAll()  
    protected void _dispose()
    Disposes the gallery Item.
    protected void _disposeChildren()  
    protected void _selectAll()  
    void _setExpanded​(boolean expanded, boolean redraw)  
    protected void addItem​(GalleryItem item, int position)  
    void clear()
    Reset item values to defaults.
    void clearAll()  
    void clearAll​(boolean all)  
    void deselectAll()
    Deselect all children of this item
    void dispose()  
    org.eclipse.swt.graphics.Color getBackground()
    Returns the receiver's background color.
    org.eclipse.swt.graphics.Color getBackground​(boolean itemOnly)
    Returns the receiver's background color.
    org.eclipse.swt.graphics.Rectangle getBounds()
    Return the current bounds of the item.
    java.lang.String getDescription()
    Deprecated. 
    org.eclipse.swt.graphics.Font getFont()  
    org.eclipse.swt.graphics.Font getFont​(boolean itemOnly)  
    org.eclipse.swt.graphics.Color getForeground()
    Returns the receiver's foreground color.
    org.eclipse.swt.graphics.Color getForeground​(boolean itemOnly)
    Returns the receiver's foreground color.
    GalleryItem getItem​(int index)
    Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.
    int getItemCount()
    Returns the number of items contained in the receiver that are direct item children of the receiver.
    GalleryItem[] getItems()  
    Gallery getParent()  
    GalleryItem getParentItem()  
    java.lang.String getText()  
    java.lang.String getText​(int index)  
    int indexOf​(GalleryItem childItem)
    Returns the index of childItem within this item or -1 if childItem is not found.
    boolean isExpanded()
    Returns true if the receiver is expanded, and false otherwise.
    protected boolean isSelected​(GalleryItem item)  
    protected boolean isUltraLazyDummy()  
    void remove​(int index)  
    void remove​(GalleryItem item)  
    protected void removeFromParent()  
    protected void select​(int from, int to)  
    void selectAll()
    Selects all of the items in the receiver.
    void setBackground​(org.eclipse.swt.graphics.Color background)
    Sets the receiver's background color to the color specified by the argument, or to the default system color for the item if the argument is null.
    void setDescription​(java.lang.String description)
    Deprecated. 
    void setExpanded​(boolean expanded)
    Sets the expanded state of the receiver.
    void setFont​(org.eclipse.swt.graphics.Font font)  
    void setForeground​(org.eclipse.swt.graphics.Color foreground)
    Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the item if the argument is null.
    void setImage​(org.eclipse.swt.graphics.Image image)  
    void setItemCount​(int count)
    Only work when the table was created with SWT.VIRTUAL
    protected void setParent​(Gallery parent)  
    protected void setParentItem​(GalleryItem parentItem)  
    void setText​(int index, java.lang.String string)  
    void setText​(java.lang.String string)  
    protected void setUltraLazyDummy​(boolean ultraLazyDummy)  

    Methods inherited from class org.eclipse.swt.widgets.Item

    checkSubclass, getImage

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • items

      protected GalleryItem[] items
      Children of this item. Only used when groups are enabled.
    • x

      protected int x
      Bounds of this items in the current Gallery. X and Y values are used for vertical or horizontal offset depending on the Gallery settings. Only used when groups are enabled. Width and height
    • y

      protected int y
    • width

      protected int width
      Size of the group, including its title.
    • height

      protected int height
    • marginBottom

      protected int marginBottom
    • hCount

      protected int hCount
    • vCount

      protected int vCount
    • lastIndexOf

      protected int lastIndexOf
      Last result of indexOf( GalleryItem). Used for optimisation.
    • selectionFlags

      protected int[] selectionFlags
      Selection bit flags. Each 'int' contains flags for 32 items.
    • font

      protected org.eclipse.swt.graphics.Font font
    • foreground

      protected org.eclipse.swt.graphics.Color foreground
    • background

      protected org.eclipse.swt.graphics.Color background
  • Constructor Details

  • Method Details

    • isUltraLazyDummy

      protected boolean isUltraLazyDummy()
    • setUltraLazyDummy

      protected void setUltraLazyDummy​(boolean ultraLazyDummy)
    • getParent

      public Gallery getParent()
    • setParent

      protected void setParent​(Gallery parent)
    • getParentItem

      public GalleryItem getParentItem()
    • setParentItem

      protected void setParentItem​(GalleryItem parentItem)
    • addItem

      protected void addItem​(GalleryItem item, int position)
    • getItemCount

      public int getItemCount()
      Returns the number of items contained in the receiver that are direct item children of the receiver.
      Returns:
    • setItemCount

      public void setItemCount​(int count)
      Only work when the table was created with SWT.VIRTUAL
      Parameters:
      itemCount -
    • getItem

      public GalleryItem getItem​(int index)
      Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.
      If SWT.VIRTUAL is used and the item has not been used yet, the item is created and a SWT.SetData event is fired.
      Parameters:
      index - : index of the item.
      Returns:
      : the GalleryItem or null if index is out of bounds
    • getItems

      public GalleryItem[] getItems()
    • indexOf

      public int indexOf​(GalleryItem childItem)
      Returns the index of childItem within this item or -1 if childItem is not found. The search is only one level deep.
      Parameters:
      childItem -
      Returns:
    • setImage

      public void setImage​(org.eclipse.swt.graphics.Image image)
      Overrides:
      setImage in class org.eclipse.swt.widgets.Item
    • isExpanded

      public boolean isExpanded()
      Returns true if the receiver is expanded, and false otherwise.
      Returns:
    • setExpanded

      public void setExpanded​(boolean expanded)
      Sets the expanded state of the receiver.
      Parameters:
      expanded -
    • _setExpanded

      public void _setExpanded​(boolean expanded, boolean redraw)
    • getDescription

      public java.lang.String getDescription()
      Deprecated.
      Returns:
    • setDescription

      public void setDescription​(java.lang.String description)
      Deprecated.
      Parameters:
      description -
    • deselectAll

      public void deselectAll()
      Deselect all children of this item
    • _deselectAll

      protected void _deselectAll()
    • _addSelection

      protected void _addSelection​(GalleryItem item)
    • isSelected

      protected boolean isSelected​(GalleryItem item)
    • select

      protected void select​(int from, int to)
    • getBounds

      public org.eclipse.swt.graphics.Rectangle getBounds()
      Return the current bounds of the item. This method may return negative values if it is not visible.
      Returns:
    • getFont

      public org.eclipse.swt.graphics.Font getFont()
    • getFont

      public org.eclipse.swt.graphics.Font getFont​(boolean itemOnly)
    • setFont

      public void setFont​(org.eclipse.swt.graphics.Font font)
    • getForeground

      public org.eclipse.swt.graphics.Color getForeground()
      Returns the receiver's foreground color.
      Returns:
      The foreground color
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getForeground

      public org.eclipse.swt.graphics.Color getForeground​(boolean itemOnly)
      Returns the receiver's foreground color.
      Parameters:
      itemOnly - If TRUE, does not try to use renderer or parent widget to guess the real foreground color. Note : FALSE is the default behavior.
      Returns:
      The foreground color
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setForeground

      public void setForeground​(org.eclipse.swt.graphics.Color foreground)
      Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the item if the argument is null.
      Parameters:
      color - The new color (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getBackground

      public org.eclipse.swt.graphics.Color getBackground()
      Returns the receiver's background color.
      Returns:
      The background color
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getBackground

      public org.eclipse.swt.graphics.Color getBackground​(boolean itemOnly)
      Returns the receiver's background color.
      Parameters:
      itemOnly - If TRUE, does not try to use renderer or parent widget to guess the real background color. Note : FALSE is the default behavior.
      Returns:
      The background color
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setBackground

      public void setBackground​(org.eclipse.swt.graphics.Color background)
      Sets the receiver's background color to the color specified by the argument, or to the default system color for the item if the argument is null.
      Parameters:
      color - The new color (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • clear

      public void clear()
      Reset item values to defaults.
    • clearAll

      public void clearAll()
    • clearAll

      public void clearAll​(boolean all)
    • selectAll

      public void selectAll()
      Selects all of the items in the receiver.
    • _selectAll

      protected void _selectAll()
    • remove

      public void remove​(int index)
    • remove

      public void remove​(GalleryItem item)
    • _dispose

      protected void _dispose()
      Disposes the gallery Item. This method is call directly by gallery and should not be used by a client
    • _disposeChildren

      protected void _disposeChildren()
    • removeFromParent

      protected void removeFromParent()
    • dispose

      public void dispose()
      Overrides:
      dispose in class org.eclipse.swt.widgets.Widget
    • setText

      public void setText​(java.lang.String string)
      Overrides:
      setText in class org.eclipse.swt.widgets.Item
    • setText

      public void setText​(int index, java.lang.String string)
    • getText

      public java.lang.String getText()
      Overrides:
      getText in class org.eclipse.swt.widgets.Item
    • getText

      public java.lang.String getText​(int index)