scheduler.view.view_ui
Class CalendarViewUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by scheduler.view.view_ui.CalendarViewUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.ScrollPaneConstants

public class CalendarViewUI
extends javax.swing.JScrollPane

Displaying a schedule in a calendar mode

Author:
Sasiluk Ruangrongsorakai
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.util.ArrayList<CalColumn> calColumnList
          List of CalColumn for selected days in AF
protected  CalendarView calView
          The companion model object
protected  int cellHeight
           
protected  int cellWidth
           
protected  java.util.ArrayList<javax.swing.Box> colBox
          list of box for each column in the schedule.
protected  java.util.ArrayList<javax.swing.Box> dayBox
          list of box each day column in the schedule
protected  java.util.ArrayList<javax.swing.JPanel> dayGrid
          list of grid each day column in the schedule
protected  int[] dayNumCol
          the number indicate number of col needed for that day more than 1 col means there is an overlapping calendar cell for that day
(package private) static java.lang.String[] daysList
           
protected  javax.swing.JPanel emptyheadingGrid
          panels inside each box
protected  java.awt.Dimension emptyheadingGridDim
          dimensions for each panel
protected  int endTime
          Time obj representing the time range in calendar view
protected  javax.swing.Box headingBox
          Box to layout the Calendar View
protected  javax.swing.JPanel headingGrid
          panels inside each box
protected  int i
           
protected  javax.swing.Box innerBox
          Box to layout the Calendar View
protected  java.util.ArrayList<ScheduleItemLabel> labelList
          ArrayList of ScheduleItemLabel for each label in Calendar View
protected  int minCellHeight
          Default constant for the height of calendar cell.
protected  int minCellWidth
          Default constant for the width of calendar cell.
protected  int minWindowHeight
          Default constant for the height of calendar panel.
protected  int minWindowWidth
          Default constant for the width of calendar panel.
protected  java.util.ArrayList<javax.swing.JButton> moreButton
          List of "More..." button in the view
protected  int numDaysInWeek
          number of days in a weekly view or 1 for a daily view, indicate number of cols
protected  int numHour
          number of hours in a day, indicate number of rows
protected  javax.swing.Box outerBox
          Box to layout the Calendar View
protected  java.awt.Dimension outerGridDim
          dimensions for each panel
protected  javax.swing.JPanel outerPanel
          panels inside each box
protected  javax.swing.Box outerScrollBox
          Box to layout the Calendar View
protected  java.util.ArrayList<javax.swing.JPanel> popup
          List of JPanel for Popup dialog in calendar view
protected  int popupInd
           
protected  javax.swing.Box scheduleBox
          Box to layout the Calendar View
protected  javax.swing.JPanel scheduleGrid
          panels inside each box
protected  java.awt.Dimension scheduleGridDim
          dimensions for each panel
protected  java.awt.GridLayout scheduleLayout
          gridLayout for each panel
protected  javax.swing.Box scheduleScrollBox
          Box to layout the Calendar View
protected  int startTime
          Time obj representing the time range in calendar view
protected  javax.swing.Box timeBox
          Box to layout the Calendar View
protected  javax.swing.JPanel timeGrid
          panels inside each box
protected  java.awt.Dimension timeGridDim
          dimensions for each panel
protected  java.awt.Dimension timeGridDimMax
          dimensions for each panel
protected  java.awt.GridLayout timeLayout
          gridLayout for each panel
(package private) static java.lang.String[] timeList
           
protected  int timeWidth
          Default constant for the width of time cell.
protected  javax.swing.Box titleBox
          Box to layout the Calendar View
protected  int totalNumCol
          Number of Column needed
protected  int windowHeight
           
protected  int windowWidth
           
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CalendarViewUI(CalendarView calView)
           
 
Method Summary
 void calcDimension()
          Calculate the dimension of the Calendar view and Calendar Cell
private  void createCalColumn()
          Go through each calColumn in CalColumnList in order to go through each CalCell in the current CalColumn in order to add ScheduleItem's label to the CalCell
private  javax.swing.JPanel createCellBox(java.util.ArrayList<ScheduleItem> siList, int numH)
          Create a panel for each cell on the calendar view Each panel contains a list of scheduleitem from the first param If there are more than 3 scheduleItem in 1 panel, this method will create "more" button to display the whole list of scheduleItem in a new dialog
private  javax.swing.JPanel createEmptyCellBox(int numH)
          Create empty JPanel when there are gaps b/w each cell
protected  javax.swing.JPanel createHeadingCol(java.lang.String str, int w)
          Create heading cell with the given text
private  void createInnerOuterBox()
          Combine each boxes together
private  void createScheduleBox()
          Create the main calendar view containing scheduleItems
private  void createTimeBox()
          Create Time Column
private  void createTitleBox()
          Create the heading/Title row
 java.util.ArrayList<ScheduleItemLabel> getLabelList()
          return labelList of the calendar view
 void printCalendarView()
          Print the calendar inforamtion
protected  javax.swing.JPanel setTimeCol(java.lang.String str)
          Create JLabel for the given text with gray background
 void update()
          update the data and repaint the panel for calendar view when View receive notification from AF or checkboxes
 void updateData()
          Update calendar information for painting
private  void updateHeadingGrid()
          Add Day's name or "Daily" to the heading box
private  void updateInnerOuterBox()
          Recombine the boxes when the setting changes
 void updateLabel()
          Update the JLabel for each Calendar Cell
private  void updateScheduleBox()
          Update the main schedule view when the setting changes
private  void updateTimeBox()
          Update the Time column when the setting changes
private  void updateTitleBox()
          Update the Title row when the setting changes
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, 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, 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, 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, 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

labelList

protected java.util.ArrayList<ScheduleItemLabel> labelList
ArrayList of ScheduleItemLabel for each label in Calendar View


minCellHeight

protected final int minCellHeight
Default constant for the height of calendar cell.

See Also:
Constant Field Values

minCellWidth

protected final int minCellWidth
Default constant for the width of calendar cell.

See Also:
Constant Field Values

timeWidth

protected final int timeWidth
Default constant for the width of time cell.

See Also:
Constant Field Values

minWindowHeight

protected final int minWindowHeight
Default constant for the height of calendar panel.

See Also:
Constant Field Values

minWindowWidth

protected final int minWindowWidth
Default constant for the width of calendar panel.

See Also:
Constant Field Values

cellHeight

protected int cellHeight

cellWidth

protected int cellWidth

windowHeight

protected int windowHeight

windowWidth

protected int windowWidth

numDaysInWeek

protected int numDaysInWeek
number of days in a weekly view or 1 for a daily view, indicate number of cols


startTime

protected int startTime
Time obj representing the time range in calendar view


endTime

protected int endTime
Time obj representing the time range in calendar view


numHour

protected int numHour
number of hours in a day, indicate number of rows


titleBox

protected javax.swing.Box titleBox
Box to layout the Calendar View


headingBox

protected javax.swing.Box headingBox
Box to layout the Calendar View


timeBox

protected javax.swing.Box timeBox
Box to layout the Calendar View


scheduleBox

protected javax.swing.Box scheduleBox
Box to layout the Calendar View


scheduleScrollBox

protected javax.swing.Box scheduleScrollBox
Box to layout the Calendar View


innerBox

protected javax.swing.Box innerBox
Box to layout the Calendar View


outerScrollBox

protected javax.swing.Box outerScrollBox
Box to layout the Calendar View


outerBox

protected javax.swing.Box outerBox
Box to layout the Calendar View


headingGrid

protected javax.swing.JPanel headingGrid
panels inside each box


emptyheadingGrid

protected javax.swing.JPanel emptyheadingGrid
panels inside each box


timeGrid

protected javax.swing.JPanel timeGrid
panels inside each box


scheduleGrid

protected javax.swing.JPanel scheduleGrid
panels inside each box


outerPanel

protected javax.swing.JPanel outerPanel
panels inside each box


emptyheadingGridDim

protected java.awt.Dimension emptyheadingGridDim
dimensions for each panel


timeGridDim

protected java.awt.Dimension timeGridDim
dimensions for each panel


outerGridDim

protected java.awt.Dimension outerGridDim
dimensions for each panel


timeGridDimMax

protected java.awt.Dimension timeGridDimMax
dimensions for each panel


scheduleGridDim

protected java.awt.Dimension scheduleGridDim
dimensions for each panel


timeLayout

protected java.awt.GridLayout timeLayout
gridLayout for each panel


scheduleLayout

protected java.awt.GridLayout scheduleLayout
gridLayout for each panel


colBox

protected java.util.ArrayList<javax.swing.Box> colBox
list of box for each column in the schedule.


dayBox

protected java.util.ArrayList<javax.swing.Box> dayBox
list of box each day column in the schedule


dayGrid

protected java.util.ArrayList<javax.swing.JPanel> dayGrid
list of grid each day column in the schedule


calView

protected CalendarView calView
The companion model object


calColumnList

protected java.util.ArrayList<CalColumn> calColumnList
List of CalColumn for selected days in AF


popup

protected java.util.ArrayList<javax.swing.JPanel> popup
List of JPanel for Popup dialog in calendar view


moreButton

protected java.util.ArrayList<javax.swing.JButton> moreButton
List of "More..." button in the view


popupInd

protected int popupInd

dayNumCol

protected int[] dayNumCol
the number indicate number of col needed for that day more than 1 col means there is an overlapping calendar cell for that day


totalNumCol

protected int totalNumCol
Number of Column needed


i

protected int i

daysList

static final java.lang.String[] daysList

timeList

static final java.lang.String[] timeList
Constructor Detail

CalendarViewUI

public CalendarViewUI(CalendarView calView)
Method Detail

printCalendarView

public void printCalendarView()
Print the calendar inforamtion


update

public void update()
update the data and repaint the panel for calendar view when View receive notification from AF or checkboxes


updateLabel

public void updateLabel()
Update the JLabel for each Calendar Cell


updateData

public void updateData()
Update calendar information for painting


calcDimension

public void calcDimension()
Calculate the dimension of the Calendar view and Calendar Cell


createTitleBox

private void createTitleBox()
Create the heading/Title row


updateTitleBox

private void updateTitleBox()
Update the Title row when the setting changes


updateHeadingGrid

private void updateHeadingGrid()
Add Day's name or "Daily" to the heading box


createTimeBox

private void createTimeBox()
Create Time Column


updateTimeBox

private void updateTimeBox()
Update the Time column when the setting changes


createScheduleBox

private void createScheduleBox()
Create the main calendar view containing scheduleItems


updateScheduleBox

private void updateScheduleBox()
Update the main schedule view when the setting changes


createCalColumn

private void createCalColumn()
Go through each calColumn in CalColumnList in order to go through each CalCell in the current CalColumn in order to add ScheduleItem's label to the CalCell


createCellBox

private javax.swing.JPanel createCellBox(java.util.ArrayList<ScheduleItem> siList,
                                         int numH)
Create a panel for each cell on the calendar view Each panel contains a list of scheduleitem from the first param If there are more than 3 scheduleItem in 1 panel, this method will create "more" button to display the whole list of scheduleItem in a new dialog

Parameters:
siList - - list of ScheduleItem in the panel
numHour - - determine the height of the panel cell
Returns:
a panel containing list of ScheduleItem (and "more" button)

createEmptyCellBox

private javax.swing.JPanel createEmptyCellBox(int numH)
Create empty JPanel when there are gaps b/w each cell

Parameters:
numH - - the width of the empty cell
Returns:
an empty panel

createInnerOuterBox

private void createInnerOuterBox()
Combine each boxes together


updateInnerOuterBox

private void updateInnerOuterBox()
Recombine the boxes when the setting changes


setTimeCol

protected javax.swing.JPanel setTimeCol(java.lang.String str)
Create JLabel for the given text with gray background

Parameters:
str - - text to display in the JPanel
Returns:
the JPanel containing the given text

createHeadingCol

protected javax.swing.JPanel createHeadingCol(java.lang.String str,
                                              int w)
Create heading cell with the given text

Parameters:
str - - the text to be displayed
w - - the width unit of the cell
Returns:
JPanel containing the given text with the given width

getLabelList

public java.util.ArrayList<ScheduleItemLabel> getLabelList()
return labelList of the calendar view

Returns:
labelList of the calendar view