net.sf.borg.ui.calendar
Class ApptBoxPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by net.sf.borg.ui.calendar.ApptBoxPanel
All Implemented Interfaces:
ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

abstract class ApptBoxPanel
extends JPanel
implements ComponentListener

ApptBoxPanel is the base class for Panels that act as containers for Box and DateZone objects. It manages the layout of Boxes and the various operations that can be done on them - such as dragging, resizing, clicking


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Collection<Box> boxes
          the Boxes managed by this container
protected  double endmin
           
protected  double startmin
           
 
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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ApptBoxPanel()
          Instantiates a new appt box panel.
 
Method Summary
protected  void addApptBox(Date d, Appointment ap, Rectangle bounds, Rectangle clip)
          Adds an appointment to the container.
 void addDateZone(Date d, Rectangle bounds)
          Adds a date zone to this container
 Box addNoteBox(Date d, CalendarEntity ap, Rectangle bounds, Rectangle clip)
          Adds the note box to this container
 void clearBoxes()
          Clear boxes and zones.
 void componentHidden(ComponentEvent arg0)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
 void drawBoxes(Graphics2D g2)
          Draw boxes.
(package private) abstract  Date getDateForCoord(double x, double y)
          Gets the date for a mouse coordinate
 String getTimeString(double y_fraction)
          Gets the time string for a given y coordinate
static boolean isStrike(CalendarEntity appt, Date date)
          Checks if entity should be shown as strike-through on a certain date.
abstract  void refresh()
          Refresh.
protected  void removeDragNewBox()
          Removes the drag new box.
 void removeResizeBox()
          Removes the resize box.
protected  void setDragBounds(int ymin, int ymax, int xmin, int xmax)
          Sets the drag bounds to limit where items can be dragged.
protected  void setDragNewBox(double x, double y, double w, double h)
          Sets the bounds for the drag new box
protected  void setResizeBounds(int ymin, int ymax)
          Sets the resize bounds which limit where a resized object border can be dragged and where a drag new box can be started
protected  void setResizeBox(double x, double y, double w, double h)
          Sets the resize box bounds.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

boxes

protected Collection<Box> boxes
the Boxes managed by this container


endmin

protected double endmin

startmin

protected double startmin
Constructor Detail

ApptBoxPanel

public ApptBoxPanel()
Instantiates a new appt box panel.

Method Detail

isStrike

public static boolean isStrike(CalendarEntity appt,
                               Date date)
Checks if entity should be shown as strike-through on a certain date.

Parameters:
appt - the entity
date - the date
Returns:
true, if is strike

addApptBox

protected void addApptBox(Date d,
                          Appointment ap,
                          Rectangle bounds,
                          Rectangle clip)
Adds an appointment to the container. Creates an ApptBox to contain it

Parameters:
d - the date of the box - not aleays the appt date
ap - the appointment
bounds - the bounds
clip - the clip

addDateZone

public void addDateZone(Date d,
                        Rectangle bounds)
Adds a date zone to this container

Parameters:
d - the date
bounds - the bounds of the zone

addNoteBox

public Box addNoteBox(Date d,
                      CalendarEntity ap,
                      Rectangle bounds,
                      Rectangle clip)
Adds the note box to this container

Parameters:
d - the date
ap - the calendar entity
bounds - the bounds
clip - the clip
Returns:
the box

clearBoxes

public void clearBoxes()
Clear boxes and zones.


drawBoxes

public void drawBoxes(Graphics2D g2)
Draw boxes.

Parameters:
g2 - the Graphics to draw in

getDateForCoord

abstract Date getDateForCoord(double x,
                              double y)
Gets the date for a mouse coordinate

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the date for coord

getTimeString

public String getTimeString(double y_fraction)
Gets the time string for a given y coordinate

Parameters:
y_fraction - the y_fraction
Returns:
the time string

refresh

public abstract void refresh()
Refresh.


removeDragNewBox

protected void removeDragNewBox()
Removes the drag new box.


removeResizeBox

public void removeResizeBox()
Removes the resize box.


setDragBounds

protected void setDragBounds(int ymin,
                             int ymax,
                             int xmin,
                             int xmax)
Sets the drag bounds to limit where items can be dragged.

Parameters:
ymin - the y minimum
ymax - the y maximum
xmin - the x minimum
xmax - the x maximum

setDragNewBox

protected void setDragNewBox(double x,
                             double y,
                             double w,
                             double h)
Sets the bounds for the drag new box

Parameters:
x - the x coord
y - the y coord
w - the width
h - the height

setResizeBounds

protected void setResizeBounds(int ymin,
                               int ymax)
Sets the resize bounds which limit where a resized object border can be dragged and where a drag new box can be started

Parameters:
ymin - the y minimum
ymax - the y maximum

setResizeBox

protected void setResizeBox(double x,
                            double y,
                            double w,
                            double h)
Sets the resize box bounds.

Parameters:
x - the x coord
y - the y coord
w - the width
h - the height

componentHidden

public void componentHidden(ComponentEvent arg0)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener


Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic