edu.wisc.ssec.mcidasv.servermanager
Class TabbedAddeManager

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 edu.wisc.ssec.mcidasv.servermanager.TabbedAddeManager
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class TabbedAddeManager
extends JFrame

This class is the GUI frontend to EntryStore (the server manager). It allows users to manipulate their local and remote ADDE data.

See Also:
Serialized Form

Nested Class Summary
private static class TabbedAddeManager.BetterCheckTask
           
private  class TabbedAddeManager.CheckEntryTask
           
 class TabbedAddeManager.EntrySourceRenderer
           
 class TabbedAddeManager.EntryValidityRenderer
           
static class TabbedAddeManager.Event
          These are the various "events" that the server manager GUI supports.
private static class TabbedAddeManager.LocalAddeTableModel
           
private static class TabbedAddeManager.RemoteAddeTableModel
           
static class TabbedAddeManager.TextRenderer
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
private  JPanel contentPane
           
private  JButton editLocalButton
           
private  JMenuItem editMenuItem
           
private  JButton editRemoteButton
           
private  boolean guiInitialized
          Whether or not initComponents() has been called.
private static String HELP_TOP_DIR
          Path to the help resources.
private  JCheckBox importAccountBox
           
private  JTextField importProject
           
private  JButton importRemoteButton
           
private  JTextField importUser
           
private  Icon invalid
          Icon for invalid datasets.
private static String LAST_IMPORTED
          ID used to save/restore the last directory that contained a MCTABLE.TXT.
private static String LAST_TAB
          ID used to save/restore the last visible tab between sessions.
private static String LOCAL_HELP_TARGET
          Help target for the local servers.
private  JTable localTable
           
private static org.slf4j.Logger logger
          Pretty typical logger object.
private  Icon mctable
          Icon for datasets that originate from a MCTABLE.TXT.
private  JButton newLocalButton
           
private  JButton newRemoteButton
           
private  JButton okButton
           
private static int POOL
          Size of the ADDE entry verification thread pool.
private static String REMOTE_HELP_TARGET
          Help target for the remote servers.
private  JTable remoteTable
           
private  JButton removeLocalButton
           
private  JMenuItem removeMenuItem
           
private  JButton removeRemoteButton
           
private  List<LocalAddeEntry> selectedLocalEntries
           
private  List<RemoteAddeEntry> selectedRemoteEntries
           
private  EntryStore serverManager
          Reference to the actual server manager.
private static TabbedAddeManager staticTabbedManager
          Static reference to an instance of this class.
private  JLabel statusLabel
           
private  Icon system
          Icon for datasets that are part of a default McIDAS-V install.
private  JTabbedPane tabbedPane
           
private  Icon unverified
          Icon for datasets that have not been verified.
private  Icon user
          Icon for datasets that the user has provided.
 
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
TabbedAddeManager()
          Creates a standalone server manager GUI.
TabbedAddeManager(EntryStore entryStore)
          Creates a server manager GUI that's linked back to the rest of McIDAS-V.
 
Method Summary
 Set<RemoteAddeEntry> checkDatasets(Collection<RemoteAddeEntry> entries)
           
 void closeManager()
          Closes and disposes (if needed) the GUI.
private  void formWindowClosed(WindowEvent evt)
          Handles the user closing the server manager GUI.
private  String getLastImportPath()
          Returns the directory that contained the most recently imported MCTABLE.TXT.
private  int getLastTab()
          Returns the index of the user's last server manager tab.
private  List<LocalAddeEntry> getSelectedLocalEntries()
          Gets the selected local ADDE entries.
private  List<RemoteAddeEntry> getSelectedRemoteEntries()
          Gets the selected remote ADDE entries.
private  LocalAddeEntry getSingleLocalSelection()
          If there is a single local dataset selected, this method will return that dataset.
static TabbedAddeManager getTabbedManager()
          Returns an instance of this class.
private  void handleTabStateChanged(ChangeEvent event)
          Respond to changes in tabbedPane; primarily switching tabs.
private  boolean hasLocalSelection()
          Checks to see if selectedLocalEntries contains any LocalAddeEntrys.
private  boolean hasRemoteSelection()
          Checks to see if selectedRemoteEntries contains any RemoteAddeEntrys.
private  boolean hasSingleLocalSelection()
          Checks to see if the user has select a single local dataset.
private  boolean hasSingleRemoteSelection()
          Checks to see if the user has select a single remote dataset.
private static Icon icon(String path)
           
private  void importButtonActionPerformed(ActionEvent evt)
           
 void importMctable(String path, String username, String project)
          Extracts datasets from a given MCTABLE.TXT and adds them to the server manager.
 void initComponents()
          Builds the server manager GUI.
private  void localSelectionModelChanged(ListSelectionEvent e)
          Respond to events from the local dataset table.
static void main(String[] args)
          Launch the application.
private  JPanel makeFileChooserAccessory()
           
 void mcservUpdated(AddeThread.McservEvent event)
          Responds to local server events and attempts to update the GUI status message.
 void refreshDisplay()
          Attempts to refresh the contents of both the local and remote dataset tables.
private  void remoteSelectionModelChanged(ListSelectionEvent e)
          Respond to events.
 void removeLocalEntries(Collection<LocalAddeEntry> entries)
          Removes the given local ADDE entries from the server manager GUI.
 void removeRemoteEntries(Collection<RemoteAddeEntry> entries)
          Removes the given remote ADDE entries from the server manager GUI.
private  void setLastImportPath(String path)
          Saves the directory that contained the most recently imported MCTABLE.TXT.
private  void setLastTab(int index)
          Saves the index of the last server manager tab the user was looking at.
private  void setSelectedLocalEntries(Collection<LocalAddeEntry> entries)
          Corresponds to the selected local ADDE entries in the GUI.
private  void setSelectedRemoteEntries(Collection<RemoteAddeEntry> entries)
          Corresponds to the selected remote ADDE entries in the GUI.
 void showLocalEditor()
          Shows a local ADDE entry editor without anything pre-populated (creating a new local ADDE dataset).
 void showLocalEditor(LocalAddeEntry entry)
          Shows a local ADDE entry editor with the appropriate fields pre-populated, using the values from entry.
 void showManager()
          If the GUI isn't shown, this method will display things.
 void showRemoteEditor()
          Create and show the GUI the remote ADDE dataset GUI.
 void showRemoteEditor(List<RemoteAddeEntry> entries)
          Create and show the GUI the remote ADDE dataset GUI.
 void startLocalServers()
          Attempts to start the local servers.
 void stopLocalServers()
          Attempts to stop the local servers.
 
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, paint, 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, 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

logger

private static final org.slf4j.Logger logger
Pretty typical logger object.


HELP_TOP_DIR

private static final String HELP_TOP_DIR
Path to the help resources.

See Also:
Constant Field Values

REMOTE_HELP_TARGET

private static final String REMOTE_HELP_TARGET
Help target for the remote servers.

See Also:
Constant Field Values

LOCAL_HELP_TARGET

private static final String LOCAL_HELP_TARGET
Help target for the local servers.

See Also:
Constant Field Values

LAST_TAB

private static final String LAST_TAB
ID used to save/restore the last visible tab between sessions.

See Also:
Constant Field Values

LAST_IMPORTED

private static final String LAST_IMPORTED
ID used to save/restore the last directory that contained a MCTABLE.TXT.

See Also:
Constant Field Values

POOL

private static final int POOL
Size of the ADDE entry verification thread pool.

See Also:
Constant Field Values

staticTabbedManager

private static TabbedAddeManager staticTabbedManager
Static reference to an instance of this class. Bad idea!


serverManager

private final EntryStore serverManager
Reference to the actual server manager.


selectedRemoteEntries

private final List<RemoteAddeEntry> selectedRemoteEntries

selectedLocalEntries

private final List<LocalAddeEntry> selectedLocalEntries

importUser

private JTextField importUser

importProject

private JTextField importProject

guiInitialized

private boolean guiInitialized
Whether or not initComponents() has been called.


contentPane

private JPanel contentPane

remoteTable

private JTable remoteTable

localTable

private JTable localTable

tabbedPane

private JTabbedPane tabbedPane

statusLabel

private JLabel statusLabel

newRemoteButton

private JButton newRemoteButton

editRemoteButton

private JButton editRemoteButton

removeRemoteButton

private JButton removeRemoteButton

importRemoteButton

private JButton importRemoteButton

newLocalButton

private JButton newLocalButton

editLocalButton

private JButton editLocalButton

removeLocalButton

private JButton removeLocalButton

okButton

private JButton okButton

editMenuItem

private JMenuItem editMenuItem

removeMenuItem

private JMenuItem removeMenuItem

importAccountBox

private JCheckBox importAccountBox

system

private Icon system
Icon for datasets that are part of a default McIDAS-V install.


mctable

private Icon mctable
Icon for datasets that originate from a MCTABLE.TXT.


user

private Icon user
Icon for datasets that the user has provided.


invalid

private Icon invalid
Icon for invalid datasets.


unverified

private Icon unverified
Icon for datasets that have not been verified.

Constructor Detail

TabbedAddeManager

public TabbedAddeManager()
Creates a standalone server manager GUI.


TabbedAddeManager

public TabbedAddeManager(EntryStore entryStore)
Creates a server manager GUI that's linked back to the rest of McIDAS-V.

Parameters:
entryStore - Server manager reference.
Throws:
NullPointerException - if entryStore is null.
Method Detail

getTabbedManager

public static TabbedAddeManager getTabbedManager()
Returns an instance of this class. The instance should correspond to the one being used by the "rest" of McIDAS-V.

Returns:
Either an instance of this class or null.

showManager

public void showManager()
If the GUI isn't shown, this method will display things. If the GUI is shown, bring it to the front.

This method publishes TabbedAddeManager.Event.SHOWN.


closeManager

public void closeManager()
Closes and disposes (if needed) the GUI.


refreshDisplay

public void refreshDisplay()
Attempts to refresh the contents of both the local and remote dataset tables.


showRemoteEditor

public void showRemoteEditor()
Create and show the GUI the remote ADDE dataset GUI. Since no RemoteAddeEntries have been provided, none of the fields will be prefilled (user is creating a new dataset).


showRemoteEditor

public void showRemoteEditor(List<RemoteAddeEntry> entries)
Create and show the GUI the remote ADDE dataset GUI. Since some RemoteAddeEntries have been provided, all of the applicable fields will be filled (user is editing an existing dataset).

Parameters:
entries - Selection to edit. Should not be null.

removeRemoteEntries

public void removeRemoteEntries(Collection<RemoteAddeEntry> entries)
Removes the given remote ADDE entries from the server manager GUI.

Parameters:
entries - Entries to remove. null is permissible, but is a "no-op".

showLocalEditor

public void showLocalEditor()
Shows a local ADDE entry editor without anything pre-populated (creating a new local ADDE dataset).


showLocalEditor

public void showLocalEditor(LocalAddeEntry entry)
Shows a local ADDE entry editor with the appropriate fields pre-populated, using the values from entry. This is intended to handled "editing" a local ADDE dataset.

Parameters:
entry - Entry to edit; should not be null.

removeLocalEntries

public void removeLocalEntries(Collection<LocalAddeEntry> entries)
Removes the given local ADDE entries from the server manager GUI.

Parameters:
entries - Entries to remove. null is permissible, but is a "no-op".

importMctable

public void importMctable(String path,
                          String username,
                          String project)
Extracts datasets from a given MCTABLE.TXT and adds them to the server manager.

Parameters:
path - Path to the MCTABLE.TXT. Cannot be null.
username - ADDE username to use for verifying extracted datasets. Cannot be null.
project - ADDE project number to use for verifying extracted datasets. Cannot be null.

startLocalServers

public void startLocalServers()
Attempts to start the local servers.

See Also:
EntryStore.startLocalServer()

stopLocalServers

public void stopLocalServers()
Attempts to stop the local servers.

See Also:
EntryStore.stopLocalServer()

mcservUpdated

public void mcservUpdated(AddeThread.McservEvent event)
Responds to local server events and attempts to update the GUI status message.

Parameters:
event - Local server event. Should not be null.

initComponents

public void initComponents()
Builds the server manager GUI.


handleTabStateChanged

private void handleTabStateChanged(ChangeEvent event)
Respond to changes in tabbedPane; primarily switching tabs.

Parameters:
event - Event being handled. Ignored for now.

remoteSelectionModelChanged

private void remoteSelectionModelChanged(ListSelectionEvent e)
Respond to events.

Parameters:
e - ListSelectionEvent that necessitated this call.

localSelectionModelChanged

private void localSelectionModelChanged(ListSelectionEvent e)
Respond to events from the local dataset table.

Parameters:
e - ListSelectionEvent that necessitated this call.

hasRemoteSelection

private boolean hasRemoteSelection()
Checks to see if selectedRemoteEntries contains any RemoteAddeEntrys.

Returns:
Whether or not any RemoteAddeEntry values are selected.

hasLocalSelection

private boolean hasLocalSelection()
Checks to see if selectedLocalEntries contains any LocalAddeEntrys.

Returns:
Whether or not any LocalAddeEntry values are selected.

hasSingleRemoteSelection

private boolean hasSingleRemoteSelection()
Checks to see if the user has select a single remote dataset.

Returns:
true if there is a single remote dataset selected. false otherwise.

hasSingleLocalSelection

private boolean hasSingleLocalSelection()
Checks to see if the user has select a single local dataset.

Returns:
true if there is a single local dataset selected. false otherwise.

getSingleLocalSelection

private LocalAddeEntry getSingleLocalSelection()
If there is a single local dataset selected, this method will return that dataset.

Returns:
Either the single selected local dataset, or LocalAddeEntry.INVALID_ENTRY.

setSelectedRemoteEntries

private void setSelectedRemoteEntries(Collection<RemoteAddeEntry> entries)
Corresponds to the selected remote ADDE entries in the GUI.

Parameters:
entries - Should not be null.

getSelectedRemoteEntries

private List<RemoteAddeEntry> getSelectedRemoteEntries()
Gets the selected remote ADDE entries.

Returns:
Either an empty list or the remote entries selected in the GUI.

setSelectedLocalEntries

private void setSelectedLocalEntries(Collection<LocalAddeEntry> entries)
Corresponds to the selected local ADDE entries in the GUI.

Parameters:
entries - Should not be null.

getSelectedLocalEntries

private List<LocalAddeEntry> getSelectedLocalEntries()
Gets the selected local ADDE entries.

Returns:
Either an empty list or the local entries selected in the GUI.

formWindowClosed

private void formWindowClosed(WindowEvent evt)
Handles the user closing the server manager GUI.

Parameters:
evt - Event that triggered this method call.
See Also:
closeManager()

makeFileChooserAccessory

private JPanel makeFileChooserAccessory()

importButtonActionPerformed

private void importButtonActionPerformed(ActionEvent evt)

getLastImportPath

private String getLastImportPath()
Returns the directory that contained the most recently imported MCTABLE.TXT.

Returns:
Either the path to the most recently imported MCTABLE.TXT file, or an empty String.

setLastImportPath

private void setLastImportPath(String path)
Saves the directory that contained the most recently imported MCTABLE.TXT.

Parameters:
path - Path to the most recently imported MCTABLE.TXT file. null values are replaced with an empty String.

getLastTab

private int getLastTab()
Returns the index of the user's last server manager tab.

Returns:
Index of the user's most recently viewed server manager tab, or 0.

setLastTab

private void setLastTab(int index)
Saves the index of the last server manager tab the user was looking at.

Parameters:
index - Index of the user's most recently viewed server manager tab.

checkDatasets

public Set<RemoteAddeEntry> checkDatasets(Collection<RemoteAddeEntry> entries)

icon

private static Icon icon(String path)
Parameters:
path -
Returns:

main

public static void main(String[] args)
Launch the application. Makes for a simplistic test.

Parameters:
args - Command line arguments. These are currently ignored.