Class McVGuiUtils
- All Implemented Interfaces:
Constants,IdvConstants
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUse this class to create a panel with a background imagestatic enumstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intEstimated number ofViewManagers.private static final org.slf4j.LoggerLogging 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_RELATIVE_TIME_BUNDLE, 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_URLFields 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 voidstatic voidcompGroup(IdvComponentGroup g, int level) static voidcompHolder(IdvComponentHolder h, int level) static booleanConvenience method for determining whether two objects are either equal or both null.static intTries to determine the physical display that contains the givenComponent.static intfindDisplayNumberForCoords(int x, int y, int width, int height) Tries to determine the physical display that contains the rectangle defined by the specified coordinates.static intTries to determine which physical display contains theComponentorMultiFramethat fired the given event.static intTries to determine the physical display that contains the givenMultiFrame.static intTries to determine the physical display that contains the givenRectangle.static List<ViewManager> findvms(List<WindowInfo> windows) static IdvComponentHolderstatic List<ViewManager> static IdvComponentHolderstatic IdvComponentHoldergetAfterHolder(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 allIdvWindowsthat contain at least one of what McIDAS-V would consider a "main display".static List<ViewManager> static IdvComponentHolderstatic IdvComponentHoldergetBeforeHolder(IdvComponentHolder current) private static <T extends JComponent>
TgetComponentFromList(Class<T> clazz, List<T> list, String property, Object value) static IdvComponentGroupgetComponentGroup(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 belowcontainerin the component hierarchy in a depth first manner and returns the first found component of classclazzhaving the bound property value.static <T extends JComponent>
TgetDescendantOfClass(Class<T> clazz, Container container, String property, Object value, boolean nested) Convenience method that searches belowcontainerin the component hierarchy in a depth first manner and returns the first found component of classclazzhaving the bound property value.static <T extends JComponent>
TgetDescendantOfType(Class<T> clazz, Container container, String property, Object value) Convenience method that searches belowcontainerin the component hierarchy and returns the first found component that is an instance of classclazzhaving the bound property value.static <T extends JComponent>
TgetDescendantOfType(Class<T> clazz, Container container, String property, Object value, boolean nested) Convenience method that searches belowcontainerin the component hierarchy and returns the first found component that is an instance of classclazzand has the bound property value.static <T extends JComponent>
List<T> getDescendantsOfClass(Class<T> clazz, Container container) Convenience method for searching belowcontainerin the component hierarchy and return nested components of classclazzit finds.static <T extends JComponent>
List<T> getDescendantsOfClass(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainerin the component hierarchy and return nested components of classclazzit finds.static <T extends JComponent>
List<T> getDescendantsOfType(Class<T> clazz, Container container) Convenience method for searching belowcontainerin the component hierarchy and return nested components that are instances of classclazzit finds.static <T extends JComponent>
List<T> getDescendantsOfType(Class<T> clazz, Container container, boolean nested) Convenience method for searching belowcontainerin the component hierarchy and return nested components that are instances of classclazzit finds.static RectanglegetDisplayBoundsFor(int index) Find the "bounds" for the physical display atindex.static <E> JComboBox<E> getEditableBox(Collection<E> items, E selected) static <T> TgetFromEDT(Callable<T> callable) Executes the specifiedCallableon the EDT thread.private static intprivate static intstatic <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 ObjectgetUIDefaultOfClass(Class<?> clazz, String property) Convenience method for retrieving the UIDefault for a single property of a particular class.static UIDefaultsgetUIDefaultsOfClass(Class<?> clazz) Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class.static UIDefaultsgetUIDefaultsOfClass(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 intstatic IdvWindowgetWindowForHolder(IdvComponentHolder holder) Find the window associated with the givenIdvComponentHolder(aka tab).static IdvWindowAttempt to find theIdvWindowthat contains the givenViewManager.static booleanhasDynamicSkins(List<WindowInfo> windows) static booleanhasNestedGroups(IdvComponentGroup group) static JPanelhorizontal(Component... components) Use GroupLayout for wrapping a list of components horizontally.static List<McvComponentGroup> static booleanstatic booleanstatic <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 JPanelmakeComponentLabeled(JComponent thing, String label) Create a sized, labeled component.static JPanelmakeComponentLabeled(JComponent thing, String label, McVGuiUtils.Position position) static JPanelmakeComponentLabeled(JComponent thing, JLabel label) static JPanelmakeComponentLabeled(JComponent thing, JLabel label, McVGuiUtils.Position position) static JButtonCustom makeImageButton to ensure proper sizing and mouseborder are setstatic JButtonmakeImageButton(String iconName, String tooltip) Custom makeImageButton to ensure proper sizing and mouseborder are setstatic JButtonmakeImageTextButton(String iconName, String label) Create a button with text and an iconstatic JPanelmakeLabeledComponent(String label, JComponent thing) Create a sized, labeled component.static JPanelmakeLabeledComponent(String label, JComponent thing, McVGuiUtils.Position position) static JPanelmakeLabeledComponent(JLabel label, JComponent thing) static JPanelmakeLabeledComponent(JLabel label, JComponent thing, McVGuiUtils.Position position) static JLabelmakeLabelLeft(String title) Create a standard sized, left-justified label.static JLabelmakeLabelLeft(String title, McVGuiUtils.Width width) static JLabelmakeLabelRight(String title) Create a standard sized, right-justified labelstatic JLabelmakeLabelRight(String title, McVGuiUtils.Width width) static JButtonmakePrettyButton(String name) Convenience method to make a button based solely on its name.static JButtonmakePrettyButton(JButton button) Add icons when we understand the button name.static ListmakePrettyButtons(List buttonList) Take a list of buttons and make them pretty.static JPanelmakePrettyButtons(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 JTextFieldmakeTextField(String value) Create a standard sized text field.static JTextFieldmakeTextField(String value, McVGuiUtils.Width width) static McVTextFieldmakeTextFieldAllow(String defaultString, int limit, boolean upper, char... allow) static McVTextFieldmakeTextFieldAllow(String defaultString, int limit, boolean upper, String allow) static McVTextFieldmakeTextFieldAllow(String defaultString, int limit, boolean upper, Pattern allow) static McVTextFieldmakeTextFieldDeny(String defaultString, int limit, boolean upper, char... deny) static McVTextFieldmakeTextFieldDeny(String defaultString, int limit, boolean upper, String deny) static McVTextFieldmakeTextFieldDeny(String defaultString, int limit, boolean upper, Pattern deny) static McVTextFieldmakeTextFieldLimit(String defaultString, int limit) Create some custom text entry widgetsstatic McVTextFieldmakeTextFieldUpper(String defaultString, int limit) private static voidprivate static Stringstatic voidprintUIComponents(JComponent parent) Print the hierarchy of components.static voidprintUIComponents(JComponent parent, int index, int depth) static voidCallsSwingUtilities.invokeLater(Runnable)if the current thread is not the event dispatch thread.static StringsafeGetText(JTextComponent textComponent) Gets the "text" contents of aJTextComponentwithout the possibility of aNullPointerException.static voidsetButtonImage(JButton existingButton, String iconName) Add an icon to a button... but only if the LookAndFeel supports itstatic voidsetComponentColor(JComponent existingComponent) Set the foreground color of an existing componentstatic voidsetComponentColor(JComponent existingComponent, McVGuiUtils.TextColor color) static voidsetComponentHeight(JComponent setme, JComponent getme) Set the component height to that of another component.static voidsetComponentHeight(JComponent setme, JComponent getme, int padding) static voidsetComponentWidth(JComponent existingComponent) Set the width of an existing component.static voidsetComponentWidth(JComponent existingComponent, int width) Set the width of an existing component to a given integer width.static voidsetComponentWidth(JComponent existingComponent, McVGuiUtils.Width width) Set the width of an existing component using standard McIDAS-V component widths.static voidsetComponentWidth(JComponent setme, JComponent getme) Set the component width to that of another component.static voidsetComponentWidth(JComponent setme, JComponent getme, int padding) static voidsetLabelBold(JLabel existingLabel, boolean bold) Set the bold attribute of an existing labelstatic voidsetLabelPosition(JLabel existingLabel) Set the label position of an existing labelstatic voidsetLabelPosition(JLabel existingLabel, McVGuiUtils.Position position) static <E> voidsetListData(JComboBox<E> box, Collection<E> items, E selected) static voidsetMenuImage(JMenuItem existingMenuItem, String iconName) Add an icon to a menu itemstatic JPanelsideBySide(JComponent left, JComponent right) Use GroupLayout for wrapping components to stop vertical resizing.static JPanelsideBySide(JComponent left, JComponent right, int gap) Use GroupLayout for wrapping components to stop vertical resizing.static JPaneltopBottom(JComponent top, JComponent bottom, McVGuiUtils.Prefer which) Use GroupLayout for stacking components vertically.static JPaneltopCenterBottom(JComponent top, JComponent center, JComponent bottom) Use GroupLayout for stacking components vertically.static JPanelUse GroupLayout for wrapping a list of components vertically.private static StringvmType(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:
JTextFieldwith 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
JPanelwith 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
JPanelwith 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
JPanelwith 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 betweenleftandright.- Returns:
- New
JPanelwith 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:
JPanelwith the given components.
-
vertical
Use GroupLayout for wrapping a list of components vertically.- Parameters:
components- Components to stack vertically. Should not benull.- Returns:
JPanelwith 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-JPanelto scan for understood button names. Should not benull.- Returns:
- The given
JPanelwith pretty buttons (where possible).
-
makePrettyButtons
Take a list of buttons and make them pretty.- Parameters:
buttonList- List of buttons. Should not benull.- Returns:
Listof 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
buttonwith 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 specifiedCallableon 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 theIdvWindowthat contains the givenViewManager.- Parameters:
vm-ViewManagerwhoseIdvWindowis needed. Cannot benull.- Returns:
- Either the
IdvWindowcontainingvm, ornull.
-
getViewManagersInGroup
-
getViewManagers
-
getViewManagers
-
isUIHolder
- Returns:
- Whether or not
hcontains some UI component like the dashboard of field selector. Yes, it can happen!
-
isDynamicSkin
- Returns:
- Whether or not
his a dynamic skin.
-
hasDynamicSkins
- Returns:
- Whether or not
windowshas 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
groupto find any component holders.
-
getComponentGroups
- Returns:
- Recursively searches
groupfor 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
groupcontains any component groups.
-
getWindowForHolder
Find the window associated with the givenIdvComponentHolder(aka tab).- Parameters:
holder- Holder whoseIdvWindowwe need to find. Should not benull.- Returns:
- Either the
IdvWindowcontaining the tab associated with the givenholder, ornullif 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 allIdvWindowsthat 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-IdvWindowwhose component groups you want (asMcvComponentGroups).- Returns:
- A
ListofMcvComponentGroups or an empty list. If there were noMcvComponentGroups inw, or ifwisnull, an emptyListis 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
Rectanglerepresenting the display's bounds, ornullifindexis invalid.
-
findDisplayNumberForRectangle
Tries to determine the physical display that contains the givenRectangle. This method (currently) fails forRectangles that span multiple displays!- Parameters:
rect-Rectangleto test. Should not benull.- Returns:
- Either the (zero-based) index of the physical display, or
-1if there was no match.
-
findDisplayNumberForComponent
Tries to determine the physical display that contains the givenComponent. This method (currently) fails forComponents that span multiple displays!- Parameters:
comp-Componentto test. Should not benull.- Returns:
- Either the (zero-based) index of the physical display, or
-1if there was no match.
-
findDisplayNumberForMultiFrame
Tries to determine the physical display that contains the givenMultiFrame. This method (currently) fails forMultiFrames that span multiple displays!- Parameters:
mf-MultiFrameto test. Should not benull.- Returns:
- Either the (zero-based) index of the physical display, or
-1if 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
-1if there was no match. - See Also:
-
findDisplayNumberForEvent
Tries to determine which physical display contains theComponentorMultiFramethat fired the given event. This method (currently) fails for coordinates that span multiple displays!- Parameters:
event-EventObjectto test. Should not benull.- Returns:
- Either the (zero-based) index of the physical display, or
-1if there was no match.
-
getDescendantsOfType
public static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container) Convenience method for searching belowcontainerin the component hierarchy and return nested components that are instances of classclazzit 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 belowcontainerin the component hierarchy and return nested components that are instances of classclazzit 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 belowcontainerin the component hierarchy and returns the first found component that is an instance of classclazzhaving the bound property value. Returnsnullif 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 belowcontainerin the component hierarchy and returns the first found component that is an instance of classclazzand has the bound property value. Returnsnullif 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 belowcontainerin the component hierarchy and return nested components of classclazzit 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 belowcontainerin the component hierarchy and return nested components of classclazzit 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 belowcontainerin the component hierarchy in a depth first manner and returns the first found component of classclazzhaving the bound property value.Returns
nullif 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 belowcontainerin the component hierarchy in a depth first manner and returns the first found component of classclazzhaving the bound property value.Returns
nullif 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 aJTextComponentwithout the possibility of aNullPointerException.- Parameters:
textComponent-JTextComponentwhose contents should be extracted.nullis allowed.- Returns:
- Either the results of
JTextComponent.getText()or an emptyStringiftextComponentorgetText()arenull.
-