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 boolean
alwaysExpanded
If true, groups are always expanded and toggle button is not displayedprotected boolean
autoMargin
(package private) static int
DEFAULT_SIZE
protected static java.lang.String
EMPTY_STRING
private static int
END
static java.lang.String
H_COUNT
protected int
itemHeight
protected int
itemWidth
protected int
margin
protected int
minMargin
private static int
START
static java.lang.String
V_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 int
calculateMargins(int size, int count, int itemSize)
void
dispose()
void
draw(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 void
drawItem(org.eclipse.swt.graphics.GC gc, int index, boolean selected, GalleryItem parent, int offsetY)
Draw a child item.private GalleryItem
getFirstItem(GalleryItem group, int from)
GalleryItem
getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
Returns the item at coords relative to the parent group.protected GalleryItem
getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords, int offsetY)
Get item at pixel positionprivate GalleryItem
getItemAt(GalleryItem group, int pos, int from)
Return the child item of group which is at column 'pos' starting from direction.int
getItemHeight()
int
getItemWidth()
protected org.eclipse.swt.graphics.Point
getLayoutData(GalleryItem item)
private int
getMaxVisibleLines()
Get maximum visible lines.int
getMinMargin()
private GalleryItem
getNextGroup(GalleryItem group)
GalleryItem
getNextItem(GalleryItem item, int key)
Returns the item that should be selected when the current item is 'item' and the 'key' is pressedprivate GalleryItem
getPreviousGroup(GalleryItem group)
protected org.eclipse.swt.graphics.Point
getSize(int nbx, int nby, int itemSizeX, int itemSizeY, int minMargin, int autoMargin)
org.eclipse.swt.graphics.Rectangle
getSize(GalleryItem item)
Returns the size of a group.protected org.eclipse.swt.graphics.Rectangle
getSize(GalleryItem item, int offsetY)
protected int[]
getVisibleItems(GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight, int offset)
private GalleryItem
goDown(GalleryItem group, int posParam, int hCount)
Get the next item, when going down.private GalleryItem
goDown(GalleryItem group, int posParam, int hCount, int lineCount)
private GalleryItem
goLeft(GalleryItem group, int posParam)
private GalleryItem
goRight(GalleryItem group, int posParam)
private GalleryItem
goUp(GalleryItem group, int posParam, int hCount)
Get the next item, when going up.private GalleryItem
goUp(GalleryItem group, int posParam, int hCount, int lineCount)
protected org.eclipse.swt.graphics.Point
gridLayout(int size, int nbItems, int itemSize)
Calculate how many items are displayed horizontally and vertically.boolean
isAlwaysExpanded()
If true, groups are always expanded and toggle button is not displayedboolean
isAutoMargin()
protected boolean
isGroupExpanded(GalleryItem item)
Return item expand state (item.isExpanded()) Returns always true is alwaysExpanded is set to true.void
layout(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.boolean
mouseDown(GalleryItem group, org.eclipse.swt.events.MouseEvent e, org.eclipse.swt.graphics.Point coords)
void
preLayout(org.eclipse.swt.graphics.GC gc)
This method is called before the layout of the first item.void
setAlwaysExpanded(boolean alwaysExpanded)
If true, groups are always expanded and toggle button is not displayed if false, expand status depends on each item.void
setAutoMargin(boolean autoMargin)
void
setItemHeight(int itemHeight)
void
setItemSize(int width, int height)
void
setItemWidth(int itemWidth)
void
setMinMargin(int minMargin)
private void
updateGallery()
-
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:AbstractGalleryGroupRenderer
Group size informations can be retrieved from group. Clipping informations- Specified by:
draw
in classAbstractGalleryGroupRenderer
-
getItem
public GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
Description copied from class:AbstractGalleryGroupRenderer
Returns the item at coords relative to the parent group.- Specified by:
getItem
in classAbstractGalleryGroupRenderer
- Returns:
-
getSize
public org.eclipse.swt.graphics.Rectangle getSize(GalleryItem item)
Description copied from class:AbstractGalleryGroupRenderer
Returns the size of a group.- Specified by:
getSize
in classAbstractGalleryGroupRenderer
- Returns:
-
layout
public void layout(org.eclipse.swt.graphics.GC gc, GalleryItem group)
Description copied from class:AbstractGalleryGroupRenderer
This 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:
layout
in 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:
dispose
in 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:AbstractGalleryGroupRenderer
This 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:
preLayout
in 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:AbstractGalleryGroupRenderer
Returns the item that should be selected when the current item is 'item' and the 'key' is pressed- Specified by:
getNextItem
in 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:
-
-