LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts
Class LyStrutsGantt

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.web.LyWebObject
          extended by leon.view.web.LyWebPageWriter
              extended by leon.view.web.struts.LyStrutsGantt
All Implemented Interfaces:
LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalGantt, LyGraphicalPanel, LyViewComponent, LyFreeInterface, LyResetContentInterface, LySetIdleInterface, LySetVisibleInterface, LyWebComponent

public class LyStrutsGantt
extends LyWebPageWriter
implements LyGraphicalGantt, LySetVisibleInterface, LyResetContentInterface, LySetIdleInterface

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

GANTT: GANTT planning
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). Remark: a generic Leonardi action « _gantt » is added with its controller, builder and behavior.

See Also:
LyMap

Field Summary
static java.lang.String __VERSION
           
static boolean CLEAR_GANTT_FILES
          Force the gantt to keep the ten last gantt files and to destroy the oldest.
static int GANTT_HEIGHT
          The Gantt height.
static int GANTT_WIDTH
          The Gantt width.
 
Fields inherited from class leon.view.web.LyWebPageWriter
FORCE_AJAX, MAIN_BUFFER
 
Fields inherited from class leon.view.web.LyWebObject
WEB_COMPONENT_ID, WEB_CONTROLLER_ID, WEB_SESSION_ID
 
Constructor Summary
LyStrutsGantt(LyGantt gantt)
          Class constructor of a Map object for the struts target.
 
Method Summary
 void addDay(LyDay day, int pos)
          Inserts a sub-component daies at given position.
 void addLine(LyLine line, int pos)
          Inserts a sub-component lines at given position.
 void addSensitiveItem(java.awt.Rectangle rect, java.lang.String id, java.lang.String tooltip)
          Adds a sensitive item to the planning.
 java.util.Date getBeginDate()
          Gets the begin date of the planning (first date visible).
 java.awt.Color getColor(java.lang.String key)
          Retrieves a Color from the current environment.
 java.text.DateFormat getDateFormat()
          Gets the date format of the component.
 java.text.DateFormat getDateTimeFormat()
          Gets the date and time format of the component.
static java.awt.Frame getDefaultFrame()
          Gets the default frame.
 java.util.Date getEndDate()
          Gets the end date of the planning (last date visible).
 java.awt.Font getFont(java.lang.String key)
          Retrieves a Font from the current environment.
 LyStrutsGanttCanvas getGanttCanvas()
          Gets the Gantt canvas.
static java.lang.String getHexString(java.awt.Color color)
          Gets the hexadecimal string representing the given color.
 java.lang.String getId()
          (non-Javadoc).
 java.util.Hashtable<LyStrutsLine,java.awt.Rectangle> getLinesBounds()
          Gets the positions of the lines.
 java.util.Vector<LyWebPageWriter> getPageWriters()
          (non-Javadoc).
 java.lang.String getRedirect(java.lang.String frame)
          Gets the url for an alternate Web page.
 int getScrollHeightForSplitter(LyWebPageWriter pw)
          Indicates whether this component needs scrollbars when inserted in a splitter.
 java.text.DateFormat getTimeFormat()
          Gets the time format of the component.
 void init()
          Initialization method.
 boolean isFrameSet()
          (non-Javadoc).
 void preparePage(java.lang.String frame, java.lang.String targetWindow)
          (non-Javadoc).
 void refreshGanttImage()
          Refresh the image of the planning.
 void removeDay(LyDay day)
          Removes a sub-component daies.
 void removeLine(LyLine line)
          Removes a sub-component lines.
 void resetContent()
          Reset the view for a new XML Structure.
 void resetContent(boolean full)
          Reset the view for a new XML Structure.
 void setBeginDate(java.lang.String beginDate)
          Updates attribute beginDate to the given value.
 void setContent()
          Sets the content of the gantt planning.
 void setCurrentDateRefreshPeriod(int period)
          Updates attribute currentDateRefreshPeriod to the given value.
 void setEndDate(java.lang.String endDate)
          Updates attribute endDate to the given value.
 void setHCenteredLine(java.lang.String line)
          Updates attribute hCenteredLine to the given value.
 void setIdle(boolean status)
          Sets or unset the idle mode on the component/node.
 void setSelectedLine(LyLine line)
          Sets the selected line.
 void setVCenteredLine(java.lang.String line)
          Updates attribute vCenteredLine to the given value.
 void setVisible(boolean status)
          Sets the visibility status of this component.
 void setZoomFactor(LyGantt.ZoomFactor scale)
          Updates attribute zoomFactor to the given value.
 void writeHtml(LyWebPageWriter pw)
          Write HTML description corresponding to this component.
 void writePlanning(LyWebPageWriter pw)
          Write the planning part of the Gantt.
 void writeTree(LyWebPageWriter pw)
          Writes the tree part of the Gantt.
 
Methods inherited from class leon.view.web.LyWebPageWriter
addBeginScript, addCssScript, addEndScript, addEndScript, append, clearBeginScripts, clearBeginScripts, clearBuffer, clearCssScripts, clearCssScripts, clearEndScripts, clearEndScripts, copyScriptsTo, endComponent, free, getActionUrl, getActiveFormId, getActiveName, getAttachmentDirectory, getAttachmentHandler, getBackground, getBackgroundColor, getBeginScriptsAsHtml, getBuffer, getCssFileAsHtml, getCssScriptsAsHtml, getEndScriptsAsHtml, getForceReloadState, getFormId, getFrameName, getLastReloadTime, getNextJavaScriptId, getOldIds, getOpenFormContent, getOpenFormContent, getProperty, getScriptRoot, getTarget, getWindowName, isInnerView, isNoFrames, isPrintMode, isVisible, setActiveBuffer, setAttachmentDirectory, setAttachmentDirectory, setAttachmentHandler, setAttachmentHandler, setBackground, setBackgroundColor, setBodyClassName, setForceReloadState, setFormId, setFrameName, setInnerView, setLastModified, setNoFrames, setPrintMode, setProperty, setTitle, setWindowName, setWriteDivOnly, startComponent, writeBeginPage, writeBeginScripts, writeCssScripts, writeDivOnly, writeEndPage, writeEndScripts, writeHtml, writePageContent
 
Methods inherited from class leon.view.web.LyWebObject
addFileScript, decodeUrl, displayUpPage, encodeUrl, encodeUrlXhtml, expandUrl, getDisabledImageUrl, getFontSize, getFontString, getFontString, getFontString, getHexColor, getHexColor, getHtmlEntitiesString, getHtmlString, getImageSize, getImageSize, getImageUrl, getJavascriptString, getLastFrameName, getLyFont, getMessage, getRootUrl, getRootURL, getUrl, getWebViewManager, refresh, replaceUrl, replaceUrl, setUpdating, updateRefreshInfo, writeJson
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, getBounds, getChildrenBounds, getController, getEnv, getEnvironment, getIdCode, getIntResource, 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
free, getViewComponent
 

Field Detail

__VERSION

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

GANTT_WIDTH

public static int GANTT_WIDTH
The Gantt width.


GANTT_HEIGHT

public static int GANTT_HEIGHT
The Gantt height.


CLEAR_GANTT_FILES

public static boolean CLEAR_GANTT_FILES
Force the gantt to keep the ten last gantt files and to destroy the oldest.

Constructor Detail

LyStrutsGantt

public LyStrutsGantt(LyGantt gantt)
Class constructor of a Map object for the struts target.

Parameters:
map - the generic Map defined for every type of view targets.
Method Detail

getDefaultFrame

public static java.awt.Frame getDefaultFrame()
Gets the default frame.

Returns:
the default frame.

getHexString

public static java.lang.String getHexString(java.awt.Color color)
Gets the hexadecimal string representing the given color.

Parameters:
color - The color to convert.
Returns:
The hexadecimal code for the color.

isFrameSet

public boolean isFrameSet()
Description copied from class: LyWebPageWriter
(non-Javadoc).

Overrides:
isFrameSet in class LyWebPageWriter
See Also:
LyWebPageWriter.isFrameSet()

getScrollHeightForSplitter

public int getScrollHeightForSplitter(LyWebPageWriter pw)
Description copied from class: LyWebObject
Indicates whether this component needs scrollbars when inserted in a splitter.

Overrides:
getScrollHeightForSplitter in class LyWebObject
Parameters:
pw - current page writer
Returns:
a positive value if this component needs scrollbars, a negative or null value otherwise.

init

public void init()
Initialization method.
Overriden to add initialization of this class attributes.
Call the super implementation then create empty lists, a gantt Canvas, sets the zoom factor with the generic gantt component value. Sets the current line position and the selected line with default values. Sets images with values defined in resources files.

Overrides:
init in class LyWebPageWriter
See Also:
leon.view.web.LyWebPage#init()

setContent

public void setContent()
Sets the content of the gantt planning.


getBeginDate

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

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

getEndDate

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

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

getDateFormat

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

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

getTimeFormat

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

Returns:
the time format

getDateTimeFormat

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

Returns:
the date and time format

getLinesBounds

public java.util.Hashtable<LyStrutsLine,java.awt.Rectangle> getLinesBounds()
Gets the positions of the lines.

Returns:
the list of lines positions

writeHtml

public void writeHtml(LyWebPageWriter pw)
Description copied from interface: LyWebComponent
Write HTML description corresponding to this component.

Specified by:
writeHtml in interface LyWebComponent
Parameters:
pw - the page writer

preparePage

public void preparePage(java.lang.String frame,
                        java.lang.String targetWindow)
Description copied from class: LyWebPageWriter
(non-Javadoc).

Overrides:
preparePage in class LyWebPageWriter
See Also:
LyWebPageWriter.preparePage(java.lang.String, java.lang.String)

writeTree

public void writeTree(LyWebPageWriter pw)
Writes the tree part of the Gantt.

Parameters:
pw - current page writer

writePlanning

public void writePlanning(LyWebPageWriter pw)
Write the planning part of the Gantt.

Parameters:
pw - current page writer

addSensitiveItem

public void addSensitiveItem(java.awt.Rectangle rect,
                             java.lang.String id,
                             java.lang.String tooltip)
Adds a sensitive item to the planning.

Parameters:
rect - the rectangle where to add the element
id - the item id
tooltip - the tooltip

setVisible

public void setVisible(boolean status)
Description copied from interface: LySetVisibleInterface
Sets the visibility status of this component.

Specified by:
setVisible in interface LySetVisibleInterface
Overrides:
setVisible in class LyWebPageWriter
Parameters:
status - new visibility status, if true the component will be shown, if false it will be hiden

resetContent

public void resetContent()
Description copied from interface: LyResetContentInterface
Reset the view for a new XML Structure. Reinitialization.

Specified by:
resetContent in interface LyResetContentInterface

resetContent

public void resetContent(boolean full)
Description copied from interface: LyResetContentInterface
Reset the view for a new XML Structure. Reinitialization.

Specified by:
resetContent in interface LyResetContentInterface
Parameters:
full - indicates whether old components must be removed from graphical view.

getGanttCanvas

public LyStrutsGanttCanvas getGanttCanvas()
Gets the Gantt canvas.

Returns:
the gantt canvas

getId

public java.lang.String getId()
Description copied from class: LyWebPageWriter
(non-Javadoc).

Overrides:
getId in class LyWebPageWriter
See Also:
LyWebPageWriter.getId()

getColor

public final java.awt.Color getColor(java.lang.String key)
Retrieves a Color from the current environment.

Parameters:
key - The ressource name (key) of the Color.
Returns:
A reference to the requested Color, or null if it could not be found.
See Also:
LyEnvironment.getColor(String)

getFont

public final java.awt.Font getFont(java.lang.String key)
Retrieves a Font from the current environment.

Parameters:
key - The ressource name (key) of the font.
Returns:
A reference to the requested Font, or a default font if it could not be found.
See Also:
LyEnvironment.getFont(String)

addLine

public void addLine(LyLine line,
                    int pos)
Description copied from interface: LyGraphicalGantt
Inserts a sub-component lines at given position.

Specified by:
addLine in interface LyGraphicalGantt
Parameters:
line - The lines to add to lines list.
pos - Position where the sub-component is inserted.

removeLine

public void removeLine(LyLine line)
Description copied from interface: LyGraphicalGantt
Removes a sub-component lines.

Specified by:
removeLine in interface LyGraphicalGantt
Parameters:
line - The lines to remove to lines list.

addDay

public void addDay(LyDay day,
                   int pos)
Description copied from interface: LyGraphicalGantt
Inserts a sub-component daies at given position.

Specified by:
addDay in interface LyGraphicalGantt
Parameters:
day - The daies to add to daies list.
pos - Position where the sub-component is inserted.

removeDay

public void removeDay(LyDay day)
Description copied from interface: LyGraphicalGantt
Removes a sub-component daies.

Specified by:
removeDay in interface LyGraphicalGantt
Parameters:
day - The daies to remove to daies list.

setBeginDate

public void setBeginDate(java.lang.String beginDate)
Description copied from interface: LyGraphicalGantt
Updates attribute beginDate to the given value.

Specified by:
setBeginDate in interface LyGraphicalGantt
Parameters:
beginDate - New value of beginDate.

setEndDate

public void setEndDate(java.lang.String endDate)
Description copied from interface: LyGraphicalGantt
Updates attribute endDate to the given value.

Specified by:
setEndDate in interface LyGraphicalGantt
Parameters:
endDate - New value of endDate.

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.

setHCenteredLine

public void setHCenteredLine(java.lang.String line)
Description copied from interface: LyGraphicalGantt
Updates attribute hCenteredLine to the given value.

Specified by:
setHCenteredLine in interface LyGraphicalGantt
Parameters:
line - New value of hCenteredLine.

setVCenteredLine

public void setVCenteredLine(java.lang.String line)
Description copied from interface: LyGraphicalGantt
Updates attribute vCenteredLine to the given value.

Specified by:
setVCenteredLine in interface LyGraphicalGantt
Parameters:
line - New value of vCenteredLine.

setZoomFactor

public void setZoomFactor(LyGantt.ZoomFactor scale)
Description copied from interface: LyGraphicalGantt
Updates attribute zoomFactor to the given value.

Specified by:
setZoomFactor in interface LyGraphicalGantt
Parameters:
scale - New value of zoomFactor.

setSelectedLine

public void setSelectedLine(LyLine line)
Sets the selected line.

Parameters:
line - the new selected line

setIdle

public void setIdle(boolean status)
Description copied from interface: LySetIdleInterface
Sets or unset the idle mode on the component/node.

Specified by:
setIdle in interface LySetIdleInterface
Parameters:
status - new idle status (LySetIdleInterface interface)

refreshGanttImage

public void refreshGanttImage()
Refresh the image of the planning.


getPageWriters

public java.util.Vector<LyWebPageWriter> getPageWriters()
Description copied from class: LyWebPageWriter
(non-Javadoc).

Specified by:
getPageWriters in class LyWebPageWriter
See Also:
LyWebPageWriter.getPageWriters()

getRedirect

public java.lang.String getRedirect(java.lang.String frame)
Description copied from class: LyWebPageWriter
Gets the url for an alternate Web page.

Specified by:
getRedirect in class LyWebPageWriter
Parameters:
frame - the frame to redirect
Returns:
the URL of the alternate Web page

(c) January 2013 - W4 S.A.

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