edu.wisc.ssec.mcidasv.util
Class McVGuiUtils

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.util.McVGuiUtils
All Implemented Interfaces:
Constants, IdvConstants

public class McVGuiUtils
extends Object
implements Constants


Nested Class Summary
static class McVGuiUtils.IconPanel
          Use this class to create a panel with a background image
static class McVGuiUtils.Position
           
static class McVGuiUtils.Prefer
           
static class McVGuiUtils.TextColor
           
static class McVGuiUtils.Width
           
 
Field Summary
private static int ESTIMATED_VM_COUNT
          Estimated number of ViewManagers.
private static org.slf4j.Logger logger
           
 
Fields inherited from interface edu.wisc.ssec.mcidasv.Constants
BLANK_COMP_GROUP, COMP_MONITORPANEL, DATASELECTOR_NAME, DEFAULT_DOCPATH, DEFAULT_SERVERSTATE, DISPLAY_NAME, DISPLAYCONTROLLER_NAME, ELEMENT_DOUBLE_WIDTH, ELEMENT_DOUBLEDOUBLE_WIDTH, ELEMENT_HALF_WIDTH, ELEMENT_ONEHALF_WIDTH, ELEMENT_WIDTH, FILTER_MCV, FILTER_MCVMCVZ, FILTER_MCVZ, GAP_RELATED, GAP_UNRELATED, HOMEPAGE_URL, ICON_ACCEPT_SMALL, ICON_ADD_SMALL, ICON_APPLY_SMALL, ICON_BACKGROUND_SMALL, ICON_CANCEL, ICON_CANCEL_SMALL, ICON_CHECKVERSION_SMALL, ICON_COLORTABLE_SMALL, ICON_CONNECT_SMALL, ICON_CONSOLE_SMALL, ICON_DATAEXPLORER_SMALL, ICON_DEFAULTLAYOUT_SMALL, ICON_DEFAULTLAYOUTADD_SMALL, ICON_DEFAULTLAYOUTDELETE_SMALL, ICON_DELETE_SMALL, ICON_DISCONNECT_SMALL, ICON_ERROR_SMALL, ICON_EXCLAMATION_SMALL, ICON_FAVORITE_SMALL, ICON_FAVORITEMANAGE_SMALL, ICON_FAVORITESAVE_SMALL, ICON_FORUMS_SMALL, ICON_GETTINGSTARTED_SMALL, ICON_HELP, ICON_HELP_SMALL, ICON_HELPTIPS_SMALL, ICON_INFORMATION_SMALL, ICON_LAYOUTEDIT_SMALL, ICON_LOCALDATA_SMALL, ICON_LOCATION_SMALL, ICON_MCIDASV_SMALL, ICON_NEWTAB_SMALL, ICON_NEWWINDOW_SMALL, ICON_NEXT_SMALL, ICON_NOTE_SMALL, ICON_OPEN, ICON_OPEN_SMALL, ICON_PREFERENCES_SMALL, ICON_PREVIOUS_SMALL, ICON_RANDOM_SMALL, ICON_RANGEANDBEARING_SMALL, ICON_REDO_SMALL, ICON_REFRESH, ICON_REFRESH_SMALL, ICON_REMOVE_SMALL, ICON_REMOVEDATA_SMALL, ICON_REMOVELAYERS_SMALL, ICON_REMOVELAYERSDATA_SMALL, ICON_SAVE, ICON_SAVE_SMALL, ICON_SAVEAS_SMALL, ICON_SUPPORT_SMALL, ICON_UNDO_SMALL, ICON_UPDATE, ICON_USERSGUIDE_SMALL, LOCAL_ADDE_PORT, MACRO_BUILDDATE, MACRO_COPYRIGHT_YEAR, MACRO_IDV_VERSION, MACRO_VERSION, MACRO_VISAD_VERSION, MAX_MEMORY_32BIT, MCV_BLUE, MCV_BLUE_DARK, NOTICE_URL, OS_OSX, PANEL_NAME, PREF_AUTO_SAVE_DEFAULT_LAYOUT, PREF_CONFIRM_REMOVE_BOTH, PREF_CONFIRM_REMOVE_DATA, PREF_CONFIRM_REMOVE_LAYERS, PREF_IMAGE_PREVIEW, PREF_LIST_ADDE_SERVERS, PREF_LIST_ADVANCED, PREF_LIST_AVAILABLE_DISPLAYS, PREF_LIST_DATA_CHOOSERS, PREF_LIST_FORMATS_DATA, PREF_LIST_GENERAL, PREF_LIST_LOCAL_ADDE, PREF_LIST_NAV_CONTROLS, PREF_LIST_TOOLBAR, PREF_LIST_VIEW, PREF_OPEN_LIMIT_WIN, PREF_PRERELEASE_CHECK, PREF_SAVE_DASHBOARD_VIZ, PREF_SERVERSTATE, PREF_SYSTEMSERVERSIMG, PREF_TBM_SIZE, PREF_VERSION_CHECK, PRERELEASE_URL, PROP_ABOUTTEXT, PROP_APP_ICON, PROP_BUILD_DATE, PROP_CHAN, PROP_COPYRIGHT_YEAR, PROP_DASHBOARD_BOUNDS, PROP_HOMEPAGE, PROP_SERVERS, PROP_SERVERS_ALL, PROP_SYSMEM, PROP_TABBED_UI, PROP_VERSION_MAJOR, PROP_VERSION_MINOR, PROP_VERSION_RELEASE, PROP_VERSIONFILE, PROP_VISAD_DATE, PROP_VISAD_ORIGINAL, PROP_VISAD_PARSE_FAIL, PROP_VISAD_REVISION, PROP_VP_CATOPEN, PROP_VP_SHOWCATS, PROP_VP_SHOWPOPUP, PROPERTIES_FILE, SCRUB_STRINGS_FILE, SUFFIX_MCV, SUFFIX_MCVZ, USER_DIRECTORY_NAME, VERSION_HANDLER_URL, VERSION_URL
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_MAX_PERMGENSIZE, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAX_PERMGENSIZE, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_TIMEDRIVER, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
 
Constructor Summary
private McVGuiUtils()
           
 
Method Summary
static void compGroup(IdvComponentGroup g)
           
static void compGroup(IdvComponentGroup g, int level)
           
static void compHolder(IdvComponentHolder h, int level)
           
static int findDisplayNumberForComponent(Component comp)
          Tries to determine the physical display that contains the given Component.
static int findDisplayNumberForCoords(int x, int y, int width, int height)
          Tries to determine the physical display that contains the rectangle defined by the specified coordinates.
static int findDisplayNumberForEvent(EventObject event)
          Tries to determine which physical display contains the Component or MultiFrame that fired the given event.
static int findDisplayNumberForMultiFrame(MultiFrame mf)
          Tries to determine the physical display that contains the given MultiFrame.
static int findDisplayNumberForRectangle(Rectangle rect)
          Tries to determine the physical display that contains the given Rectangle.
static List<ViewManager> findvms(List<WindowInfo> windows)
           
static IdvComponentHolder getActiveComponentHolder()
           
static List<ViewManager> getActiveViewManagers()
           
static IdvComponentHolder getAfterActiveHolder()
           
static IdvComponentHolder getAfterHolder(IdvComponentHolder current)
           
static List<IdvComponentGroup> getAllComponentGroups()
           
static List<IdvComponentHolder> getAllComponentHolders()
           
static List<IdvWindow> getAllDisplayWindows()
           
static List<Object> getAllShareGroups()
           
static List<ViewManager> getAllViewManagers()
           
static IdvComponentHolder getBeforeActiveHolder()
           
static IdvComponentHolder getBeforeHolder(IdvComponentHolder current)
           
static IdvComponentGroup getComponentGroup(IdvWindow window)
           
static List<IdvComponentGroup> getComponentGroups(IdvComponentGroup group)
           
static List<IdvComponentGroup> getComponentGroups(List<WindowInfo> windows)
           
static List<IdvComponentGroup> getComponentGroups(WindowInfo window)
           
static List<IdvComponentHolder> getComponentHolders(IdvComponentGroup group)
           
static List<IdvComponentHolder> getComponentHolders(IdvWindow idvWindow)
           
static List<IdvComponentHolder> getComponentHolders(WindowInfo windowInfo)
           
static Rectangle getDisplayBoundsFor(int index)
          Find the "bounds" for the physical display at index.
static JComboBox getEditableBox(Collection<?> items, Object selected)
           
private static int getGroupCount()
           
private static int getHolderCount()
           
static List<Object> getShareGroupsInWindow(IdvWindow window)
           
static List<ViewManager> getViewManagers(IdvWindow window)
           
static List<ViewManager> getViewManagers(WindowInfo info)
           
static List<ViewManager> getViewManagersInGroup(Object sharedGroup)
           
private static int getVMCount()
           
static boolean hasDynamicSkins(List<WindowInfo> windows)
           
static boolean hasNestedGroups(IdvComponentGroup group)
           
static JPanel horizontal(Component[] components)
          Use GroupLayout for wrapping a list of components horizontally
static List<McvComponentGroup> idvGroupsToMcv(IdvWindow w)
           
static boolean isDynamicSkin(IdvComponentHolder h)
           
static boolean isUIHolder(IdvComponentHolder h)
           
static JComboBox makeComboBox(Collection<?> items, Object selected)
           
static JComboBox makeComboBox(Collection<?> items, Object selected, McVGuiUtils.Width width)
           
static
<E> JComboBox
makeComboBox(E[] items, Object selected)
           
static
<E> JComboBox
makeComboBox(E[] items, Object selected, McVGuiUtils.Width width)
           
static JPanel makeComponentLabeled(JComponent thing, JLabel label)
           
static JPanel makeComponentLabeled(JComponent thing, JLabel label, McVGuiUtils.Position position)
           
static JPanel makeComponentLabeled(JComponent thing, String label)
          Create a sized, labeled component
static JPanel makeComponentLabeled(JComponent thing, String label, McVGuiUtils.Position position)
           
static JButton makeImageButton(String iconName, Object object, String methodName, Object arg, String tooltip)
          Custom makeImageButton to ensure proper sizing and mouseborder are set
static JButton makeImageButton(String iconName, String tooltip)
          Custom makeImageButton to ensure proper sizing and mouseborder are set
static JButton makeImageTextButton(String iconName, String label)
          Create a button with text and an icon
static JPanel makeLabeledComponent(JLabel label, JComponent thing)
           
static JPanel makeLabeledComponent(JLabel label, JComponent thing, McVGuiUtils.Position position)
           
static JPanel makeLabeledComponent(String label, JComponent thing)
          Create a sized, labeled component
static JPanel makeLabeledComponent(String label, JComponent thing, McVGuiUtils.Position position)
           
static JLabel makeLabelLeft(String title)
          Create a standard sized, left-justified label
static JLabel makeLabelLeft(String title, McVGuiUtils.Width width)
           
static JLabel makeLabelRight(String title)
          Create a standard sized, right-justified label
static JLabel makeLabelRight(String title, McVGuiUtils.Width width)
           
static JButton makePrettyButton(JButton button)
          - Add icons when we understand the button name
static JButton makePrettyButton(String name)
          Convenience method to make a button based solely on its name
static JPanel makePrettyButtons(JPanel idvButtonPanel)
          Hack apart an IDV button panel and do a few things: - Reorder the buttons based on OS preference Windows: OK on left Mac: OK on right - Add icons when we understand the button name TODO: Revisit this?
static List makePrettyButtons(List buttonList)
          Take a list of buttons and make them pretty
static JTextField makeTextField(String value)
          Create a standard sized text field
static JTextField makeTextField(String value, McVGuiUtils.Width width)
           
static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, char[] allow)
           
static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, Pattern allow)
           
static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, String allow)
           
static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, char[] deny)
           
static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, Pattern deny)
           
static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, String deny)
           
static McVTextField makeTextFieldLimit(String defaultString, int limit)
          Create some custom text entry widgets
static McVTextField makeTextFieldUpper(String defaultString, int limit)
           
private static void p(String str, int padding)
           
private static String pad(String str, int pad)
           
static void printUIComponents(JComponent parent)
          Print the hierarchy of components
static void printUIComponents(JComponent parent, int index, int depth)
           
static void runOnEDT(Runnable r)
          Calls SwingUtilities.invokeLater(Runnable) if the current thread is not the event dispatch thread.
static void setButtonImage(JButton existingButton, String iconName)
          Add an icon to a button... but only if the LookAndFeel supports it
static void setComponentColor(JComponent existingComponent)
          Set the foreground color of an existing component
static void setComponentColor(JComponent existingComponent, McVGuiUtils.TextColor color)
           
static void setComponentHeight(JComponent setme, JComponent getme)
          Set the component height to that of another component
static void setComponentHeight(JComponent setme, JComponent getme, int padding)
           
static void setComponentWidth(JComponent existingComponent)
          Set the width of an existing component
static void setComponentWidth(JComponent existingComponent, int width)
          Set the width of an existing component to a given int width
static void setComponentWidth(JComponent setme, JComponent getme)
          Set the component width to that of another component
static void setComponentWidth(JComponent setme, JComponent getme, int padding)
           
static void setComponentWidth(JComponent existingComponent, McVGuiUtils.Width width)
           
static void setLabelBold(JLabel existingLabel, boolean bold)
          Set the bold attribute of an existing label
static void setLabelPosition(JLabel existingLabel)
          Set the label position of an existing label
static void setLabelPosition(JLabel existingLabel, McVGuiUtils.Position position)
           
static void setListData(JComboBox box, Collection<?> items, Object selected)
           
static void setMenuImage(JMenuItem existingMenuItem, String iconName)
          Add an icon to a menu item
static JPanel sideBySide(JComponent left, JComponent right)
          Use GroupLayout for wrapping components to stop vertical resizing
static JPanel sideBySide(JComponent left, JComponent right, int gap)
          Use GroupLayout for wrapping components to stop vertical resizing
static JPanel topBottom(JComponent top, JComponent bottom, McVGuiUtils.Prefer which)
          Use GroupLayout for stacking components vertically
static JPanel topCenterBottom(JComponent top, JComponent center, JComponent bottom)
          Use GroupLayout for stacking components vertically Set center to resize vertically
static JPanel vertical(Component[] components)
          Use GroupLayout for wrapping a list of components vertically
private static String vmType(ViewManager vm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.slf4j.Logger logger

ESTIMATED_VM_COUNT

private static final int ESTIMATED_VM_COUNT
Estimated number of ViewManagers. This value is only used as a last resort (McIDASV.getStaticMcv() failing).

See Also:
Constant Field Values
Constructor Detail

McVGuiUtils

private McVGuiUtils()
Method Detail

makeLabelRight

public static JLabel makeLabelRight(String title)
Create a standard sized, right-justified label

Parameters:
title -
Returns:

makeLabelRight

public static JLabel makeLabelRight(String title,
                                    McVGuiUtils.Width width)

makeLabelLeft

public static JLabel makeLabelLeft(String title)
Create a standard sized, left-justified label

Parameters:
title -
Returns:

makeLabelLeft

public static JLabel makeLabelLeft(String title,
                                   McVGuiUtils.Width width)

makeLabeledComponent

public static JPanel makeLabeledComponent(String label,
                                          JComponent thing)
Create a sized, labeled component

Parameters:
label -
thing -
Returns:

makeLabeledComponent

public static JPanel makeLabeledComponent(JLabel label,
                                          JComponent thing)

makeLabeledComponent

public static JPanel makeLabeledComponent(String label,
                                          JComponent thing,
                                          McVGuiUtils.Position position)

makeLabeledComponent

public static JPanel makeLabeledComponent(JLabel label,
                                          JComponent thing,
                                          McVGuiUtils.Position position)

makeComponentLabeled

public static JPanel makeComponentLabeled(JComponent thing,
                                          String label)
Create a sized, labeled component

Parameters:
label -
thing -
Returns:

makeComponentLabeled

public static JPanel makeComponentLabeled(JComponent thing,
                                          String label,
                                          McVGuiUtils.Position position)

makeComponentLabeled

public static JPanel makeComponentLabeled(JComponent thing,
                                          JLabel label)

makeComponentLabeled

public static JPanel makeComponentLabeled(JComponent thing,
                                          JLabel label,
                                          McVGuiUtils.Position position)

setComponentWidth

public static void setComponentWidth(JComponent existingComponent)
Set the width of an existing component

Parameters:
existingComponent -

setComponentWidth

public static void setComponentWidth(JComponent existingComponent,
                                     McVGuiUtils.Width width)

setComponentWidth

public static void setComponentWidth(JComponent existingComponent,
                                     int width)
Set the width of an existing component to a given int width

Parameters:
existingComponent -
width -

setComponentWidth

public static void setComponentWidth(JComponent setme,
                                     JComponent getme)
Set the component width to that of another component


setComponentWidth

public static void setComponentWidth(JComponent setme,
                                     JComponent getme,
                                     int padding)

setComponentHeight

public static void setComponentHeight(JComponent setme,
                                      JComponent getme)
Set the component height to that of another component


setComponentHeight

public static void setComponentHeight(JComponent setme,
                                      JComponent getme,
                                      int padding)

setLabelPosition

public static void setLabelPosition(JLabel existingLabel)
Set the label position of an existing label

Parameters:
existingLabel -

setLabelPosition

public static void setLabelPosition(JLabel existingLabel,
                                    McVGuiUtils.Position position)

setLabelBold

public static void setLabelBold(JLabel existingLabel,
                                boolean bold)
Set the bold attribute of an existing label

Parameters:
existingLabel -
bold -

setComponentColor

public static void setComponentColor(JComponent existingComponent)
Set the foreground color of an existing component

Parameters:
existingComponent -

setComponentColor

public static void setComponentColor(JComponent existingComponent,
                                     McVGuiUtils.TextColor color)

makeImageButton

public static JButton makeImageButton(String iconName,
                                      Object object,
                                      String methodName,
                                      Object arg,
                                      String tooltip)
Custom makeImageButton to ensure proper sizing and mouseborder are set


makeImageButton

public static JButton makeImageButton(String iconName,
                                      String tooltip)
Custom makeImageButton to ensure proper sizing and mouseborder are set


makeImageTextButton

public static JButton makeImageTextButton(String iconName,
                                          String label)
Create a button with text and an icon


setButtonImage

public static void setButtonImage(JButton existingButton,
                                  String iconName)
Add an icon to a button... but only if the LookAndFeel supports it


setMenuImage

public static void setMenuImage(JMenuItem existingMenuItem,
                                String iconName)
Add an icon to a menu item


makeComboBox

public static <E> JComboBox makeComboBox(E[] items,
                                         Object selected)

makeComboBox

public static <E> JComboBox makeComboBox(E[] items,
                                         Object selected,
                                         McVGuiUtils.Width width)

makeComboBox

public static JComboBox makeComboBox(Collection<?> items,
                                     Object selected)

makeComboBox

public static JComboBox makeComboBox(Collection<?> items,
                                     Object selected,
                                     McVGuiUtils.Width width)

setListData

public static void setListData(JComboBox box,
                               Collection<?> items,
                               Object selected)

getEditableBox

public static JComboBox getEditableBox(Collection<?> items,
                                       Object selected)

makeTextField

public static JTextField makeTextField(String value)
Create a standard sized text field

Parameters:
value -
Returns:

makeTextField

public static JTextField makeTextField(String value,
                                       McVGuiUtils.Width width)

makeTextFieldLimit

public static McVTextField makeTextFieldLimit(String defaultString,
                                              int limit)
Create some custom text entry widgets


makeTextFieldUpper

public static McVTextField makeTextFieldUpper(String defaultString,
                                              int limit)

makeTextFieldAllow

public static McVTextField makeTextFieldAllow(String defaultString,
                                              int limit,
                                              boolean upper,
                                              String allow)

makeTextFieldDeny

public static McVTextField makeTextFieldDeny(String defaultString,
                                             int limit,
                                             boolean upper,
                                             String deny)

makeTextFieldAllow

public static McVTextField makeTextFieldAllow(String defaultString,
                                              int limit,
                                              boolean upper,
                                              char[] allow)

makeTextFieldDeny

public static McVTextField makeTextFieldDeny(String defaultString,
                                             int limit,
                                             boolean upper,
                                             char[] deny)

makeTextFieldAllow

public static McVTextField makeTextFieldAllow(String defaultString,
                                              int limit,
                                              boolean upper,
                                              Pattern allow)

makeTextFieldDeny

public static McVTextField makeTextFieldDeny(String defaultString,
                                             int limit,
                                             boolean upper,
                                             Pattern deny)

topCenterBottom

public static JPanel topCenterBottom(JComponent top,
                                     JComponent center,
                                     JComponent bottom)
Use GroupLayout for stacking components vertically Set center to resize vertically

Parameters:
top -
center -
bottom -
Returns:

topBottom

public static JPanel topBottom(JComponent top,
                               JComponent bottom,
                               McVGuiUtils.Prefer which)
Use GroupLayout for stacking components vertically

Parameters:
top -
bottom -
which -
Returns:

sideBySide

public static JPanel sideBySide(JComponent left,
                                JComponent right)
Use GroupLayout for wrapping components to stop vertical resizing

Parameters:
left -
right -
Returns:

sideBySide

public static JPanel sideBySide(JComponent left,
                                JComponent right,
                                int gap)
Use GroupLayout for wrapping components to stop vertical resizing

Parameters:
left -
right -
Returns:

horizontal

public static JPanel horizontal(Component[] components)
Use GroupLayout for wrapping a list of components horizontally


vertical

public static JPanel vertical(Component[] components)
Use GroupLayout for wrapping a list of components vertically


makePrettyButtons

public static JPanel makePrettyButtons(JPanel idvButtonPanel)
Hack apart an IDV button panel and do a few things: - Reorder the buttons based on OS preference Windows: OK on left Mac: OK on right - Add icons when we understand the button name TODO: Revisit this? Could hamper GUI performance. But it is niiice...

Parameters:
idvButtonPanel -
Returns:

makePrettyButtons

public static List makePrettyButtons(List buttonList)
Take a list of buttons and make them pretty

Parameters:
buttonList -
Returns:
list

makePrettyButton

public static JButton makePrettyButton(String name)
Convenience method to make a button based solely on its name

Parameters:
name -
Returns:

makePrettyButton

public static JButton makePrettyButton(JButton button)
- Add icons when we understand the button name

Parameters:
button -
Returns:
button

printUIComponents

public static void printUIComponents(JComponent parent)
Print the hierarchy of components


printUIComponents

public static void printUIComponents(JComponent parent,
                                     int index,
                                     int depth)

runOnEDT

public static void runOnEDT(Runnable r)
Calls SwingUtilities.invokeLater(Runnable) if the current thread is not the event dispatch thread. If this thread is the EDT, then call Runnable.run() for r.

Remember, you do not want to execute long-running tasks in the event dispatch thread--it'll lock up the GUI.

Parameters:
r - Code to run in the event dispatch thread. Cannot be null.

getVMCount

private static int getVMCount()

getHolderCount

private static int getHolderCount()

getGroupCount

private static int getGroupCount()

getActiveViewManagers

public static List<ViewManager> getActiveViewManagers()

getAllViewManagers

public static List<ViewManager> getAllViewManagers()

getShareGroupsInWindow

public static List<Object> getShareGroupsInWindow(IdvWindow window)

getAllShareGroups

public static List<Object> getAllShareGroups()

getViewManagersInGroup

public static List<ViewManager> getViewManagersInGroup(Object sharedGroup)

getViewManagers

public static List<ViewManager> getViewManagers(WindowInfo info)

getViewManagers

public static List<ViewManager> getViewManagers(IdvWindow window)

isUIHolder

public static boolean isUIHolder(IdvComponentHolder h)
Returns:
Whether or not h contains some UI component like the dashboard of field selector. Yes, it can happen!

isDynamicSkin

public static boolean isDynamicSkin(IdvComponentHolder h)
Returns:
Whether or not h is a dynamic skin.

hasDynamicSkins

public static boolean hasDynamicSkins(List<WindowInfo> windows)
Returns:
Whether or not windows has at least one dynamic skin.

getComponentHolders

public static List<IdvComponentHolder> getComponentHolders(WindowInfo windowInfo)
Returns:
The component holders within windowInfo.
See Also:
getComponentHolders(IdvComponentGroup)

getComponentHolders

public static List<IdvComponentHolder> getComponentHolders(IdvWindow idvWindow)
Returns:
The component holders within idvWindow.
See Also:
getComponentHolders(IdvComponentGroup)

getComponentHolders

public static List<IdvComponentHolder> getComponentHolders(IdvComponentGroup group)
Returns:
Recursively searches group to find any component holders.

getComponentGroups

public static List<IdvComponentGroup> getComponentGroups(IdvComponentGroup group)
Returns:
Recursively searches group for any nested component groups.

getComponentGroups

public static List<IdvComponentGroup> getComponentGroups(WindowInfo window)
Returns:
Component groups contained in window.
See Also:
getComponentGroups(IdvComponentGroup)

getComponentGroups

public static List<IdvComponentGroup> getComponentGroups(List<WindowInfo> windows)
Returns:
Component groups contained in windows.
See Also:
getComponentGroups(IdvComponentGroup)

getComponentGroup

public static IdvComponentGroup getComponentGroup(IdvWindow window)
Returns:
The component group within window.

hasNestedGroups

public static boolean hasNestedGroups(IdvComponentGroup group)
Returns:
Whether or not group contains any component groups.

getAllComponentHolders

public static List<IdvComponentHolder> getAllComponentHolders()
Returns:
All active component holders in McIDAS-V.

getAllComponentGroups

public static List<IdvComponentGroup> getAllComponentGroups()
Returns:
All active component groups in McIDAS-V.

getAllDisplayWindows

public static List<IdvWindow> getAllDisplayWindows()
Returns:
All windows that contain at least one component group.

getAfterActiveHolder

public static IdvComponentHolder getAfterActiveHolder()
Returns:
The component holder positioned after the active component holder.

getBeforeActiveHolder

public static IdvComponentHolder getBeforeActiveHolder()
Returns:
The component holder positioned before the active component holder.

getActiveComponentHolder

public static IdvComponentHolder getActiveComponentHolder()
Returns:
The active component holder in the active window.

getAfterHolder

public static IdvComponentHolder getAfterHolder(IdvComponentHolder current)
Returns:
The component holder positioned after current.

getBeforeHolder

public static IdvComponentHolder getBeforeHolder(IdvComponentHolder current)
Returns:
The component holder positioned before current.

idvGroupsToMcv

public static List<McvComponentGroup> idvGroupsToMcv(IdvWindow w)
Parameters:
w - IdvWindow whose component groups you want (as McvComponentGroups).
Returns:
A List of McvComponentGroups or an empty list. If there were no McvComponentGroups in w, or if w is null, an empty List is returned.

compGroup

public static void compGroup(IdvComponentGroup g)

compGroup

public static void compGroup(IdvComponentGroup g,
                             int level)

compHolder

public static void compHolder(IdvComponentHolder h,
                              int level)

findvms

public static List<ViewManager> findvms(List<WindowInfo> windows)

vmType

private static String vmType(ViewManager vm)

pad

private static String pad(String str,
                          int pad)

p

private static void p(String str,
                      int padding)

getDisplayBoundsFor

public static Rectangle getDisplayBoundsFor(int index)
Find the "bounds" for the physical display at index.

Parameters:
index - Zero-based index of the desired physical display.
Returns:
Either a Rectangle representing the display's bounds, or null if index is invalid.

findDisplayNumberForRectangle

public static int findDisplayNumberForRectangle(Rectangle rect)
Tries to determine the physical display that contains the given Rectangle. This method (currently) fails for Rectangles that span multiple displays!

Parameters:
rect - Rectangle to test. Should not be null.
Returns:
Either the (zero-based) index of the physical display, or -1 if there was no match.

findDisplayNumberForComponent

public static int findDisplayNumberForComponent(Component comp)
Tries to determine the physical display that contains the given Component. This method (currently) fails for Components that span multiple displays!

Parameters:
comp - Component to test. Should not be null.
Returns:
Either the (zero-based) index of the physical display, or -1 if there was no match.

findDisplayNumberForMultiFrame

public static int findDisplayNumberForMultiFrame(MultiFrame mf)
Tries to determine the physical display that contains the given MultiFrame. This method (currently) fails for MultiFrames that span multiple displays!

Parameters:
mf - MultiFrame to test. Should not be null.
Returns:
Either the (zero-based) index of the physical display, or -1 if there was no match.

findDisplayNumberForCoords

public static int findDisplayNumberForCoords(int x,
                                             int y,
                                             int width,
                                             int height)
Tries to determine the physical display that contains the rectangle defined by the specified coordinates. This method (currently) fails for coordinates that span multiple displays!

Parameters:
x - X coordinate of the upper-left corner.
y - Y coordinate of the upper-left corner.
width - Width of the rectangle.
height - Height of the rectangle.
Returns:
Either the (zero-based) index of the physical display, or -1 if there was no match.
See Also:
Rectangle.Rectangle(int, int, int, int)

findDisplayNumberForEvent

public static int findDisplayNumberForEvent(EventObject event)
Tries to determine which physical display contains the Component or MultiFrame that fired the given event. This method (currently) fails for coordinates that span multiple displays!

Parameters:
event - EventObject to test. Should not be null.
Returns:
Either the (zero-based) index of the physical display, or -1 if there was no match.