Class McVGuiUtils
- All Implemented Interfaces:
Constants
,IdvConstants
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Use this class to create a panel with a background imagestatic enum
static enum
static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Estimated number ofViewManagers
.private static final org.slf4j.Logger
Logging object.Exclude methods that return values that are meaningless to the userFields inherited from interface edu.wisc.ssec.mcidasv.Constants
BLANK_COMP_GROUP, COMP_MONITORPANEL, DATASELECTOR_NAME, DEFAULT_COLOR_PICKER_SIZE, DEFAULT_DOCPATH, DEFAULT_MAP_Z_LEVEL, DEFAULT_SERVERSTATE, DISPLAY_NAME, DISPLAYCONTROLLER_NAME, ELEMENT_DOUBLE_WIDTH, ELEMENT_DOUBLEDOUBLE_WIDTH, ELEMENT_HALF_WIDTH, ELEMENT_ONEHALF_WIDTH, ELEMENT_WIDTH, EVENT_FILECHOOSER_START, EVENT_FILECHOOSER_STOP, 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_DEFAULT, 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, lineStyles, LOCAL_ADDE_PORT, MACRO_BUILDDATE, MACRO_COPYRIGHT_YEAR, MACRO_GRANULE_COUNT, 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_MODIFY_DEFAULT_COLOR_TABLE, PREF_NUM_IMAGE_PRESET_IMGCHOOSER, PREF_NUM_IMAGE_PRESET_RADARCHOOSER, PREF_OPEN_LIMIT_WIN, PREF_PRERELEASE_CHECK, PREF_SAVE_DASHBOARD_VIZ, PREF_SERVERSTATE, PREF_SHOW_SYSTEM_BUNDLES, 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_GRANULE_COUNT, PROP_HOMEPAGE, PROP_HYDRA_360, PROP_RECENT_COLORS, 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, TOOLTIP_PROGRESSIVE_RESOLUTION, 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_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_APPEARANCEMODE, 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_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_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
compGroup
(IdvComponentGroup g, int level) static void
compHolder
(IdvComponentHolder h, int level) static boolean
Convenience method for determining whether two objects are either equal or both null.static int
Tries to determine the physical display that contains the givenComponent
.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
Tries to determine which physical display contains theComponent
orMultiFrame
that fired the given event.static int
Tries to determine the physical display that contains the givenMultiFrame
.static int
Tries to determine the physical display that contains the givenRectangle
.static List
<ViewManager> findvms
(List<WindowInfo> windows) static IdvComponentHolder
static List
<ViewManager> static IdvComponentHolder
static IdvComponentHolder
getAfterHolder
(IdvComponentHolder current) static List
<IdvComponentGroup> Get the list of all active component groups in a McIDAS-V session.static List
<IdvComponentHolder> Get the list of all active component holders in a McIDAS-V session.Get the list of allIdvWindows
that contain at least one of what McIDAS-V would consider a "main display".static List
<ViewManager> static IdvComponentHolder
static IdvComponentHolder
getBeforeHolder
(IdvComponentHolder current) private static <T extends JComponent>
TgetComponentFromList
(Class<T> clazz, List<T> list, String property, Object value) static IdvComponentGroup
getComponentGroup
(IdvWindow window) static List
<IdvComponentGroup> getComponentGroups
(List<WindowInfo> windows) static List
<IdvComponentGroup> static List
<IdvComponentGroup> getComponentGroups
(WindowInfo window) static List
<IdvComponentHolder> static List
<IdvComponentHolder> getComponentHolders
(IdvWindow idvWindow) static List
<IdvComponentHolder> getComponentHolders
(WindowInfo windowInfo) static Map
<JComponent, List<JComponent>> getComponentMap
(JComponent container, boolean nested) Convenience method for mapping a container in the hierarchy to its contained components.static <T extends JComponent>
TgetDescendantOfClass
(Class<T> clazz, Container container, String property, Object value) Convenience method that searches belowcontainer
in the component hierarchy in a depth first manner and returns the first found component of classclazz
having the bound property value.static <T extends JComponent>
TgetDescendantOfClass
(Class<T> clazz, Container container, String property, Object value, boolean nested) Convenience method that searches belowcontainer
in the component hierarchy in a depth first manner and returns the first found component of classclazz
having the bound property value.static <T extends JComponent>
TgetDescendantOfType
(Class<T> clazz, Container container, String property, Object value) Convenience method that searches belowcontainer
in the component hierarchy and returns the first found component that is an instance of classclazz
having the bound property value.static <T extends JComponent>
TgetDescendantOfType
(Class<T> clazz, Container container, String property, Object value, boolean nested) Convenience method that searches belowcontainer
in the component hierarchy and returns the first found component that is an instance of classclazz
and has the bound property value.static <T extends JComponent>
List<T> getDescendantsOfClass
(Class<T> clazz, Container container) Convenience method for searching belowcontainer
in the component hierarchy and return nested components of classclazz
it finds.static <T extends JComponent>
List<T> getDescendantsOfClass
(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainer
in the component hierarchy and return nested components of classclazz
it finds.static <T extends JComponent>
List<T> getDescendantsOfType
(Class<T> clazz, Container container) Convenience method for searching belowcontainer
in the component hierarchy and return nested components that are instances of classclazz
it finds.static <T extends JComponent>
List<T> getDescendantsOfType
(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainer
in the component hierarchy and return nested components that are instances of classclazz
it finds.static Rectangle
getDisplayBoundsFor
(int index) Find the "bounds" for the physical display atindex
.static <E> JComboBox
<E> getEditableBox
(Collection<E> items, E selected) static <T> T
getFromEDT
(Callable<T> callable) Executes the specifiedCallable
on the EDT thread.private static int
private static int
static <T extends JComponent>
Class<?> getJClass
(T component) Convenience method to obtain the Swing class from which this component was directly or indirectly derived.getProperties
(JComponent component) Convenience method for obtaining most non-null human-readable properties of a JComponent.getShareGroupsInWindow
(IdvWindow window) static Object
getUIDefaultOfClass
(Class<?> clazz, String property) Convenience method for retrieving the UIDefault for a single property of a particular class.static UIDefaults
getUIDefaultsOfClass
(Class<?> clazz) Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class.static UIDefaults
getUIDefaultsOfClass
(String className) Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class.static List
<ViewManager> getViewManagers
(IdvWindow window) static List
<ViewManager> getViewManagers
(WindowInfo info) static List
<ViewManager> getViewManagersInGroup
(Object sharedGroup) private static int
static IdvWindow
getWindowForHolder
(IdvComponentHolder holder) Find the window associated with the givenIdvComponentHolder
(aka tab).static IdvWindow
Attempt to find theIdvWindow
that contains the givenViewManager
.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> static boolean
static boolean
static <E> JComboBox
<E> makeComboBox
(E[] items, E selected) static <E> JComboBox
<E> makeComboBox
(E[] items, E selected, McVGuiUtils.Width width) static <E> JComboBox
<E> makeComboBox
(Collection<E> items, E selected) static <E> JComboBox
<E> makeComboBox
(Collection<E> items, E selected, McVGuiUtils.Width width) static JPanel
makeComponentLabeled
(JComponent thing, String label) Create a sized, labeled component.static JPanel
makeComponentLabeled
(JComponent thing, String label, McVGuiUtils.Position position) static JPanel
makeComponentLabeled
(JComponent thing, JLabel label) static JPanel
makeComponentLabeled
(JComponent thing, JLabel label, McVGuiUtils.Position position) static JButton
Custom makeImageButton to ensure proper sizing and mouseborder are setstatic JButton
makeImageButton
(String iconName, String tooltip) Custom makeImageButton to ensure proper sizing and mouseborder are setstatic JButton
makeImageTextButton
(String iconName, String label) Create a button with text and an iconstatic JPanel
makeLabeledComponent
(String label, JComponent thing) Create a sized, labeled component.static JPanel
makeLabeledComponent
(String label, JComponent thing, McVGuiUtils.Position position) static JPanel
makeLabeledComponent
(JLabel label, JComponent thing) static JPanel
makeLabeledComponent
(JLabel 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 labelstatic JLabel
makeLabelRight
(String title, McVGuiUtils.Width width) static JButton
makePrettyButton
(String name) Convenience method to make a button based solely on its name.static JButton
makePrettyButton
(JButton button) Add icons when we understand the button name.static List
makePrettyButtons
(List buttonList) Take a list of buttons and make them pretty.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 namestatic 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, String allow) static McVTextField
makeTextFieldAllow
(String defaultString, int limit, boolean upper, Pattern allow) static McVTextField
makeTextFieldDeny
(String defaultString, int limit, boolean upper, char... deny) static McVTextField
makeTextFieldDeny
(String defaultString, int limit, boolean upper, String deny) static McVTextField
makeTextFieldDeny
(String defaultString, int limit, boolean upper, Pattern deny) static McVTextField
makeTextFieldLimit
(String defaultString, int limit) Create some custom text entry widgetsstatic McVTextField
makeTextFieldUpper
(String defaultString, int limit) private static void
private static String
static void
printUIComponents
(JComponent parent) Print the hierarchy of components.static void
printUIComponents
(JComponent parent, int index, int depth) static void
CallsSwingUtilities.invokeLater(Runnable)
if the current thread is not the event dispatch thread.static String
safeGetText
(JTextComponent textComponent) Gets the "text" contents of aJTextComponent
without the possibility of aNullPointerException
.static void
setButtonImage
(JButton existingButton, String iconName) Add an icon to a button... but only if the LookAndFeel supports itstatic void
setComponentColor
(JComponent existingComponent) Set the foreground color of an existing componentstatic 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 integer width.static void
setComponentWidth
(JComponent existingComponent, McVGuiUtils.Width width) Set the width of an existing component using standard McIDAS-V component widths.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
setLabelBold
(JLabel existingLabel, boolean bold) Set the bold attribute of an existing labelstatic void
setLabelPosition
(JLabel existingLabel) Set the label position of an existing labelstatic void
setLabelPosition
(JLabel existingLabel, McVGuiUtils.Position position) static <E> void
setListData
(JComboBox<E> box, Collection<E> items, E selected) static void
setMenuImage
(JMenuItem existingMenuItem, String iconName) Add an icon to a menu itemstatic 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.static JPanel
Use GroupLayout for wrapping a list of components vertically.private static String
vmType
(ViewManager vm)
-
Field Details
-
logger
Logging object. -
ESTIMATED_VM_COUNT
Estimated number ofViewManagers
. This value is only used as a last resort (McIDASV.getStaticMcv()
failing).- See Also:
-
setExclude
Exclude methods that return values that are meaningless to the user
-
-
Constructor Details
-
McVGuiUtils
private McVGuiUtils()
-
-
Method Details
-
makeLabelRight
Create a standard sized, right-justified label- Parameters:
title
- Label text. Should not benull
.- Returns:
- A new label.
-
makeLabelRight
-
makeLabelLeft
Create a standard sized, left-justified label.- Parameters:
title
- Label text. Should not benull
.- Returns:
- A new label.
-
makeLabelLeft
-
makeLabeledComponent
Create a sized, labeled component.- Parameters:
label
- Label forthing
. Should not benull
.thing
- Component to label. Should not benull
.- Returns:
- A component with its label to the right.
-
makeLabeledComponent
-
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
Create a sized, labeled component.- Parameters:
thing
- Component to label. Should not benull
.label
- Label forthing
. Should not benull
.- Returns:
- A labeled component.
-
makeComponentLabeled
public static JPanel makeComponentLabeled(JComponent thing, String label, McVGuiUtils.Position position) -
makeComponentLabeled
-
makeComponentLabeled
public static JPanel makeComponentLabeled(JComponent thing, JLabel label, McVGuiUtils.Position position) -
setComponentWidth
Set the width of an existing component.- Parameters:
existingComponent
- Component that will have its width set.
-
setComponentWidth
Set the width of an existing component using standard McIDAS-V component widths.- Parameters:
existingComponent
- Component that will have its width set.width
- Width to use forexistingComponent
.
-
setComponentWidth
Set the width of an existing component to a given integer width.- Parameters:
existingComponent
- Component that will have its width set.width
- Width to use forexistingComponent
.
-
setComponentWidth
Set the component width to that of another component. -
setComponentWidth
-
setComponentHeight
Set the component height to that of another component. -
setComponentHeight
-
setLabelPosition
Set the label position of an existing label- Parameters:
existingLabel
-
-
setLabelPosition
-
setLabelBold
Set the bold attribute of an existing label- Parameters:
existingLabel
-bold
-
-
setComponentColor
Set the foreground color of an existing component- Parameters:
existingComponent
-
-
setComponentColor
-
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
Custom makeImageButton to ensure proper sizing and mouseborder are set -
makeImageTextButton
Create a button with text and an icon -
setButtonImage
Add an icon to a button... but only if the LookAndFeel supports it -
setMenuImage
Add an icon to a menu item -
makeComboBox
-
makeComboBox
-
makeComboBox
-
makeComboBox
public static <E> JComboBox<E> makeComboBox(Collection<E> items, E selected, McVGuiUtils.Width width) -
setListData
-
getEditableBox
-
makeTextField
Create a standard sized text field.- Parameters:
value
- Text to place within the text field. Should not benull
.- Returns:
JTextField
with initial text taken fromvalue
.
-
makeTextField
-
makeTextFieldLimit
Create some custom text entry widgets -
makeTextFieldUpper
-
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
Use GroupLayout for stacking components vertically. Set center to resize vertically.- Parameters:
top
- Component to place at the top of the newly created panel. Should not benull
.center
- Component to place in the center of the newly created panel. Should not benull
.bottom
- Component to place at the bottom of the newly created panel. Should not benull
.- Returns:
- New
JPanel
with the given components in the top, center, and bottom positions.
-
topBottom
Use GroupLayout for stacking components vertically.- Parameters:
top
- Component to place at the top of the newly created panel. Should not benull
.bottom
- Component to place at the bottom of the newly created panel. Should not benull
.which
- Which component's size to prefer. Should not benull
.- Returns:
- New
JPanel
with the given components.
-
sideBySide
Use GroupLayout for wrapping components to stop vertical resizing.- Parameters:
left
- Left component. Should not benull
.right
- Right component. Should not benull
.- Returns:
- New
JPanel
with the given components side-by-side.
-
sideBySide
Use GroupLayout for wrapping components to stop vertical resizing.- Parameters:
left
- Left component. Should not benull
.right
- Right component. Should not benull
.gap
- Gap betweenleft
andright
.- Returns:
- New
JPanel
with the given components side-by-side, separated by value fromgap
.
-
horizontal
Use GroupLayout for wrapping a list of components horizontally.- Parameters:
components
- Components to stack horizontally. Should not benull
.- Returns:
JPanel
with the given components.
-
vertical
Use GroupLayout for wrapping a list of components vertically.- Parameters:
components
- Components to stack vertically. Should not benull
.- Returns:
JPanel
with the given components.
-
makePrettyButtons
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- Parameters:
idvButtonPanel
-JPanel
to scan for understood button names. Should not benull
.- Returns:
- The given
JPanel
with pretty buttons (where possible).
-
makePrettyButtons
Take a list of buttons and make them pretty.- Parameters:
buttonList
- List of buttons. Should not benull
.- Returns:
List
of pretty buttons.
-
makePrettyButton
Convenience method to make a button based solely on its name.- Parameters:
name
- Button text. Should not benull
.- Returns:
- A "pretty" button.
-
makePrettyButton
Add icons when we understand the button name.- Parameters:
button
- Button to make pretty. Should not benull
.- Returns:
- button Either the given
button
with an icon, or just the givenbutton
(if the name was not understood).
-
printUIComponents
Print the hierarchy of components. -
printUIComponents
-
runOnEDT
CallsSwingUtilities.invokeLater(Runnable)
if the current thread is not the event dispatch thread. If this thread is the EDT, then callRunnable.run()
forr
.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 benull
.
-
getFromEDT
Executes the specifiedCallable
on the EDT thread.If the calling thread is already the EDT thread, this invocation simply delegates to call(), otherwise the callable is placed in Swing's event dispatch queue and the method waits for the result.
- Type Parameters:
T
- Result type of thecallable
.- Parameters:
callable
- Callable task. Cannot benull
.- Returns:
- Computed result
-
getVMCount
-
getHolderCount
-
getGroupCount
-
getActiveViewManagers
-
getAllViewManagers
-
getWindowForViewManager
Attempt to find theIdvWindow
that contains the givenViewManager
.- Parameters:
vm
-ViewManager
whoseIdvWindow
is needed. Cannot benull
.- Returns:
- Either the
IdvWindow
containingvm
, ornull
.
-
getViewManagersInGroup
-
getViewManagers
-
getViewManagers
-
isUIHolder
- Returns:
- Whether or not
h
contains some UI component like the dashboard of field selector. Yes, it can happen!
-
isDynamicSkin
- Returns:
- Whether or not
h
is a dynamic skin.
-
hasDynamicSkins
- Returns:
- Whether or not
windows
has at least one dynamic skin.
-
getComponentHolders
- Returns:
- The component holders within
windowInfo
. - See Also:
-
getComponentHolders
- Returns:
- The component holders within
idvWindow
. - See Also:
-
getComponentHolders
- Returns:
- Recursively searches
group
to find any component holders.
-
getComponentGroups
- Returns:
- Recursively searches
group
for any nested component groups.
-
getComponentGroups
- Returns:
- Component groups contained in
window
. - See Also:
-
getComponentGroups
- Returns:
- Component groups contained in
windows
. - See Also:
-
getComponentGroup
- Returns:
- The component group within
window
.
-
hasNestedGroups
- Returns:
- Whether
group
contains any component groups.
-
getWindowForHolder
Find the window associated with the givenIdvComponentHolder
(aka tab).- Parameters:
holder
- Holder whoseIdvWindow
we need to find. Should not benull
.- Returns:
- Either the
IdvWindow
containing the tab associated with the givenholder
, ornull
if there was somehow no window associated with the holder.
-
getAllComponentHolders
Get the list of all active component holders in a McIDAS-V session.This method is a essentially a "get all tabs" method.
- Returns:
- All active component holders in McIDAS-V.
-
getAllComponentGroups
Get the list of all active component groups in a McIDAS-V session.There is a single component group per window, so this method could be used as a way to get all display windows. That said, you probably want to look at
getAllDisplayWindows()
first.- Returns:
- All active component groups in McIDAS-V.
-
getAllDisplayWindows
Get the list of allIdvWindows
that contain at least one of what McIDAS-V would consider a "main display".- Returns:
- All windows that contain at least one component group.
-
getAfterActiveHolder
- Returns:
- The component holder positioned after the active component holder.
-
getBeforeActiveHolder
- Returns:
- The component holder positioned before the active component holder.
-
getActiveComponentHolder
- Returns:
- The active component holder in the active window.
-
getAfterHolder
- Returns:
- The component holder positioned after
current
.
-
getBeforeHolder
- Returns:
- The component holder positioned before
current
.
-
idvGroupsToMcv
- Parameters:
w
-IdvWindow
whose component groups you want (asMcvComponentGroup
s).- Returns:
- A
List
ofMcvComponentGroup
s or an empty list. If there were noMcvComponentGroup
s inw
, or ifw
isnull
, an emptyList
is returned.
-
compGroup
-
compGroup
-
compHolder
-
findvms
-
vmType
-
pad
-
p
-
getDisplayBoundsFor
Find the "bounds" for the physical display atindex
.- Parameters:
index
- Zero-based index of the desired physical display.- Returns:
- Either a
Rectangle
representing the display's bounds, ornull
ifindex
is invalid.
-
findDisplayNumberForRectangle
Tries to determine the physical display that contains the givenRectangle
. This method (currently) fails forRectangle
s that span multiple displays!- Parameters:
rect
-Rectangle
to test. Should not benull
.- Returns:
- Either the (zero-based) index of the physical display, or
-1
if there was no match.
-
findDisplayNumberForComponent
Tries to determine the physical display that contains the givenComponent
. This method (currently) fails forComponent
s that span multiple displays!- Parameters:
comp
-Component
to test. Should not benull
.- Returns:
- Either the (zero-based) index of the physical display, or
-1
if there was no match.
-
findDisplayNumberForMultiFrame
Tries to determine the physical display that contains the givenMultiFrame
. This method (currently) fails forMultiFrame
s that span multiple displays!- Parameters:
mf
-MultiFrame
to test. Should not benull
.- Returns:
- Either the (zero-based) index of the physical display, or
-1
if there was no match.
-
findDisplayNumberForCoords
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:
-
findDisplayNumberForEvent
Tries to determine which physical display contains theComponent
orMultiFrame
that fired the given event. This method (currently) fails for coordinates that span multiple displays!- Parameters:
event
-EventObject
to test. Should not benull
.- Returns:
- Either the (zero-based) index of the physical display, or
-1
if there was no match.
-
getDescendantsOfType
public static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container) Convenience method for searching belowcontainer
in the component hierarchy and return nested components that are instances of classclazz
it finds. Returns an empty list if no such components exist in the container.Invoking this method with a class parameter of JComponent.class will return all nested components.
This method invokes
getDescendantsOfType(Class, java.awt.Container, boolean)
- Parameters:
clazz
- the class of components whose instances are to be found.container
- the container at which to begin the search- Returns:
- the List of components
-
getDescendantsOfType
public static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainer
in the component hierarchy and return nested components that are instances of classclazz
it finds. Returns an empty list if no such components exist in the container.Invoking this method with a class parameter of JComponent.class will return all nested components.
- Parameters:
clazz
- the class of components whose instances are to be found.container
- the container at which to begin the searchnested
- true to list components nested within another listed component, false otherwise- Returns:
- the List of components
-
getDescendantOfType
public static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException Convenience method that searches belowcontainer
in the component hierarchy and returns the first found component that is an instance of classclazz
having the bound property value. Returnsnull
if such component cannot be found.This method invokes
getDescendantOfType(Class, java.awt.Container, String, Object, boolean)
- Parameters:
clazz
- the class of component whose instance is to be found.container
- the container at which to begin the searchproperty
- the className of the bound property, exactly as expressed in the accessor e.g. "Text" for getText(), "Value" for getValue().value
- the value of the bound property- Returns:
- the component, or null if no such component exists in the container
- Throws:
IllegalArgumentException
- if the bound property does not exist for the class or cannot be accessed
-
getDescendantOfType
public static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException Convenience method that searches belowcontainer
in the component hierarchy and returns the first found component that is an instance of classclazz
and has the bound property value. Returnsnull
if such component cannot be found.- Parameters:
clazz
- the class of component whose instance to be found.container
- the container at which to begin the searchproperty
- the className of the bound property, exactly as expressed in the accessor e.g. "Text" for getText(), "Value" for getValue().value
- the value of the bound propertynested
- true to list components nested within another component which is also an instance ofclazz
, false otherwise.- Returns:
- the component, or null if no such component exists in the container.
- Throws:
IllegalArgumentException
- if the bound property does not exist for the class or cannot be accessed.
-
getDescendantsOfClass
public static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container) Convenience method for searching belowcontainer
in the component hierarchy and return nested components of classclazz
it finds. Returns an empty list if no such components exist in the container.This method invokes
getDescendantsOfClass(Class, java.awt.Container, boolean)
.- Parameters:
clazz
- the class of components to be found.container
- the container at which to begin the search- Returns:
- the List of components
-
getDescendantsOfClass
public static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainer
in the component hierarchy and return nested components of classclazz
it finds. Returns an empty list if no such components exist in the container.- Parameters:
clazz
- the class of components to be found.container
- the container at which to begin the searchnested
- true to list components nested within another listed component, false otherwise- Returns:
- the List of components
-
getDescendantOfClass
public static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException Convenience method that searches belowcontainer
in the component hierarchy in a depth first manner and returns the first found component of classclazz
having the bound property value.Returns
null
if such component cannot be found.This method invokes
getDescendantOfClass(Class, java.awt.Container, String, Object, boolean)
- Parameters:
clazz
- the class of component to be found.container
- the container at which to begin the searchproperty
- the className of the bound property, exactly as expressed in the accessor e.g. "Text" for getText(), "Value" for getValue(). This parameter is case-sensitive.value
- the value of the bound property- Returns:
- the component, or null if no such component exists in the container's hierarchy.
- Throws:
IllegalArgumentException
- if the bound property does not exist for the class or cannot be accessed
-
getDescendantOfClass
public static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException Convenience method that searches belowcontainer
in the component hierarchy in a depth first manner and returns the first found component of classclazz
having the bound property value.Returns
null
if such component cannot be found.- Parameters:
clazz
- the class of component to be found.container
- the container at which to begin the searchproperty
- the className of the bound property, exactly as expressed in the accessor e.g. "Text" for getText(), "Value" for getValue(). This parameter is case sensitive.value
- the value of the bound propertynested
- true to include components nested within another listed component, false otherwise.- Returns:
- the component, or null if no such component exists in the container's hierarchy.
- Throws:
IllegalArgumentException
- if the bound property does not exist for the class or cannot be accessed
-
getComponentFromList
private static <T extends JComponent> T getComponentFromList(Class<T> clazz, List<T> list, String property, Object value) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
equals
Convenience method for determining whether two objects are either equal or both null.- Parameters:
obj1
- the first reference object to compare.obj2
- the second reference object to compare.- Returns:
- true if obj1 and obj2 are equal or if both are null, false otherwise
-
getComponentMap
public static Map<JComponent,List<JComponent>> getComponentMap(JComponent container, boolean nested) Convenience method for mapping a container in the hierarchy to its contained components. The keys are the containers, and the values are lists of contained components.Implementation note: The returned value is a HashMap and the values are of type ArrayList. This is subject to change, so callers should code against the interfaces Map and List.
- Parameters:
container
- The JComponent to be mappednested
- true to drill down to nested containers, false otherwise- Returns:
- the Map of the UI
-
getUIDefaultsOfClass
Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class.- Parameters:
clazz
- the class of interest- Returns:
- the UIDefaults of the class
-
getUIDefaultsOfClass
Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class.- Parameters:
className
- fully qualified name of the class of interest- Returns:
- the UIDefaults of the class named
-
getUIDefaultOfClass
Convenience method for retrieving the UIDefault for a single property of a particular class.- Parameters:
clazz
- the class of interestproperty
- the property to query- Returns:
- the UIDefault property, or null if not found
-
getProperties
Convenience method for obtaining most non-null human-readable properties of a JComponent. Array properties are not included.Implementation note: The returned value is a HashMap. This is subject to change, so callers should code against the interface Map.
- Parameters:
component
- the component whose proerties are to be determined- Returns:
- the class and value of the properties
-
getJClass
Convenience method to obtain the Swing class from which this component was directly or indirectly derived.- Parameters:
component
- The component whose Swing superclass is to be determined- Returns:
- The nearest Swing class in the inheritance tree
-
safeGetText
Gets the "text" contents of aJTextComponent
without the possibility of aNullPointerException
.- Parameters:
textComponent
-JTextComponent
whose contents should be extracted.null
is allowed.- Returns:
- Either the results of
JTextComponent.getText()
or an emptyString
iftextComponent
orgetText()
arenull
.
-