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 private booleanalwaysExpandedIf true, groups are always expanded and toggle button is not displayedprotected booleanautoMargin(package private) static intDEFAULT_SIZEprotected static java.lang.StringEMPTY_STRINGprivate static intENDstatic java.lang.StringH_COUNTprotected intitemHeightprotected intitemWidthprotected intmarginprotected intminMarginprivate static intSTARTstatic java.lang.StringV_COUNT-
Fields inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
expanded, gallery
-
-
Constructor Summary
Constructors Constructor Description AbstractGridGroupRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods 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.private GalleryItemgetFirstItem(GalleryItem group, int from)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 positionprivate GalleryItemgetItemAt(GalleryItem group, int pos, int from)Return the child item of group which is at column 'pos' starting from direction.intgetItemHeight()intgetItemWidth()protected org.eclipse.swt.graphics.PointgetLayoutData(GalleryItem item)private intgetMaxVisibleLines()Get maximum visible lines.intgetMinMargin()private GalleryItemgetNextGroup(GalleryItem group)GalleryItemgetNextItem(GalleryItem item, int key)Returns the item that should be selected when the current item is 'item' and the 'key' is pressedprivate GalleryItemgetPreviousGroup(GalleryItem group)protected 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)private GalleryItemgoDown(GalleryItem group, int posParam, int hCount)Get the next item, when going down.private GalleryItemgoDown(GalleryItem group, int posParam, int hCount, int lineCount)private GalleryItemgoLeft(GalleryItem group, int posParam)private GalleryItemgoRight(GalleryItem group, int posParam)private GalleryItemgoUp(GalleryItem group, int posParam, int hCount)Get the next item, when going up.private GalleryItemgoUp(GalleryItem group, int posParam, int hCount, int lineCount)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)private voidupdateGallery()-
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 Detail
-
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
-
END
private static final int END
- See Also:
- Constant Field Values
-
START
private static final int START
- See Also:
- Constant Field Values
-
alwaysExpanded
private boolean alwaysExpanded
If true, groups are always expanded and toggle button is not displayed
-
-
Method Detail
-
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
public GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
Description copied from class:AbstractGalleryGroupRendererReturns the item at coords relative to the parent group.- Specified by:
getItemin classAbstractGalleryGroupRenderer- Returns:
-
getSize
public org.eclipse.swt.graphics.Rectangle getSize(GalleryItem item)
Description copied from class:AbstractGalleryGroupRendererReturns the size of a group.- Specified by:
getSizein classAbstractGalleryGroupRenderer- Returns:
-
layout
public void layout(org.eclipse.swt.graphics.GC gc, GalleryItem group)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
protected boolean isGroupExpanded(GalleryItem item)
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)
-
updateGallery
private void updateGallery()
-
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
protected org.eclipse.swt.graphics.Point getLayoutData(GalleryItem item)
-
getSize
protected org.eclipse.swt.graphics.Rectangle getSize(GalleryItem item, int offsetY)
-
getItem
protected GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords, int offsetY)
Get item at pixel position- Parameters:
coords-- Returns:
-
goLeft
private GalleryItem goLeft(GalleryItem group, int posParam)
-
goRight
private GalleryItem goRight(GalleryItem group, int posParam)
-
goUp
private GalleryItem goUp(GalleryItem group, int posParam, int hCount, int lineCount)
-
goDown
private GalleryItem goDown(GalleryItem group, int posParam, int hCount, int lineCount)
-
goUp
private GalleryItem goUp(GalleryItem group, int posParam, int hCount)
Get the next item, when going up.- Parameters:
group- current groupposParam- index of currently selected itemhCount- size of a line- Returns:
-
goDown
private GalleryItem goDown(GalleryItem group, int posParam, int hCount)
Get the next item, when going down.- Parameters:
group- current groupposParam- index of currently selected itemhCount- size of a line- Returns:
-
getMaxVisibleLines
private int getMaxVisibleLines()
Get maximum visible lines.- Returns:
-
getNextItem
public GalleryItem getNextItem(GalleryItem item, int key)
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:
-
getPreviousGroup
private GalleryItem getPreviousGroup(GalleryItem group)
-
getNextGroup
private GalleryItem getNextGroup(GalleryItem group)
-
getFirstItem
private GalleryItem getFirstItem(GalleryItem group, int from)
-
getItemAt
private GalleryItem getItemAt(GalleryItem group, int pos, int from)
Return the child item of group which is at column 'pos' starting from direction. If this item doesn't exists, returns the nearest item.- Parameters:
group-pos-from- START or END- Returns:
-
-