net.sf.borg.ui.calendar
Class ApptBox

java.lang.Object
  extended by net.sf.borg.ui.calendar.Box
      extended by net.sf.borg.ui.calendar.ApptBox
All Implemented Interfaces:
Box.Draggable

 class ApptBox
extends Box
implements Box.Draggable

ApptBox is used to draw timed appointments on the time-grid part of the day and week UIs.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.borg.ui.calendar.Box
Box.Draggable
 
Field Summary
 
Fields inherited from class net.sf.borg.ui.calendar.Box
bounds, clip, isSelected
 
Constructor Summary
ApptBox(Date d, Appointment ap, Rectangle bounds, Rectangle clip)
          constructor.
 
Method Summary
 void delete()
          react to a delete request on the box.
 void draw(Graphics2D g2, Component comp)
          draw the box.
 Date getDate()
          Gets the date.
 JPopupMenu getMenu()
          get the box popup menu
 String getText()
          get the box text
 String getToolTipText()
          gets the tool tip text for this box
static void layoutBoxes(List<ApptBox> boxlist, int starthr, int endhr)
          Layout all boxes for a particular day by determining how many overlap and then setting the horizontal position and width to fit them all together in the day grid.
 void move(int realtime, Date d)
          move an appointment when the box is dragged
 void onClick()
          react to a mouse click on the box
 void resize(boolean isTop, int realtime)
          react to a box resize - change the appt duration
 
Methods inherited from class net.sf.borg.ui.calendar.Box
clicksToActivate, getBounds, setBounds, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApptBox

public ApptBox(Date d,
               Appointment ap,
               Rectangle bounds,
               Rectangle clip)
constructor.

Parameters:
d - date that the box is in - not always the appt date
ap - the appointment represented by this box
bounds - box bounds
clip - box clip
Method Detail

layoutBoxes

public static void layoutBoxes(List<ApptBox> boxlist,
                               int starthr,
                               int endhr)
Layout all boxes for a particular day by determining how many overlap and then setting the horizontal position and width to fit them all together in the day grid.

Parameters:
boxlist - the list of all ApptBox objects for a day
starthr - first hour shown on the grid
endhr - last hour shown on the grid

delete

public void delete()
react to a delete request on the box.

Overrides:
delete in class Box

draw

public void draw(Graphics2D g2,
                 Component comp)
draw the box.

Specified by:
draw in class Box
Parameters:
g2 - the graphics to draw in
comp - the component that the graphics is in

getDate

public Date getDate()
Gets the date.

Returns:
the date

getMenu

public JPopupMenu getMenu()
Description copied from class: Box
get the box popup menu

Overrides:
getMenu in class Box
Returns:
the popup menu

getText

public String getText()
Description copied from class: Box
get the box text

Specified by:
getText in class Box
Returns:
the text

move

public void move(int realtime,
                 Date d)
          throws Exception
move an appointment when the box is dragged

Specified by:
move in interface Box.Draggable
Parameters:
realtime - time of day in minutes to which the object has been dragged
d - date that the object was dragged to
Throws:
Exception

onClick

public void onClick()
react to a mouse click on the box

Specified by:
onClick in class Box

resize

public void resize(boolean isTop,
                   int realtime)
            throws Exception
react to a box resize - change the appt duration

Parameters:
isTop - true if the top edge was dragged
realtime - the time in minutes after midnight that the dragged edge was dragged to
Throws:
Exception - the exception

getToolTipText

public String getToolTipText()
Description copied from class: Box
gets the tool tip text for this box

Specified by:
getToolTipText in class Box
Returns:
the tool tip text


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