LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyAbstractGanttPanelManager

java.lang.Object
  extended by leon.view.win.swing.component.LyAbstractGanttPanelManager
All Implemented Interfaces:
LyPaintListener

public abstract class LyAbstractGanttPanelManager
extends java.lang.Object
implements LyPaintListener

Handles Gantt panel management.


Nested Class Summary
 class LyAbstractGanttPanelManager._LyGanttCanvasTreeAdjustmentListener
          Handles tree adjustment events.
 class LyAbstractGanttPanelManager._LySensitiveItem
          Defines a sensitive item area.
static class LyAbstractGanttPanelManager._LySpecialDay
          Internal class representing a special day for the planning.
 
Field Summary
static java.lang.String __VERSION
           
static java.awt.Cursor DEFAULT_CURSOR
          Default cursor.
static int DEFAULT_HEIGHT
          Default height of the canvas.
static int DEFAULT_SCALE_HEIGHT
          Default height of the scale at the top of the component.
static int DEFAULT_WIDTH
          Default width of the canvas.
static java.awt.Cursor DIVIDE_CURSOR
          Cursor used when an interval is divided.
static java.awt.Cursor HAND_CURSOR
          Hand cursor (for intervals translation).
static short SCALE_DAY
          Day scaling.
static short SCALE_HOUR
          Hour scaling.
static short SCALE_MINUTE
          Minute scaling.
static short SCALE_MONTH
          Month scaling.
static short SCALE_SECOND
          Second scaling.
static short SCALE_WEEK
          Week scaling.
static short SCALE_YEAR
          Year scaling.
static java.awt.Cursor W_RESIZE_CURSOR
          Resize cursor (for resizing scale and intervals).
 
Constructor Summary
LyAbstractGanttPanelManager()
          Gant panel manager constructor.
LyAbstractGanttPanelManager(java.awt.Component tree, java.awt.Component comp, LyActionListener listener)
          Gant panel manager constructor.
 
Method Summary
 void addStep(boolean left, boolean remove)
          Adds or removes a step to the planning.
 void centerOnDate(java.util.Date date)
          Centers the planning on the given date.
 void checkComponentsSize(java.awt.Graphics g)
          Checks the size of all the components of the canvas.
 void componentPainted(java.awt.event.PaintEvent event)
          (non-Javadoc).
 java.awt.Dimension computeSize()
          Compute the size of the planning.
 void drawInSplitter(java.awt.Graphics gc, int xOffset, int yOffset)
          Draws the canvas in a graphics context.
 LyActionTransmitter getActionTransmitter()
          Gets the action transmitter associated to this Gantt panel manager.
 java.util.Date getBeginDate()
          Returns the begin date (the date at position 0).
 LyAbstractCanvasSplitterManager getCanvasSplitter()
          Gets the associated canvas splitter.
 long getCenterDate()
          Returns the date at the center of the planning.
 java.awt.Component getComponent()
          Gets the current Gantt component.
 java.awt.Dimension getComponentSize()
          Gets the size of the component, or its parent splitter if any.
abstract  java.awt.Rectangle getElementBounds(LyGanttElement ganttElement)
          Returns the bounds of a given Gantt element.
 java.util.Date getEndDate()
          Returns the end date (the date at last position).
 java.awt.Color getFontColor()
          Gets the font color.
abstract  java.awt.Image getImageOffScreen(java.awt.Dimension offScreenSize)
          Returns the offscreen image if any.
 int getLeftHeaderWidth()
          Gets the left header width.
 java.awt.Color getLinesColor()
          Gets the vertical lines color.
 java.lang.Object getLock()
          Get a lock on the table to prevent concurrent access on rows.
 java.util.Date getMaximumDate()
          Returns the maximum date of the planning.
 java.util.Date getMinimumDate()
          Returns the minimum date of the planning.
 java.awt.Dimension getMinimumSize()
          Computes minimum size depending on content.
 java.awt.Dimension getPreferredSize()
          Computes preferred size depending on content.
 java.awt.Color getScaleBackground()
          Gets the scale background color.
 java.awt.Color getScaleLinesColor()
          Gets the scale lines color.
 java.awt.Dimension getScrollableSize()
          Gets the scrollable size, which is equals to the planning size.
 LySelectionTransmitter getSelectionTransmitter()
          Gets the selection transmitter associated to this Gantt panel manager.
abstract  java.awt.Graphics getTargetGraphics(java.awt.Image offScreenImage, java.awt.Graphics defaultGraphics)
          Returns the graphics context of the specified offscreen image or the default graphics context if none is available.
 java.awt.Color getTooltipColor()
          Gets the tooltip color.
 java.awt.Color getTooltipFontColor()
          Gets the tooltip font color.
 java.lang.String getToolTipText()
          Returns the current tooltip for panel.
 int getTopHeaderHeight()
          Gets the top header height.
 java.awt.Color getWeekEndColor()
          Gets the week end color.
 int headerHeight()
          Returns the height, in pixels, of the Gantt header.
 int lineHeight()
          Returns the height, in pixels, of aGantt ling.
 void paintCommon(java.awt.Graphics g)
          Draws the title panel in the specified graphics context.
 void paintComponent()
          Paints the Gantt component.
abstract  void paintOnScreen(java.awt.Image offScreenImage, java.awt.Graphics onScreenGraphics)
          Paints the specified offscreen image to the onscreen graphics context.
 void popupMenu(java.awt.event.MouseEvent e)
          Manages popup menus.
 void reset()
          Resets the Gannt planning.
 java.awt.Dimension scrollSize()
          Gets the size of the scrolling.
 void scrollX(int x)
          Scrolls the screen horizontally.
 void setBigScale(short scaleType)
          Sets the big scaling type.
 void setBigStep(int step)
          Sets the big step of the planning.
 void setCanvasSplitter(LyAbstractCanvasSplitterManager splitter)
          Sets the canvas splitter.
 void setCheckComponentsSize(boolean check)
          Sets the component size check property.
 void setCurrentDateDisplayTime(boolean display)
          Sets the _currentDateDisplayTime parameter indicating if time must be displayed with the current date cursor.
 void setCurrentDateRefreshPeriod(int period)
          Sets the refresh period, in seconds, for current date refresh.
 void setDateFormat(java.lang.String dateFormat)
          Sets the date format used to display dates.
 void setDates(java.util.Date minimumDate, java.util.Date maximumDate, java.util.Date beginDate, java.util.Date endDate, boolean adjustMinDate, boolean adjustMaxDate)
          Sets the dates of the Gantt planning.
 void setFontColor(java.awt.Color color)
          Sets the color of the font.
 void setGanttElements(java.lang.Object treeElement, java.util.Vector<LyGanttElement> ganttElements)
          Sets tree element and Gantt elements association.
 void setLinesColor(java.awt.Color color)
          Sets the color used to draw the vertical lines of the planning.
 void setMaximumIntervalDate(java.util.Date maximumIntervalDate)
          Sets the maximum interval date.
 void setMinimumIntervalDate(java.util.Date minimumIntervalDate)
          Sets the minimum interval date.
 void setScale(short scaleType)
          Sets the scaling type.
 void setScaleBackground(java.awt.Color color)
          Sets the color used to fill the scale.
 void setScaleLinesColor(java.awt.Color color)
          Sets the color used to draw the lines of the scale.
 void setScroll(int scroll)
          Sets the x scroll position of the canvas.
 void setSpecialDays(java.util.Vector<LyAbstractGanttPanelManager._LySpecialDay> days)
          Sets the list of special days for this planning.
 void setStep(int step)
          Sets the step of the planning.
 void setTimeFormat(java.lang.String timeFormat)
          Sets the time format used to display times.
 void setTooltipColor(java.awt.Color tooltipColor)
          Sets the color used for tooltips (when an item is being moved).
abstract  void setTooltipFont(java.awt.Font font)
          Sets the font used for the tooltip.
 void setTooltipFontColor(java.awt.Color tooltipFontColor)
          Sets the font color used for tooltips (when an item is being moved).
 void setUpperScaleFont(java.awt.Font font)
          Sets the font used for the upper scale part.
 void setWeekendColor(java.awt.Color weekendColor)
          Sets the color used to draw the week-ends on the planning.
 void setWeekInitial(java.lang.String weekInitial)
          Sets the initial string for weeks.
 void setZoom(float zoom)
          Sets the new zoom factor of the planning.
 void startDivideIntervalMode()
          Sets the division mode.
 void translatePlanning(boolean left)
          Translates the viewable dates on the left or right.
 java.awt.Dimension viewSize()
          Gets the visible component size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Default width of the canvas.

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Default height of the canvas.

See Also:
Constant Field Values

DEFAULT_SCALE_HEIGHT

public static final int DEFAULT_SCALE_HEIGHT
Default height of the scale at the top of the component.

See Also:
Constant Field Values

SCALE_SECOND

public static final short SCALE_SECOND
Second scaling.

See Also:
Constant Field Values

SCALE_MINUTE

public static final short SCALE_MINUTE
Minute scaling.

See Also:
Constant Field Values

SCALE_HOUR

public static final short SCALE_HOUR
Hour scaling.

See Also:
Constant Field Values

SCALE_DAY

public static final short SCALE_DAY
Day scaling.

See Also:
Constant Field Values

SCALE_WEEK

public static final short SCALE_WEEK
Week scaling.

See Also:
Constant Field Values

SCALE_MONTH

public static final short SCALE_MONTH
Month scaling.

See Also:
Constant Field Values

SCALE_YEAR

public static final short SCALE_YEAR
Year scaling.

See Also:
Constant Field Values

DEFAULT_CURSOR

public static final java.awt.Cursor DEFAULT_CURSOR
Default cursor.


HAND_CURSOR

public static final java.awt.Cursor HAND_CURSOR
Hand cursor (for intervals translation).


W_RESIZE_CURSOR

public static final java.awt.Cursor W_RESIZE_CURSOR
Resize cursor (for resizing scale and intervals).


DIVIDE_CURSOR

public static final java.awt.Cursor DIVIDE_CURSOR
Cursor used when an interval is divided.

Constructor Detail

LyAbstractGanttPanelManager

public LyAbstractGanttPanelManager()
Gant panel manager constructor.


LyAbstractGanttPanelManager

public LyAbstractGanttPanelManager(java.awt.Component tree,
                                   java.awt.Component comp,
                                   LyActionListener listener)
Gant panel manager constructor. This constructor initializes the class fields to the specified parameters then intializes the remaining attributes at default values.

Parameters:
tree - the tree component
comp - the Gantt component
listener - the action listeners
Method Detail

getImageOffScreen

public abstract java.awt.Image getImageOffScreen(java.awt.Dimension offScreenSize)
Returns the offscreen image if any.

Parameters:
offScreenSize - size of the offscreen image
Returns:
the offscreen image

getTargetGraphics

public abstract java.awt.Graphics getTargetGraphics(java.awt.Image offScreenImage,
                                                    java.awt.Graphics defaultGraphics)
Returns the graphics context of the specified offscreen image or the default graphics context if none is available.

Parameters:
offScreenImage - the image to get its graphics context
defaultGraphics - the default graphics context if the image doesn't have one
Returns:
a graphics context to use

paintOnScreen

public abstract void paintOnScreen(java.awt.Image offScreenImage,
                                   java.awt.Graphics onScreenGraphics)
Paints the specified offscreen image to the onscreen graphics context.

Parameters:
offScreenImage - the offscreen image to paint on the onscreen context
onScreenGraphics - the graphics context to paint the offscreen image on

reset

public void reset()
Resets the Gannt planning.


headerHeight

public int headerHeight()
Returns the height, in pixels, of the Gantt header.

Returns:
10

lineHeight

public int lineHeight()
Returns the height, in pixels, of aGantt ling.

Returns:
10

scrollSize

public java.awt.Dimension scrollSize()
Gets the size of the scrolling.

Returns:
the size of the scrolling.

viewSize

public java.awt.Dimension viewSize()
Gets the visible component size.

Returns:
the dimension of the visible size of the component.

computeSize

public java.awt.Dimension computeSize()
Compute the size of the planning.

Returns:
the size of the planning

getComponentSize

public java.awt.Dimension getComponentSize()
Gets the size of the component, or its parent splitter if any.

Returns:
the visible size of the component

setMinimumIntervalDate

public void setMinimumIntervalDate(java.util.Date minimumIntervalDate)
Sets the minimum interval date.

Parameters:
minimumIntervalDate - new minimum interval date

setMaximumIntervalDate

public void setMaximumIntervalDate(java.util.Date maximumIntervalDate)
Sets the maximum interval date.

Parameters:
maximumIntervalDate - new maximum interval date

setDates

public void setDates(java.util.Date minimumDate,
                     java.util.Date maximumDate,
                     java.util.Date beginDate,
                     java.util.Date endDate,
                     boolean adjustMinDate,
                     boolean adjustMaxDate)
Sets the dates of the Gantt planning.

Parameters:
minimumDate - the minimum date of all the elements of the planning
maximumDate - the maximum date of all the elements of the planning
beginDate - the first visible date of the planning
endDate - the last visible date of the planning
adjustMinDate - indicates if minimum date must be set to the begin date if begin date is before the minimum date
adjustMaxDate - indicates if maximum date must be set to the end date if end date is after the maximum date

centerOnDate

public void centerOnDate(java.util.Date date)
Centers the planning on the given date.

Parameters:
date - the date that becomes the center of the planning

translatePlanning

public void translatePlanning(boolean left)
Translates the viewable dates on the left or right.

Parameters:
left - Indicates if translation must be performed on the left or on the right.

setSpecialDays

public void setSpecialDays(java.util.Vector<LyAbstractGanttPanelManager._LySpecialDay> days)
Sets the list of special days for this planning.

Parameters:
days - the list of _LySpecialDay instances

checkComponentsSize

public void checkComponentsSize(java.awt.Graphics g)
Checks the size of all the components of the canvas. If there is no space enough to display them, adds a step on the left or on the right and recurses.

Parameters:
g - the context graphics handling the display of the canvas components

getBeginDate

public java.util.Date getBeginDate()
Returns the begin date (the date at position 0).

Returns:
the begin date

getEndDate

public java.util.Date getEndDate()
Returns the end date (the date at last position).

Returns:
the end date

setCheckComponentsSize

public void setCheckComponentsSize(boolean check)
Sets the component size check property.

Parameters:
check - Indicates if the components size must be checked.

popupMenu

public void popupMenu(java.awt.event.MouseEvent e)
Manages popup menus.

Parameters:
e - the mouse event for the component popup menu

setScale

public void setScale(short scaleType)
Sets the scaling type.

Parameters:
scaleType - the scaling type. One of the following:

setBigScale

public void setBigScale(short scaleType)
Sets the big scaling type.

Parameters:
scaleType - the scaling type. One of the following:

setStep

public void setStep(int step)
Sets the step of the planning.

Parameters:
step - the new step value

setBigStep

public void setBigStep(int step)
Sets the big step of the planning.

Parameters:
step - the new big step value

addStep

public void addStep(boolean left,
                    boolean remove)
Adds or removes a step to the planning.

Parameters:
left - true if step must be added or removed on the left, false for the right
remove - true if step must be removed, false if step must be added

scrollX

public void scrollX(int x)
Scrolls the screen horizontally.

Parameters:
x - the scroll amount

setScroll

public void setScroll(int scroll)
Sets the x scroll position of the canvas.

Parameters:
scroll - the new x scroll position

setZoom

public void setZoom(float zoom)
Sets the new zoom factor of the planning.

Parameters:
zoom - the new zoom factor

setWeekInitial

public void setWeekInitial(java.lang.String weekInitial)
Sets the initial string for weeks.

Parameters:
weekInitial - the string used for weeks

setScaleBackground

public void setScaleBackground(java.awt.Color color)
Sets the color used to fill the scale.

Parameters:
color - the new scale color
See Also:
getScaleBackground()

getScaleBackground

public java.awt.Color getScaleBackground()
Gets the scale background color.

Returns:
the scale background color, or Color.GRAY if not available
See Also:
setScaleBackground(Color)

setScaleLinesColor

public void setScaleLinesColor(java.awt.Color color)
Sets the color used to draw the lines of the scale.

Parameters:
color - the new color used to draw the lines of the scale
See Also:
getScaleLinesColor()

getScaleLinesColor

public java.awt.Color getScaleLinesColor()
Gets the scale lines color.

Returns:
the scale lines color, or Color.DARK_GRAY if not available
See Also:
setScaleLinesColor(Color)

setLinesColor

public void setLinesColor(java.awt.Color color)
Sets the color used to draw the vertical lines of the planning.

Parameters:
color - the new color used to draw the vertical lines of the planning
See Also:
getLinesColor()

getLinesColor

public java.awt.Color getLinesColor()
Gets the vertical lines color.

Returns:
the vertical lines color, or Color.DARK_GRAY if not available
See Also:
setLinesColor(Color)

setFontColor

public void setFontColor(java.awt.Color color)
Sets the color of the font.

Parameters:
color - the new color of the font
See Also:
getFontColor()

getFontColor

public java.awt.Color getFontColor()
Gets the font color.

Returns:
the font color, or Color.BLACK if not available
See Also:
setFontColor(Color)

setWeekendColor

public void setWeekendColor(java.awt.Color weekendColor)
Sets the color used to draw the week-ends on the planning.

Parameters:
weekendColor - the new color used to draw the week-ends on the planning
See Also:
getWeekEndColor()

getWeekEndColor

public java.awt.Color getWeekEndColor()
Gets the week end color.

Returns:
the week end color, or Color.CYAN if not available
See Also:
setWeekendColor(Color)

setTooltipColor

public void setTooltipColor(java.awt.Color tooltipColor)
Sets the color used for tooltips (when an item is being moved).

Parameters:
tooltipColor - the new tooltip color
See Also:
getTooltipColor()

getTooltipColor

public java.awt.Color getTooltipColor()
Gets the tooltip color.

Returns:
the tooltip color, or Color.YELLOW if not available
See Also:
setTooltipColor(Color)

setTooltipFontColor

public void setTooltipFontColor(java.awt.Color tooltipFontColor)
Sets the font color used for tooltips (when an item is being moved).

Parameters:
tooltipFontColor - the tooltip font color
See Also:
getTooltipFontColor()

getTooltipFontColor

public java.awt.Color getTooltipFontColor()
Gets the tooltip font color.

Returns:
the tooltip font color, or Color.BLACK if not available
See Also:
setTooltipFontColor(Color)

setUpperScaleFont

public void setUpperScaleFont(java.awt.Font font)
Sets the font used for the upper scale part.

Parameters:
font - the new font used for the upper scale part

getMinimumDate

public java.util.Date getMinimumDate()
Returns the minimum date of the planning.

Returns:
the minimum date of the planning

getMaximumDate

public java.util.Date getMaximumDate()
Returns the maximum date of the planning.

Returns:
the maximum date of the planning

setDateFormat

public void setDateFormat(java.lang.String dateFormat)
Sets the date format used to display dates.

Parameters:
dateFormat - the new date format used to display dates

setTimeFormat

public void setTimeFormat(java.lang.String timeFormat)
Sets the time format used to display times.

Parameters:
timeFormat - the new time format used to display times

getCenterDate

public long getCenterDate()
Returns the date at the center of the planning.

Returns:
the date displayed at the center of the planning

setCurrentDateRefreshPeriod

public void setCurrentDateRefreshPeriod(int period)
Sets the refresh period, in seconds, for current date refresh.

Parameters:
period - time in seconds, negative if current date should not be displayed

setCurrentDateDisplayTime

public void setCurrentDateDisplayTime(boolean display)
Sets the _currentDateDisplayTime parameter indicating if time must be displayed with the current date cursor.

Parameters:
display - true if time must be displayed, false otherwise

setGanttElements

public void setGanttElements(java.lang.Object treeElement,
                             java.util.Vector<LyGanttElement> ganttElements)
Sets tree element and Gantt elements association.

Parameters:
treeElement - the tree element
ganttElements - the Gantt elements associated with the given tree element

paintComponent

public void paintComponent()
Paints the Gantt component.


paintCommon

public void paintCommon(java.awt.Graphics g)
Draws the title panel in the specified graphics context.

Parameters:
g - the graphics context to draw the title panel

getElementBounds

public abstract java.awt.Rectangle getElementBounds(LyGanttElement ganttElement)
Returns the bounds of a given Gantt element. The y position and height are computed with the associated tree node of the Gantt element. The x position and width are computed with both begin and end dates of the Gantt element.

Parameters:
ganttElement - the Gantt element
Returns:
a rectangle describing the bounds of the Gantt element

setTooltipFont

public abstract void setTooltipFont(java.awt.Font font)
Sets the font used for the tooltip.

Parameters:
font - the new font used for the tooltip

startDivideIntervalMode

public void startDivideIntervalMode()
Sets the division mode. Forces the setting of true to _divideIntervalMode.


getToolTipText

public java.lang.String getToolTipText()
Returns the current tooltip for panel.

Returns:
the tooltip of the current panel

getMinimumSize

public java.awt.Dimension getMinimumSize()
Computes minimum size depending on content.

Returns:
the preferred size of the component
See Also:
getPreferredSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Computes preferred size depending on content.

Returns:
the preferred size of the component. This preferred size uses the default width and heights for the canvas.

getComponent

public java.awt.Component getComponent()
Gets the current Gantt component.

Returns:
the Gantt component

getActionTransmitter

public LyActionTransmitter getActionTransmitter()
Gets the action transmitter associated to this Gantt panel manager. If there is none, a LySimpleActionTransmitter is created.

Returns:
the action transmitter of this component
See Also:
LyEventTransmitter.getActionTransmitter()

getSelectionTransmitter

public LySelectionTransmitter getSelectionTransmitter()
Gets the selection transmitter associated to this Gantt panel manager. If there is none, a LySimpleSelectionTransmitter is created.

Returns:
the selection transmitter of this component
See Also:
LyEventTransmitter.getSelectionTransmitter()

componentPainted

public void componentPainted(java.awt.event.PaintEvent event)
(non-Javadoc).

Specified by:
componentPainted in interface LyPaintListener
Parameters:
event - the paint event
See Also:
LyPaintListener.componentPainted(java.awt.event.PaintEvent)

drawInSplitter

public void drawInSplitter(java.awt.Graphics gc,
                           int xOffset,
                           int yOffset)
Draws the canvas in a graphics context.

Parameters:
gc - the graphical context
xOffset - the horizontal offset for the splitter drawing
yOffset - the vertical offset for the splitter drawing

setCanvasSplitter

public void setCanvasSplitter(LyAbstractCanvasSplitterManager splitter)
Sets the canvas splitter.

Parameters:
splitter - the splitter
See Also:
getCanvasSplitter()

getScrollableSize

public java.awt.Dimension getScrollableSize()
Gets the scrollable size, which is equals to the planning size.

Returns:
the scrollable size

getTopHeaderHeight

public int getTopHeaderHeight()
Gets the top header height. It is the default height of the header.

Returns:
the top header height

getLeftHeaderWidth

public int getLeftHeaderWidth()
Gets the left header width. Its value is 0 by default.

Returns:
the left header width

getCanvasSplitter

public LyAbstractCanvasSplitterManager getCanvasSplitter()
Gets the associated canvas splitter.

Returns:
the canvas splitter for the planning
See Also:
setCanvasSplitter(LyAbstractCanvasSplitterManager)

getLock

public java.lang.Object getLock()
Get a lock on the table to prevent concurrent access on rows.

Returns:
a valid lock for synchronized()

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com