public class CommonGuiUtility
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | CommonGuiUtility.FileChooserOutputThis class provides the result of a file chooser dialog. | 
| Constructor and Description | 
|---|
| CommonGuiUtility() | 
| Modifier and Type | Method and Description | 
|---|---|
| static CommonGuiUtility.FileChooserOutput | browseAction(java.awt.Component owner,
            int fileSelectionMode,
            java.lang.String originalFilename,
            java.util.List<javax.swing.filechooser.FileFilter> fileFilters,
            int dialogType)This method instantiates a JFileChooser and returns the result in the FileChooserOutput object. | 
| static CommonGuiUtility.FileChooserOutput | browseAction(java.awt.Component owner,
            int fileSelectionMode,
            java.lang.String originalFilename,
            java.util.List<javax.swing.filechooser.FileFilter> fileFilters,
            int dialogType,
            javax.swing.filechooser.FileSystemView fsv)This method instantiates a JFileChooser and returns the result in the FileChooserOutput object. | 
| static java.lang.String | convertFilenameForLabel(java.lang.String filename,
                       int maxLength)This method truncates a filename and keeps only the last characters whose length is set through 
 the maxLength parameter. | 
| static javax.swing.JPanel | createSelectAFilePanel(javax.swing.JTextField textField,
                      javax.swing.JButton browse,
                      javax.swing.JLabel label) | 
| static void | enableAllControls(java.awt.Container container,
                 boolean enabled)This method is a recursive method that enables/disables all the controls, ie. | 
| static void | enableThoseComponents(java.awt.Container container,
                     java.lang.Class<? extends java.awt.Component> clazz,
                     boolean enabled)This method is a recursive method that enables/disables all the buttons in a container. | 
| static java.awt.Container | getParentComponent(java.awt.Component comp,
                  java.lang.Class<? extends java.awt.Container> clazz)This method looks for the Container instance that owns this component. | 
| static java.awt.Window | getParentWindow(java.awt.Component comp)This method looks for the Window instance that owns this component. | 
| static java.util.List<java.awt.Component> | mapComponents(java.awt.Container container,
             java.lang.Class<? extends java.awt.Component> clazz)This method scans a container for all the instances of a particular class that
 extends the class parameter. | 
| static boolean | popupWriteOverWarningDialog(java.awt.Component owner)This static method asks the user if he/she wants to write over an
 existing file. | 
| static javax.swing.ImageIcon | retrieveIcon(java.lang.Class<?> clazz,
            java.lang.String iconName)This method retrieves the icon in a specific package. | 
| static void | showErrorMessage(java.lang.String message,
                java.awt.Component parent)This method causes a JOptionPane.showErrorMessage to be sent on the Event Dispatch Thread. | 
| static void | showInformationMessage(java.lang.String message,
                      java.awt.Component parent)This method causes a JOptionPane.showErrorMessage to be sent on the Event Dispatch Thread. | 
| static void | showWarningMessage(java.lang.String message,
                  java.awt.Component parent)This method causes a JOptionPane.showErrorMessage to be sent on the Event Dispatch Thread. | 
public static CommonGuiUtility.FileChooserOutput browseAction(java.awt.Component owner, int fileSelectionMode, java.lang.String originalFilename, java.util.List<javax.swing.filechooser.FileFilter> fileFilters, int dialogType)
owner - a Component object that calls this JFileChooserfileSelectionMode - either JFileChooser.FILES_ONLY (default), JFileChooser.DIRECTORIES_ONLY or JFileChooser.FILES_AND_DIRECTORIESoriginalFilename - a String that indicates the initial path of the JFileChooserfileFilters - a Vector of FileFilter instancesdialogType - either JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOGjava.io.IOException - if the dialog type is not recognizedpublic static CommonGuiUtility.FileChooserOutput browseAction(java.awt.Component owner, int fileSelectionMode, java.lang.String originalFilename, java.util.List<javax.swing.filechooser.FileFilter> fileFilters, int dialogType, javax.swing.filechooser.FileSystemView fsv)
owner - a Component object that calls this JFileChooserfileSelectionMode - either JFileChooser.FILES_ONLY (default), JFileChooser.DIRECTORIES_ONLY or JFileChooser.FILES_AND_DIRECTORIESoriginalFilename - a String that indicates the initial path of the JFileChooserfileFilters - a Vector of FileFilter instancesdialogType - either JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOGfsv - a FileSystemView instancejava.io.IOException - if the dialog type is not recognizedpublic static boolean popupWriteOverWarningDialog(java.awt.Component owner)
public static javax.swing.JPanel createSelectAFilePanel(javax.swing.JTextField textField,
                                                        javax.swing.JButton browse,
                                                        javax.swing.JLabel label)
public static java.awt.Window getParentWindow(java.awt.Component comp)
comp - a Component instancepublic static java.awt.Container getParentComponent(java.awt.Component comp,
                                                    java.lang.Class<? extends java.awt.Container> clazz)
comp - a Component instanceclazz - a Class that extends Containerpublic static void showErrorMessage(java.lang.String message,
                                    java.awt.Component parent)
message - the error message to be displayedparent - the Container instance that is the parent of this error message (can be null)public static void showInformationMessage(java.lang.String message,
                                          java.awt.Component parent)
message - the error message to be displayedparent - the Container instance that is the parent of this error message (can be null)public static void showWarningMessage(java.lang.String message,
                                      java.awt.Component parent)
message - the error message to be displayedparent - the Container instance that is the parent of this error message (can be null)public static java.util.List<java.awt.Component> mapComponents(java.awt.Container container,
                                                               java.lang.Class<? extends java.awt.Component> clazz)
container - a Container instanceclazz - a Class instance that extends Componentpublic static void enableThoseComponents(java.awt.Container container,
                                         java.lang.Class<? extends java.awt.Component> clazz,
                                         boolean enabled)
container - a Container instanceclazz - a Class instance that extends Componentenabled - a booleanpublic static void enableAllControls(java.awt.Container container,
                                     boolean enabled)
container - a Container instanceenabled - a booleanpublic static javax.swing.ImageIcon retrieveIcon(java.lang.Class<?> clazz,
                                                 java.lang.String iconName)
clazz - a class of the package for setting the pathiconName - the filename of the iconpublic static java.lang.String convertFilenameForLabel(java.lang.String filename,
                                                       int maxLength)
filename - the filename (String)maxLength - the maximum number of characters (Integer)