fi.helsinki.cs.gist.schedule
Class GDaySheet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--fi.helsinki.cs.gist.schedule.GDaySheet

public class GDaySheet
extends javax.swing.JComponent
implements java.awt.dnd.DropTargetListener, java.beans.PropertyChangeListener, GCalendarModelListener

GDaySheet

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  GCalendarEventBoxFactory boxFactory
          CalendarEventBoxFactory of this component.
protected  java.util.Calendar calendar
          Calendar object of this component.
protected  GCalendarEventSelectionModel calendarEventSelectionModel
          CalendarEventSelectionModel of this component.
protected  GCalendarModel calendarModel
          CalendarModel of this component.
protected  GDaySheetColumnModel columnModel
          DaySheetColumnModel of this component.
protected  java.util.Vector columns
          Columns of DaySheet.
protected  java.util.Date day
          A day that these DaySheet represents.
protected  GScheduleHeaderRenderer scheduleHeaderRenderer
          ScheduleHeaderRenderer of this component.
protected  GScheduleViewModel scheduleViewModel
          ScheduleViewModel of this component.
 
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
 
Constructor Summary
GDaySheet(java.util.Date aDay, GScheduleViewModel aScheduleViewModel, GCalendarModel aCalendarModel, GCalendarEventSelectionModel aCalendarEventSelectionModel, GCalendarEventBoxFactory aBoxFactory, GDaySheetColumnModel aColumnModel, GScheduleHeaderRenderer aScheduleHeaderRenderer)
           
 
Method Summary
 void addCalendarEvent(GCalendarEvent calEvent)
          Adds a GCalendarEvent object of this component
protected  GCalendarEvent calculateNewEventForDrop(GCalendarEvent oldCalEvent, java.awt.Point dropPoint)
           
 void calendarModelChanged(GCalendarModelEvent e)
          unistalls and installs all components to update the DaysSheet view
 void changeCalendarEvent(GCalendarEvent calE, GCalendarEvent aNewEvent)
          Modifies a GCalendarEvent object in the GCalendarModel of this component
 void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
          is invoked when you are dragging over the DropSite
 void dragExit(java.awt.dnd.DropTargetEvent event)
          is invoked when you are exit the DropSite without dropping
 void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
          is invoked when a drag operation is going on
 void drop(java.awt.dnd.DropTargetDropEvent dtde)
          a drop has occurred
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
          is invoked if the use modifies the current drop gesture
 java.util.Calendar getCalendar()
           
 GCalendarEventBoxFactory getCalendarEventBoxFactory()
           
 java.util.Vector getColumn(int i)
           
 int getColumnCount()
           
 java.util.Vector getColumns()
          Returns all columns in Vector.
 java.util.Date getDay()
           
 GScheduleHeaderRenderer getScheduleHeaderRenderer()
           
 GScheduleViewModel getScheduleViewModel()
           
 fi.helsinki.cs.gist.plaf.GDaySheetUI getUI()
          Returns the L&F object that renders this component.
 java.lang.String getUIClassID()
          Returns a string that specifies the name of the l&f class that renders this component.
protected  void init()
           
 void propertyChange(java.beans.PropertyChangeEvent e)
          HourRange has been modified, unistalls and installs all components to update the DaysSheet view
 void removeCalendarEvent(GCalendarEvent calEvent)
          Removes a GCalendarEvent object of this component
protected  void resolveColumns(java.util.Vector calEvents)
          Resolves columns for given calendar events.
 void setDay(java.util.Date aDay)
          Sets the day attribute of this component
 void setUI(fi.helsinki.cs.gist.plaf.GDaySheetUI ui)
          Sets the L&F object that renders this component.
protected  void sortEventsByStartTime(java.util.Vector events)
          TO BE IMPLEMENTED SOON !!!
 void stretchCalendarEvent(GCalendarEvent calEvent, java.awt.Point p, int stretchEdge)
          Handles stretching of a calendar event
 java.lang.String toString()
           
protected  boolean tryToPutToColumn(int colNumber, GCalendarEvent newEvent)
          Tries to put event on specified column.
protected  void updateEvents()
           
 void updateUI()
          Notification from the UIFactory that the L&F has changed.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

day

protected java.util.Date day
A day that these DaySheet represents.

columns

protected java.util.Vector columns
Columns of DaySheet. Each column is a Vector of GCalendarEvents.

scheduleViewModel

protected GScheduleViewModel scheduleViewModel
ScheduleViewModel of this component.

calendarModel

protected GCalendarModel calendarModel
CalendarModel of this component.

calendarEventSelectionModel

protected GCalendarEventSelectionModel calendarEventSelectionModel
CalendarEventSelectionModel of this component.

scheduleHeaderRenderer

protected GScheduleHeaderRenderer scheduleHeaderRenderer
ScheduleHeaderRenderer of this component.

boxFactory

protected GCalendarEventBoxFactory boxFactory
CalendarEventBoxFactory of this component.

columnModel

protected GDaySheetColumnModel columnModel
DaySheetColumnModel of this component.

calendar

protected java.util.Calendar calendar
Calendar object of this component.
Constructor Detail

GDaySheet

public GDaySheet(java.util.Date aDay,
                 GScheduleViewModel aScheduleViewModel,
                 GCalendarModel aCalendarModel,
                 GCalendarEventSelectionModel aCalendarEventSelectionModel,
                 GCalendarEventBoxFactory aBoxFactory,
                 GDaySheetColumnModel aColumnModel,
                 GScheduleHeaderRenderer aScheduleHeaderRenderer)
Method Detail

init

protected void init()

addCalendarEvent

public void addCalendarEvent(GCalendarEvent calEvent)
Adds a GCalendarEvent object of this component

removeCalendarEvent

public void removeCalendarEvent(GCalendarEvent calEvent)
Removes a GCalendarEvent object of this component

changeCalendarEvent

public void changeCalendarEvent(GCalendarEvent calE,
                                GCalendarEvent aNewEvent)
Modifies a GCalendarEvent object in the GCalendarModel of this component

getDay

public java.util.Date getDay()
Returns:
day attribute of this component

setDay

public void setDay(java.util.Date aDay)
Sets the day attribute of this component

updateEvents

protected void updateEvents()

getCalendar

public java.util.Calendar getCalendar()
Returns:
Calendar object of this component

getScheduleHeaderRenderer

public GScheduleHeaderRenderer getScheduleHeaderRenderer()
Returns:
GScheduleHeaderRenderer of this component

getScheduleViewModel

public GScheduleViewModel getScheduleViewModel()
Returns:
GScheduleViewModel of this component

getCalendarEventBoxFactory

public GCalendarEventBoxFactory getCalendarEventBoxFactory()
Returns:
GCalendarEventBoxFactory of this component

getColumnCount

public int getColumnCount()
Returns:
number of columns

getColumn

public java.util.Vector getColumn(int i)
Returns:
a column as a Vector of GCalendarEvents.

getColumns

public java.util.Vector getColumns()
Returns all columns in Vector. Returned Vector has another Vectors representing columns. This column Vectors contain GCalendarEvents.

stretchCalendarEvent

public void stretchCalendarEvent(GCalendarEvent calEvent,
                                 java.awt.Point p,
                                 int stretchEdge)
Handles stretching of a calendar event

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
HourRange has been modified, unistalls and installs all components to update the DaysSheet view
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

calendarModelChanged

public void calendarModelChanged(GCalendarModelEvent e)
unistalls and installs all components to update the DaysSheet view
Specified by:
calendarModelChanged in interface GCalendarModelListener

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
is invoked when you are dragging over the DropSite
Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent event)
is invoked when you are exit the DropSite without dropping
Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
is invoked when a drag operation is going on
Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent dtde)
a drop has occurred
Specified by:
drop in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
is invoked if the use modifies the current drop gesture
Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

calculateNewEventForDrop

protected GCalendarEvent calculateNewEventForDrop(GCalendarEvent oldCalEvent,
                                                  java.awt.Point dropPoint)

tryToPutToColumn

protected boolean tryToPutToColumn(int colNumber,
                                   GCalendarEvent newEvent)
Tries to put event on specified column. If possible, puts event into the right place (events in column are ordered by start time) and returns true. If not possible, doesn't do anything and returns false.

resolveColumns

protected void resolveColumns(java.util.Vector calEvents)
Resolves columns for given calendar events. Asks columns from GDaySheetColumnModel. If columns for some events is not known solves them.

sortEventsByStartTime

protected void sortEventsByStartTime(java.util.Vector events)
TO BE IMPLEMENTED SOON !!!

getUI

public fi.helsinki.cs.gist.plaf.GDaySheetUI getUI()
Returns the L&F object that renders this component.
Returns:
GThumbLayerUI object

setUI

public void setUI(fi.helsinki.cs.gist.plaf.GDaySheetUI ui)
Sets the L&F object that renders this component.
Parameters:
ui - the GDaySheetUI L&F object
See Also:
UIDefaults.getUI(javax.swing.JComponent)

updateUI

public void updateUI()
Notification from the UIFactory that the L&F has changed.
Overrides:
updateUI in class javax.swing.JComponent
See Also:
JComponent.updateUI()

getUIClassID

public java.lang.String getUIClassID()
Returns a string that specifies the name of the l&f class that renders this component.
Returns:
String "GDaySheetUI"
Overrides:
getUIClassID in class javax.swing.JComponent
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component