Class AbstractGridGroupRenderer
java.lang.Object
org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
org.eclipse.nebula.widgets.gallery.AbstractGridGroupRenderer
- Direct Known Subclasses:
DefaultGalleryGroupRenderer,NoGroupRenderer
public abstract class AbstractGridGroupRenderer extends AbstractGalleryGroupRenderer
Abstract class which provides low-level support for a grid-based group. renderer.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.
-
Field Summary
Fields Modifier and Type Field Description protected booleanautoMargin(package private) static intDEFAULT_SIZEprotected static java.lang.StringEMPTY_STRINGstatic java.lang.StringH_COUNTprotected intitemHeightprotected intitemWidthprotected intmarginprotected intminMarginstatic java.lang.StringV_COUNTFields inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
expanded, gallery -
Constructor Summary
Constructors Constructor Description AbstractGridGroupRenderer() -
Method Summary
Modifier and Type Method Description protected intcalculateMargins(int size, int count, int itemSize)voiddispose()voiddraw(org.eclipse.swt.graphics.GC gc, GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight)Group size informations can be retrieved from group.protected voiddrawItem(org.eclipse.swt.graphics.GC gc, int index, boolean selected, GalleryItem parent, int offsetY)Draw a child item.GalleryItemgetItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)Returns the item at coords relative to the parent group.protected GalleryItemgetItem(GalleryItem group, org.eclipse.swt.graphics.Point coords, int offsetY)Get item at pixel positionintgetItemHeight()intgetItemWidth()protected org.eclipse.swt.graphics.PointgetLayoutData(GalleryItem item)intgetMinMargin()GalleryItemgetNextItem(GalleryItem item, int key)Returns the item that should be selected when the current item is 'item' and the 'key' is pressedprotected org.eclipse.swt.graphics.PointgetSize(int nbx, int nby, int itemSizeX, int itemSizeY, int minMargin, int autoMargin)org.eclipse.swt.graphics.RectanglegetSize(GalleryItem item)Returns the size of a group.protected org.eclipse.swt.graphics.RectanglegetSize(GalleryItem item, int offsetY)protected int[]getVisibleItems(GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight, int offset)protected org.eclipse.swt.graphics.PointgridLayout(int size, int nbItems, int itemSize)Calculate how many items are displayed horizontally and vertically.booleanisAlwaysExpanded()If true, groups are always expanded and toggle button is not displayedbooleanisAutoMargin()protected booleanisGroupExpanded(GalleryItem item)Return item expand state (item.isExpanded()) Returns always true is alwaysExpanded is set to true.voidlayout(org.eclipse.swt.graphics.GC gc, GalleryItem group)This method is called on each root item when the Gallery changes (resize, item addition or removal) in order to update the gallery size.booleanmouseDown(GalleryItem group, org.eclipse.swt.events.MouseEvent e, org.eclipse.swt.graphics.Point coords)voidpreLayout(org.eclipse.swt.graphics.GC gc)This method is called before the layout of the first item.voidsetAlwaysExpanded(boolean alwaysExpanded)If true, groups are always expanded and toggle button is not displayed if false, expand status depends on each item.voidsetAutoMargin(boolean autoMargin)voidsetItemHeight(int itemHeight)voidsetItemSize(int width, int height)voidsetItemWidth(int itemWidth)voidsetMinMargin(int minMargin)Methods inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
getBackground, getFont, getForeground, getGallery, getGroupPosition, getGroupSize, getScrollBarIncrement, isDebugMode, isExpanded, mouseDown, notifyTreeListeners, postDraw, postLayout, preDraw, setExpanded, setGallery, setGroupSize, updateScrollBarsProperties, updateStructuralValues
-
Field Details
-
DEFAULT_SIZE
static final int DEFAULT_SIZE- See Also:
- Constant Field Values
-
minMargin
protected int minMargin -
margin
protected int margin -
autoMargin
protected boolean autoMargin -
itemWidth
protected int itemWidth -
itemHeight
protected int itemHeight -
H_COUNT
public static final java.lang.String H_COUNT- See Also:
- Constant Field Values
-
V_COUNT
public static final java.lang.String V_COUNT- See Also:
- Constant Field Values
-
EMPTY_STRING
protected static final java.lang.String EMPTY_STRING- See Also:
- Constant Field Values
-
-
Constructor Details
-
AbstractGridGroupRenderer
public AbstractGridGroupRenderer()
-
-
Method Details
-
draw
public void draw(org.eclipse.swt.graphics.GC gc, GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight)Description copied from class:AbstractGalleryGroupRendererGroup size informations can be retrieved from group. Clipping informations- Specified by:
drawin classAbstractGalleryGroupRenderer
-
getItem
Description copied from class:AbstractGalleryGroupRendererReturns the item at coords relative to the parent group.- Specified by:
getItemin classAbstractGalleryGroupRenderer- Returns:
-
getSize
Description copied from class:AbstractGalleryGroupRendererReturns the size of a group.- Specified by:
getSizein classAbstractGalleryGroupRenderer- Returns:
-
layout
Description copied from class:AbstractGalleryGroupRendererThis method is called on each root item when the Gallery changes (resize, item addition or removal) in order to update the gallery size. The implementation must update the item internal size (px) using setGroupSize(item, size); before returning.- Specified by:
layoutin classAbstractGalleryGroupRenderer
-
isAlwaysExpanded
public boolean isAlwaysExpanded()If true, groups are always expanded and toggle button is not displayed- Returns:
- true if groups are always expanded
-
isGroupExpanded
Return item expand state (item.isExpanded()) Returns always true is alwaysExpanded is set to true.- Parameters:
item-- Returns:
-
setAlwaysExpanded
public void setAlwaysExpanded(boolean alwaysExpanded)If true, groups are always expanded and toggle button is not displayed if false, expand status depends on each item.- Parameters:
alwaysExpanded-
-
getMinMargin
public int getMinMargin() -
getItemWidth
public int getItemWidth() -
setItemWidth
public void setItemWidth(int itemWidth) -
getItemHeight
public int getItemHeight() -
setItemHeight
public void setItemHeight(int itemHeight) -
setItemSize
public void setItemSize(int width, int height) -
setMinMargin
public void setMinMargin(int minMargin) -
isAutoMargin
public boolean isAutoMargin() -
setAutoMargin
public void setAutoMargin(boolean autoMargin) -
calculateMargins
protected int calculateMargins(int size, int count, int itemSize) -
getSize
protected org.eclipse.swt.graphics.Point getSize(int nbx, int nby, int itemSizeX, int itemSizeY, int minMargin, int autoMargin) -
drawItem
protected void drawItem(org.eclipse.swt.graphics.GC gc, int index, boolean selected, GalleryItem parent, int offsetY)Draw a child item. Only used when useGroup is true.- Parameters:
gc-index-selected-parent-
-
getVisibleItems
protected int[] getVisibleItems(GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight, int offset) -
gridLayout
protected org.eclipse.swt.graphics.Point gridLayout(int size, int nbItems, int itemSize)Calculate how many items are displayed horizontally and vertically.- Parameters:
size-nbItems-itemSize-- Returns:
-
dispose
public void dispose()- Specified by:
disposein classAbstractGalleryGroupRenderer
-
mouseDown
public boolean mouseDown(GalleryItem group, org.eclipse.swt.events.MouseEvent e, org.eclipse.swt.graphics.Point coords) -
preLayout
public void preLayout(org.eclipse.swt.graphics.GC gc)Description copied from class:AbstractGalleryGroupRendererThis method is called before the layout of the first item. It can be used to calculate some values (like font metrics) that will be used for each item.- Overrides:
preLayoutin classAbstractGalleryGroupRenderer- See Also:
(org.eclipse.swt.graphics.GC)
-
getLayoutData
-
getSize
-
getItem
protected GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords, int offsetY)Get item at pixel position- Parameters:
coords-- Returns:
-
getNextItem
Description copied from class:AbstractGalleryGroupRendererReturns the item that should be selected when the current item is 'item' and the 'key' is pressed- Specified by:
getNextItemin classAbstractGalleryGroupRenderer- Returns:
-