LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts.gantt
Class LyStrutsGanttCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by leon.view.web.struts.gantt.LyStrutsGanttCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, LyFreeInterface

public class LyStrutsGanttCanvas
extends java.awt.Canvas
implements LyFreeInterface

This class defines a Gantt component.

See Also:
Serialized Form

Nested Class Summary
static class LyStrutsGanttCanvas._LySpecialDay
          Internal class representing a special day for the planning.
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String __VERSION
           
static int DEFAULT_HEIGHT
          The default height.
static int DEFAULT_SCALE_HEIGHT
          Default scale height at the top of the component.
static int DEFAULT_WIDTH
          The default width.
static short SCALE_DAY
          Scale (in day).
static short SCALE_HOUR
          Scale (in hour).
static short SCALE_MINUTE
          Scale (in minute).
static short SCALE_MONTH
          Scale (in month).
static short SCALE_SECOND
          Scale (in second).
static short SCALE_WEEK
          Scale (in week).
static short SCALE_YEAR
          Scale (in year).
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LyStrutsGanttCanvas()
          Class constructor of a Gantt object for the struts target.
LyStrutsGanttCanvas(LyStrutsGantt parent)
          Deprecated. replaced by LyStrutsGanttCanvas() because the parent parameter is not used.
 
Method Summary
 void addSensitiveItem(java.awt.Rectangle rect, java.lang.String id, java.lang.String tooltip)
          Adds a sensitive item to the planning.
 void addStep(boolean left, boolean remove)
          Adds or removes a step to the planning.
 void checkComponentsSize()
          Check the size of all the components of the canvas.
 java.awt.Dimension computeSize()
          Computes the size of the planning.
 void free()
          Free all used resources.
 long getAbscisseDate(int abscisse)
          Gets the date corresponding to the given abscisse.
 java.util.Date getBeginDate()
          Gets the begin date (the date at position 0 of the abscisse).
 int getDateAbscisse(java.util.Date date)
          Gets the abscisse corresponding to the given date.
 int getDateAbscisse(long time)
          Gets the abscisse corresponding to the given time.
 java.awt.Rectangle getElementBounds(LyInterval interval)
          Gets the bounds of given interval.
 java.util.Date getEndDate()
          Gets the end date (the date at ultimate position of the abscisse).
 LyEnvironment getEnvironment()
          Gets the Leonardi's Environment.
 java.awt.Color getFontColor()
          Gets the font color.
 java.awt.Color getLinesColor()
          Gets the color used to draw the vertical lines of the planning.
 java.util.Date getMaximumDate()
          Gets the maximum date of the planning.
 java.util.Date getMinimumDate()
          Gets the minimum date of the planning.
 java.awt.Dimension getPreferredSize()
          (non-Javadoc).
 java.awt.Color getScaleBackground()
          Gets the scale color of the planning background.
 java.awt.Color getScaleLinesColor()
          Gets the color of the lines scale.
 java.awt.Color getWeekEndColor()
          Gets the color used to draw the week-ends on the planning.
 void init()
          Initialization method.
 void paint(java.awt.Graphics g)
          (non-Javadoc).
 void resetView()
          Resets all to initial values.
 void setBigScale(short scale)
          Sets the big scale of the planning.
 void setBigStep(int step)
          Sets the big step of the planning.
 void setCheckComponentsSize()
          Sets the attribute _checkComponentsSize to true.
 void setCurrentDateDisplayTime(boolean display)
          Indicates if time is displayed with current date cursor.
 void setCurrentDateRefreshPeriod(int period)
          Sets the period of the planning.
 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 font color.
 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 setParent(LyStrutsGantt parent)
          Sets the parent of the gantt.
 void setScale(short scale)
          Sets the scale type of the planning.
 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 setSize(int w, int h)
          (non-Javadoc).
 void setSpecialDays(java.util.Vector<LyStrutsGanttCanvas._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 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 used for weeks.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

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

DEFAULT_WIDTH

public static int DEFAULT_WIDTH
The default width.


DEFAULT_HEIGHT

public static int DEFAULT_HEIGHT
The default height.


DEFAULT_SCALE_HEIGHT

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

See Also:
Constant Field Values

SCALE_SECOND

public static final short SCALE_SECOND
Scale (in second).

See Also:
Constant Field Values

SCALE_MINUTE

public static final short SCALE_MINUTE
Scale (in minute).

See Also:
Constant Field Values

SCALE_HOUR

public static final short SCALE_HOUR
Scale (in hour).

See Also:
Constant Field Values

SCALE_DAY

public static final short SCALE_DAY
Scale (in day).

See Also:
Constant Field Values

SCALE_WEEK

public static final short SCALE_WEEK
Scale (in week).

See Also:
Constant Field Values

SCALE_MONTH

public static final short SCALE_MONTH
Scale (in month).

See Also:
Constant Field Values

SCALE_YEAR

public static final short SCALE_YEAR
Scale (in year).

See Also:
Constant Field Values
Constructor Detail

LyStrutsGanttCanvas

public LyStrutsGanttCanvas(LyStrutsGantt parent)
Deprecated. replaced by LyStrutsGanttCanvas() because the parent parameter is not used.

Class constructor of a Gantt object for the struts target.

Parameters:
parent - the Gantt containing this canvas

LyStrutsGanttCanvas

public LyStrutsGanttCanvas()
Class constructor of a Gantt object for the struts target.

Since:
leonardi V4.0, replaces LyStrutsGanttCanvas(LyStrutsGantt) because the parameter was not used.
Method Detail

init

public void init()
Initialization method.
Sets a default value or null to all class attributes then resets the view.


free

public void free()
Free all used resources.

Specified by:
free in interface LyFreeInterface

getPreferredSize

public java.awt.Dimension getPreferredSize()
(non-Javadoc).

Overrides:
getPreferredSize in class java.awt.Component
See Also:
Component.getPreferredSize()

resetView

public void resetView()
Resets all to initial values. This method does nothing.


getMinimumDate

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

Returns:
the minimum date of the planning

getMaximumDate

public java.util.Date getMaximumDate()
Gets 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 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 time format used to display times

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 planning elements
maximumDate - the maximum date of all planning elements
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

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

getDateAbscisse

public int getDateAbscisse(java.util.Date date)
Gets the abscisse corresponding to the given date.

Parameters:
date - the date to be converted
Returns:
the abscisse corresponding to the given date

getDateAbscisse

public int getDateAbscisse(long time)
Gets the abscisse corresponding to the given time.

Parameters:
time - the time to be converted
Returns:
the abscisse corresponding to the given time

getAbscisseDate

public long getAbscisseDate(int abscisse)
Gets the date corresponding to the given abscisse.

Parameters:
abscisse - the abscisse to be converted
Returns:
the date corresponding to the given abscisse

computeSize

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

Returns:
the size of the planning

getElementBounds

public java.awt.Rectangle getElementBounds(LyInterval interval)
Gets the bounds of given interval.

Parameters:
interval - the interval
Returns:
the bounds of given interval

setCheckComponentsSize

public void setCheckComponentsSize()
Sets the attribute _checkComponentsSize to true.


checkComponentsSize

public void checkComponentsSize()
Check the size of all the components of the canvas. If there is no space enough to display them, add a step on the left or on the right and recurse.


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 otherwise
remove - true if step must be removed, false otherwise

setSpecialDays

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

Parameters:
days - the list of _LySpecialDay instances

getBeginDate

public java.util.Date getBeginDate()
Gets the begin date (the date at position 0 of the abscisse).

Returns:
the begin date

getEndDate

public java.util.Date getEndDate()
Gets the end date (the date at ultimate position of the abscisse).

Returns:
the end date

paint

public void paint(java.awt.Graphics g)
(non-Javadoc).

Overrides:
paint in class java.awt.Canvas
See Also:
Component.paint(java.awt.Graphics)

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
id - the id
tooltip - the tooltip

setScaleBackground

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

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

getScaleBackground

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

Returns:
the background scale color if exist, else the Gray.
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 color of the lines scale.

Returns:
The color of the lines scale if exist, else Dark Gray.
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 color used to draw the vertical lines of the planning.

Returns:
The vertical lines color if exist, else Dark Gray.
See Also:
setLinesColor(Color)

setFontColor

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

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

getFontColor

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

Returns:
the font color
See Also:
setFontColor(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

setWeekInitial

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

Parameters:
weekInitial - the string used for weeks

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

getWeekEndColor

public java.awt.Color getWeekEndColor()
Gets the color used to draw the week-ends on the planning.

Returns:
the color used to draw the week-ends on the planning

setParent

public void setParent(LyStrutsGantt parent)
Sets the parent of the gantt.

Parameters:
parent - the Gantt containing this GanttCanvas

setSize

public void setSize(int w,
                    int h)
(non-Javadoc).

Overrides:
setSize in class java.awt.Component
See Also:
Component.setSize(int, int)

setCurrentDateRefreshPeriod

public void setCurrentDateRefreshPeriod(int period)
Sets the period of the planning.

Parameters:
period - the period in seconds

setCurrentDateDisplayTime

public void setCurrentDateDisplayTime(boolean display)
Indicates if time is displayed with current date cursor.

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

setStep

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

Parameters:
step - the new step

setBigStep

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

Parameters:
step - the new big step

setScale

public void setScale(short scale)
Sets the scale type of the planning.

Parameters:
scale - the new scale, can be SCALE_DAY, SCALE_HOUR, SCALE_MINUTE, SCALE_MONTH, SCALE_SECOND, SCALE_WEEK or SCALE_YEAR

setBigScale

public void setBigScale(short scale)
Sets the big scale of the planning.

Parameters:
scale - the new big scale

getEnvironment

public LyEnvironment getEnvironment()
Gets the Leonardi's Environment.

Returns:
the environment

(c) January 2013 - W4 S.A.

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