git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268378 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -68,42 +68,42 @@ public abstract class AntModule extends JComponent { | |||
| /** The application context. */ | |||
| private AppContext _context = null; | |||
| /** | |||
| * Default constructor. | |||
| */ | |||
| protected AntModule() { | |||
| /** | |||
| * Default constructor. | |||
| */ | |||
| protected AntModule() { | |||
| // Create a dummy border so that the widget will at least have a | |||
| // minimal display in a bean environment. | |||
| setBorder(BorderFactory.createTitledBorder(getClass().getName())); | |||
| } | |||
| } | |||
| /** | |||
| * This method is called after instantiation when the application context | |||
| /** | |||
| * This method is called after instantiation when the application context | |||
| * is available for constructing the class' display. Think of this in | |||
| * a similar manner to Applet.init() or Servlet.init(). It should | |||
| * immediately call #setContext() with the given parameter. | |||
| * | |||
| * @param context Valid application context providing | |||
| * all required resources. | |||
| * | |||
| * @param context Valid application context providing | |||
| * all required resources. | |||
| */ | |||
| public abstract void contextualize(AppContext context); | |||
| /** | |||
| * Set the application context. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| /** | |||
| * Set the application context. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| protected void setContext(AppContext context) { | |||
| _context = context; | |||
| setBorder(_context == null ? null : | |||
| BorderFactory.createTitledBorder(getName())); | |||
| } | |||
| /** | |||
| * Get the application context. | |||
| * | |||
| * @return Application context. | |||
| */ | |||
| /** | |||
| * Get the application context. | |||
| * | |||
| * @return Application context. | |||
| */ | |||
| public AppContext getContext() { | |||
| if(_context == null) { | |||
| throw new IllegalStateException( | |||
| @@ -111,11 +111,11 @@ public abstract class AntModule extends JComponent { | |||
| } | |||
| return _context; | |||
| } | |||
| /** | |||
| * Get the name of the editor. | |||
| * | |||
| * @return Editor's name. | |||
| */ | |||
| /** | |||
| * Get the name of the editor. | |||
| * | |||
| * @return Editor's name. | |||
| */ | |||
| public String getName() { | |||
| return getContext().getResources().getString(getClass(), "name"); | |||
| } | |||
| @@ -80,31 +80,31 @@ public class PropertyEditor extends AntModule { | |||
| /** Scroll area containing contents. */ | |||
| private JScrollPane _scroller = null; | |||
| /** | |||
| * Default ctor. | |||
| * | |||
| */ | |||
| public PropertyEditor() { | |||
| /** | |||
| * Default ctor. | |||
| * | |||
| */ | |||
| public PropertyEditor() { | |||
| } | |||
| /** | |||
| * Using the given AppContext, initialize the display. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| /** | |||
| * Using the given AppContext, initialize the display. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| public void contextualize(AppContext context) { | |||
| setContext(context); | |||
| context.getEventBus().addMember(EventBus.MONITORING, new Handler()); | |||
| setLayout(new BorderLayout()); | |||
| _container = new JPanel(new BorderLayout()); | |||
| add(_scroller = new JScrollPane(_container)); | |||
| } | |||
| } | |||
| /** | |||
| * Update the display for the current items. | |||
| * | |||
| * @param items Current items to display. | |||
| */ | |||
| /** | |||
| * Update the display for the current items. | |||
| * | |||
| * @param items Current items to display. | |||
| */ | |||
| private void updateDisplay(ACSElement[] items) { | |||
| if(_customizer != null) { | |||
| _container.remove((Component)_customizer); | |||
| @@ -70,30 +70,30 @@ public class ResourceManager { | |||
| /** Resources to reference. */ | |||
| private ResourceBundle _resources = null; | |||
| /** | |||
| * Default ctor. Uses the default properties file for antidote. | |||
| * | |||
| */ | |||
| /** | |||
| * Default ctor. Uses the default properties file for antidote. | |||
| * | |||
| */ | |||
| public ResourceManager() { | |||
| this("org.apache.tools.ant.gui.resources.antidote"); | |||
| } | |||
| /** | |||
| * Standard ctor. | |||
| * | |||
| * @param propName Fully qualified name of the resources to use. | |||
| */ | |||
| /** | |||
| * Standard ctor. | |||
| * | |||
| * @param propName Fully qualified name of the resources to use. | |||
| */ | |||
| public ResourceManager(String propName) { | |||
| _resources = ResourceBundle.getBundle(propName); | |||
| } | |||
| /** | |||
| * Get a string resource for the given class. | |||
| * | |||
| * @param clazz Class to get resource for. | |||
| * @param name Name of the string resource. | |||
| * @return String resource for the given class. | |||
| */ | |||
| /** | |||
| * Get a string resource for the given class. | |||
| * | |||
| * @param clazz Class to get resource for. | |||
| * @param name Name of the string resource. | |||
| * @return String resource for the given class. | |||
| */ | |||
| public String getString(Class clazz, String name) { | |||
| if(clazz == null || name == null) { | |||
| return null; | |||
| @@ -102,13 +102,13 @@ public class ResourceManager { | |||
| return _resources.getString(getKey(clazz, name)); | |||
| } | |||
| /** | |||
| * Get an array of string resources for the given class. | |||
| * | |||
| * @param clazz Class to get resource for. | |||
| * @param name Name of the string resource. | |||
| * @return Array of string resources for the given class. | |||
| */ | |||
| /** | |||
| * Get an array of string resources for the given class. | |||
| * | |||
| * @param clazz Class to get resource for. | |||
| * @param name Name of the string resource. | |||
| * @return Array of string resources for the given class. | |||
| */ | |||
| public String[] getStringArray(Class clazz, String name) { | |||
| if(clazz == null || name == null) { | |||
| return null; | |||
| @@ -137,50 +137,50 @@ public class ResourceManager { | |||
| } | |||
| } | |||
| /** | |||
| * Generate a composit key from the given class and key name. | |||
| * | |||
| * @param clazz Class to find resource for. | |||
| * @param name Name of the resource. | |||
| * @return Composite key. | |||
| */ | |||
| /** | |||
| * Generate a composit key from the given class and key name. | |||
| * | |||
| * @param clazz Class to find resource for. | |||
| * @param name Name of the resource. | |||
| * @return Composite key. | |||
| */ | |||
| private String getKey(Class clazz, String name) { | |||
| return clazz.getName() + "." + name; | |||
| } | |||
| /** | |||
| * Generate a localized message using the given set of arguments to | |||
| /** | |||
| * Generate a localized message using the given set of arguments to | |||
| * format the message with. | |||
| * | |||
| * @param clazz Class to get message resource for. | |||
| * @param name | |||
| * @param arguments | |||
| * @return | |||
| */ | |||
| * | |||
| * @param clazz Class to get message resource for. | |||
| * @param name | |||
| * @param arguments | |||
| * @return | |||
| */ | |||
| public String getMessage(Class clazz, String name, Object[] arguments) { | |||
| String format = getString(clazz, name); | |||
| return MessageFormat.format(format, arguments); | |||
| } | |||
| /** | |||
| * Get the image as an ImageIcon assigned to the given class with the | |||
| /** | |||
| * Get the image as an ImageIcon assigned to the given class with the | |||
| * given key. | |||
| * | |||
| * | |||
| * @param clazz The class to load icon for. | |||
| * @param key The key for looking up the icon. | |||
| * @return Image as an ImageIcon, or null if not found. | |||
| */ | |||
| * @return Image as an ImageIcon, or null if not found. | |||
| */ | |||
| public ImageIcon getImageIcon(Class clazz, String key) { | |||
| return getImageIcon(getString(clazz, key)); | |||
| } | |||
| /** | |||
| * Get the image as an ImageIcon with the given file name. | |||
| /** | |||
| * Get the image as an ImageIcon with the given file name. | |||
| * For example "open.gif". The image is loaded from the resources package. | |||
| * | |||
| * @param fileName Image file to load. | |||
| * @return Image as an ImageIcon, or null if not found. | |||
| */ | |||
| * | |||
| * @param fileName Image file to load. | |||
| * @return Image as an ImageIcon, or null if not found. | |||
| */ | |||
| public ImageIcon getImageIcon(String fileName) { | |||
| if(fileName == null) return null; | |||
| @@ -76,18 +76,18 @@ public class TargetMonitor extends AntModule { | |||
| /** Default text. */ | |||
| private String _defText = null; | |||
| /** | |||
| * Default ctor. | |||
| * | |||
| */ | |||
| /** | |||
| * Default ctor. | |||
| * | |||
| */ | |||
| public TargetMonitor() { | |||
| } | |||
| /** | |||
| * Using the given AppContext, initialize the display. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| /** | |||
| * Using the given AppContext, initialize the display. | |||
| * | |||
| * @param context Application context. | |||
| */ | |||
| public void contextualize(AppContext context) { | |||
| setContext(context); | |||
| context.getEventBus().addMember(EventBus.RESPONDING, new Handler()); | |||
| @@ -103,11 +103,11 @@ public class TargetMonitor extends AntModule { | |||
| setText(_defText); | |||
| } | |||
| /** | |||
| * Set the displayed text. | |||
| * | |||
| * @param text Text to display. | |||
| */ | |||
| /** | |||
| * Set the displayed text. | |||
| * | |||
| * @param text Text to display. | |||
| */ | |||
| private void setText(String text) { | |||
| _text.setText("<html> " + text + "</html>"); | |||
| } | |||
| @@ -68,21 +68,21 @@ public class XMLFileFilter extends FileFilter { | |||
| private String _description = null; | |||
| /** | |||
| * Standard constructor. | |||
| * | |||
| * @param resources Access to text resources. | |||
| */ | |||
| /** | |||
| * Standard constructor. | |||
| * | |||
| * @param resources Access to text resources. | |||
| */ | |||
| public XMLFileFilter(ResourceManager resources) { | |||
| _description = resources.getString(getClass(), "description"); | |||
| } | |||
| /** | |||
| * Accept files that end with ".xml". | |||
| * | |||
| * @param f File to test. | |||
| * @return True if accepted, false otherwise. | |||
| */ | |||
| /** | |||
| * Accept files that end with ".xml". | |||
| * | |||
| * @param f File to test. | |||
| * @return True if accepted, false otherwise. | |||
| */ | |||
| public boolean accept(File f) { | |||
| if(f.isDirectory()) return true; | |||
| @@ -90,11 +90,11 @@ public class XMLFileFilter extends FileFilter { | |||
| return name.endsWith(".xml"); | |||
| } | |||
| /** | |||
| * Human readable description of filter. | |||
| * | |||
| * @return Description. | |||
| */ | |||
| /** | |||
| * Human readable description of filter. | |||
| * | |||
| * @return Description. | |||
| */ | |||
| public String getDescription() { | |||
| return _description; | |||
| } | |||