|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wisc.ssec.mcidasv.util.McVGuiUtils
public class McVGuiUtils
Nested Class Summary | |
---|---|
static class |
McVGuiUtils.IconPanel
Use this class to create a panel with a background image |
static class |
McVGuiUtils.Position
|
static class |
McVGuiUtils.Prefer
|
static class |
McVGuiUtils.TextColor
|
static class |
McVGuiUtils.Width
|
Field Summary | |
---|---|
private static int |
ESTIMATED_VM_COUNT
Estimated number of ViewManagers . |
private static org.slf4j.Logger |
logger
|
Constructor Summary | |
---|---|
private |
McVGuiUtils()
|
Method Summary | ||
---|---|---|
static void |
compGroup(IdvComponentGroup g)
|
|
static void |
compGroup(IdvComponentGroup g,
int level)
|
|
static void |
compHolder(IdvComponentHolder h,
int level)
|
|
static int |
findDisplayNumberForComponent(Component comp)
Tries to determine the physical display that contains the given Component . |
|
static int |
findDisplayNumberForCoords(int x,
int y,
int width,
int height)
Tries to determine the physical display that contains the rectangle defined by the specified coordinates. |
|
static int |
findDisplayNumberForEvent(EventObject event)
Tries to determine which physical display contains the Component or MultiFrame that
fired the given event. |
|
static int |
findDisplayNumberForMultiFrame(MultiFrame mf)
Tries to determine the physical display that contains the given MultiFrame . |
|
static int |
findDisplayNumberForRectangle(Rectangle rect)
Tries to determine the physical display that contains the given Rectangle . |
|
static List<ViewManager> |
findvms(List<WindowInfo> windows)
|
|
static IdvComponentHolder |
getActiveComponentHolder()
|
|
static List<ViewManager> |
getActiveViewManagers()
|
|
static IdvComponentHolder |
getAfterActiveHolder()
|
|
static IdvComponentHolder |
getAfterHolder(IdvComponentHolder current)
|
|
static List<IdvComponentGroup> |
getAllComponentGroups()
|
|
static List<IdvComponentHolder> |
getAllComponentHolders()
|
|
static List<IdvWindow> |
getAllDisplayWindows()
|
|
static List<Object> |
getAllShareGroups()
|
|
static List<ViewManager> |
getAllViewManagers()
|
|
static IdvComponentHolder |
getBeforeActiveHolder()
|
|
static IdvComponentHolder |
getBeforeHolder(IdvComponentHolder current)
|
|
static IdvComponentGroup |
getComponentGroup(IdvWindow window)
|
|
static List<IdvComponentGroup> |
getComponentGroups(IdvComponentGroup group)
|
|
static List<IdvComponentGroup> |
getComponentGroups(List<WindowInfo> windows)
|
|
static List<IdvComponentGroup> |
getComponentGroups(WindowInfo window)
|
|
static List<IdvComponentHolder> |
getComponentHolders(IdvComponentGroup group)
|
|
static List<IdvComponentHolder> |
getComponentHolders(IdvWindow idvWindow)
|
|
static List<IdvComponentHolder> |
getComponentHolders(WindowInfo windowInfo)
|
|
static Rectangle |
getDisplayBoundsFor(int index)
Find the "bounds" for the physical display at index . |
|
static JComboBox |
getEditableBox(Collection<?> items,
Object selected)
|
|
private static int |
getGroupCount()
|
|
private static int |
getHolderCount()
|
|
static List<Object> |
getShareGroupsInWindow(IdvWindow window)
|
|
static List<ViewManager> |
getViewManagers(IdvWindow window)
|
|
static List<ViewManager> |
getViewManagers(WindowInfo info)
|
|
static List<ViewManager> |
getViewManagersInGroup(Object sharedGroup)
|
|
private static int |
getVMCount()
|
|
static boolean |
hasDynamicSkins(List<WindowInfo> windows)
|
|
static boolean |
hasNestedGroups(IdvComponentGroup group)
|
|
static JPanel |
horizontal(Component[] components)
Use GroupLayout for wrapping a list of components horizontally |
|
static List<McvComponentGroup> |
idvGroupsToMcv(IdvWindow w)
|
|
static boolean |
isDynamicSkin(IdvComponentHolder h)
|
|
static boolean |
isUIHolder(IdvComponentHolder h)
|
|
static JComboBox |
makeComboBox(Collection<?> items,
Object selected)
|
|
static JComboBox |
makeComboBox(Collection<?> items,
Object selected,
McVGuiUtils.Width width)
|
|
static
|
makeComboBox(E[] items,
Object selected)
|
|
static
|
makeComboBox(E[] items,
Object selected,
McVGuiUtils.Width width)
|
|
static JPanel |
makeComponentLabeled(JComponent thing,
JLabel label)
|
|
static JPanel |
makeComponentLabeled(JComponent thing,
JLabel label,
McVGuiUtils.Position position)
|
|
static JPanel |
makeComponentLabeled(JComponent thing,
String label)
Create a sized, labeled component |
|
static JPanel |
makeComponentLabeled(JComponent thing,
String label,
McVGuiUtils.Position position)
|
|
static JButton |
makeImageButton(String iconName,
Object object,
String methodName,
Object arg,
String tooltip)
Custom makeImageButton to ensure proper sizing and mouseborder are set |
|
static JButton |
makeImageButton(String iconName,
String tooltip)
Custom makeImageButton to ensure proper sizing and mouseborder are set |
|
static JButton |
makeImageTextButton(String iconName,
String label)
Create a button with text and an icon |
|
static JPanel |
makeLabeledComponent(JLabel label,
JComponent thing)
|
|
static JPanel |
makeLabeledComponent(JLabel label,
JComponent thing,
McVGuiUtils.Position position)
|
|
static JPanel |
makeLabeledComponent(String label,
JComponent thing)
Create a sized, labeled component |
|
static JPanel |
makeLabeledComponent(String label,
JComponent thing,
McVGuiUtils.Position position)
|
|
static JLabel |
makeLabelLeft(String title)
Create a standard sized, left-justified label |
|
static JLabel |
makeLabelLeft(String title,
McVGuiUtils.Width width)
|
|
static JLabel |
makeLabelRight(String title)
Create a standard sized, right-justified label |
|
static JLabel |
makeLabelRight(String title,
McVGuiUtils.Width width)
|
|
static JButton |
makePrettyButton(JButton button)
- Add icons when we understand the button name |
|
static JButton |
makePrettyButton(String name)
Convenience method to make a button based solely on its name |
|
static JPanel |
makePrettyButtons(JPanel idvButtonPanel)
Hack apart an IDV button panel and do a few things: - Reorder the buttons based on OS preference Windows: OK on left Mac: OK on right - Add icons when we understand the button name TODO: Revisit this? |
|
static List |
makePrettyButtons(List buttonList)
Take a list of buttons and make them pretty |
|
static JTextField |
makeTextField(String value)
Create a standard sized text field |
|
static JTextField |
makeTextField(String value,
McVGuiUtils.Width width)
|
|
static McVTextField |
makeTextFieldAllow(String defaultString,
int limit,
boolean upper,
char[] allow)
|
|
static McVTextField |
makeTextFieldAllow(String defaultString,
int limit,
boolean upper,
Pattern allow)
|
|
static McVTextField |
makeTextFieldAllow(String defaultString,
int limit,
boolean upper,
String allow)
|
|
static McVTextField |
makeTextFieldDeny(String defaultString,
int limit,
boolean upper,
char[] deny)
|
|
static McVTextField |
makeTextFieldDeny(String defaultString,
int limit,
boolean upper,
Pattern deny)
|
|
static McVTextField |
makeTextFieldDeny(String defaultString,
int limit,
boolean upper,
String deny)
|
|
static McVTextField |
makeTextFieldLimit(String defaultString,
int limit)
Create some custom text entry widgets |
|
static McVTextField |
makeTextFieldUpper(String defaultString,
int limit)
|
|
private static void |
p(String str,
int padding)
|
|
private static String |
pad(String str,
int pad)
|
|
static void |
printUIComponents(JComponent parent)
Print the hierarchy of components |
|
static void |
printUIComponents(JComponent parent,
int index,
int depth)
|
|
static void |
runOnEDT(Runnable r)
Calls SwingUtilities.invokeLater(Runnable) if the current thread
is not the event dispatch thread. |
|
static void |
setButtonImage(JButton existingButton,
String iconName)
Add an icon to a button... but only if the LookAndFeel supports it |
|
static void |
setComponentColor(JComponent existingComponent)
Set the foreground color of an existing component |
|
static void |
setComponentColor(JComponent existingComponent,
McVGuiUtils.TextColor color)
|
|
static void |
setComponentHeight(JComponent setme,
JComponent getme)
Set the component height to that of another component |
|
static void |
setComponentHeight(JComponent setme,
JComponent getme,
int padding)
|
|
static void |
setComponentWidth(JComponent existingComponent)
Set the width of an existing component |
|
static void |
setComponentWidth(JComponent existingComponent,
int width)
Set the width of an existing component to a given int width |
|
static void |
setComponentWidth(JComponent setme,
JComponent getme)
Set the component width to that of another component |
|
static void |
setComponentWidth(JComponent setme,
JComponent getme,
int padding)
|
|
static void |
setComponentWidth(JComponent existingComponent,
McVGuiUtils.Width width)
|
|
static void |
setLabelBold(JLabel existingLabel,
boolean bold)
Set the bold attribute of an existing label |
|
static void |
setLabelPosition(JLabel existingLabel)
Set the label position of an existing label |
|
static void |
setLabelPosition(JLabel existingLabel,
McVGuiUtils.Position position)
|
|
static void |
setListData(JComboBox box,
Collection<?> items,
Object selected)
|
|
static void |
setMenuImage(JMenuItem existingMenuItem,
String iconName)
Add an icon to a menu item |
|
static JPanel |
sideBySide(JComponent left,
JComponent right)
Use GroupLayout for wrapping components to stop vertical resizing |
|
static JPanel |
sideBySide(JComponent left,
JComponent right,
int gap)
Use GroupLayout for wrapping components to stop vertical resizing |
|
static JPanel |
topBottom(JComponent top,
JComponent bottom,
McVGuiUtils.Prefer which)
Use GroupLayout for stacking components vertically |
|
static JPanel |
topCenterBottom(JComponent top,
JComponent center,
JComponent bottom)
Use GroupLayout for stacking components vertically Set center to resize vertically |
|
static JPanel |
vertical(Component[] components)
Use GroupLayout for wrapping a list of components vertically |
|
private static String |
vmType(ViewManager vm)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.slf4j.Logger logger
private static final int ESTIMATED_VM_COUNT
ViewManagers
.
This value is only used as a last resort (McIDASV.getStaticMcv()
failing).
Constructor Detail |
---|
private McVGuiUtils()
Method Detail |
---|
public static JLabel makeLabelRight(String title)
title
-
public static JLabel makeLabelRight(String title, McVGuiUtils.Width width)
public static JLabel makeLabelLeft(String title)
title
-
public static JLabel makeLabelLeft(String title, McVGuiUtils.Width width)
public static JPanel makeLabeledComponent(String label, JComponent thing)
label
- thing
-
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)
label
- thing
-
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
- public static void setComponentWidth(JComponent existingComponent, McVGuiUtils.Width width)
public static void setComponentWidth(JComponent existingComponent, int width)
existingComponent
- width
- 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 makeComboBox(E[] items, Object selected)
public static <E> JComboBox makeComboBox(E[] items, Object selected, McVGuiUtils.Width width)
public static JComboBox makeComboBox(Collection<?> items, Object selected)
public static JComboBox makeComboBox(Collection<?> items, Object selected, McVGuiUtils.Width width)
public static void setListData(JComboBox box, Collection<?> items, Object selected)
public static JComboBox getEditableBox(Collection<?> items, Object selected)
public static JTextField makeTextField(String value)
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
- center
- bottom
-
public static JPanel topBottom(JComponent top, JComponent bottom, McVGuiUtils.Prefer which)
top
- bottom
- which
-
public static JPanel sideBySide(JComponent left, JComponent right)
left
- right
-
public static JPanel sideBySide(JComponent left, JComponent right, int gap)
left
- right
-
public static JPanel horizontal(Component[] components)
public static JPanel vertical(Component[] components)
public static JPanel makePrettyButtons(JPanel idvButtonPanel)
idvButtonPanel
-
public static List makePrettyButtons(List buttonList)
buttonList
-
public static JButton makePrettyButton(String name)
name
-
public static JButton makePrettyButton(JButton button)
button
-
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 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)
private static String pad(String str, int pad)
private static void p(String str, int padding)
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |