Class AbstractGalleryGroupRenderer
- java.lang.Object
-
- org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
-
- Direct Known Subclasses:
AbstractGridGroupRenderer
public abstract class AbstractGalleryGroupRenderer extends java.lang.ObjectBase class used to implement a custom gallery group renderer.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.
-
-
Constructor Summary
Constructors Constructor Description AbstractGalleryGroupRenderer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voiddispose()abstract 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 org.eclipse.swt.graphics.ColorgetBackground(GalleryItem item)Returns item background color.protected org.eclipse.swt.graphics.FontgetFont(GalleryItem item)Returns item font.protected org.eclipse.swt.graphics.ColorgetForeground(GalleryItem item)Returns item foreground color.GallerygetGallery()protected org.eclipse.swt.graphics.PointgetGroupPosition(GalleryItem item)protected org.eclipse.swt.graphics.PointgetGroupSize(GalleryItem item)abstract GalleryItemgetItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)Returns the item at coords relative to the parent group.abstract GalleryItemgetNextItem(GalleryItem item, int key)Returns the item that should be selected when the current item is 'item' and the 'key' is pressedintgetScrollBarIncrement()Returns the preferred Scrollbar increment for the current gallery layout.abstract org.eclipse.swt.graphics.RectanglegetSize(GalleryItem item)Returns the size of a group.protected booleanisDebugMode()This method can be used as a condition to print trace or debug informations in standard output.booleanisExpanded()Get the expand/collapse state of the current groupabstract 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.abstract booleanmouseDown(GalleryItem group, org.eclipse.swt.widgets.Event e, org.eclipse.swt.graphics.Point coords)This method can be implemented to handle mouse down events at the group level.protected voidnotifyTreeListeners(GalleryItem group)Notifies the Gallery that the control expanded/collapsed state has changed.voidpostDraw(org.eclipse.swt.graphics.GC gc)This method is called after drawing the last item.voidpostLayout(org.eclipse.swt.graphics.GC gc)This method is called after the layout of the last item.voidpreDraw(org.eclipse.swt.graphics.GC gc)This method is called before drawing the first item.voidpreLayout(org.eclipse.swt.graphics.GC gc)This method is called before the layout of the first item.voidsetExpanded(boolean selected)voidsetGallery(Gallery gallery)protected voidsetGroupSize(GalleryItem item, org.eclipse.swt.graphics.Point size)protected voidupdateScrollBarsProperties()protected voidupdateStructuralValues(boolean keeplocation)Forces an update of the gallery layout.
-
-
-
Field Detail
-
gallery
protected Gallery gallery
-
expanded
protected boolean expanded
-
-
Method Detail
-
isExpanded
public boolean isExpanded()
Get the expand/collapse state of the current group- Returns:
- true is the current group is expanded
-
setExpanded
public void setExpanded(boolean selected)
- Parameters:
selected-- See Also:
isExpanded()
-
preDraw
public void preDraw(org.eclipse.swt.graphics.GC gc)
This method is called before drawing the first item. It can be used to calculate some values (like font metrics) that will be used for each item.- Parameters:
gc-
-
postDraw
public void postDraw(org.eclipse.swt.graphics.GC gc)
This method is called after drawing the last item. It may be used to cleanup and release resources created in preDraw().- Parameters:
gc-
-
draw
public abstract 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. Clipping informations- Parameters:
gc-group-x-y-
-
dispose
public abstract void dispose()
-
getNextItem
public abstract GalleryItem getNextItem(GalleryItem item, int key)
Returns the item that should be selected when the current item is 'item' and the 'key' is pressed- Parameters:
item-key-- Returns:
-
preLayout
public void preLayout(org.eclipse.swt.graphics.GC gc)
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.- Parameters:
gc-
-
postLayout
public void postLayout(org.eclipse.swt.graphics.GC gc)
This method is called after the layout of the last item.- Parameters:
gc-
-
layout
public abstract 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. The implementation must update the item internal size (px) using setGroupSize(item, size); before returning.- Parameters:
gc-group-
-
getItem
public abstract GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
Returns the item at coords relative to the parent group.- Parameters:
group-coords-- Returns:
-
getSize
public abstract org.eclipse.swt.graphics.Rectangle getSize(GalleryItem item)
Returns the size of a group.- Parameters:
item-- Returns:
-
mouseDown
public abstract boolean mouseDown(GalleryItem group, org.eclipse.swt.widgets.Event e, org.eclipse.swt.graphics.Point coords)
This method can be implemented to handle mouse down events at the group level. Usually to interact with custom group UI.- Parameters:
group- The group on which the mouse click occurede- The original mouse eventcoords- The pointer coordinates relative to the group- Returns:
- false if event was handled by the group renderer and Gallery should not try to handle this event as a click on a GalleryItem.
-
getGallery
public Gallery getGallery()
-
setGallery
public void setGallery(Gallery gallery)
-
getGroupSize
protected org.eclipse.swt.graphics.Point getGroupSize(GalleryItem item)
-
getGroupPosition
protected org.eclipse.swt.graphics.Point getGroupPosition(GalleryItem item)
-
setGroupSize
protected void setGroupSize(GalleryItem item, org.eclipse.swt.graphics.Point size)
-
isDebugMode
protected boolean isDebugMode()
This method can be used as a condition to print trace or debug informations in standard output.- Returns:
- true if Debug mode is enabled
-
notifyTreeListeners
protected void notifyTreeListeners(GalleryItem group)
Notifies the Gallery that the control expanded/collapsed state has changed.- Parameters:
group-
-
updateStructuralValues
protected void updateStructuralValues(boolean keeplocation)
Forces an update of the gallery layout.- Parameters:
keeplocation- if true, the gallery will try to keep the current visible items in the client area after the new layout has been calculated.
-
updateScrollBarsProperties
protected void updateScrollBarsProperties()
-
getScrollBarIncrement
public int getScrollBarIncrement()
Returns the preferred Scrollbar increment for the current gallery layout.- Returns:
-
getBackground
protected org.eclipse.swt.graphics.Color getBackground(GalleryItem item)
Returns item background color. This method is called byGalleryItem.getBackground()and should be overridden by any group renderer which use additional colors. Note that item renderer is automatically used for items.- Parameters:
item- a GalleryItem- Returns:
- Color The current background color (never null)
-
getForeground
protected org.eclipse.swt.graphics.Color getForeground(GalleryItem item)
Returns item foreground color. This method is called byGalleryItem.getForeground()and should be overridden by any group renderer which use additional colors. Note that item renderer is automatically used for items.- Parameters:
item- a GalleryItem- Returns:
- The current foreground (never null)
-
getFont
protected org.eclipse.swt.graphics.Font getFont(GalleryItem item)
Returns item font. This method is called byGalleryItem.getFont()and should be overridden by any group renderer which use additional fonts. Note that item renderer is automatically used for items.- Parameters:
item- a GalleryItem- Returns:
- The current item Font (never null)
-
-