com.isti.util.gui
Class IstiRegionPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.isti.util.gui.IstiRegionPanel
All Implemented Interfaces:
java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
AlarmRegionConfigDialog

public class IstiRegionPanel
extends javax.swing.JPanel
implements java.awt.event.WindowListener

Class IstiRegionPanel defines a region panel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
 javax.swing.AbstractAction addCircleButtonActionObj
          Action object for the "Add Circle" button.
 javax.swing.AbstractAction addPolyButtonActionObj
          Action object for the "Add Poly" button.
protected  boolean centerEditDialogFlag
          Flag set true if the edit dialog should be centered.
static java.lang.String CLOSE_OPTION_TEXT
          Close option text.
 javax.swing.AbstractAction copyButtonActionObj
          Action object for the "Copy" button.
protected static java.lang.String DEF_NEWREGION_NAME
          Default region name text.
protected  boolean dialogModalFlag
          Flag set true if the dialogs are modal.
protected  IstiDialogPopup dialogObj
          Dialog object for this panel.
protected  IstiDialogUtil dialogUtilObj
          Dialog utility object for popup messages.
 javax.swing.AbstractAction editButtonActionObj
          Action object for the "Edit" button.
static java.lang.String HELP_OPTION_TEXT
          Help option text.
protected  boolean mouseClickEditFlag
          Flag set true if region-edit via double-click on list is enabled.
protected  java.lang.String newRegionNameStr
          Name to be pre-filled in new regions.
 javax.swing.AbstractAction removeButtonActionObj
          Action object for the "Remove" button.
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IstiRegionPanel()
          Creates a region panel with all 'IstiRegion' option groups.
IstiRegionPanel(java.util.List optionGroups)
          Creates a region panel.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds an ActionListener to the panel.
protected  void addNewRegion(boolean circleFlag)
          Creates, edits and adds a new region object.
protected  void closeRegionEditPanel()
          Closes the region edit panel.
protected  void copyToNewRegion()
          Shows a list of regions; then shows an add-region dialog with entries copied from the selected source region.
 IstiDialogPopup createDialog(java.lang.String titleStr, java.awt.Component regionParentComp)
          Creates a dialog for the specified region panel.
 IstiDialogPopup createDialog(java.lang.String titleStr, java.awt.Component regionParentComp, boolean modalFlag)
          Creates a dialog for the specified region panel.
 IstiDialogPopup createDialog(java.lang.String titleStr, java.awt.Component regionParentComp, java.awt.Component regionEditParentComp)
          Creates a dialog for the specified region panel.
 IstiDialogPopup createDialog(java.lang.String titleStr, java.awt.Component regionParentComp, java.awt.Component regionEditParentComp, boolean modalFlag)
          Creates a dialog for the specified region panel.
protected  void editSelectedRegion()
          Edits the region that is currently selected on the GUI list.
protected  void editSpecifiedRegion(java.lang.String specStr, int specIdx)
          Edits the region that is currently selected on the GUI list.
protected  void fireActionPerformed(java.awt.event.ActionEvent event)
          Notifies all listeners that have registered interest for notification on this event type.
 IstiDialogPopup getDialog()
          Gets the dialog for this panel.
 java.lang.String getRegionString()
          Gets the region string.
 boolean isDialogVisible()
          Determines if the dialog for this panel is visible.
 boolean isHelpActionListenerInstalled()
          Returns true if the "Help"-button action listener is installed.
protected  void jbInit()
          Performs component initialization.
 void notifyHelpActionListener(java.lang.Object source)
          Notify the help action listener.
protected  void notifyRegionsUpdated()
          Notify regions updated.
protected  void openRegionEditPanel(java.lang.String regionStr, int regionIndex)
          Opens the region edit panel for the specified region.
 void removeActionListener(java.awt.event.ActionListener l)
          Removes an ActionListener from the panel.
protected  void removeSelectedRegions()
          Removes the one or more regions that are currently selected on the GUI list.
 void requestFocus()
          Overridden version that also calls 'requestFocus()' on the dialog hosting this panel.
protected  void selectAndShowListRegion(int idx)
          Selects the given entry on the GUI list of regions and ensures that the entry is visible.
protected  void setButtonsEnabled(boolean b)
          Enables or disables the buttons.
 void setHelpActionListener(java.awt.event.ActionListener l)
          Sets the "Help" button action listener.
 void setIstiRegionMgrObj(IstiRegionMgrIntf istiRegionMgrObj)
          Sets the region-manager object to be used by this panel.
 void setNewRegionNameStr(java.lang.String nameStr)
          Sets the name to be pre-filled when adding a new region.
 void setRegionString(java.lang.String str)
          Sets the region string.
 void showDialog(java.awt.Component regionParentComp, java.lang.String titleStr)
          Shows a dialog for the specified region panel.
 void showDialog(java.awt.Component regionParentComp, java.lang.String titleStr, boolean modalFlag)
          Shows a dialog for the specified region panel.
 void windowActivated(java.awt.event.WindowEvent e)
          Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events.
 void windowClosed(java.awt.event.WindowEvent e)
          Invoked when a window has been closed as the result of calling dispose on the window.
 void windowClosing(java.awt.event.WindowEvent e)
          Invoked when the user attempts to close the window from the window's system menu.
 void windowDeactivated(java.awt.event.WindowEvent e)
          Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents.
 void windowDeiconified(java.awt.event.WindowEvent e)
          Invoked when a window is changed from a minimized to a normal state.
 void windowIconified(java.awt.event.WindowEvent e)
          Invoked when a window is changed from a normal to a minimized state.
 void windowOpened(java.awt.event.WindowEvent e)
          Invoked the first time a window is made visible.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, isValidateRoot, 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, 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, setLayout, 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, setComponentOrientation, 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

HELP_OPTION_TEXT

public static final java.lang.String HELP_OPTION_TEXT
Help option text.

See Also:
Constant Field Values

CLOSE_OPTION_TEXT

public static final java.lang.String CLOSE_OPTION_TEXT
Close option text.

See Also:
Constant Field Values

DEF_NEWREGION_NAME

protected static final java.lang.String DEF_NEWREGION_NAME
Default region name text.

See Also:
Constant Field Values

dialogUtilObj

protected final IstiDialogUtil dialogUtilObj
Dialog utility object for popup messages.


dialogModalFlag

protected boolean dialogModalFlag
Flag set true if the dialogs are modal.


centerEditDialogFlag

protected boolean centerEditDialogFlag
Flag set true if the edit dialog should be centered.


mouseClickEditFlag

protected boolean mouseClickEditFlag
Flag set true if region-edit via double-click on list is enabled.


newRegionNameStr

protected java.lang.String newRegionNameStr
Name to be pre-filled in new regions.


dialogObj

protected IstiDialogPopup dialogObj
Dialog object for this panel.


addCircleButtonActionObj

public final javax.swing.AbstractAction addCircleButtonActionObj
Action object for the "Add Circle" button.


addPolyButtonActionObj

public final javax.swing.AbstractAction addPolyButtonActionObj
Action object for the "Add Poly" button.


editButtonActionObj

public final javax.swing.AbstractAction editButtonActionObj
Action object for the "Edit" button.


removeButtonActionObj

public final javax.swing.AbstractAction removeButtonActionObj
Action object for the "Remove" button.


copyButtonActionObj

public final javax.swing.AbstractAction copyButtonActionObj
Action object for the "Copy" button.

Constructor Detail

IstiRegionPanel

public IstiRegionPanel()
Creates a region panel with all 'IstiRegion' option groups.


IstiRegionPanel

public IstiRegionPanel(java.util.List optionGroups)
Creates a region panel.

Parameters:
optionGroups - the 'IstiRegion' option groups or null for all.
Method Detail

setIstiRegionMgrObj

public void setIstiRegionMgrObj(IstiRegionMgrIntf istiRegionMgrObj)
Sets the region-manager object to be used by this panel.

Parameters:
istiRegionMgrObj - region-manger object to use.

setNewRegionNameStr

public void setNewRegionNameStr(java.lang.String nameStr)
Sets the name to be pre-filled when adding a new region. If this method is not called then the default name "Region" will be used. (When a new region is created a number is appended after the name to make the region names unique.)

Parameters:
nameStr - region name to use.

jbInit

protected final void jbInit()
                     throws java.lang.Exception
Performs component initialization.

Throws:
java.lang.Exception - if an error occurs.

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds an ActionListener to the panel.

Parameters:
l - the ActionListener to be added

createDialog

public IstiDialogPopup createDialog(java.lang.String titleStr,
                                    java.awt.Component regionParentComp,
                                    java.awt.Component regionEditParentComp,
                                    boolean modalFlag)
Creates a dialog for the specified region panel.

Parameters:
titleStr - the title for the region panel.
regionParentComp - the parent for the region panel.
regionEditParentComp - the parent for region edit panel or null to use the region panel.
modalFlag - true for a modal dialog, false for modeless (allows other windows to run).
Returns:
A new 'IstiDialogPopup' object.

createDialog

public IstiDialogPopup createDialog(java.lang.String titleStr,
                                    java.awt.Component regionParentComp,
                                    java.awt.Component regionEditParentComp)
Creates a dialog for the specified region panel. A non-modal dialog is created.

Parameters:
titleStr - the title for the region panel.
regionParentComp - the parent for the region panel.
regionEditParentComp - the parent for region edit panel or null to use the region panel.
Returns:
A new 'IstiDialogPopup' object.

createDialog

public IstiDialogPopup createDialog(java.lang.String titleStr,
                                    java.awt.Component regionParentComp,
                                    boolean modalFlag)
Creates a dialog for the specified region panel. The region edit panel uses this region panel as its parent component.

Parameters:
titleStr - the title for the region panel.
regionParentComp - the parent for the region panel.
modalFlag - true for a modal dialog, false for modeless (allows other windows to run).
Returns:
A new 'IstiDialogPopup' object.

createDialog

public IstiDialogPopup createDialog(java.lang.String titleStr,
                                    java.awt.Component regionParentComp)
Creates a dialog for the specified region panel. The region edit panel uses this region panel as its parent component and a non-modal dialog is created.

Parameters:
titleStr - the title for the region panel.
regionParentComp - the parent for the region panel.
Returns:
A new 'IstiDialogPopup' object.

showDialog

public void showDialog(java.awt.Component regionParentComp,
                       java.lang.String titleStr,
                       boolean modalFlag)
Shows a dialog for the specified region panel. The region edit panel uses this region panel as its parent component.

Parameters:
regionParentComp - the parent for the region panel.
titleStr - the title for the region panel.
modalFlag - true for a modal dialog, false for modeless (allows other windows to run).

showDialog

public void showDialog(java.awt.Component regionParentComp,
                       java.lang.String titleStr)
Shows a dialog for the specified region panel. The region edit panel uses this region panel as its parent component and a non-modal dialog is created.

Parameters:
regionParentComp - the parent for the region panel.
titleStr - the title for the region panel.

getDialog

public IstiDialogPopup getDialog()
Gets the dialog for this panel.

Returns:
The dialog object for this panel, or null if none has been created.

isDialogVisible

public boolean isDialogVisible()
Determines if the dialog for this panel is visible.

Returns:
true if the dialog for this panel has been created and is visible; false otherwise.

requestFocus

public void requestFocus()
Overridden version that also calls 'requestFocus()' on the dialog hosting this panel.

Overrides:
requestFocus in class javax.swing.JComponent

getRegionString

public java.lang.String getRegionString()
Gets the region string.

Returns:
the region string.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the panel. If the listener is the currently set Action for the button, then the Action is set to null.

Parameters:
l - the listener to be removed

setHelpActionListener

public void setHelpActionListener(java.awt.event.ActionListener l)
Sets the "Help" button action listener.

Parameters:
l - the action listener.

setRegionString

public void setRegionString(java.lang.String str)
Sets the region string.

Parameters:
str - the region string.

addNewRegion

protected void addNewRegion(boolean circleFlag)
Creates, edits and adds a new region object.

Parameters:
circleFlag - true for circle, false for polygon.

editSelectedRegion

protected void editSelectedRegion()
Edits the region that is currently selected on the GUI list.


editSpecifiedRegion

protected void editSpecifiedRegion(java.lang.String specStr,
                                   int specIdx)
Edits the region that is currently selected on the GUI list.

Parameters:
specStr - region string to edit.
specIdx - index of given region string, or -1 if adding new region.

copyToNewRegion

protected void copyToNewRegion()
Shows a list of regions; then shows an add-region dialog with entries copied from the selected source region.


closeRegionEditPanel

protected void closeRegionEditPanel()
Closes the region edit panel.


fireActionPerformed

protected void fireActionPerformed(java.awt.event.ActionEvent event)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
event - the ChangeEvent object
See Also:
EventListenerList

notifyHelpActionListener

public void notifyHelpActionListener(java.lang.Object source)
Notify the help action listener.

Parameters:
source - the object that originated the event

isHelpActionListenerInstalled

public boolean isHelpActionListenerInstalled()
Returns true if the "Help"-button action listener is installed.

Returns:
true if the "Help"-button action listener is installed.

notifyRegionsUpdated

protected void notifyRegionsUpdated()
Notify regions updated.


openRegionEditPanel

protected void openRegionEditPanel(java.lang.String regionStr,
                                   int regionIndex)
Opens the region edit panel for the specified region.

Parameters:
regionStr - the region-text string, or an empty string for none.
regionIndex - the region index.

removeSelectedRegions

protected void removeSelectedRegions()
Removes the one or more regions that are currently selected on the GUI list.


selectAndShowListRegion

protected void selectAndShowListRegion(int idx)
Selects the given entry on the GUI list of regions and ensures that the entry is visible.

Parameters:
idx - the index of the region entry.

setButtonsEnabled

protected void setButtonsEnabled(boolean b)
Enables or disables the buttons.

Parameters:
b - true to enable, false to disable.

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Invoked the first time a window is made visible.

Specified by:
windowOpened in interface java.awt.event.WindowListener
Parameters:
e - window event

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Invoked when the user attempts to close the window from the window's system menu. If the program does not explicitly hide or dispose the window while processing this event, the window close operation will be cancelled.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - window event

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Invoked when a window has been closed as the result of calling dispose on the window.

Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
e - window event

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.

Specified by:
windowIconified in interface java.awt.event.WindowListener
Parameters:
e - window event
See Also:
Frame.setIconImage(java.awt.Image)

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a minimized to a normal state.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Parameters:
e - window event

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Parameters:
e - window event

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents.

Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Parameters:
e - window event