org.opensha.sha.gcim.ui
Class IMCorrRel_MultiGuiBean

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 org.opensha.commons.gui.LabeledBoxPanel
                      extended by org.opensha.sha.gcim.ui.IMCorrRel_MultiGuiBean
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IMTChangeListener

public class IMCorrRel_MultiGuiBean
extends LabeledBoxPanel
implements ActionListener, IMTChangeListener

This is a IMCorrRel selection GUI which allows for multiple IM Correlation Relations to be selected and edited, one for each Tectonic Region Type.

Version:
1.0 5 July 2010, 2.0 4 Jan 2011 - added HARD CODED lines to store default IMikj correlation relations which are needed for GCIM simulations
Author:
Brendon Bradley
See Also:
Serialized Form

Nested Class Summary
 class IMCorrRel_MultiGuiBean.ChooserComboBox
          Internal sub-class for IMCorrRel chooser combo box
 class IMCorrRel_MultiGuiBean.EnableableCellRenderer
          This class is the cell renderer for the drop down chooser boxes.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JCheckBox singleIMCorrRelBox
           
protected static Font supportedTRTFont
           
protected static Font unsupportedTRTFont
           
 
Fields inherited from class org.opensha.commons.gui.LabeledBoxPanel
addDefault, borderColor, C, D, editorPanel, GBL, headerLabel, headerPanel, headerPanelBackgroundColor, jScrollPane1, title
 
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
IMCorrRel_MultiGuiBean(ArrayList<ImCorrelationRelationship> imCorrRels, Parameter<Double> imtj)
          Initializes the GUI with the given list of IMCorrRels
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addIMCorrRelChangeListener(IMCorrRelChangeListener listener)
           
protected  IMCorrRel_MultiGuiBean.ChooserComboBox getChooser(TectonicRegionType trt)
           
 HashMap<TectonicRegionType,ImCorrelationRelationship> getIMCorrRelMap()
          This returns a clone of the current IMCorrRel map in the GUI.
 ArrayList<ImCorrelationRelationship> getIMCorrRels()
          Returns a clone of this GUI's IMCorrRel list
 ArrayList<HashMap<TectonicRegionType,ImCorrelationRelationship>> getIMikCorrRelMap()
          This returns a clone of the current IMikCorrRel map in the GUI.
 NtoNMap<TectonicRegionType,ImCorrelationRelationship> getNtoNMap()
           
protected  IMCorrRel_ParamEditor getParamEdit()
           
 ImCorrelationRelationship getSelectedIMCorrRel()
          This returns the selected IMCorrRel if only a single one is selected.
 ArrayList<TectonicRegionType> getTectonicRegions()
           
 void imtChange(IMTChangeEvent e)
          This method will be called when the IMT is changed in an editor
 boolean isCheckBoxVisible()
           
 boolean isIMCorrRelEnabled(String imCorrRelName)
           
 boolean isMultipleIMCorrRels()
           
 void rebuildGUI()
          This rebuilds all components of the GUI for display
 void removeIMCorrRelChangeListener(IMCorrRelChangeListener listener)
           
 void setIMCorrRel(String imCorrRelName, TectonicRegionType trt)
           
 void setIMTi(Parameter<Double> newIMTi)
          Sets the IMTi that this GUI should use.
 void setMaxChooserChars(int maxChooserChars)
          Sets the number of characters that should be displayed in the chooser lists.
 void setMultipleIMCorrRels(boolean multipleIMCorrRels)
          Sets the GUI to multiple/single IMCorrRel mode.
 void setMultipleIMCorrRelsEnabled(boolean enabled)
          this enables/disables the multiple IMCorrRel check box.
 void setMultipleIMikCorrRels(boolean multipleIMikCorrRels)
          Sets the GUI to multiple/single IMikCorrRel mode.
 void setSelectedSingleIMCorrRel(String imCorrRelName)
          Sets the GUI to single IMCorrRel mode, and sets the selected IMCorrRel to the given name.
 void setSelectedSingleIMikCorrRel(int corrRelIndex, ImCorrelationRelationship imikCorrRel)
          Sets the GUI to single IMikCorrRel mode, and sets the selected IMikCorrRel to the given name.
 void setTectonicRegions(ArrayList<TectonicRegionType> regions)
          This sets the tectonic regions for the GUI.
 void showParamEditor(TectonicRegionType trt)
          In multiple IMCorrRel mode, shows the parameter editor for the IMCorrRel associated with the given tectonic region type.
 void updateIMCorrRelMap()
          This updates the current in-memory IMCorrRel map (the one returned by getIMCorrRelMap())
 
Methods inherited from class org.opensha.commons.gui.LabeledBoxPanel
add, add, add, add, add, addPanel, getBorderColor, getHeaderPanelBackgroundColor, getTitle, jbInit, remove, remove, removeAll, setHeaderPanelBackgroundColor, setLayout, setTitle
 
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, 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
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, 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, 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

singleIMCorrRelBox

protected JCheckBox singleIMCorrRelBox

supportedTRTFont

protected static final Font supportedTRTFont

unsupportedTRTFont

protected static final Font unsupportedTRTFont
Constructor Detail

IMCorrRel_MultiGuiBean

public IMCorrRel_MultiGuiBean(ArrayList<ImCorrelationRelationship> imCorrRels,
                              Parameter<Double> imtj)
Initializes the GUI with the given list of IMCorrRels

Parameters:
imCorrRels -
Method Detail

rebuildGUI

public void rebuildGUI()
This rebuilds all components of the GUI for display


isCheckBoxVisible

public boolean isCheckBoxVisible()
Returns:
true if the single IMCorrRel check box is visible in the GUI

setTectonicRegions

public void setTectonicRegions(ArrayList<TectonicRegionType> regions)
This sets the tectonic regions for the GUI. If regions is not null and contains multiple, TRTs, then the user can select multiple IMCorrRels This triggers a GUI rebuild, and will fire an IMCorrRel Change Event if necessary

Parameters:
regions -

getTectonicRegions

public ArrayList<TectonicRegionType> getTectonicRegions()
Returns:
the list Tectonic Regions from the GUI

getChooser

protected IMCorrRel_MultiGuiBean.ChooserComboBox getChooser(TectonicRegionType trt)

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

isMultipleIMCorrRels

public boolean isMultipleIMCorrRels()
Returns:
true if multiple IMCorrRels are both enabled, and selected

setMultipleIMCorrRelsEnabled

public void setMultipleIMCorrRelsEnabled(boolean enabled)
this enables/disables the multiple IMCorrRel check box.

Parameters:
enabled -

getSelectedIMCorrRel

public ImCorrelationRelationship getSelectedIMCorrRel()
This returns the selected IMCorrRel if only a single one is selected. Otherwise, a RuntimeException is thrown.

Returns:

showParamEditor

public void showParamEditor(TectonicRegionType trt)
In multiple IMCorrRel mode, shows the parameter editor for the IMCorrRel associated with the given tectonic region type.

Parameters:
trt -

getParamEdit

protected IMCorrRel_ParamEditor getParamEdit()

getIMCorrRelMap

public HashMap<TectonicRegionType,ImCorrelationRelationship> getIMCorrRelMap()
This returns a clone of the current IMCorrRel map in the GUI. This internal IMCorrRel map is updated when certain actions are preformed, and should always be up to date.

Returns:

getIMikCorrRelMap

public ArrayList<HashMap<TectonicRegionType,ImCorrelationRelationship>> getIMikCorrRelMap()
This returns a clone of the current IMikCorrRel map in the GUI. This internal IMikCorrRel map is updated when certain actions are preformed, and should always be up to date.

Returns:

updateIMCorrRelMap

public void updateIMCorrRelMap()
This updates the current in-memory IMCorrRel map (the one returned by getIMCorrRelMap())


setMultipleIMCorrRels

public void setMultipleIMCorrRels(boolean multipleIMCorrRels)
Sets the GUI to multiple/single IMCorrRel mode. If setting to multiple, but multiple isn't supported, a RundimeException is thrown. The GUI will be updated, and IMCorrRel an change event will be fired as needed.

Parameters:
multipleIMCorrRels -

setMultipleIMikCorrRels

public void setMultipleIMikCorrRels(boolean multipleIMikCorrRels)
Sets the GUI to multiple/single IMikCorrRel mode. If setting to multiple, but multiple isn't supported, a RundimeException is thrown. The GUI will be updated, and IMCorrRel an change event will be fired as needed.

Parameters:
multipleIMCorrRels -

setSelectedSingleIMCorrRel

public void setSelectedSingleIMCorrRel(String imCorrRelName)
Sets the GUI to single IMCorrRel mode, and sets the selected IMCorrRel to the given name.

Parameters:
imCorrRelName -

setIMCorrRel

public void setIMCorrRel(String imCorrRelName,
                         TectonicRegionType trt)

setSelectedSingleIMikCorrRel

public void setSelectedSingleIMikCorrRel(int corrRelIndex,
                                         ImCorrelationRelationship imikCorrRel)
Sets the GUI to single IMikCorrRel mode, and sets the selected IMikCorrRel to the given name. THIS IS HARD CODED - NEEDS TO BE CODED CORRECTLY AT A LATER DATE

Parameters:
imCorrRelName -

addIMCorrRelChangeListener

public void addIMCorrRelChangeListener(IMCorrRelChangeListener listener)

removeIMCorrRelChangeListener

public void removeIMCorrRelChangeListener(IMCorrRelChangeListener listener)

isIMCorrRelEnabled

public boolean isIMCorrRelEnabled(String imCorrRelName)

setIMTi

public void setIMTi(Parameter<Double> newIMTi)
Sets the IMTi that this GUI should use. All IMCorrRels that don't support this IMTi will be disabled.

Parameters:
newIMTi - - new IMTi, or null to enable all IMCorrRels

getIMCorrRels

public ArrayList<ImCorrelationRelationship> getIMCorrRels()
Returns a clone of this GUI's IMCorrRel list

Returns:

getNtoNMap

public NtoNMap<TectonicRegionType,ImCorrelationRelationship> getNtoNMap()

imtChange

public void imtChange(IMTChangeEvent e)
Description copied from interface: IMTChangeListener
This method will be called when the IMT is changed in an editor

Specified by:
imtChange in interface IMTChangeListener

setMaxChooserChars

public void setMaxChooserChars(int maxChooserChars)
Sets the number of characters that should be displayed in the chooser lists. This helps to constrain GUI width.

Parameters:
maxChooserChars -