LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingGantt

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingFieldItem
              extended by leon.view.win.swing.LySwingPanel
                  extended by leon.view.win.swing.LySwingGantt
All Implemented Interfaces:
LyActionListener, LyEventTransmitter, LySelectionListener, LyGanttInterface, LyGetLockInterface, LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalGantt, LyGraphicalPanel, LyViewComponent, LyFreeInterface, LySetIdleInterface, LySetPopupMenuInterface, LySwingComponent

public class LySwingGantt
extends LySwingPanel
implements LySwingComponent, LyGanttInterface, LyGraphicalGantt, LyActionListener, LySelectionListener, LySetIdleInterface, LyGetLockInterface

This class implements the Gantt object (as described in the dtd) for swing viewer.

A Gantt planning is a graphical component that generally allows to represent the planning of a project by visualizing the different tasks that compose it. It is constituted by two distinct parts: a planning on the right and a tree view on the left. To each node of the tree corresponds a representation on the planning, horizontally aligned with this node (the node and its representation make what we will call a line). This representation may be a segment, a filled rectangle or a point.

A Gantt planning has a begin date and an end date that represent the limits of the visible part of the planning. The full size of the planning is automatically computed with the dates of the intervals. It also has a date format used to represent the dates of the intervals and a zoom factor indicating the steps of the vertical grid of the planning (months, weeks, days, hours or minutes).

The tree view allows to visualize the different lines with the capacity of hiding or showing the sub-lines. Each node of the tree has a label, an image, a background color, a foreground color and a font.

The planning allows to visualize the time intervals associated to the nodes of the tree. If a line contains intervals it is represented in the planning by points or filled rectangles (depending on the begin and end dates). If a line contains sub-lines it is represented by a segment starting from the minimum date of its sub-intervals and going to the maximum date of its sub-intervals.

It is also possible to indicate particular days that must appear with a color on the planning. Those days may be of three types: days of week (for example Saturday and Sunday), days of year (for example May the 1st) and special days (for example 24th December 2004).

See Also:
LyGantt

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingGantt(LyGantt gantt)
          Class constructor of a Gantt object for the Swing target.
 
Method Summary
 void actionPerformed(LyActionEvent actionEvent)
          (non-Javadoc).
 void addDay(LyDay day, int pos)
          Inserts the specified day to the special days list.
 void addLine(LyLine line, int pos)
          Computes the tree content again and resets the Gantt intervals dependencies.
 void centerOnDate(java.util.Date date)
          (non-Javadoc).
 void displayTimeFrame()
          (non-Javadoc).
 void fitSize(boolean fitView)
          Updates the planning with the Gantt minimum and maximum size.
 void free()
          Free resources allocated to this component.
 LyActionTransmitter getActionTransmitter()
          (non-Javadoc).
 java.util.Date getBeginDate()
          Returns the begin date of the planning (first visible date).
 java.util.Date getCenterDate()
          (non-Javadoc).
 java.awt.Component getComponent()
          (non-Javadoc).
 java.text.DateFormat getDateFormat()
          Returns the date format of this component.
 java.text.DateFormat getDateTimeFormat()
          Returns the date and time format of this component.
 java.util.Date getEndDate()
          Returns the end date of the planning (last visible date).
 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 this Gantt component.
 java.util.Date getMinimumDate()
          Returns the minimum date of this Gantt component.
 LySelectionTransmitter getSelectionTransmitter()
          (non-Javadoc).
 java.text.DateFormat getTimeFormat()
          Returns the time format of this component.
 float getVerticalZoom()
          (non-Javadoc).
 void removeDay(LyDay day)
          Removes the specified day from the special days list.
 void removeLine(LyLine line)
          Computes the tree content again and resets the Gantt intervals dependencies.
 void resetLinesDates()
          Retrieves the Gantt lines of this planning and resets their minimum and maximum dates to this Gantt's dates values.
 void selectionPerformed(LySelectionEvent selectionEvent)
          (non-Javadoc).
 void setBeginDate(java.lang.String date)
          Not implemented.
 void setContent()
          Sets the Gantt planning dates for this component.
 void setCurrentDateRefreshPeriod(int period)
          Updates attribute currentDateRefreshPeriod to the given value.
 void setEndDate(java.lang.String date)
          Not implemented.
 void setGanttElements(java.lang.Object treeElement, java.util.Vector<LyGanttElement> ganttElements)
          Sets the association between a tree element and Gantt elements of the planning.
 void setHCenteredLine(java.lang.String line)
          (non-Javadoc).
 void setIdle(boolean status)
          (non-Javadoc).
 void setVCenteredLine(java.lang.String lineId)
          (non-Javadoc).
 void setVisible(boolean status)
          Shows or hides the Gantt planning panel.
 void setZoomFactor(LyGantt.ZoomFactor scale)
          Updates attribute zoomFactor to the given value.
 void startDivideInterval()
          (non-Javadoc).
 void verticalZoomIn()
          (non-Javadoc).
 void verticalZoomOut()
          (non-Javadoc).
 
Methods inherited from class leon.view.win.swing.LySwingPanel
setPopupMenu
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.graphic.LyGraphicalComponent
getViewComponent
 

Field Detail

__VERSION

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

LySwingGantt

public LySwingGantt(LyGantt gantt)
Class constructor of a Gantt object for the Swing target.

Parameters:
gantt - a GANTT component defined for every type of view targets. This gantt is initialized specificaly for the Swing view.
Method Detail

setIdle

public void setIdle(boolean status)
(non-Javadoc).

Specified by:
setIdle in interface LySetIdleInterface
Parameters:
status - new idle status (LySetIdleInterface interface)
See Also:
LySetIdleInterface.setIdle(boolean)

getComponent

public java.awt.Component getComponent()
(non-Javadoc).

Specified by:
getComponent in interface LySwingComponent
Overrides:
getComponent in class LySwingObject
Returns:
this Swing view component
See Also:
LySwingComponent.getComponent()

setContent

public void setContent()
Sets the Gantt planning dates for this component.


fitSize

public void fitSize(boolean fitView)
Updates the planning with the Gantt minimum and maximum size. The view rectangle of the planning may or may not be updated.

Parameters:
fitView - Indicates if the view rectangle must be updated.

setHCenteredLine

public void setHCenteredLine(java.lang.String line)
(non-Javadoc).

Specified by:
setHCenteredLine in interface LyGraphicalGantt
Parameters:
line - New value of hCenteredLine.
See Also:
LyGraphicalGantt.setHCenteredLine(java.lang.String)

setVCenteredLine

public void setVCenteredLine(java.lang.String lineId)
(non-Javadoc).

Specified by:
setVCenteredLine in interface LyGraphicalGantt
Parameters:
lineId - New value of vCenteredLine.
See Also:
LyGraphicalGantt.setVCenteredLine(java.lang.String)

getCenterDate

public java.util.Date getCenterDate()
(non-Javadoc).

Specified by:
getCenterDate in interface LyGanttInterface
See Also:
LyGanttInterface.getCenterDate()

centerOnDate

public void centerOnDate(java.util.Date date)
(non-Javadoc).

Specified by:
centerOnDate in interface LyGanttInterface
See Also:
LyGanttInterface.centerOnDate(java.util.Date)

verticalZoomIn

public void verticalZoomIn()
(non-Javadoc).

Specified by:
verticalZoomIn in interface LyGanttInterface
See Also:
LyGanttInterface.verticalZoomIn()

verticalZoomOut

public void verticalZoomOut()
(non-Javadoc).

Specified by:
verticalZoomOut in interface LyGanttInterface
See Also:
LyGanttInterface.verticalZoomOut()

getVerticalZoom

public float getVerticalZoom()
(non-Javadoc).

Specified by:
getVerticalZoom in interface LyGanttInterface
See Also:
LyGanttInterface.getVerticalZoom()

displayTimeFrame

public void displayTimeFrame()
(non-Javadoc).

Specified by:
displayTimeFrame in interface LyGanttInterface
See Also:
LyGanttInterface.displayTimeFrame()

startDivideInterval

public void startDivideInterval()
(non-Javadoc).

Specified by:
startDivideInterval in interface LyGanttInterface
See Also:
LyGanttInterface.startDivideInterval()

resetLinesDates

public void resetLinesDates()
Retrieves the Gantt lines of this planning and resets their minimum and maximum dates to this Gantt's dates values.


setZoomFactor

public void setZoomFactor(LyGantt.ZoomFactor scale)
Updates attribute zoomFactor to the given value. The values are the following:

Specified by:
setZoomFactor in interface LyGraphicalGantt
Parameters:
scale - New value of zoomFactor.
See Also:
leon.view.graphic.LyGraphicalGantt#setZoomFactor(short)

setGanttElements

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

Parameters:
treeElement - the tree element
ganttElements - the Gantt elemnt to associate with the tree
See Also:
LyJGanttScrollPane.setGanttElements(Object, Vector)

addLine

public void addLine(LyLine line,
                    int pos)
Computes the tree content again and resets the Gantt intervals dependencies. The specified line and position are already added when this method is called and is only used here to refresh the Swing component.

Specified by:
addLine in interface LyGraphicalGantt
Parameters:
line - Gantt line to add, not used in this implementation
pos - position of the line to add, not used in this implementation
See Also:
LyGraphicalGantt.addLine(leon.view.LyLine, int)

removeLine

public void removeLine(LyLine line)
Computes the tree content again and resets the Gantt intervals dependencies. The specified line and position are already removed when this method is called and is only used here to refresh the Swing component.

Specified by:
removeLine in interface LyGraphicalGantt
Parameters:
line - Gantt line to remove, not used in this implementation
See Also:
LyGraphicalGantt.removeLine(leon.view.LyLine)

actionPerformed

public void actionPerformed(LyActionEvent actionEvent)
(non-Javadoc).

Specified by:
actionPerformed in interface LyActionListener
See Also:
LyActionListener.actionPerformed(leon.view.event.LyActionEvent)

selectionPerformed

public void selectionPerformed(LySelectionEvent selectionEvent)
(non-Javadoc).

Specified by:
selectionPerformed in interface LySelectionListener
Parameters:
selectionEvent - description of the selection which has occured
See Also:
LySelectionListener.selectionPerformed(leon.view.event.LySelectionEvent)

setVisible

public void setVisible(boolean status)
Shows or hides the Gantt planning panel.

Parameters:
status - new visibility status

getDateFormat

public java.text.DateFormat getDateFormat()
Returns the date format of this component.

Returns:
the format used to display the date
See Also:
setDateFormat(String, String)

getTimeFormat

public java.text.DateFormat getTimeFormat()
Returns the time format of this component.

Returns:
the format used to display the time

getDateTimeFormat

public java.text.DateFormat getDateTimeFormat()
Returns the date and time format of this component.

Returns:
the format used to display both the time and the date

getMinimumDate

public java.util.Date getMinimumDate()
Returns the minimum date of this Gantt component.

Returns:
the minimum date

getMaximumDate

public java.util.Date getMaximumDate()
Returns the maximum date of this Gantt component.

Returns:
the maximum date

getBeginDate

public java.util.Date getBeginDate()
Returns the begin date of the planning (first visible date).

Returns:
the begin date
See Also:
setBeginDate(String)

getEndDate

public java.util.Date getEndDate()
Returns the end date of the planning (last visible date).

Returns:
the end date
See Also:
setEndDate(String)

setBeginDate

public void setBeginDate(java.lang.String date)
Not implemented.

Specified by:
setBeginDate in interface LyGraphicalGantt
Parameters:
date - not used in this implementation
See Also:
LyGraphicalGantt.setBeginDate(java.lang.String), getBeginDate()

setEndDate

public void setEndDate(java.lang.String date)
Not implemented.

Specified by:
setEndDate in interface LyGraphicalGantt
Parameters:
date - not used in this implementation
See Also:
LyGraphicalGantt.setEndDate(java.lang.String), getEndDate()

setCurrentDateRefreshPeriod

public void setCurrentDateRefreshPeriod(int period)
Description copied from interface: LyGraphicalGantt
Updates attribute currentDateRefreshPeriod to the given value.

Specified by:
setCurrentDateRefreshPeriod in interface LyGraphicalGantt
Parameters:
period - New value of currentDateRefreshPeriod.
See Also:
LyGraphicalGantt.setCurrentDateRefreshPeriod(int)

addDay

public void addDay(LyDay day,
                   int pos)
Inserts the specified day to the special days list. The specified day and position are already added when this method is called and is only used here to refresh the Swing component.

Specified by:
addDay in interface LyGraphicalGantt
Parameters:
day - the day to add to days list
pos - Position where the sub-component is inserted.
See Also:
LyGraphicalGantt.addDay(LyDay, int)

removeDay

public void removeDay(LyDay day)
Removes the specified day from the special days list. The specified day is already removed when this method is called and is only used here to refresh the Swing component.

Specified by:
removeDay in interface LyGraphicalGantt
Parameters:
day - the day to remove
See Also:
LyGraphicalGantt.removeDay(LyDay)

getActionTransmitter

public LyActionTransmitter getActionTransmitter()
(non-Javadoc).

Specified by:
getActionTransmitter in interface LyEventTransmitter
Overrides:
getActionTransmitter in class LySwingFieldItem
Returns:
the action transmitter of this component
See Also:
LyEventTransmitter.getActionTransmitter()

getSelectionTransmitter

public LySelectionTransmitter getSelectionTransmitter()
(non-Javadoc).

Specified by:
getSelectionTransmitter in interface LyEventTransmitter
Overrides:
getSelectionTransmitter in class LySwingFieldItem
Returns:
null
See Also:
LyEventTransmitter.getSelectionTransmitter()

free

public void free()
Free resources allocated to this component.

Specified by:
free in interface LyGraphicalComponent
Specified by:
free in interface LyFreeInterface
Overrides:
free in class LyGraphicalObject
See Also:
LyFreeInterface.free()

getLock

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

Specified by:
getLock in interface LyGetLockInterface
Returns:
a valid lock for synchronized()

(c) January 2013 - W4 S.A.

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