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.ItemInstances 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.Colorbackgroundprivate static java.lang.StringEMPTY_STRINGprivate booleanexpandedprotected org.eclipse.swt.graphics.Fontfontprotected org.eclipse.swt.graphics.Colorforegroundprotected inthCountprotected intheightprotected GalleryItem[]itemsChildren of this item.protected intlastIndexOfLast result of indexOf( GalleryItem).protected intmarginBottomprivate Galleryparentprivate GalleryItemparentItemprotected int[]selectionFlagsSelection bit flags.private java.lang.String[]textprivate booleanultraLazyDummyprotected intvCountprivate booleanvirtualGalleryTrue if the Gallery was created wih SWT.VIRTUALprotected intwidthSize of the group, including its title.protected intxBounds of this items in the current Gallery.protected inty
-
Constructor Summary
Constructors Modifier Constructor Description GalleryItem(GalleryItem parent, int style)GalleryItem(GalleryItem parent, int style, int index)protectedGalleryItem(GalleryItem parent, int style, int index, boolean create)GalleryItem(Gallery parent, int style)GalleryItem(Gallery parent, int style, int index)protectedGalleryItem(Gallery parent, int style, int index, boolean create)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void_addItem(GalleryItem item, int position)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 voidaddItem(GalleryItem item, int position)voidclear()Reset item values to defaults.voidclearAll()voidclearAll(boolean all)voiddeselectAll()Deselect all children of this itemvoiddispose()org.eclipse.swt.graphics.ColorgetBackground()Returns the receiver's background color.org.eclipse.swt.graphics.ColorgetBackground(boolean itemOnly)Returns the receiver's background color.org.eclipse.swt.graphics.RectanglegetBounds()Return the current bounds of the item.java.lang.StringgetDescription()Deprecated.org.eclipse.swt.graphics.FontgetFont()org.eclipse.swt.graphics.FontgetFont(boolean itemOnly)org.eclipse.swt.graphics.ColorgetForeground()Returns the receiver's foreground color.org.eclipse.swt.graphics.ColorgetForeground(boolean itemOnly)Returns the receiver's foreground color.GalleryItemgetItem(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.intgetItemCount()Returns the number of items contained in the receiver that are direct item children of the receiver.GalleryItem[]getItems()GallerygetParent()GalleryItemgetParentItem()java.lang.StringgetText()java.lang.StringgetText(int index)intindexOf(GalleryItem childItem)Returns the index of childItem within this item or -1 if childItem is not found.booleanisExpanded()Returns true if the receiver is expanded, and false otherwise.protected booleanisSelected(GalleryItem item)protected booleanisUltraLazyDummy()voidremove(int index)voidremove(GalleryItem item)protected voidremoveFromParent()protected voidselect(int from, int to)voidselectAll()Selects all of the items in the receiver.voidsetBackground(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.voidsetDescription(java.lang.String description)Deprecated.voidsetExpanded(boolean expanded)Sets the expanded state of the receiver.voidsetFont(org.eclipse.swt.graphics.Font font)voidsetForeground(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.voidsetImage(org.eclipse.swt.graphics.Image image)voidsetItemCount(int count)Only work when the table was created with SWT.VIRTUALprotected voidsetParent(Gallery parent)protected voidsetParentItem(GalleryItem parentItem)voidsetText(int index, java.lang.String string)voidsetText(java.lang.String string)protected voidsetUltraLazyDummy(boolean ultraLazyDummy)-
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
-
-
-
-
Field Detail
-
EMPTY_STRING
private static final java.lang.String EMPTY_STRING
- See Also:
- Constant Field Values
-
text
private java.lang.String[] text
-
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.
-
virtualGallery
private boolean virtualGallery
True if the Gallery was created wih SWT.VIRTUAL
-
parent
private Gallery parent
-
parentItem
private GalleryItem parentItem
-
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
-
ultraLazyDummy
private boolean ultraLazyDummy
-
expanded
private boolean expanded
-
-
Constructor Detail
-
GalleryItem
public GalleryItem(Gallery parent, int style)
-
GalleryItem
public GalleryItem(Gallery parent, int style, int index)
-
GalleryItem
public GalleryItem(GalleryItem parent, int style)
-
GalleryItem
public GalleryItem(GalleryItem parent, int style, int index)
-
GalleryItem
protected GalleryItem(GalleryItem parent, int style, int index, boolean create)
-
GalleryItem
protected GalleryItem(Gallery parent, int style, int index, boolean create)
-
-
Method Detail
-
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)
-
_addItem
private 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:
setImagein classorg.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:
disposein classorg.eclipse.swt.widgets.Widget
-
setText
public void setText(java.lang.String string)
- Overrides:
setTextin classorg.eclipse.swt.widgets.Item
-
setText
public void setText(int index, java.lang.String string)
-
getText
public java.lang.String getText()
- Overrides:
getTextin classorg.eclipse.swt.widgets.Item
-
getText
public java.lang.String getText(int index)
-
-