scheduler.view.view_ui
Class ViewSettingsUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by scheduler.view.view_ui.ViewSettingsUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ViewSettingsUI
extends javax.swing.JFrame

Class ViewSettingsUI provides a view of ViewSettings as an input to the viewSchedule method. Hence, the dialog is a view of both an ViewSettings object as well as the viewSchedule method. The data-entry components of the dialog constitute the ViewSettings view. The 'OK' button is the view of the viewSchedule method.

The data components consist of JLabels, JTables, JRadioButtons JCheckBoxes, and a JComboBox. The 'OK', 'Clear', and 'Cancel' buttons are JButtons. The description of the compose method has details of how the components are laid out in the dialog window.

For organizational clarity, some of the rows in the ViewSettingsUI are defined in separate classes.

The companion model for ViewSettingsUI is the View class, since View has the method that is invoked from the 'OK' button action listener.

Author:
Jason Mak (jamak3@gmail.com) 50%, Sasiluk Ruangrongsorakai (sruangro@calpoly.edu) 50%
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
private  javax.swing.JRadioButton calendar
           
private  javax.swing.JButton cancelButton
           
private  javax.swing.JButton clearCourse
           
private  javax.swing.JButton clearFilter
           
protected  java.util.LinkedList<Course> courseList
          The courses to be displayed in the left panel for a course view.
private  javax.swing.JScrollPane coursePanel
           
private  javax.swing.JRadioButton daily
           
protected  java.util.ArrayList<javax.swing.JCheckBox> dataCheckBoxList
          List of checkboxes for each course, instructor, or location.
private  javax.swing.JComboBox dayComboBox
           
protected  javax.swing.JCheckBox[] filterCheckBoxList
          Array of checkboxes for each filter option.
private  javax.swing.JScrollPane filterPanel
           
protected  java.util.LinkedList<Instructor> instructorList
          The instructors to be displayed in the left panel for an instructor view.
private  javax.swing.JLabel jLabel1
           
private  javax.swing.JPanel jPanel1
           
private  javax.swing.JPanel jPanel2
           
private  javax.swing.JPanel jPanel3
           
private  javax.swing.JPanel jPanel4
           
private  javax.swing.JRadioButton list
           
protected  java.util.LinkedList<Location> locationList
          The locations to be displayed in the left panel for a location view.
private  javax.swing.JButton okButton
           
private  javax.swing.GroupLayout.ParallelGroup parallelGroup
           
private  javax.swing.JButton selectAllCourse
           
private  javax.swing.JButton selectAllFilter
           
private  javax.swing.GroupLayout.SequentialGroup sequentialGroup
           
protected  java.lang.String title
          Title of this window.
protected  View view
          View module
private  javax.swing.ButtonGroup viewLevel
           
private  javax.swing.ButtonGroup viewMode
           
protected  ViewType viewType
          The type of view created by this UI dialog.
protected  java.util.ArrayList<java.lang.String> viewTypeFilter
          List of label names for filtering ocurses, instructors, or locations.
protected  java.lang.String viewTypeFilterPrompt
          Prompt for filters based on the ViewType.
private  javax.swing.JRadioButton weekly
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ViewSettingsUI(ViewType viewType, View view)
          Construct this by calling compose
 
Method Summary
private  void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)
           
private  void clearCourseActionPerformed(java.awt.event.ActionEvent evt)
           
private  void clearFilterActionPerformed(java.awt.event.ActionEvent evt)
           
private  void compose()
          This method is called from within the constructor to initialize the form.
 java.util.ArrayList<java.lang.String> createFilterNames()
          Makes a list of string representations of courses, instructors, or location, depending on view type.
private  void dailyActionPerformed(java.awt.event.ActionEvent evt)
           
protected  void defaultFilterOptions()
          The default filters options for a course, instructor, or location view.
 java.util.ArrayList<javax.swing.JCheckBox> getDataCheckBoxlist()
          Returns the array of course, instructor, or location checkboxes.
 javax.swing.JCheckBox[] getFilterCheckBoxlist()
          Returns the array of filter option checkboxes.
static ViewSettingsUI getNewCourseViewSettingsUI(View view)
          Returns an instance of this class using the settings for a course view.
static ViewSettingsUI getNewInstructorViewSettingsUI(View view)
          Returns an instance of this class using the settings for an instructor view.
static ViewSettingsUI getNewLocationViewSettingsUI(View view)
          Returns an instance of this class using the settings for a location view.
 ViewLevel getViewLevel()
          Returns the view level selected in the dialog.
 ViewMode getViewMode()
          Returns the view mode selected in the dialog.
 ViewType getViewType()
          Returns the view type selected in the dialog.
static void main(java.lang.String[] args)
          stub main for testing.
private  void okButtonActionPerformed(java.awt.event.ActionEvent evt)
           
private  void selectAllCourseActionPerformed(java.awt.event.ActionEvent evt)
           
private  void selectAllFilterActionPerformed(java.awt.event.ActionEvent evt)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

calendar

private javax.swing.JRadioButton calendar

cancelButton

private javax.swing.JButton cancelButton

clearCourse

private javax.swing.JButton clearCourse

clearFilter

private javax.swing.JButton clearFilter

coursePanel

private javax.swing.JScrollPane coursePanel

daily

private javax.swing.JRadioButton daily

filterPanel

private javax.swing.JScrollPane filterPanel

parallelGroup

private javax.swing.GroupLayout.ParallelGroup parallelGroup

sequentialGroup

private javax.swing.GroupLayout.SequentialGroup sequentialGroup

dayComboBox

private javax.swing.JComboBox dayComboBox

jLabel1

private javax.swing.JLabel jLabel1

jPanel1

private javax.swing.JPanel jPanel1

jPanel2

private javax.swing.JPanel jPanel2

jPanel3

private javax.swing.JPanel jPanel3

jPanel4

private javax.swing.JPanel jPanel4

list

private javax.swing.JRadioButton list

okButton

private javax.swing.JButton okButton

selectAllCourse

private javax.swing.JButton selectAllCourse

selectAllFilter

private javax.swing.JButton selectAllFilter

viewLevel

private javax.swing.ButtonGroup viewLevel

viewMode

private javax.swing.ButtonGroup viewMode

weekly

private javax.swing.JRadioButton weekly

title

protected java.lang.String title
Title of this window.


viewTypeFilterPrompt

protected java.lang.String viewTypeFilterPrompt
Prompt for filters based on the ViewType.


viewTypeFilter

protected java.util.ArrayList<java.lang.String> viewTypeFilter
List of label names for filtering ocurses, instructors, or locations.


dataCheckBoxList

protected java.util.ArrayList<javax.swing.JCheckBox> dataCheckBoxList
List of checkboxes for each course, instructor, or location.


filterCheckBoxList

protected javax.swing.JCheckBox[] filterCheckBoxList
Array of checkboxes for each filter option.


viewType

protected ViewType viewType
The type of view created by this UI dialog.


courseList

protected java.util.LinkedList<Course> courseList
The courses to be displayed in the left panel for a course view.


instructorList

protected java.util.LinkedList<Instructor> instructorList
The instructors to be displayed in the left panel for an instructor view.


locationList

protected java.util.LinkedList<Location> locationList
The locations to be displayed in the left panel for a location view.


view

protected View view
View module

Constructor Detail

ViewSettingsUI

public ViewSettingsUI(ViewType viewType,
                      View view)
Construct this by calling compose

Parameters:
viewType - the viewtype specified in the menubar
view - the view to apply settings on
Method Detail

compose

private void compose()
This method is called from within the constructor to initialize the form.


dailyActionPerformed

private void dailyActionPerformed(java.awt.event.ActionEvent evt)

okButtonActionPerformed

private void okButtonActionPerformed(java.awt.event.ActionEvent evt)

selectAllCourseActionPerformed

private void selectAllCourseActionPerformed(java.awt.event.ActionEvent evt)

clearCourseActionPerformed

private void clearCourseActionPerformed(java.awt.event.ActionEvent evt)

selectAllFilterActionPerformed

private void selectAllFilterActionPerformed(java.awt.event.ActionEvent evt)

clearFilterActionPerformed

private void clearFilterActionPerformed(java.awt.event.ActionEvent evt)

cancelButtonActionPerformed

private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)

defaultFilterOptions

protected void defaultFilterOptions()
The default filters options for a course, instructor, or location view.


getViewMode

public ViewMode getViewMode()
Returns the view mode selected in the dialog.

Returns:
the selected view mode

getViewType

public ViewType getViewType()
Returns the view type selected in the dialog.

Returns:
the selected view type

getViewLevel

public ViewLevel getViewLevel()
Returns the view level selected in the dialog.

Returns:
the view level selected in this dialog

createFilterNames

public java.util.ArrayList<java.lang.String> createFilterNames()
Makes a list of string representations of courses, instructors, or location, depending on view type.

Returns:
a list of course names, instructor names, or location strings

getFilterCheckBoxlist

public javax.swing.JCheckBox[] getFilterCheckBoxlist()
Returns the array of filter option checkboxes.

Returns:
the selected filter options

getDataCheckBoxlist

public java.util.ArrayList<javax.swing.JCheckBox> getDataCheckBoxlist()
Returns the array of course, instructor, or location checkboxes.

Returns:
the selected courses, instructors, or locations

getNewLocationViewSettingsUI

public static ViewSettingsUI getNewLocationViewSettingsUI(View view)
Returns an instance of this class using the settings for a location view.

Parameters:
view - the view to apply settings on
Returns:
a new instance of this class with location view type

getNewInstructorViewSettingsUI

public static ViewSettingsUI getNewInstructorViewSettingsUI(View view)
Returns an instance of this class using the settings for an instructor view.

Parameters:
view - the view to apply settings on
Returns:
a new instance of this class with instructor view type

getNewCourseViewSettingsUI

public static ViewSettingsUI getNewCourseViewSettingsUI(View view)
Returns an instance of this class using the settings for a course view.

Parameters:
view - the view to apply settings on
Returns:
a new instance of this class with course view type

main

public static void main(java.lang.String[] args)
stub main for testing.

Parameters:
args - for main