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. */ | /** The application context. */ | ||||
private AppContext _context = null; | 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 | // Create a dummy border so that the widget will at least have a | ||||
// minimal display in a bean environment. | // minimal display in a bean environment. | ||||
setBorder(BorderFactory.createTitledBorder(getClass().getName())); | 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 | * is available for constructing the class' display. Think of this in | ||||
* a similar manner to Applet.init() or Servlet.init(). It should | * a similar manner to Applet.init() or Servlet.init(). It should | ||||
* immediately call #setContext() with the given parameter. | * 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); | 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) { | protected void setContext(AppContext context) { | ||||
_context = context; | _context = context; | ||||
setBorder(_context == null ? null : | setBorder(_context == null ? null : | ||||
BorderFactory.createTitledBorder(getName())); | BorderFactory.createTitledBorder(getName())); | ||||
} | } | ||||
/** | |||||
* Get the application context. | |||||
* | |||||
* @return Application context. | |||||
*/ | |||||
/** | |||||
* Get the application context. | |||||
* | |||||
* @return Application context. | |||||
*/ | |||||
public AppContext getContext() { | public AppContext getContext() { | ||||
if(_context == null) { | if(_context == null) { | ||||
throw new IllegalStateException( | throw new IllegalStateException( | ||||
@@ -111,11 +111,11 @@ public abstract class AntModule extends JComponent { | |||||
} | } | ||||
return _context; | 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() { | public String getName() { | ||||
return getContext().getResources().getString(getClass(), "name"); | return getContext().getResources().getString(getClass(), "name"); | ||||
} | } | ||||
@@ -80,31 +80,31 @@ public class PropertyEditor extends AntModule { | |||||
/** Scroll area containing contents. */ | /** Scroll area containing contents. */ | ||||
private JScrollPane _scroller = null; | 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) { | public void contextualize(AppContext context) { | ||||
setContext(context); | setContext(context); | ||||
context.getEventBus().addMember(EventBus.MONITORING, new Handler()); | context.getEventBus().addMember(EventBus.MONITORING, new Handler()); | ||||
setLayout(new BorderLayout()); | setLayout(new BorderLayout()); | ||||
_container = new JPanel(new BorderLayout()); | _container = new JPanel(new BorderLayout()); | ||||
add(_scroller = new JScrollPane(_container)); | 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) { | private void updateDisplay(ACSElement[] items) { | ||||
if(_customizer != null) { | if(_customizer != null) { | ||||
_container.remove((Component)_customizer); | _container.remove((Component)_customizer); | ||||
@@ -70,30 +70,30 @@ public class ResourceManager { | |||||
/** Resources to reference. */ | /** Resources to reference. */ | ||||
private ResourceBundle _resources = null; | private ResourceBundle _resources = null; | ||||
/** | |||||
* Default ctor. Uses the default properties file for antidote. | |||||
* | |||||
*/ | |||||
/** | |||||
* Default ctor. Uses the default properties file for antidote. | |||||
* | |||||
*/ | |||||
public ResourceManager() { | public ResourceManager() { | ||||
this("org.apache.tools.ant.gui.resources.antidote"); | 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) { | public ResourceManager(String propName) { | ||||
_resources = ResourceBundle.getBundle(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) { | public String getString(Class clazz, String name) { | ||||
if(clazz == null || name == null) { | if(clazz == null || name == null) { | ||||
return null; | return null; | ||||
@@ -102,13 +102,13 @@ public class ResourceManager { | |||||
return _resources.getString(getKey(clazz, name)); | 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) { | public String[] getStringArray(Class clazz, String name) { | ||||
if(clazz == null || name == null) { | if(clazz == null || name == null) { | ||||
return 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) { | private String getKey(Class clazz, String name) { | ||||
return clazz.getName() + "." + 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. | * 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) { | public String getMessage(Class clazz, String name, Object[] arguments) { | ||||
String format = getString(clazz, name); | String format = getString(clazz, name); | ||||
return MessageFormat.format(format, arguments); | 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. | * given key. | ||||
* | |||||
* | |||||
* @param clazz The class to load icon for. | * @param clazz The class to load icon for. | ||||
* @param key The key for looking up the icon. | * @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) { | public ImageIcon getImageIcon(Class clazz, String key) { | ||||
return getImageIcon(getString(clazz, 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. | * 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) { | public ImageIcon getImageIcon(String fileName) { | ||||
if(fileName == null) return null; | if(fileName == null) return null; | ||||
@@ -76,18 +76,18 @@ public class TargetMonitor extends AntModule { | |||||
/** Default text. */ | /** Default text. */ | ||||
private String _defText = null; | private String _defText = null; | ||||
/** | |||||
* Default ctor. | |||||
* | |||||
*/ | |||||
/** | |||||
* Default ctor. | |||||
* | |||||
*/ | |||||
public TargetMonitor() { | 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) { | public void contextualize(AppContext context) { | ||||
setContext(context); | setContext(context); | ||||
context.getEventBus().addMember(EventBus.RESPONDING, new Handler()); | context.getEventBus().addMember(EventBus.RESPONDING, new Handler()); | ||||
@@ -103,11 +103,11 @@ public class TargetMonitor extends AntModule { | |||||
setText(_defText); | 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) { | private void setText(String text) { | ||||
_text.setText("<html> " + text + "</html>"); | _text.setText("<html> " + text + "</html>"); | ||||
} | } | ||||
@@ -68,21 +68,21 @@ public class XMLFileFilter extends FileFilter { | |||||
private String _description = null; | private String _description = null; | ||||
/** | |||||
* Standard constructor. | |||||
* | |||||
* @param resources Access to text resources. | |||||
*/ | |||||
/** | |||||
* Standard constructor. | |||||
* | |||||
* @param resources Access to text resources. | |||||
*/ | |||||
public XMLFileFilter(ResourceManager resources) { | public XMLFileFilter(ResourceManager resources) { | ||||
_description = resources.getString(getClass(), "description"); | _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) { | public boolean accept(File f) { | ||||
if(f.isDirectory()) return true; | if(f.isDirectory()) return true; | ||||
@@ -90,11 +90,11 @@ public class XMLFileFilter extends FileFilter { | |||||
return name.endsWith(".xml"); | return name.endsWith(".xml"); | ||||
} | } | ||||
/** | |||||
* Human readable description of filter. | |||||
* | |||||
* @return Description. | |||||
*/ | |||||
/** | |||||
* Human readable description of filter. | |||||
* | |||||
* @return Description. | |||||
*/ | |||||
public String getDescription() { | public String getDescription() { | ||||
return _description; | return _description; | ||||
} | } | ||||