net.sourceforge.ganttproject
Class GanttGraphicArea

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--net.sourceforge.ganttproject.GanttGraphicArea
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable

public class GanttGraphicArea
extends javax.swing.JPanel
implements java.awt.print.Printable

Classe for the graphic part of the soft

See Also:
Serialized Form

Nested Class Summary
 class GanttGraphicArea.Arrow
          Draw arrow between two points
 class GanttGraphicArea.GanttPaintParam
          Class to store parameters of each task (pixel to start, end y value...
 class GanttGraphicArea.Notes
          Note paint of the graphic Area
 
Field Summary
 GanttCalendar beg
          Begin of project
 GanttCalendar date
          Begin of display.
 GanttCalendar end
          End date for the project
static int FOUR_MONTH
          Zoom to tree month
 int mouseButton
          The mouse button press
 GanttCalendar olddate
          Begin of display.
static int ONE_MONTH
          Zoom to one month
static int ONE_WEEK
          Zoom to on week
static int ONE_YEAR
          Zoom to one year
static int SIX_MONTH
          Zoom to six month
static java.awt.Color taskDefaultColor
          Default color for tasks
static int THREE_MONTH
          Zoom to tree month
static int THREE_YEAR
          Zoom to three year
 GanttTree tree
          Reference to the GanttTree
static int TWO_MONTH
          Zoom to two month
static int TWO_WEEK
          Zoom to two week
static int TWO_YEAR
          Zoom to two year
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GanttGraphicArea(GanttProject app, GanttTree ttree)
          Constructor
 
Method Summary
 void changeDate(boolean next)
          Method to change the date
 int detectPosition(int mx, int my, boolean all)
          Detect if the position of the mouse is on a special place (return -1 if nothing or the numer of the task
 void drawVerticalLinedash(java.awt.Graphics g, int x, int y1, int y2, int size)
          Draw a vertical dash line from point (x1, y1) to (x2, y2)
 void export(java.io.File file, boolean name, boolean percent, boolean depend)
          Function able to export in PNG format the graphic area
 void fitWholeProject(boolean resize)
          Resizes the area to fit the whole project.
 GanttCalendar getDate()
          Return the date
 int getFoot()
          Return the advance foot
 int getGranit(boolean day)
          Return the number of day visible for each level of granularity
 java.awt.Dimension getPreferredSize()
          The size of the panel.
 int getScrollBar()
          Return the value of the JTree's Scrollbar
 java.awt.Color getTaskColor()
          Return the color of the task
 int getZoom()
          Return the zoom value
 int indexOf(java.util.ArrayList listOfParam, int id)
          Search for a coef on the arraylist
 boolean isVisible(GanttTask thetask)
          Is the Task visible on the JTree
 int paintAdvancement(java.awt.Graphics g, int x1, int x2, int y, int percent, ShapePaint shape, java.awt.Color color, boolean justText)
          Paint advance state of the task
 void paintATaskBilan(java.awt.Graphics g, int x1, int y, java.lang.String taskName, java.awt.Color color)
          Draw a meeting task
 void paintATaskChild(java.awt.Graphics g, int x1, int x2, int y, java.lang.String taskName, java.awt.Color color)
          Draw a normal task
 void paintATaskFather(java.awt.Graphics g, int x1, int x2, int y, java.lang.String taskName, java.awt.Color color)
          Draw a monther task
 void paintCalendar1(java.awt.Graphics g)
          Paint the vertical bars
 void paintCalendar2(java.awt.Graphics g)
          Draw the legend of the calendar
 void paintComponent(java.awt.Graphics g)
          draw the panel
 void paintDepend(java.awt.Graphics g)
          Draw the arrows for depends
 void paintTasks(java.awt.Graphics g)
          Paint all tasks
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Print the page
 void printProject(boolean name, boolean percent, boolean depend)
          Print the project
 void setDate(GanttCalendar d)
          Change the date of the begin to paint
 void setScrollBar(int v)
          Change the velue connected to the JTree's Scrollbar
 void setTaskColor(java.awt.Color c)
          Change the color of the task
 void setTaskToMove(int index)
          The te task we want to move
 void setZoom(int z)
          Change the zoom value
 void zoomLess()
          Less a zoom
 void zoomMore()
          Add a zoom
 void zoomToBegin()
          Method when zoomin, to set at the begin for each value
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

date

public GanttCalendar date
Begin of display.


olddate

public GanttCalendar olddate
Begin of display.


tree

public GanttTree tree
Reference to the GanttTree


ONE_WEEK

public static final int ONE_WEEK
Zoom to on week

See Also:
Constant Field Values

TWO_WEEK

public static final int TWO_WEEK
Zoom to two week

See Also:
Constant Field Values

ONE_MONTH

public static final int ONE_MONTH
Zoom to one month

See Also:
Constant Field Values

TWO_MONTH

public static final int TWO_MONTH
Zoom to two month

See Also:
Constant Field Values

THREE_MONTH

public static final int THREE_MONTH
Zoom to tree month

See Also:
Constant Field Values

FOUR_MONTH

public static final int FOUR_MONTH
Zoom to tree month

See Also:
Constant Field Values

SIX_MONTH

public static final int SIX_MONTH
Zoom to six month

See Also:
Constant Field Values

ONE_YEAR

public static final int ONE_YEAR
Zoom to one year

See Also:
Constant Field Values

TWO_YEAR

public static final int TWO_YEAR
Zoom to two year

See Also:
Constant Field Values

THREE_YEAR

public static final int THREE_YEAR
Zoom to three year

See Also:
Constant Field Values

taskDefaultColor

public static java.awt.Color taskDefaultColor
Default color for tasks


beg

public GanttCalendar beg
Begin of project


end

public GanttCalendar end
End date for the project


mouseButton

public int mouseButton
The mouse button press

Constructor Detail

GanttGraphicArea

public GanttGraphicArea(GanttProject app,
                        GanttTree ttree)
Constructor

Method Detail

getTaskColor

public java.awt.Color getTaskColor()
Return the color of the task


setTaskColor

public void setTaskColor(java.awt.Color c)
Change the color of the task


detectPosition

public int detectPosition(int mx,
                          int my,
                          boolean all)
Detect if the position of the mouse is on a special place (return -1 if nothing or the numer of the task


setTaskToMove

public void setTaskToMove(int index)
The te task we want to move


getPreferredSize

public java.awt.Dimension getPreferredSize()
The size of the panel.

Overrides:
getPreferredSize in class javax.swing.JComponent

changeDate

public void changeDate(boolean next)
Method to change the date


zoomToBegin

public void zoomToBegin()
Method when zoomin, to set at the begin for each value


paintComponent

public void paintComponent(java.awt.Graphics g)
draw the panel

Overrides:
paintComponent in class javax.swing.JComponent

isVisible

public boolean isVisible(GanttTask thetask)
Is the Task visible on the JTree


indexOf

public int indexOf(java.util.ArrayList listOfParam,
                   int id)
Search for a coef on the arraylist


setScrollBar

public void setScrollBar(int v)
Change the velue connected to the JTree's Scrollbar


getScrollBar

public int getScrollBar()
Return the value of the JTree's Scrollbar


setZoom

public void setZoom(int z)
Change the zoom value


zoomMore

public void zoomMore()
Add a zoom


zoomLess

public void zoomLess()
Less a zoom


getZoom

public int getZoom()
Return the zoom value


setDate

public void setDate(GanttCalendar d)
Change the date of the begin to paint


getDate

public GanttCalendar getDate()
Return the date


getGranit

public int getGranit(boolean day)
Return the number of day visible for each level of granularity


getFoot

public int getFoot()
Return the advance foot


paintCalendar1

public void paintCalendar1(java.awt.Graphics g)
Paint the vertical bars


paintCalendar2

public void paintCalendar2(java.awt.Graphics g)
Draw the legend of the calendar


paintTasks

public void paintTasks(java.awt.Graphics g)
Paint all tasks


paintATaskFather

public void paintATaskFather(java.awt.Graphics g,
                             int x1,
                             int x2,
                             int y,
                             java.lang.String taskName,
                             java.awt.Color color)
Draw a monther task


paintATaskChild

public void paintATaskChild(java.awt.Graphics g,
                            int x1,
                            int x2,
                            int y,
                            java.lang.String taskName,
                            java.awt.Color color)
Draw a normal task


paintATaskBilan

public void paintATaskBilan(java.awt.Graphics g,
                            int x1,
                            int y,
                            java.lang.String taskName,
                            java.awt.Color color)
Draw a meeting task


paintDepend

public void paintDepend(java.awt.Graphics g)
Draw the arrows for depends


paintAdvancement

public int paintAdvancement(java.awt.Graphics g,
                            int x1,
                            int x2,
                            int y,
                            int percent,
                            ShapePaint shape,
                            java.awt.Color color,
                            boolean justText)
Paint advance state of the task


drawVerticalLinedash

public void drawVerticalLinedash(java.awt.Graphics g,
                                 int x,
                                 int y1,
                                 int y2,
                                 int size)
Draw a vertical dash line from point (x1, y1) to (x2, y2)


print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
Print the page

Specified by:
print in interface java.awt.print.Printable

printProject

public void printProject(boolean name,
                         boolean percent,
                         boolean depend)
Print the project


export

public void export(java.io.File file,
                   boolean name,
                   boolean percent,
                   boolean depend)
Function able to export in PNG format the graphic area


fitWholeProject

public void fitWholeProject(boolean resize)
Resizes the area to fit the whole project. Height is set according to the number of tasks. Width is not changed, but zooming is set instead



${copyright}