LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyGanttElementImpl

java.lang.Object
  extended by leon.view.win.swing.component.LyGanttElementImpl
All Implemented Interfaces:
LyGanttElement

public class LyGanttElementImpl
extends java.lang.Object
implements LyGanttElement

Implementation of a LyGanttElement.

See Also:
LyGanttElement

Nested Class Summary
static class LyGanttElementImpl._LyPeriod
          Handles periods specified by 2 dates.
 
Field Summary
static java.lang.String __VERSION
           
static int DEFAULT_INTERVAL_HEIGHT
          Default height of the interval.
static int DEPENDENCIES_DELTA
          Size of the dependency arrows.
 
Fields inherited from interface leon.view.win.swing.component.LyGanttElement
POINT_INTERVAL, REAL_INTERVAL, SUPER_LINE
 
Constructor Summary
LyGanttElementImpl()
          Default constructor.
LyGanttElementImpl(LyComponent component)
          Class constructor for a specified component.
 
Method Summary
 void draw(LyAbstractGanttPanelManager canvas, java.awt.Graphics g, java.awt.Color background, int beginX, int endX, int beginY, int endY)
          (non-Javadoc).
 java.util.Date getBeginDate()
          (non-Javadoc).
 java.util.Vector<LyGanttElement> getDependencies()
          Returns the dependencies of the Gantt element as a list of LyGanttElement.
 java.awt.Rectangle getElementBounds(LyAbstractGanttPanelManager canvas, java.awt.Graphics g)
          (non-Javadoc).
 java.util.Date getEndDate()
          (non-Javadoc).
 java.awt.Point getGanttImageSize()
          (non-Javadoc).
 java.lang.String getId()
          (non-Javadoc).
 int getIndex()
          (non-Javadoc).
 java.lang.String getTooltip()
          (non-Javadoc).
 short getType()
          (non-Javadoc).
 boolean isDrawVerticalLines()
          Indicates if vertical lines must be draws at the extremities of the Gantt element.
 boolean isLeftResizable()
          (non-Javadoc).
 boolean isMovable()
          (non-Javadoc).
 boolean isRightResizable()
          (non-Javadoc).
 boolean moveDates(java.util.Date beginDate, java.util.Date endDate)
          Updates the dates of the component associated with the Gantt element (only if the component is an interval).
 void refreshCanvas()
          Refreshs the drawing component.
 void selectParentLine(boolean select)
          (non-Javadoc).
 void setBeginDate(java.util.Date beginDate)
          Sets the begin date of the Gantt element.
 void setCenterLabel(java.lang.String label)
          Sets the center label of the Gantt element.
 void setColor(java.awt.Color color)
          (non-Javadoc).
 void setComponent(LyComponent component)
          Sets the component associated with the Gantt element.
 void setDateFormat(java.text.DateFormat format)
          Sets the date format used to format date in the Gantt component.
 void setDependencies(java.util.Vector<LyGanttElement> dependencies)
          (non-Javadoc).
 void setDependencyColor(java.awt.Color color)
          Sets the color used to draw the dependencies.
 void setDrawingComponent(java.awt.Component c)
          Sets the drawing component reference to repaint when label/select has changed.
 void setDrawVerticalLines(boolean draw)
          Sets the draw vertical lines parameter of the Gantt element.
 void setEndDate(java.util.Date endDate)
          Sets the end date of the Gantt element.
 void setFont(java.awt.Font font)
          Sets the font.
 void setGanttImage(java.awt.Image image)
          Sets the image used to draw the Gantt element (only for LyGanttElement.POINT_INTERVAL type).
 void setHidden(boolean hidden)
          Sets the hidden parameter of the Gantt element.
 void setId(java.lang.String id)
          Sets the id of the Gantt element.
 void setLabel(java.lang.String label)
          (non-Javadoc).
 void setLabelColor(java.awt.Color color)
          Sets the color of the label.
 void setLeftResizable(boolean resizable)
          Sets the left resizable parameter of the Gantt element.
 void setMovable(boolean movable)
          Sets the movable parameter of the Gantt element.
 void setPeriods(java.util.Vector<LyGanttElementImpl._LyPeriod> periods)
          Sets the periods of the Gantt element.
 void setRightResizable(boolean resizable)
          Sets the right resizable parameter of the Gantt element.
 void setTooltip(java.lang.String tooltip)
          Sets the tooltip of the Gantt element.
 void setType(short type)
          Sets the type of the Gantt element (SUPER_LINE, REAL_INTERVAL, POINT_INTERVAL).
 void setVerticalLinesColor(java.awt.Color color)
          Sets the color of the vertical lines.
 
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_INTERVAL_HEIGHT

public static final int DEFAULT_INTERVAL_HEIGHT
Default height of the interval.

See Also:
Constant Field Values

DEPENDENCIES_DELTA

public static final int DEPENDENCIES_DELTA
Size of the dependency arrows.

See Also:
Constant Field Values
Constructor Detail

LyGanttElementImpl

public LyGanttElementImpl()
Default constructor. Initializes all this class fields to the default values and computes the interval colors.


LyGanttElementImpl

public LyGanttElementImpl(LyComponent component)
Class constructor for a specified component.

Parameters:
component - the component to associate
Method Detail

setColor

public void setColor(java.awt.Color color)
(non-Javadoc).

Specified by:
setColor in interface LyGanttElement
Parameters:
color - new dependencies value
See Also:
LyGanttElement.setColor(java.awt.Color)

setLabelColor

public void setLabelColor(java.awt.Color color)
Sets the color of the label.

Parameters:
color - new color of the label

setVerticalLinesColor

public void setVerticalLinesColor(java.awt.Color color)
Sets the color of the vertical lines.

Parameters:
color - new color of the vertical lines

setFont

public void setFont(java.awt.Font font)
Sets the font.

Parameters:
font - new font

setDependencyColor

public void setDependencyColor(java.awt.Color color)
Sets the color used to draw the dependencies.

Parameters:
color - the new color of the dependencies

setId

public void setId(java.lang.String id)
Sets the id of the Gantt element.

Parameters:
id - the new id of the Gantt element
See Also:
getId()

setDrawingComponent

public void setDrawingComponent(java.awt.Component c)
Sets the drawing component reference to repaint when label/select has changed.

Specified by:
setDrawingComponent in interface LyGanttElement
Parameters:
c - the drawing component
See Also:
LyGanttElement.setDrawingComponent(Component)

setComponent

public void setComponent(LyComponent component)
Sets the component associated with the Gantt element.

Parameters:
component - the component associated with the Gantt element

setDateFormat

public void setDateFormat(java.text.DateFormat format)
Sets the date format used to format date in the Gantt component.

Parameters:
format - new date format

setLabel

public void setLabel(java.lang.String label)
(non-Javadoc).

Specified by:
setLabel in interface LyGanttElement
Parameters:
label - new label value
See Also:
LyGanttElement.setLabel(java.lang.String)

setTooltip

public void setTooltip(java.lang.String tooltip)
Sets the tooltip of the Gantt element.

Parameters:
tooltip - the new tooltip text
See Also:
getTooltip()

getTooltip

public java.lang.String getTooltip()
(non-Javadoc).

Specified by:
getTooltip in interface LyGanttElement
Returns:
the tooltip of the element
See Also:
LyGanttElement.getTooltip()

setCenterLabel

public void setCenterLabel(java.lang.String label)
Sets the center label of the Gantt element.

Parameters:
label - the new center label

setBeginDate

public void setBeginDate(java.util.Date beginDate)
Sets the begin date of the Gantt element.

Parameters:
beginDate - new begin date
See Also:
getBeginDate()

setEndDate

public void setEndDate(java.util.Date endDate)
Sets the end date of the Gantt element.

Parameters:
endDate - new end date
See Also:
getEndDate()

setDependencies

public void setDependencies(java.util.Vector<LyGanttElement> dependencies)
(non-Javadoc).

Specified by:
setDependencies in interface LyGanttElement
Parameters:
dependencies - new dependencies value
See Also:
LyGanttElement.setDependencies(java.util.Vector)

setPeriods

public void setPeriods(java.util.Vector<LyGanttElementImpl._LyPeriod> periods)
Sets the periods of the Gantt element.

Parameters:
periods - the list of element period

setMovable

public void setMovable(boolean movable)
Sets the movable parameter of the Gantt element.

Parameters:
movable - indicates if the Gantt element is movable or not

setLeftResizable

public void setLeftResizable(boolean resizable)
Sets the left resizable parameter of the Gantt element.

Parameters:
resizable - indicates if the Gantt element is left resizable or not

setRightResizable

public void setRightResizable(boolean resizable)
Sets the right resizable parameter of the Gantt element.

Parameters:
resizable - indicates if the Gantt element is right resizable or not

setDrawVerticalLines

public void setDrawVerticalLines(boolean draw)
Sets the draw vertical lines parameter of the Gantt element.

Parameters:
draw - indicates if vertical lines must be drawn

setHidden

public void setHidden(boolean hidden)
Sets the hidden parameter of the Gantt element.

Parameters:
hidden - indicates element is hidden

setGanttImage

public void setGanttImage(java.awt.Image image)
Sets the image used to draw the Gantt element (only for LyGanttElement.POINT_INTERVAL type).

Parameters:
image - the new image

setType

public void setType(short type)
Sets the type of the Gantt element (SUPER_LINE, REAL_INTERVAL, POINT_INTERVAL).

Parameters:
type - the new type
See Also:
getType()

refreshCanvas

public void refreshCanvas()
Refreshs the drawing component.


selectParentLine

public void selectParentLine(boolean select)
(non-Javadoc).

Specified by:
selectParentLine in interface LyGanttElement
Parameters:
select - indicates if parent line must be selected or unselected
See Also:
LyGanttElement.selectParentLine(boolean)

moveDates

public boolean moveDates(java.util.Date beginDate,
                         java.util.Date endDate)
Updates the dates of the component associated with the Gantt element (only if the component is an interval).

Specified by:
moveDates in interface LyGanttElement
Parameters:
beginDate - new begin date of the element
endDate - new end date of the element
Returns:
true if at least one date has changed, false otherwise
See Also:
LyGanttElement.moveDates(Date, Date)

getId

public java.lang.String getId()
(non-Javadoc).

Specified by:
getId in interface LyGanttElement
Returns:
the id of the Gantt element
See Also:
LyGanttElement.getId()

getType

public short getType()
(non-Javadoc).

Specified by:
getType in interface LyGanttElement
Returns:
the type of the element: it may be LyGanttElement.SUPER_LINE, LyGanttElement.REAL_INTERVAL or LyGanttElement.POINT_INTERVAL
See Also:
LyGanttElement.getType()

getDependencies

public java.util.Vector<LyGanttElement> getDependencies()
Returns the dependencies of the Gantt element as a list of LyGanttElement.

Specified by:
getDependencies in interface LyGanttElement
Returns:
a list of Gantt Element
See Also:
setDependencies(Vector), LyGanttElement.getDependencies()

getBeginDate

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

Specified by:
getBeginDate in interface LyGanttElement
Returns:
the begin date of the Gantt element
See Also:
LyGanttElement.getBeginDate()

getEndDate

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

Specified by:
getEndDate in interface LyGanttElement
Returns:
the end date of the Gantt element
See Also:
LyGanttElement.getEndDate()

isMovable

public boolean isMovable()
(non-Javadoc).

Specified by:
isMovable in interface LyGanttElement
Returns:
true if the element is movable, false otherwise
See Also:
LyGanttElement.isMovable()

isLeftResizable

public boolean isLeftResizable()
(non-Javadoc).

Specified by:
isLeftResizable in interface LyGanttElement
Returns:
true if the element is resizable from its left extremity, false otherwise
See Also:
LyGanttElement.isLeftResizable()

isRightResizable

public boolean isRightResizable()
(non-Javadoc).

Specified by:
isRightResizable in interface LyGanttElement
Returns:
true if the element is resizable from its right extremity, false otherwise
See Also:
LyGanttElement.isRightResizable()

isDrawVerticalLines

public boolean isDrawVerticalLines()
Indicates if vertical lines must be draws at the extremities of the Gantt element.

Returns:
true if the vertical lines must be drawn, false otherwise

getIndex

public int getIndex()
(non-Javadoc).

Specified by:
getIndex in interface LyGanttElement
Returns:
the index of the Gantt element
See Also:
LyGanttElement.getIndex()

getGanttImageSize

public java.awt.Point getGanttImageSize()
(non-Javadoc).

Specified by:
getGanttImageSize in interface LyGanttElement
Returns:
the dimension of the image used to represent the Gantt element
See Also:
LyGanttElement.getGanttImageSize()

getElementBounds

public java.awt.Rectangle getElementBounds(LyAbstractGanttPanelManager canvas,
                                           java.awt.Graphics g)
(non-Javadoc).

Specified by:
getElementBounds in interface LyGanttElement
Parameters:
canvas - the canvas containing the element
g - the graphics context
Returns:
the bounds of the Gantt element representation
See Also:
LyGanttElement.getElementBounds(leon.view.win.swing.component.LyAbstractGanttPanelManager, java.awt.Graphics)

draw

public void draw(LyAbstractGanttPanelManager canvas,
                 java.awt.Graphics g,
                 java.awt.Color background,
                 int beginX,
                 int endX,
                 int beginY,
                 int endY)
(non-Javadoc).

Specified by:
draw in interface LyGanttElement
Parameters:
canvas - the instance of LyGanttCanvas
g - the graphics context
background - the background color
beginX - begin X coordinate
endX - end X coordinate
beginY - begin Y coordinate
endY - end Y coordinate
See Also:
LyGanttElement.draw(leon.view.win.swing.component.LyAbstractGanttPanelManager, java.awt.Graphics, java.awt.Color, int, int, int, int)

(c) January 2013 - W4 S.A.

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