public class McVGuiUtils extends Object implements Constants
Modifier and Type | Class and Description |
---|---|
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 |
Modifier and Type | Field and Description |
---|---|
private static int |
ESTIMATED_VM_COUNT
Estimated number of
ViewManagers . |
(package private) static Set<String> |
setExclude
Exclude methods that return values that are meaningless to the user
|
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, 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_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_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_OPEN_LIMIT_WIN, PREF_PRERELEASE_CHECK, PREF_SAVE_DASHBOARD_VIZ, PREF_SERVERSTATE, PREF_SHOW_SYSTEM_BUNDLES, PREF_SYSTEMSERVERSIMG, PREF_TBM_SIZE, PREF_VERSION_CHECK, PREF_VIIRS_PLUGIN, 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, VIIRS_PLUGIN_VERSION_NUMBER
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_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
Modifier | Constructor and Description |
---|---|
private |
McVGuiUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
compGroup(IdvComponentGroup g) |
static void |
compGroup(IdvComponentGroup g,
int level) |
static void |
compHolder(IdvComponentHolder h,
int level) |
static boolean |
equals(Object obj1,
Object obj2)
Convenience method for determining whether two objects are either
equal or both null.
|
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) |
private static <T extends JComponent> |
getComponentFromList(Class<T> clazz,
List<T> list,
String property,
Object value) |
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 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> |
getDescendantOfClass(Class<T> clazz,
Container container,
String property,
Object value)
Convenience method that searches below
container in the
component hierarchy in a depth first manner and returns the first
found component of class clazz having the bound property
value. |
static <T extends JComponent> |
getDescendantOfClass(Class<T> clazz,
Container container,
String property,
Object value,
boolean nested)
Convenience method that searches below
container in the
component hierarchy in a depth first manner and returns the first
found component of class clazz having the bound property
value. |
static <T extends JComponent> |
getDescendantOfType(Class<T> clazz,
Container container,
String property,
Object value)
Convenience method that searches below
container in the
component hierarchy and returns the first found component that is an
instance of class clazz having the bound property value. |
static <T extends JComponent> |
getDescendantOfType(Class<T> clazz,
Container container,
String property,
Object value,
boolean nested)
Convenience method that searches below
container in the
component hierarchy and returns the first found component that is an
instance of class clazz and has the bound property value. |
static <T extends JComponent> |
getDescendantsOfClass(Class<T> clazz,
Container container)
Convenience method for searching below
container in the
component hierarchy and return nested components of class
clazz it finds. |
static <T extends JComponent> |
getDescendantsOfClass(Class<T> clazz,
Container container,
boolean nested)
Convenience method for searching below
container in the
component hierarchy and return nested components of class
clazz it finds. |
static <T extends JComponent> |
getDescendantsOfType(Class<T> clazz,
Container container)
Convenience method for searching below
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. |
static <T extends JComponent> |
getDescendantsOfType(Class<T> clazz,
Container container,
boolean nested)
Convenience method for searching below
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. |
static Rectangle |
getDisplayBoundsFor(int index)
Find the "bounds" for the physical display at
index . |
static <E> JComboBox<E> |
getEditableBox(Collection<E> items,
E selected) |
private static int |
getGroupCount() |
private static int |
getHolderCount() |
static <T extends JComponent> |
getJClass(T component)
Convenience method to obtain the Swing class from which this
component was directly or indirectly derived.
|
static Map<Object,Object> |
getProperties(JComponent component)
Convenience method for obtaining most non-null human readable properties
of a JComponent.
|
static List<Object> |
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 |
getVMCount() |
static IdvWindow |
getWindowForViewManager(ViewManager vm)
Attempt to find the
IdvWindow that contains the given
ViewManager . |
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 <E> JComboBox<E> |
makeComboBox(Collection<E> items,
E selected) |
static <E> JComboBox<E> |
makeComboBox(Collection<E> items,
E selected,
McVGuiUtils.Width width) |
static <E> JComboBox<E> |
makeComboBox(E[] items,
E selected) |
static <E> JComboBox<E> |
makeComboBox(E[] items,
E 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
|
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 String |
safeGetText(JTextComponent textComponent)
Gets the "text" contents of a
JTextComponent without
the possibility of a NullPointerException . |
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 integer 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)
Set the width of an existing component using standard McIDAS-V component
widths.
|
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 <E> void |
setListData(JComboBox<E> box,
Collection<E> items,
E 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.
|
static JPanel |
vertical(Component... components)
Use GroupLayout for wrapping a list of components vertically.
|
private static String |
vmType(ViewManager vm) |
private static final int ESTIMATED_VM_COUNT
ViewManagers
.
This value is only used as a last resort (McIDASV.getStaticMcv()
failing).static Set<String> setExclude
private McVGuiUtils()
public static JLabel makeLabelRight(String title)
title
- Label text. Should not be null
.public static JLabel makeLabelRight(String title, McVGuiUtils.Width width)
public static JLabel makeLabelLeft(String title)
title
- Label text. Should not be null
.public static JLabel makeLabelLeft(String title, McVGuiUtils.Width width)
public static JPanel makeLabeledComponent(String label, JComponent thing)
label
- Label for thing
. Should not be null
.thing
- Component to label. Should not be null
.public static JPanel makeLabeledComponent(JLabel label, JComponent thing)
public static JPanel makeLabeledComponent(String label, JComponent thing, McVGuiUtils.Position position)
public static JPanel makeLabeledComponent(JLabel label, JComponent thing, McVGuiUtils.Position position)
public static JPanel makeComponentLabeled(JComponent thing, String label)
thing
- Component to label. Should not be null
.label
- Label for thing
. Should not be null
.public static JPanel makeComponentLabeled(JComponent thing, String label, McVGuiUtils.Position position)
public static JPanel makeComponentLabeled(JComponent thing, JLabel label)
public static JPanel makeComponentLabeled(JComponent thing, JLabel label, McVGuiUtils.Position position)
public static void setComponentWidth(JComponent existingComponent)
existingComponent
- Component that will have its width set.public static void setComponentWidth(JComponent existingComponent, McVGuiUtils.Width width)
existingComponent
- Component that will have its width set.width
- Width to use for existingComponent
.public static void setComponentWidth(JComponent existingComponent, int width)
existingComponent
- Component that will have its width set.width
- Width to use for existingComponent
.public static void setComponentWidth(JComponent setme, JComponent getme)
public static void setComponentWidth(JComponent setme, JComponent getme, int padding)
public static void setComponentHeight(JComponent setme, JComponent getme)
public static void setComponentHeight(JComponent setme, JComponent getme, int padding)
public static void setLabelPosition(JLabel existingLabel)
existingLabel
- public static void setLabelPosition(JLabel existingLabel, McVGuiUtils.Position position)
public static void setLabelBold(JLabel existingLabel, boolean bold)
existingLabel
- bold
- public static void setComponentColor(JComponent existingComponent)
existingComponent
- public static void setComponentColor(JComponent existingComponent, McVGuiUtils.TextColor color)
public static JButton makeImageButton(String iconName, Object object, String methodName, Object arg, String tooltip)
public static JButton makeImageButton(String iconName, String tooltip)
public static JButton makeImageTextButton(String iconName, String label)
public static void setButtonImage(JButton existingButton, String iconName)
public static void setMenuImage(JMenuItem existingMenuItem, String iconName)
public static <E> JComboBox<E> makeComboBox(E[] items, E selected)
public static <E> JComboBox<E> makeComboBox(E[] items, E selected, McVGuiUtils.Width width)
public static <E> JComboBox<E> makeComboBox(Collection<E> items, E selected)
public static <E> JComboBox<E> makeComboBox(Collection<E> items, E selected, McVGuiUtils.Width width)
public static <E> void setListData(JComboBox<E> box, Collection<E> items, E selected)
public static <E> JComboBox<E> getEditableBox(Collection<E> items, E selected)
public static JTextField makeTextField(String value)
value
- Text to place within the text field. Should not be null
.JTextField
with initial text taken from value
.public static JTextField makeTextField(String value, McVGuiUtils.Width width)
public static McVTextField makeTextFieldLimit(String defaultString, int limit)
public static McVTextField makeTextFieldUpper(String defaultString, int limit)
public static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, String allow)
public static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, String deny)
public static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, char... allow)
public static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, char... deny)
public static McVTextField makeTextFieldAllow(String defaultString, int limit, boolean upper, Pattern allow)
public static McVTextField makeTextFieldDeny(String defaultString, int limit, boolean upper, Pattern deny)
public static JPanel topCenterBottom(JComponent top, JComponent center, JComponent bottom)
top
- Component to place at the top of the newly created panel. Should not be null
.center
- Component to place in the center of the newly created panel. Should not be null
.bottom
- Component to place at the bottom of the newly created panel. Should not be null
.JPanel
with the given components in the top, center, and bottom positions.public static JPanel topBottom(JComponent top, JComponent bottom, McVGuiUtils.Prefer which)
top
- Component to place at the top of the newly created panel. Should not be null
.bottom
- Component to place at the bottom of the newly created panel. Should not be null
.which
- Which component's size to prefer. Should not be null
.JPanel
with the given components.public static JPanel sideBySide(JComponent left, JComponent right)
left
- Left component. Should not be null
.right
- Right component. Should not be null
.JPanel
with the given components side-by-side.public static JPanel sideBySide(JComponent left, JComponent right, int gap)
left
- Left component. Should not be null
.right
- Right component. Should not be null
.gap
- Gap between left
and right
.JPanel
with the given components side-by-side,
separated by value from gap
.public static JPanel horizontal(Component... components)
components
- Components to stack horizontally. Should not be null
.JPanel
with the given components.public static JPanel vertical(Component... components)
components
- Components to stack vertically. Should not be null
.JPanel
with the given components.public static JPanel makePrettyButtons(JPanel idvButtonPanel)
idvButtonPanel
- JPanel
to scan for understood button names. Should not be null
.JPanel
with pretty buttons (where possible).public static List makePrettyButtons(List buttonList)
buttonList
- List of buttons. Should not be null
.List
of pretty buttons.public static JButton makePrettyButton(String name)
name
- Button text. Should not be null
.public static JButton makePrettyButton(JButton button)
button
- Button to make pretty. Should not be null
.button
with an icon, or just the given
button
(if the name was not understood).public static void printUIComponents(JComponent parent)
public static void printUIComponents(JComponent parent, int index, int depth)
public static void runOnEDT(Runnable r)
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.
r
- Code to run in the event dispatch thread. Cannot be null
.private static int getVMCount()
private static int getHolderCount()
private static int getGroupCount()
public static List<ViewManager> getActiveViewManagers()
public static List<ViewManager> getAllViewManagers()
public static IdvWindow getWindowForViewManager(ViewManager vm)
IdvWindow
that contains the given
ViewManager
.vm
- ViewManager
whose IdvWindow
is needed.
Cannot be null
.IdvWindow
containing vm
, or
null
.public static List<Object> getShareGroupsInWindow(IdvWindow window)
public static List<Object> getAllShareGroups()
public static List<ViewManager> getViewManagersInGroup(Object sharedGroup)
public static List<ViewManager> getViewManagers(WindowInfo info)
public static List<ViewManager> getViewManagers(IdvWindow window)
public static boolean isUIHolder(IdvComponentHolder h)
h
contains some UI component like
the dashboard of field selector. Yes, it can happen!public static boolean isDynamicSkin(IdvComponentHolder h)
h
is a dynamic skin.public static boolean hasDynamicSkins(List<WindowInfo> windows)
windows
has at least one dynamic
skin.public static List<IdvComponentHolder> getComponentHolders(WindowInfo windowInfo)
windowInfo
.getComponentHolders(IdvComponentGroup)
public static List<IdvComponentHolder> getComponentHolders(IdvWindow idvWindow)
idvWindow
.getComponentHolders(IdvComponentGroup)
public static List<IdvComponentHolder> getComponentHolders(IdvComponentGroup group)
group
to find any
component holders.public static List<IdvComponentGroup> getComponentGroups(IdvComponentGroup group)
group
for any nested
component groups.public static List<IdvComponentGroup> getComponentGroups(WindowInfo window)
window
.getComponentGroups(IdvComponentGroup)
public static List<IdvComponentGroup> getComponentGroups(List<WindowInfo> windows)
windows
.getComponentGroups(IdvComponentGroup)
public static IdvComponentGroup getComponentGroup(IdvWindow window)
window
.public static boolean hasNestedGroups(IdvComponentGroup group)
group
contains any component
groups.public static List<IdvComponentHolder> getAllComponentHolders()
public static List<IdvComponentGroup> getAllComponentGroups()
public static List<IdvWindow> getAllDisplayWindows()
public static IdvComponentHolder getAfterActiveHolder()
public static IdvComponentHolder getBeforeActiveHolder()
public static IdvComponentHolder getActiveComponentHolder()
public static IdvComponentHolder getAfterHolder(IdvComponentHolder current)
current
.public static IdvComponentHolder getBeforeHolder(IdvComponentHolder current)
current
.public static List<McvComponentGroup> idvGroupsToMcv(IdvWindow w)
w
- IdvWindow
whose component groups you want (as
McvComponentGroup
s).List
of McvComponentGroup
s or an empty list.
If there were no McvComponentGroup
s in w
,
or if w
is null
, an empty List
is returned.public static void compGroup(IdvComponentGroup g)
public static void compGroup(IdvComponentGroup g, int level)
public static void compHolder(IdvComponentHolder h, int level)
public static List<ViewManager> findvms(List<WindowInfo> windows)
private static String vmType(ViewManager vm)
public static Rectangle getDisplayBoundsFor(int index)
index
.index
- Zero-based index of the desired physical display.Rectangle
representing the display's
bounds, or null
if index
is invalid.public static int findDisplayNumberForRectangle(Rectangle rect)
Rectangle
. This method (currently) fails for
Rectangle
s that span multiple displays!rect
- Rectangle
to test. Should not be null
.-1
if there was no match.public static int findDisplayNumberForComponent(Component comp)
Component
. This method (currently) fails for
Component
s that span multiple displays!comp
- Component
to test. Should not be null
.-1
if there was no match.public static int findDisplayNumberForMultiFrame(MultiFrame mf)
MultiFrame
. This method (currently) fails
for MultiFrame
s that span multiple displays!mf
- MultiFrame
to test. Should not be null
.-1
if there was no match.public static int findDisplayNumberForCoords(int x, int y, int width, int height)
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.-1
if there was no match.Rectangle.Rectangle(int, int, int, int)
public static int findDisplayNumberForEvent(EventObject event)
Component
or MultiFrame
that
fired the given event. This method (currently) fails for coordinates
that span multiple displays!event
- EventObject
to test. Should not be null
.-1
if there was no match.public static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container)
container
in the
component hierarchy and return nested components that are instances of
class clazz
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)
clazz
- the class of components whose instances are to be found.container
- the container at which to begin the searchpublic static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container, boolean nested)
container
in the
component hierarchy and return nested components that are instances of
class clazz
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.
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 otherwisepublic static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException
container
in the
component hierarchy and returns the first found component that is an
instance of class clazz
having the bound property value.
Returns null
if such component cannot be found.
This method invokes
getDescendantOfType(Class, java.awt.Container, String, Object, boolean)
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 propertyIllegalArgumentException
- if the bound property does
not exist for the class or cannot be accessedpublic static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException
container
in the
component hierarchy and returns the first found component that is an
instance of class clazz
and has the bound property value.
Returns null
if such component cannot be found.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 of clazz
, false otherwise.IllegalArgumentException
- if the bound property does
not exist for the class or cannot be accessed.public static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container)
container
in the
component hierarchy and return nested components of class
clazz
it finds. Returns an empty list if no such
components exist in the container.
This method invokes
getDescendantsOfClass(Class, java.awt.Container, boolean)
.
clazz
- the class of components to be found.container
- the container at which to begin the searchpublic static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container, boolean nested)
container
in the
component hierarchy and return nested components of class
clazz
it finds. Returns an empty list if no such
components exist in the container.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 otherwisepublic static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException
container
in the
component hierarchy in a depth first manner and returns the first
found component of class clazz
having the bound property
value.
Returns null
if such component cannot be found.
This method invokes
getDescendantOfClass(Class, java.awt.Container, String, Object, boolean)
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 propertyIllegalArgumentException
- if the bound property does
not exist for the class or cannot be accessedpublic static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException
container
in the
component hierarchy in a depth first manner and returns the first
found component of class clazz
having the bound property
value.
Returns null
if such component cannot be found.
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.IllegalArgumentException
- if the bound property does
not exist for the class or cannot be accessedprivate static <T extends JComponent> T getComponentFromList(Class<T> clazz, List<T> list, String property, Object value) throws IllegalArgumentException
IllegalArgumentException
public static boolean equals(Object obj1, Object obj2)
obj1
- the first reference object to compare.obj2
- the second reference object to compare.public static Map<JComponent,List<JComponent>> getComponentMap(JComponent container, boolean nested)
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.
container
- The JComponent to be mappednested
- true to drill down to nested containers, false otherwisepublic static UIDefaults getUIDefaultsOfClass(Class<?> clazz)
clazz
- the class of interestpublic static UIDefaults getUIDefaultsOfClass(String className)
className
- fully qualified name of the class of interestpublic static Object getUIDefaultOfClass(Class<?> clazz, String property)
clazz
- the class of interestproperty
- the property to querypublic static Map<Object,Object> getProperties(JComponent component)
Implementation note: The returned value is a HashMap. This is subject to change, so callers should code against the interface Map.
component
- the component whose proerties are to be determinedpublic static <T extends JComponent> Class<?> getJClass(T component)
component
- The component whose Swing superclass is to be
determinedpublic static String safeGetText(JTextComponent textComponent)
JTextComponent
without
the possibility of a NullPointerException
.textComponent
- JTextComponent
whose contents should be
extracted. null
is allowed.JTextComponent.getText()
or an
empty String
if textComponent
or getText()
are
null
.