org.bibalex.daf.managers.admin
Class ReasonGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.bibalex.daf.managers.admin.ReasonGUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ReasonGUI
extends javax.swing.JDialog

This class manages operations over Job Types like add, remove, update,...

Author:
Mohammed.Abuouda
See Also:
Serialized Form

Nested Class Summary
private static class ReasonGUI.UIStates
          UIStates is enum indicates to the state of the selected row (Add for new , Edit for update)
 
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JLabel availableReasonsLabel
           
private  javax.swing.JScrollPane availableReasonsScrollPane
          availableReasonsScrollPane is the container Pane for available reasons table
private  SortableTable availableReasonsTable
          availableJobTypesTable is the table that shows up the system JobTypes
private  javax.swing.JButton createNewReasonButton
          createNewReasonButton is the button to craete new Reason
private  javax.swing.JButton deleteReasonButton
          deleteReasonButton is the button to delete Reason
private  javax.swing.JLabel descriptionLabel
           
private  javax.swing.JTextArea descriptionTextArea
          descriptionTextArea is a text field shows the description of selectd JobType
private  javax.swing.JPanel detailsPanel
          detailsPanel is the panel that carry the derived components for reason
private  javax.swing.JPanel jPanel
          jPanel is Main panel which containes master and details panels
private  int lastSelectedReasonIndex
          lastSelectedJobTypeIndex used to indicate to the last selected row of available JobTypes table
private  javax.swing.JPanel masterPanel
          masterPanel is the panel that carry the basic components which are availableReasonsTable,deleteReasonButton and createNewReasonButton
private  int phaseID
          phase ID that reasons belong to
private  javax.swing.JLabel reasonNameLabel
           
private  javax.swing.JTextField reasonNameTextField
          reasonNameTextField is a text field shows the name of selectd Reason
private  boolean recordModified
          recordModified used to check if there are updates or modifications applied but not saved yet to the selected jobType
protected  ResourceManager resourceManager
           
private  javax.swing.JButton saveButton
          saveButton is the button to save the changes of Reason these changes could be updates or even new data
private  ReasonGUI.UIStates uiState
           
private  java.awt.event.KeyAdapter updatesKeyAdapter
          key listener handles the events of change the text of text fields.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
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, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ReasonGUI(int PhaseID)
          This is the default constructor
 
Method Summary
private  void adjustDetailsPanel()
          Extract the data of the selected JobType and fill up the correspondence fileds
private  void clearDetailsPanel()
          Reset GUI controls
private  boolean confirmDiscardChanges()
          Confirm discard User changes message
 javax.swing.JScrollPane getAvailableReasonsScrollPane()
          This method initializes availableJobTypesScrollPane
 javax.swing.JTable getAvailableReasonsTable()
          This method initializes availableJobTypesTable
private  javax.swing.JButton getCreateNewReasonButton()
          This method initializes createNewJobTypeButton
private  javax.swing.JButton getDeleteReasonButton()
          This method initializes deleteJobTypeButton
private  javax.swing.JTextArea getDescriptionTextArea()
          This method initializes descriptionTextArea
private  javax.swing.JPanel getDetailsPanel()
          This method initializes detailsPanel
private  javax.swing.JPanel getJPanel()
          This method initializes jPanel
private  javax.swing.JPanel getMasterPanel()
          This method initializes masterPanel
private  javax.swing.JTextField getReasonNameTextField()
          This method initializes reasonNameTextField
private  javax.swing.JButton getSaveButton()
          This method initializes saveButton
private  void initialize()
          This method initializes layout
private  void loadAvailableJobTypesTable()
          Load availableJobTypesTable
private  void setCreateMode()
          Clear the GUI and set mode to Add
private  void setEditMode()
          Set GUI mode to Edit
private  void showMsg(java.lang.String msg)
          Show message box
private  boolean validateValues()
          Validate filed values
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, 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, removeNotify, 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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jPanel

private javax.swing.JPanel jPanel
jPanel is Main panel which containes master and details panels


masterPanel

private javax.swing.JPanel masterPanel
masterPanel is the panel that carry the basic components which are availableReasonsTable,deleteReasonButton and createNewReasonButton


detailsPanel

private javax.swing.JPanel detailsPanel
detailsPanel is the panel that carry the derived components for reason


availableReasonsScrollPane

private javax.swing.JScrollPane availableReasonsScrollPane
availableReasonsScrollPane is the container Pane for available reasons table


availableReasonsTable

private SortableTable availableReasonsTable
availableJobTypesTable is the table that shows up the system JobTypes


deleteReasonButton

private javax.swing.JButton deleteReasonButton
deleteReasonButton is the button to delete Reason


createNewReasonButton

private javax.swing.JButton createNewReasonButton
createNewReasonButton is the button to craete new Reason


saveButton

private javax.swing.JButton saveButton
saveButton is the button to save the changes of Reason these changes could be updates or even new data


reasonNameTextField

private javax.swing.JTextField reasonNameTextField
reasonNameTextField is a text field shows the name of selectd Reason


descriptionTextArea

private javax.swing.JTextArea descriptionTextArea
descriptionTextArea is a text field shows the description of selectd JobType


availableReasonsLabel

private javax.swing.JLabel availableReasonsLabel

reasonNameLabel

private javax.swing.JLabel reasonNameLabel

descriptionLabel

private javax.swing.JLabel descriptionLabel

resourceManager

protected ResourceManager resourceManager

lastSelectedReasonIndex

private int lastSelectedReasonIndex
lastSelectedJobTypeIndex used to indicate to the last selected row of available JobTypes table


recordModified

private boolean recordModified
recordModified used to check if there are updates or modifications applied but not saved yet to the selected jobType


phaseID

private int phaseID
phase ID that reasons belong to


uiState

private ReasonGUI.UIStates uiState

updatesKeyAdapter

private java.awt.event.KeyAdapter updatesKeyAdapter
key listener handles the events of change the text of text fields. Once the event fired, the key adapter enables the saveButton and set recordModified to true. The value of recordModified utilized when the user decides to change to selected JobType to another one, here the system generates a confirmation message that asks the user to discared the changes he done or to commit them.

Constructor Detail

ReasonGUI

public ReasonGUI(int PhaseID)
This is the default constructor

Method Detail

initialize

private void initialize()
This method initializes layout


getJPanel

private javax.swing.JPanel getJPanel()
This method initializes jPanel

Returns:
javax.swing.JPanel

getMasterPanel

private javax.swing.JPanel getMasterPanel()
This method initializes masterPanel

Returns:
javax.swing.JPanel

getDetailsPanel

private javax.swing.JPanel getDetailsPanel()
This method initializes detailsPanel

Returns:
javax.swing.JPanel

getAvailableReasonsScrollPane

public javax.swing.JScrollPane getAvailableReasonsScrollPane()
This method initializes availableJobTypesScrollPane

Returns:
javax.swing.JScrollPane

getDeleteReasonButton

private javax.swing.JButton getDeleteReasonButton()
This method initializes deleteJobTypeButton

Returns:
javax.swing.JButton

getCreateNewReasonButton

private javax.swing.JButton getCreateNewReasonButton()
This method initializes createNewJobTypeButton

Returns:
javax.swing.JButton

getSaveButton

private javax.swing.JButton getSaveButton()
This method initializes saveButton

Returns:
javax.swing.JButton

getReasonNameTextField

private javax.swing.JTextField getReasonNameTextField()
This method initializes reasonNameTextField

Returns:
javax.swing.JTextField

getDescriptionTextArea

private javax.swing.JTextArea getDescriptionTextArea()
This method initializes descriptionTextArea

Returns:
javax.swing.JTextArea

validateValues

private boolean validateValues()
Validate filed values

Returns:
true if all values are valid , false other wise

showMsg

private void showMsg(java.lang.String msg)
Show message box

Parameters:
msg - string in Resource File

confirmDiscardChanges

private boolean confirmDiscardChanges()
Confirm discard User changes message

Returns:
true if confirmed and false otherwise

setEditMode

private void setEditMode()
Set GUI mode to Edit


setCreateMode

private void setCreateMode()
Clear the GUI and set mode to Add


adjustDetailsPanel

private void adjustDetailsPanel()
Extract the data of the selected JobType and fill up the correspondence fileds


clearDetailsPanel

private void clearDetailsPanel()
Reset GUI controls


getAvailableReasonsTable

public javax.swing.JTable getAvailableReasonsTable()
This method initializes availableJobTypesTable

Returns:
javax.swing.JTable

loadAvailableJobTypesTable

private void loadAvailableJobTypesTable()
Load availableJobTypesTable