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 boolean
autoMargin
(package private) static int
DEFAULT_SIZE
protected static java.lang.String
EMPTY_STRING
static java.lang.String
H_COUNT
protected int
itemHeight
protected int
itemWidth
protected int
margin
protected int
minMargin
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
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.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 positionint
getItemHeight()
int
getItemWidth()
protected org.eclipse.swt.graphics.Point
getLayoutData(GalleryItem item)
int
getMinMargin()
GalleryItem
getNextItem(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.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)
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)
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:AbstractGalleryGroupRenderer
Group size informations can be retrieved from group. Clipping informations- Specified by:
draw
in classAbstractGalleryGroupRenderer
-
getItem
Description copied from class:AbstractGalleryGroupRenderer
Returns the item at coords relative to the parent group.- Specified by:
getItem
in classAbstractGalleryGroupRenderer
- Returns:
-
getSize
Description copied from class:AbstractGalleryGroupRenderer
Returns the size of a group.- Specified by:
getSize
in classAbstractGalleryGroupRenderer
- Returns:
-
layout
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
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:
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
-
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: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:
-