public class GanttChart
extends org.eclipse.swt.widgets.Composite
Website
If you want more info or more documentation, please visit: http://www.hexapixel.com/
Description
The GANTT widget has taken hints from Microsoft Project as far as arrow styles and overall look and feel goes. There are features such as dependencies, checkpoints, revised
dates, and much more. Nearly everything is customizable and you can zoom in to detailed day views all the way out to yearly overviews (12 zoom levels). Events can be resized,
dragged and dropped and various other things.
The widget is extremely simple to use for those wishing a basic implementation, or you can customize everything down to the pixel level if you so wish. Basically, if you don't like something, change it!
Important note: This class exposes a few select methods from the actual GanttComposite (where all the magic happens). If you are looking for a specific method and can't find it here, do a call to getGanttComposite() and see if the method you are looking for is located there.
Example creation code:
GanttChart ganttChart = new GanttChart(parentComposite, SWT.NONE);
Calendar calStart = Calendar.getInstance();
Calendar calEnd = Calendar.getInstance();
calEnd.add(Calendar.DATE, 10);
// set the data object to null, and percentage complete to 50
GanttEvent event = new GanttEvent(ganttChart, "Project X", calStart, calEnd, 50);
Customizing
As you may wish to customize the widget beyond the capabilities it already has, there are a few ways you may basically take control over as much or little as you please. First,
there are four interfaces that are of importance. They are the IPaintManager, the IColorManager, the ISettings and the ILanguageManager. Let's start with the IColorManager.
IColorManager
If you don't specify a color manager, the DefaultColorManager will be used. The color manager's job is to return colors to the method that is painting everything that is visual
in the chart. The colors that are returned from the ColorManager will determine everything as far as looks go.
IPaintManager
This interface is one you want to use if you want to dig really deep into how things are drawn. This class by default controls exactly how an event is represented visually,
pixel by pixel. If you don't like the look of a certain object on the chart, this is the interface you will want to implement.
ISettings
This interface is probably the most likely that you will be implementing on your own. Mainly this interface controls pixel values (widths, heights, multipliers) and various
boolean flags (if events can be moved, resized, etc).
ILanguageManager
Should you wish to use a different language than English, this is the interface to implement where you can override all the English text strings with whatever you wish.
Constructor and Description |
---|
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style)
Constructs a new GANTT chart widget.
|
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style,
ISettings settings)
Constructs a new GANTT chart widget with custom settings
ISettings . |
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style,
ISettings settings,
IColorManager colorManager)
Constructs a new GANTT chart widget with custom settings and a custom color manager
IColorManager . |
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style,
ISettings settings,
IColorManager colorManager,
IPaintManager paintManager,
ILanguageManager languageManager)
Constructs a new GANTT chart widget with custom settings, custom color manager
IColorManager , a custom paint manager
IPaintManager and a custom language manager ILanguageManager . |
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style,
ISettings settings,
IColorManager colorManager,
IPaintManager paintManager,
ILanguageManager languageManager,
java.util.Calendar... holidays)
Constructs a new GANTT chart widget with custom settings, custom color manager
IColorManager , a custom paint manager IPaintManager and a custom language
manager ILanguageManager . |
GanttChart(org.eclipse.swt.widgets.Composite parent,
int style,
ISettings settings,
IColorManager colorManager,
IPaintManager paintManager,
ILanguageManager languageManager,
Holiday... holidays)
Constructs a new GANTT chart widget with custom settings, custom color manager
IColorManager , a custom paint manager IPaintManager and a custom language
manager ILanguageManager . |
Modifier and Type | Method and Description |
---|---|
void |
addConnection(GanttEvent source,
GanttEvent target)
Adds a dependency between two events.
|
void |
addDependency(GanttEvent source,
GanttEvent target)
Same as addConnection().
|
void |
addGanttEventListener(IGanttEventListener listener)
Adds an event listener.
|
void |
addGroup(GanttGroup group)
Adds a GanttGroup.
|
void |
addUndoRedoListener(IUndoRedoListener listener)
Adds a listener to be notified when undo/redo possibilities change
|
IColorManager |
getColorManager()
Returns the currently set color manager.
|
GanttComposite |
getGanttComposite()
Returns the widget that is the actual GANTT widget at the root level.
|
org.eclipse.swt.widgets.ScrollBar |
getHorizontalBar() |
ILanguageManager |
getLanguageManger()
Returns the currently set language manager.
|
IPaintManager |
getPaintManager()
Returns the currently set paint manager.
|
GanttEvent |
getRandomEvent()
Returns a random GanttEvent, useful for testing.
|
ISettings |
getSettings()
Returns the currently set settings implementor.
|
GanttUndoRedoManager |
getUndoRedoManager()
Returns the Undo/Redo manager
|
org.eclipse.swt.widgets.ScrollBar |
getVerticalBar() |
void |
print()
Will print the GanttChart based on the settings made in the PrintDialog.
|
void |
redrawGanttChart()
Redraws the GanttChart.
|
void |
reindex(GanttEvent event,
int newIndex)
Re-indexes an event to show at a new location.
|
void |
removeGanttEventListener(IGanttEventListener listener)
Removes and event listener.
|
void |
removeGroup(GanttGroup group)
Removes a GanttGroup.
|
void |
removeUndoRedoListener(IUndoRedoListener listener)
Removes a listener from being notified when undo/redo possibilities change
|
void |
setGanttChartPrinter(GanttChartPrinter printer)
Set a different GanttChartPrinter that should be used to print this GanttChart.
|
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getScrollbarsMode
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public GanttChart(org.eclipse.swt.widgets.Composite parent, int style)
GanttFlags
.parent
- Parent compositestyle
- Widget stylejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GanttChart(org.eclipse.swt.widgets.Composite parent, int style, ISettings settings)
ISettings
. For styles, please see GanttFlags
.parent
- Parent compositestyle
- Widget stylesettings
- ISettings implementation or nulljava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GanttChart(org.eclipse.swt.widgets.Composite parent, int style, ISettings settings, IColorManager colorManager)
IColorManager
. For styles, please see GanttFlags
.parent
- Parent compositestyle
- Widget stylesettings
- ISettings implementation or nullcolorManager
- IColorManager implementationjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GanttChart(org.eclipse.swt.widgets.Composite parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager, java.util.Calendar... holidays)
IColorManager
, a custom paint manager IPaintManager
and a custom language
manager ILanguageManager
. If any of the managers is set to null the default manager using that implementation will be used. For styles, please see GanttFlags
.parent
- Parent compositestyle
- Widget stylesettings
- ISettings implementation or nullcolorManager
- IColorManager implementation or nullpaintManager
- IPaintManager implementation or nulllanguageManager
- ILanguageManager
implementation or nullholidays
- Calendar objects specifying holidaysjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GanttChart(org.eclipse.swt.widgets.Composite parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager)
IColorManager
, a custom paint manager
IPaintManager
and a custom language manager ILanguageManager
. If any of the managers is set to null the
default manager using that implementation will be used. For styles, please see GanttFlags
.parent
- Parent compositestyle
- Widget stylesettings
- ISettings implementation or nullcolorManager
- IColorManager implementation or nullpaintManager
- IPaintManager implementation or nulljava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GanttChart(org.eclipse.swt.widgets.Composite parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager, Holiday... holidays)
IColorManager
, a custom paint manager IPaintManager
and a custom language
manager ILanguageManager
. If any of the managers is set to null the default manager using that implementation will be used. For styles, please see GanttFlags
.parent
- Parent compositestyle
- Widget stylesettings
- ISettings implementation or nullcolorManager
- IColorManager implementation or nullpaintManager
- IPaintManager implementation or nulllanguageManager
- ILanguageManager
implementation or nullholidays
- Holiday objects specifying holidaysjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void addGroup(GanttGroup group)
group
- GanttGroup to addpublic void removeGroup(GanttGroup group)
group
- GanttGroup to removepublic void addConnection(GanttEvent source, GanttEvent target)
source
- GanttEvent sourcetarget
- GanttEvent targetpublic void addDependency(GanttEvent source, GanttEvent target)
source
- GanttEvent sourcetarget
- GanttEvent targetpublic void addGanttEventListener(IGanttEventListener listener)
listener
- IGanttEventListenerpublic void removeGanttEventListener(IGanttEventListener listener)
listener
- IGanttEventListenerpublic GanttComposite getGanttComposite()
public void redrawGanttChart()
public void reindex(GanttEvent event, int newIndex)
event
- GanttEvent to re-indexnewIndex
- new index positionpublic ISettings getSettings()
public IColorManager getColorManager()
public IPaintManager getPaintManager()
public ILanguageManager getLanguageManger()
public org.eclipse.swt.widgets.ScrollBar getVerticalBar()
getVerticalBar
in class org.eclipse.swt.widgets.Scrollable
public org.eclipse.swt.widgets.ScrollBar getHorizontalBar()
getHorizontalBar
in class org.eclipse.swt.widgets.Scrollable
public void addUndoRedoListener(IUndoRedoListener listener)
listener
- public void removeUndoRedoListener(IUndoRedoListener listener)
listener
- public GanttUndoRedoManager getUndoRedoManager()
GanttUndoRedoManager
public GanttEvent getRandomEvent()
public void setGanttChartPrinter(GanttChartPrinter printer)
printer
- The GanttChartPrinter that should be used to print this GanttChart.public void print()