public abstract class AbstractFlowWidget
extends Canvas
0.0
and 1.0
(both inclusive) and a flow objects.Modifier and Type | Field and Description |
---|---|
protected static int |
ARROW_LENGHT |
protected Color |
blackColor |
protected Color |
clickareaBackgroundColor |
protected Color |
clickareaBackgroundColorDragging |
protected IFlowEntry |
draggingEntry |
protected java.text.NumberFormat |
floatFormatter |
protected int |
flowHeight |
protected int |
flowWidth |
protected Color |
handleColorTwo |
protected int |
leftWidth |
protected Color |
linkageColor |
protected static int |
POSITION_HALF_HEIGTH |
protected static int |
POSITION_HEIGTH |
protected int |
rightWidth |
protected int |
topHeight |
Constructor and Description |
---|
AbstractFlowWidget(Composite parent,
int style,
int flowHeight,
int flowWidth,
boolean changeable)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addFlowEntry(IFlowEntry entry)
Adds a new
FlowEntry . |
Point |
calcPreferredSize()
Calculates the perferred size of this widget.
|
Point |
computeSize(int wHint,
int hHint) |
protected MenuItem |
createMenuItem(Menu parent,
int style,
java.lang.String text,
Image icon,
int accel,
boolean enabled,
java.lang.String callback)
Creates a menu item
|
protected void |
doAddEntry()
Performs the popop-menu command "Add"
|
protected void |
doDeleteEntry()
Performs the popop-menu command "Delete"
|
abstract java.util.List<ColorData> |
getEntries() |
protected abstract java.lang.String |
getFlowEntryName() |
int |
getFlowHeight() |
java.util.List<IFlowEntry> |
getFlowList() |
int |
getFlowWidth() |
Color |
getInternalBorderColor() |
int |
getInternalBorderWidth() |
int |
getLeftWidth() |
int |
getRightWidth() |
protected abstract void |
handleObjectClick(IFlowEntry entry)
Opens a dialog used for editing the
FlowEntry object. |
protected java.lang.Double |
handlePositionClick(IFlowEntry entry)
Calls the
FlowEntryValueDialog . |
boolean |
hasEntries() |
protected void |
init(Composite parent)
Initilalizes the widget.
|
void |
mouseDoubleClick(MouseEvent e) |
void |
mouseDown(MouseEvent e)
Sets the dragging item and the popup menu text for the "Delete" menu item
|
void |
mouseMove(MouseEvent e) |
void |
mouseUp(MouseEvent e)
Performs the dragging and calling the value and object editor dialogs.
|
protected abstract IFlowEntry |
newInitialFlowEntry() |
void |
paintControl(PaintEvent e)
Paints the control.
|
protected abstract Rectangle |
paintEntryObject(GC gc,
IFlowEntry entry,
Point lineHook,
int lastHeightPosition)
Paints the
FlowEntry object. |
protected abstract void |
paintFlowArea(GC gc)
Paints the complete flow area
|
protected void |
registerCallback(MenuItem mi,
java.lang.Object handler,
java.lang.String handlerName)
Adds a new
SelectionListener to the given MenuItem ,
which calls the handler method using Java reflection. |
abstract void |
setEntries(java.util.List<ColorData> list) |
void |
setFlowHeight(int flowHeight) |
void |
setFlowWidth(int flowWidth) |
void |
setInternalBorderColor(Color internalBorderColor) |
void |
setInternalBorderWidth(int internalBorderWidth) |
void |
setLeftWidth(int leftWidth) |
void |
setRightWidth(int rightWidth) |
void |
setSizeUpdater(ISizeUpdater sizeUpdater)
Sets the
ISizeUpdater to be notified if the
widget size has been changed. |
protected static final int POSITION_HEIGTH
protected static final int POSITION_HALF_HEIGTH
protected static final int ARROW_LENGHT
protected java.text.NumberFormat floatFormatter
protected int topHeight
protected int flowHeight
protected int flowWidth
protected int leftWidth
protected int rightWidth
protected Color blackColor
protected Color linkageColor
protected Color clickareaBackgroundColor
protected Color clickareaBackgroundColorDragging
protected Color handleColorTwo
protected IFlowEntry draggingEntry
public AbstractFlowWidget(Composite parent, int style, int flowHeight, int flowWidth, boolean changeable)
parent
- The sidgets parent compositestyle
- The SWT style bits, only those for Canvas
widgets are supported.flowHeight
- The height of the flow barflowWidth
- The width of the flow barchangeable
- true
to enable the mouse listeners,
false
to have the widget in a read-only mode.public Point computeSize(int wHint, int hHint)
protected abstract void paintFlowArea(GC gc)
gc
- The GC
to be used for the drawing.protected abstract Rectangle paintEntryObject(GC gc, IFlowEntry entry, Point lineHook, int lastHeightPosition)
FlowEntry
object. This has to be done at the right of
the flow drawing area, as the left side is occupied by the FlowEntry
value drawing.gc
- The GC
to be used for the drawingentry
- The FlowEntry
who's object is to be drawn.lineHook
- a Point
identifying the last pixel of the
entries linelastHeightPosition
- The y coordinate the last FlowEntry
object
painting has been done.Rectangle
identifying the palace beeing sensible for
user clicks. Clicking into this area results in showing the object editing dialog.protected abstract void handleObjectClick(IFlowEntry entry)
FlowEntry
object.entry
- The FlowEntry
to be edited.protected abstract java.lang.String getFlowEntryName()
FlowEntry
implementation.protected abstract IFlowEntry newInitialFlowEntry()
FlowEntry
.public abstract void setEntries(java.util.List<ColorData> list)
list
- A list of object beeing used as map initializer.public abstract java.util.List<ColorData> getEntries()
protected void init(Composite parent)
parent
- The parent Composite
of this widget.protected void doAddEntry()
protected void doDeleteEntry()
protected MenuItem createMenuItem(Menu parent, int style, java.lang.String text, Image icon, int accel, boolean enabled, java.lang.String callback)
parent
- The Menu
to hold the new MenuItem
style
- The MenuItem
SWT style bitstext
- The tex to be displayedicon
- The icon to be shownaccel
- The accelleration value to be usedenabled
- true
to enable and false
to disable the new MenuItem
callback
- The name of the callback method to be called when the menu item is selected.MenuItem
.protected void registerCallback(MenuItem mi, java.lang.Object handler, java.lang.String handlerName)
SelectionListener
to the given MenuItem
,
which calls the handler method using Java reflection.mi
- The MenuItem
to receive the SelectionListener
handler
- The Handler class implementing the handlerName
handlerName
- The method name to be called by the listener.public java.util.List<IFlowEntry> getFlowList()
List
of IFlowEntry
objects.public void addFlowEntry(IFlowEntry entry)
FlowEntry
.entry
- the FlowEntry
to be added.public boolean hasEntries()
true
if the set of FlowEntries
is not
empty, false
otherwise.public Point calcPreferredSize()
public void mouseDoubleClick(MouseEvent e)
protected java.lang.Double handlePositionClick(IFlowEntry entry)
FlowEntryValueDialog
.entry
- The IFlowEntry
whose position is to be changed.NULL
if the user cancels the dialog.public void mouseDown(MouseEvent e)
org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
public void mouseUp(MouseEvent e)
org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
public void mouseMove(MouseEvent e)
public void paintControl(PaintEvent e)
org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
public int getFlowHeight()
public void setFlowHeight(int flowHeight)
flowHeight
- The hight of the flow area to be used.public int getFlowWidth()
public void setFlowWidth(int flowWidth)
flowWidth
- The width of the flow area to be used.public Color getInternalBorderColor()
Color
used for painting the flow area border.public void setInternalBorderColor(Color internalBorderColor)
internalBorderColor
- The Color
to be used for paining the
flow area border.public int getInternalBorderWidth()
public void setInternalBorderWidth(int internalBorderWidth)
internalBorderWidth
- The width of the flow area border.public int getLeftWidth()
public void setLeftWidth(int leftWidth)
leftWidth
- The offset of the flow area.
The leftWidth
can not be smaller than the minLeftWidth
.public int getRightWidth()
public void setRightWidth(int rightWidth)
rightWidth
- The size between the right side of the flow area and the widget's
rigt side, that is the width the implementing class can be use for drawing the
FlowEntries
objects.
The rightWidth
can not be smaller than the minRightWidth
.public void setSizeUpdater(ISizeUpdater sizeUpdater)
ISizeUpdater
to be notified if the
widget size has been changed.sizeUpdater
- The ISizeUpdater
to be notified.