Class AbstractGalleryGroupRenderer
- java.lang.Object
-
- org.eclipse.nebula.widgets.gallery.AbstractGalleryGroupRenderer
-
- Direct Known Subclasses:
AbstractGridGroupRenderer
public abstract class AbstractGalleryGroupRenderer extends java.lang.Object
Base 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 void
dispose()
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.protected org.eclipse.swt.graphics.Color
getBackground(GalleryItem item)
Returns item background color.protected org.eclipse.swt.graphics.Font
getFont(GalleryItem item)
Returns item font.protected org.eclipse.swt.graphics.Color
getForeground(GalleryItem item)
Returns item foreground color.Gallery
getGallery()
protected org.eclipse.swt.graphics.Point
getGroupPosition(GalleryItem item)
protected org.eclipse.swt.graphics.Point
getGroupSize(GalleryItem item)
abstract GalleryItem
getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
Returns the item at coords relative to the parent group.abstract GalleryItem
getNextItem(GalleryItem item, int key)
Returns the item that should be selected when the current item is 'item' and the 'key' is pressedint
getScrollBarIncrement()
Returns the preferred Scrollbar increment for the current gallery layout.abstract org.eclipse.swt.graphics.Rectangle
getSize(GalleryItem item)
Returns the size of a group.protected boolean
isDebugMode()
This method can be used as a condition to print trace or debug informations in standard output.boolean
isExpanded()
Get the expand/collapse state of the current groupabstract 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.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.protected void
notifyTreeListeners(GalleryItem group)
Notifies the Gallery that the control expanded/collapsed state has changed.void
postDraw(org.eclipse.swt.graphics.GC gc)
This method is called after drawing the last item.void
postLayout(org.eclipse.swt.graphics.GC gc)
This method is called after the layout of the last item.void
preDraw(org.eclipse.swt.graphics.GC gc)
This method is called before drawing the first item.void
preLayout(org.eclipse.swt.graphics.GC gc)
This method is called before the layout of the first item.void
setExpanded(boolean selected)
void
setGallery(Gallery gallery)
protected void
setGroupSize(GalleryItem item, org.eclipse.swt.graphics.Point size)
protected void
updateScrollBarsProperties()
protected void
updateStructuralValues(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)
-
-