|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.ui.FormHelper
public class FormHelper
Utilities for the UI layer.
| Nested Class Summary | |
|---|---|
static class |
FormHelper.PreferredSizeMouseListener
A mouse listener to open a popup menu for setting/getting the preferred sizes. |
| Field Summary | |
|---|---|
static boolean |
preferencesAreReadOnly
true if user should not be allowed to write preferences |
static boolean |
useSystemPreferencesOnly
true if retrieving and storing preferences refers to the systemRoot only. |
| Constructor Summary | |
|---|---|
FormHelper()
|
|
| Method Summary | |
|---|---|
static void |
addWindow(Window w)
Adds window to the set of windows (must be visible or iconified). |
static void |
addWindowActionListener(ActionListener listener)
Adds a listener being notified whenever the state of the current windows-list has changed. |
static void |
doFireValueChanged(FormComponent c,
Object[] listeners)
Notifies all ValueListeners (usually only one!) that the field is going to be displayed and thus needs the data what to display. |
static void |
doFireValueEntered(FormComponent c,
Object[] listeners)
Notifies all ValueListeners (usually only one!) that the field contents should be moved to the actual data object. |
static Point |
getAlignedLocation(Window window,
Point location)
Calculates the location of a window so that it is completely visible on the screen, using a "free" spot. |
static long |
getAutoClose()
Gets the global autoclose feature for all newly created Windows. |
static Point |
getCenteredLocation(Window window)
Calculates the location of a window so that it will be centered on the screen. |
static FormEventQueue |
getEventQueue()
Gets the eventqueue. The method installs the FormEventQueue if not yet done. |
static void |
getFormValue(Component c)
Recursively walk down and fireValueEntered(). |
static String |
getHelpURL()
Gets the global help url prefix. |
static Window |
getParentWindow(Component comp)
Determines the parent-window of a component. Much the same as getTopLevelAncestor in JComponent, this does method not return Applets. |
static String |
getPreferencesName(Class clazz,
String compName)
Determines the Preferences-name for a class. The name is built from the classname and a componentname. |
static Point |
getPreferredLocation(Window window,
Window owner)
Calculates the position of a window on the screen so that it is being display in an optimal manner. |
static Window |
getVisibleParentOrRelatedWindow(Component comp)
Gets the parent window of the given component. |
static Object[] |
getWindows()
Gets the current windows which are visible or iconified. |
static void |
installPreferredSizeMenu(Component comp,
String prefName)
Installs a menu for setting/retrieving the preferred sizes. |
static void |
invalidateParentInfo(Component c)
Recursively walk down and invalidate the parentInfo. |
static boolean |
isParentWindowModal(Component comp)
Determines whether parent window a modal dialog. |
static boolean |
isValueChanged(Component c)
Recursively walk down and check for value changed. |
static void |
loadPreferredSizes(Component comp,
String prefName,
boolean system)
Loads the preferences of a component. Use it whenever there is no table in it (FormTable provide setting too) or some other scrolling regions need to be preset. |
static void |
modalToFront()
Brings the current modal dialogs toFront. |
static void |
openHelpURL(Component comp)
Opens the online help for a given component. |
static boolean |
packParentWindow(Component comp)
Packs the window containing the given component. |
static void |
processWindowEvent(WindowEvent e)
Process a window event (from a FormDialog or FormFrame). |
static void |
registerLocaleRunnable(Runnable runnable)
Registers a runnable which will be invoked for each Locale change. |
static void |
removeWindow(Window w)
Removes a window from the set (i.e. |
static void |
removeWindowActionListener(ActionListener listener)
Removes a listener. |
static void |
requestFocusLater(Component c)
Requests focus by EventQueue.invokeLater(). |
static void |
savePreferredSizes(Component comp,
String prefName,
boolean system)
Saves the preferences of a component. Use it whenever there is no table in it (FormTable provide setting too) or some other scrolling regions need to be preset. |
static void |
saveValue(Component c)
Recursively walk down and saveValue(). |
static void |
setAutoClose(long ms)
Sets the global autoclose feature for all newly created Windows. |
static void |
setBackground(Component c,
Color background)
Recursively walk down and setBackground(). |
static void |
setChangeable(Component c,
boolean changeable)
Recursively walk down and setChangeable(). |
static void |
setDefaultCursor(Component comp)
Sets the default-cursor. Determines the parent or related window and applies the cursor. |
static void |
setDefaultFocusTraversalPolicy(Container container)
Sets the focus-policy for a container. |
static void |
setForeground(Component c,
Color foreground)
Recursively walk down and setForeground(). |
static void |
setFormValue(Component c)
Recursively walk down and fireValueChanged(). |
static void |
setFormValueKeepChanged(Component c)
Recursively walk down and fireValueChanged(), but only fields that have *NOT* been changed by the user. Nice to mask out unchanged fields. |
static void |
setHelpURL(String aHelpURL)
Sets the global help url prefix. |
static void |
setScale(DecimalFormat format,
int scale)
Changes the format according to the given scale. |
static void |
setupDefaultBindings(JComponent comp)
Registers some default Keyboard Actions for Components. |
static void |
setWaitCursor(Component comp)
Sets the wait-cursor. Determines the parent or related window and applies the cursor. |
static void |
triggerLocaleChanged()
Invokes all locale runnables. |
static void |
triggerValueChanged(Component c)
Recursively walk up and trigger value changed in FormContainers. |
static void |
updateUIofAllWindows()
Updates the UI of all registered windows |
static void |
updateUIofWindow(Window w)
Updates the UI of a given window. |
static void |
waitForEmptyEventQueue()
Waits for the event queue to become empty. This method must not be invoked from the GUI thread! The method waits until the q is empty. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean useSystemPreferencesOnly
public static boolean preferencesAreReadOnly
| Constructor Detail |
|---|
public FormHelper()
| Method Detail |
|---|
public static void registerLocaleRunnable(Runnable runnable)
runnable - the runnablepublic static void triggerLocaleChanged()
registerLocaleRunnable(java.lang.Runnable)public static FormEventQueue getEventQueue()
public static void waitForEmptyEventQueue()
public static void setAutoClose(long ms)
ms - timeout in milliseconds. Default is 0.public static long getAutoClose()
public static void modalToFront()
public static void addWindow(Window w)
w - the window to addpublic static void removeWindow(Window w)
w - the window to removepublic static Object[] getWindows()
public static void updateUIofAllWindows()
public static void updateUIofWindow(Window w)
w - the windowpublic static void processWindowEvent(WindowEvent e)
e - the event to processpublic static void addWindowActionListener(ActionListener listener)
listener - the action listenerpublic static void removeWindowActionListener(ActionListener listener)
listener - the listener to be removedpublic static void setDefaultFocusTraversalPolicy(Container container)
container - the container.
public static void doFireValueChanged(FormComponent c,
Object[] listeners)
c - the componentlisteners - the listener array
public static void doFireValueEntered(FormComponent c,
Object[] listeners)
c - the componentlisteners - the listener arraypublic static void setFormValue(Component c)
c - the componentpublic static void setFormValueKeepChanged(Component c)
c - the componentpublic static void getFormValue(Component c)
c - the componentpublic static void saveValue(Component c)
c - the componentpublic static boolean isValueChanged(Component c)
c - the component
public static void triggerValueChanged(Component c)
c - the component
public static void setChangeable(Component c,
boolean changeable)
c - the componentchangeable - true if changeable
public static void setBackground(Component c,
Color background)
c - the componentbackground - the background color
public static void setForeground(Component c,
Color foreground)
c - the componentforeground - the foreground colorpublic static Window getParentWindow(Component comp)
comp - the component
public static Window getVisibleParentOrRelatedWindow(Component comp)
comp - the component
public static boolean isParentWindowModal(Component comp)
comp - the component
public static boolean packParentWindow(Component comp)
comp - the component
public static void invalidateParentInfo(Component c)
c - the componentpublic static void requestFocusLater(Component c)
c - the componentpublic static void setWaitCursor(Component comp)
comp - the related componentpublic static void setDefaultCursor(Component comp)
comp - the related componentpublic static Point getCenteredLocation(Window window)
window - the window
public static Point getPreferredLocation(Window window,
Window owner)
window - the window to be positioned on the screenowner - the window to which the window will be related to
public static Point getAlignedLocation(Window window,
Point location)
window - the current windowlocation - the desired (not necessarily current!) location
public static void setupDefaultBindings(JComponent comp)
comp - the component
public static void setScale(DecimalFormat format,
int scale)
format - the decimal formatscale - the scale
public static void savePreferredSizes(Component comp,
String prefName,
boolean system)
comp - is the component (usually a panel, srolling area or window)prefName - is the preferences namesystem - is true if store to system-preferences, else store in userprefs
public static void loadPreferredSizes(Component comp,
String prefName,
boolean system)
comp - is the component (usually a panel, srolling area or window)prefName - is the preferences namesystem - is true if load from system-preferences, else try userprefs first
public static void installPreferredSizeMenu(Component comp,
String prefName)
comp - is the componentprefName - is the preferences name
public static String getPreferencesName(Class clazz,
String compName)
clazz - the classcompName - the name of the component
public static void setHelpURL(String aHelpURL)
aHelpURL - the prefixpublic static String getHelpURL()
public static void openHelpURL(Component comp)
comp - the component
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||