org.fopps.ui.project
Class ProjectPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.fopps.ui.project.ProjectPanel
All Implemented Interfaces:
javax.accessibility.Accessible, ConfigListener, ContainerSelectable, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, ModelListener, java.awt.print.Printable, java.io.Serializable, ViewActionReceiver

public class ProjectPanel
extends javax.swing.JPanel
implements ContainerSelectable, ModelListener, java.awt.print.Printable, ConfigListener, ViewActionReceiver

ProjectPanel displays scheduling and relations of products and assets

See Also:
Serialized Form

Field Summary
static int BAR_GAP
           
static int BAR_GAP_2
           
static double MAX_ZOOM
           
static double MIN_ZOOM
           
static int NORMAL_FONTSIZE
           
static int NORMAL_TIMEWIDTH
           
static int TEXT_GAP
           
 
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
ProjectPanel(ProjectContainer pProjects)
          Constructor for ProjectPanel.
 
Method Summary
 void addItemListener(java.awt.event.ItemListener pListener)
          Adds a listener
 void addToSelection(AbstractItem pItem)
          Removes an item from selection.
 boolean allowMultipleSelection()
          Returns true if view allows multiple selection.
 boolean canZoom()
          Returns true if view can be zoomed
 void clearSelection()
          Removes all selected elements from selection
 void configChanged(java.lang.String pKey, java.lang.Object pValue)
          Notifies listener that a configuration item has changed
protected  void emitItemEvent(java.awt.event.ItemEvent pEvent)
           
 double getHorzZoomFactor()
           
 int getLineHeight()
          Returns the lineHeight.
 AbstractItem getObjectFromPoint(int x, int y)
          Returns the corresponding item of a coordinate pair.
 AbstractItem getObjectFromPoint(java.awt.Point p)
          Returns the corresponding item to a given point.
 ProjectContainer getProjects()
           
 ProjectItemRenderer getRenderer()
          Returns the current renderer
 java.lang.Object[] getSelectedObjects()
           
 int getTimeWidth()
          Returns the timeWidth.
 double getZoomFactor()
           
 void invertSelection()
          Inverts current selection
 boolean isShowGrid()
          Returns the showGrid.
 boolean isShowTRef()
          Returns the showTRef.
 void modelChanged(ModelEvent ev)
          Invoked on model changes.
 void narrow()
          Narrows current view, if applicable
protected  void notifyChange(AbstractItem pItem)
           
protected  void notifySelection(AbstractItem pItem)
           
protected  void notifyUnselection(AbstractItem pItem)
           
 void paint(java.awt.Graphics g)
           
protected  void paintComponent(java.awt.Graphics arg0)
           
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Prints the page at the specified index into the specified Graphics context in the specified format.
 void removeAllItemListener()
          Removes all listeners
 void removeFromSelection(AbstractItem pItem)
          Removes an item from selection.
 void removeItemListener(java.awt.event.ItemListener pListener)
          Removes a listener
protected  void repaintLater()
           
 void resetZoom()
           
 void selectAll()
          Selects all items in a view
 void selectItem(java.lang.Object pObject)
          Select an object in the view
 void setContainer(ProjectContainer pContainer)
          Sets the container
 void setProjects(ProjectContainer pProjects)
           
 void setRenderer(ProjectItemRenderer pRenderer)
           
 void setShowGrid(boolean showGrid)
          Sets the showGrid.
 void setShowTRef(boolean showTRef)
          Sets the showTRef.
 void setTimeWidth(int timeWidth)
          Sets the timeWidth.
 void toggleSelection(AbstractItem pItem, boolean pExtendSelection)
          Adds an item to selection.
 void unselectAll()
          Unselects all items in a view.
 void widen()
          Widens current view, if applicable
 void zoomIn()
          Zooms current view, if applicable
 void zoomOut()
          Unzooms current view, if applicable
 
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, getPreferredSize, 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, 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

MAX_ZOOM

public static final double MAX_ZOOM
See Also:
Constant Field Values

MIN_ZOOM

public static final double MIN_ZOOM
See Also:
Constant Field Values

NORMAL_TIMEWIDTH

public static final int NORMAL_TIMEWIDTH
See Also:
Constant Field Values

NORMAL_FONTSIZE

public static final int NORMAL_FONTSIZE
See Also:
Constant Field Values

TEXT_GAP

public static final int TEXT_GAP
See Also:
Constant Field Values

BAR_GAP

public static final int BAR_GAP
See Also:
Constant Field Values

BAR_GAP_2

public static final int BAR_GAP_2
See Also:
Constant Field Values
Constructor Detail

ProjectPanel

public ProjectPanel(ProjectContainer pProjects)
Constructor for ProjectPanel.

Method Detail

getZoomFactor

public double getZoomFactor()

getHorzZoomFactor

public double getHorzZoomFactor()

zoomOut

public void zoomOut()
Description copied from interface: ViewActionReceiver
Unzooms current view, if applicable

Specified by:
zoomOut in interface ViewActionReceiver

zoomIn

public void zoomIn()
Description copied from interface: ViewActionReceiver
Zooms current view, if applicable

Specified by:
zoomIn in interface ViewActionReceiver

resetZoom

public void resetZoom()

narrow

public void narrow()
Description copied from interface: ViewActionReceiver
Narrows current view, if applicable

Specified by:
narrow in interface ViewActionReceiver

widen

public void widen()
Description copied from interface: ViewActionReceiver
Widens current view, if applicable

Specified by:
widen in interface ViewActionReceiver

canZoom

public boolean canZoom()
Returns true if view can be zoomed

Specified by:
canZoom in interface ViewActionReceiver

getLineHeight

public int getLineHeight()
Returns the lineHeight.

Returns:
int

isShowGrid

public boolean isShowGrid()
Returns the showGrid.

Returns:
boolean

isShowTRef

public boolean isShowTRef()
Returns the showTRef.

Returns:
boolean

getTimeWidth

public int getTimeWidth()
Returns the timeWidth.

Returns:
int

getRenderer

public ProjectItemRenderer getRenderer()
Returns the current renderer


setRenderer

public void setRenderer(ProjectItemRenderer pRenderer)

setShowGrid

public void setShowGrid(boolean showGrid)
Sets the showGrid.

Parameters:
showGrid - The showGrid to set

setShowTRef

public void setShowTRef(boolean showTRef)
Sets the showTRef.

Parameters:
showTRef - The showTRef to set

setTimeWidth

public void setTimeWidth(int timeWidth)
Sets the timeWidth.

Parameters:
timeWidth - The timeWidth to set

getProjects

public ProjectContainer getProjects()

setContainer

public void setContainer(ProjectContainer pContainer)
Description copied from interface: ContainerSelectable
Sets the container

Specified by:
setContainer in interface ContainerSelectable

setProjects

public void setProjects(ProjectContainer pProjects)

paintComponent

protected void paintComponent(java.awt.Graphics arg0)
Overrides:
paintComponent in class javax.swing.JComponent
See Also:
JComponent.paintComponent(Graphics)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent
See Also:
Component.paint(Graphics)

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Prints the page at the specified index into the specified Graphics context in the specified format. A PrinterJob calls the Printable interface to request that a page be rendered into the context specified by graphics. The format of the page to be drawn is specified by pageFormat. The zero based index of the requested page is specified by pageIndex. If the requested page does not exist then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. The Graphics class or subclass implements the PrinterGraphics interface to provide additional information. If the Printable object aborts the print job then it throws a PrinterException.

Specified by:
print in interface java.awt.print.Printable
Parameters:
graphics - the context into which the page is drawn
pageFormat - the size and orientation of the page being drawn
pageIndex - the zero based index of the page to be drawn
Returns:
PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
Throws:
java.awt.print.PrinterException - thrown when the print job is terminated.

getObjectFromPoint

public AbstractItem getObjectFromPoint(int x,
                                       int y)
Returns the corresponding item of a coordinate pair. If no item is loacted at the given position, this method returns null.

Parameters:
x - X coordinate
y - Y coordinate

getObjectFromPoint

public AbstractItem getObjectFromPoint(java.awt.Point p)
Returns the corresponding item to a given point. Overloaded for convenience

See Also:
getObjectFromPoint(int,int)

modelChanged

public void modelChanged(ModelEvent ev)
Description copied from interface: ModelListener
Invoked on model changes.

Specified by:
modelChanged in interface ModelListener
Parameters:
ev - Model event
See Also:
ModelEvent

addItemListener

public void addItemListener(java.awt.event.ItemListener pListener)
Adds a listener

Specified by:
addItemListener in interface java.awt.ItemSelectable

removeItemListener

public void removeItemListener(java.awt.event.ItemListener pListener)
Removes a listener

Specified by:
removeItemListener in interface java.awt.ItemSelectable

removeAllItemListener

public void removeAllItemListener()
Removes all listeners


getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable

selectAll

public void selectAll()
Selects all items in a view

Specified by:
selectAll in interface ViewActionReceiver

unselectAll

public void unselectAll()
Unselects all items in a view. Simply calls clearSelection.

Specified by:
unselectAll in interface ViewActionReceiver
See Also:
org.fopps.ui.ProjectPanel#clearSelection()

invertSelection

public void invertSelection()
Inverts current selection

Specified by:
invertSelection in interface ViewActionReceiver

selectItem

public void selectItem(java.lang.Object pObject)
Select an object in the view

Specified by:
selectItem in interface ViewActionReceiver
Parameters:
pObject - Object to select in view

allowMultipleSelection

public boolean allowMultipleSelection()
Returns true if view allows multiple selection. If false, (un)selectAll and invertSelection actions are disabled

Specified by:
allowMultipleSelection in interface ViewActionReceiver

clearSelection

public void clearSelection()
Removes all selected elements from selection


toggleSelection

public void toggleSelection(AbstractItem pItem,
                            boolean pExtendSelection)
Adds an item to selection. If the item is already selected, it will be removed from selection.

Parameters:
pItem - Item to add
pExtendSelection - If true, the previous selection will be kept. If false, all previous selected items will be unselected

addToSelection

public void addToSelection(AbstractItem pItem)
Removes an item from selection. If the given item is not selected, this method does nothing.

Parameters:
pItem - Item to add to selection

removeFromSelection

public void removeFromSelection(AbstractItem pItem)
Removes an item from selection. If the given item is not selected, this method does nothing.

Parameters:
pItem - Item to remove from selection

configChanged

public void configChanged(java.lang.String pKey,
                          java.lang.Object pValue)
Notifies listener that a configuration item has changed

Specified by:
configChanged in interface ConfigListener
Parameters:
pKey - Name of the option
pValue - New value of option

notifySelection

protected void notifySelection(AbstractItem pItem)

notifyUnselection

protected void notifyUnselection(AbstractItem pItem)

notifyChange

protected void notifyChange(AbstractItem pItem)

emitItemEvent

protected void emitItemEvent(java.awt.event.ItemEvent pEvent)

repaintLater

protected void repaintLater()


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.