metasim 00/12/18 19:50:13
Modified: src/antidote/docs design-overview.html
src/antidote/org/apache/tools/ant/gui Antidote.java
Console.java ProjectNavigator.java
PropertyEditor.java TargetMonitor.java
src/antidote/org/apache/tools/ant/gui/resources
antidote.properties
Added: src/antidote/org/apache/tools/ant/gui AntModule.java
Removed: src/antidote/org/apache/tools/ant/gui AntEditor.java
SourceEditor.java
Log:
Changed "AntEditor" to "AntModule", and made construct more JavaBean
compliant (primarily a default ctor). Now has "contextualize()" method
that modules must implement.
Revision Changes Path
1.3 +3 -3 jakarta-ant/src/antidote/docs/design-overview.html
Index: design-overview.html
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/docs/design-overview.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- design-overview.html 2000/12/14 00:28:16 1.2
+++ design-overview.html 2000/12/19 03:50:07 1.3
@@ -8,7 +8,7 @@
<H1>Antidote Design Overview</H1>
- <P>Version 0.1 (2000/11/02)</P>
+ <P>Version 0.2 (2000/12/18)</P>
<P>Authors:
<A HREF="mailto:[EMAIL PROTECTED]">Simeon H.K. Fitch</A>
@@ -39,7 +39,7 @@
communications channel.</P>
<P>To a large extent, the configuration of application modules is
- driven by localized configuration files, allowing new editors or
+ driven by localized configuration files, allowing new modules or
data views to be added, as well as providing multi-language
support.</P>
@@ -53,7 +53,7 @@
+---------------+ +----------------+ +-------------+ +-------------+
| | | | | | | |
- | ActionManager | | EventResponder | | AntEditor | | AntEditor |
+ | ActionManager | | EventResponder | | AntModule | | AntModule |
| | | | |(ProjectNav) | |(SourceEdit) |
+---------------+ +----------------+ +-------------+ +-------------+
| ^ ^ ^
1.5 +19 -22
jakarta-ant/src/antidote/org/apache/tools/ant/gui/Antidote.java
Index: Antidote.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/Antidote.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Antidote.java 2000/11/16 18:32:23 1.4
+++ Antidote.java 2000/12/19 03:50:09 1.5
@@ -62,7 +62,7 @@
* The root class for the Ant GUI. Assembles all the graphical components
* based on the configuration files.
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @author Simeon Fitch
*/
public class Antidote extends JPanel {
@@ -78,10 +78,10 @@
_context = context;
- // Add the various editors/views to the editing area.
+ // Add the various modules to the editing area.
JSplitPane splitter = new JSplitPane();
- splitter.add(JSplitPane.LEFT, populateEditors("left"));
- splitter.add(JSplitPane.RIGHT, populateEditors("right"));
+ splitter.add(JSplitPane.LEFT, populateModules("left"));
+ splitter.add(JSplitPane.RIGHT, populateModules("right"));
// This is necessary because, frankly, the JSplitPane widget
// sucks, and doesn't provide enought (working) control over the
// initial size of it's subcomponents. setDividerLocation(double)
@@ -93,38 +93,35 @@
splitter2.setOneTouchExpandable(true);
splitter2.add(JSplitPane.TOP, splitter);
- splitter2.add(JSplitPane.BOTTOM, populateEditors("bottom"));
+ splitter2.add(JSplitPane.BOTTOM, populateModules("bottom"));
add(BorderLayout.CENTER, splitter2);
splitter2.resetToPreferredSizes();
- add(BorderLayout.NORTH, populateEditors("top"));
+ add(BorderLayout.NORTH, populateModules("top"));
setPreferredSize(new Dimension(640, 600));
}
/**
- * Instantiate the configured editors.
+ * Instantiate the configured modules.
*
- * @return Component containing the editor(s).
+ * @return Component containing the modules(s).
*/
- private JComponent populateEditors(String prefix) {
+ private JComponent populateModules(String prefix) {
String[] classNames = _context.getResources().
- getStringArray(getClass(), prefix + ".editors");
+ getStringArray(getClass(), prefix + ".modules");
- AntEditor[] editors = new AntEditor[classNames.length];
+ AntModule[] modules = new AntModule[classNames.length];
for(int i = 0; i < classNames.length; i++) {
try {
- Class editorType = Class.forName(classNames[i]);
+ Class type = Class.forName(classNames[i]);
- Constructor ctor =
- editorType.getConstructor(AntEditor.CTOR_PARAMS);
-
- editors[i] =
- (AntEditor) ctor.newInstance(new Object[] { _context });
+ modules[i] = (AntModule) type.newInstance();
+ modules[i].contextualize(_context);
}
catch(Exception ex) {
// XXX log me.
@@ -132,14 +129,14 @@
}
}
- if(editors.length == 1) {
- return editors[0];
+ if(modules.length == 1) {
+ return modules[0];
}
- else if(editors.length > 1) {
+ else if(modules.length > 1) {
JTabbedPane tabbed = new JTabbedPane(JTabbedPane.BOTTOM);
- for(int i = 0; i < editors.length; i++) {
- tabbed.addTab(editors[i].getName(), editors[i]);
+ for(int i = 0; i < modules.length; i++) {
+ tabbed.addTab(modules[i].getName(), modules[i]);
}
return tabbed;
}
1.9 +14 -6
jakarta-ant/src/antidote/org/apache/tools/ant/gui/Console.java
Index: Console.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/Console.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Console.java 2000/11/25 04:33:04 1.8
+++ Console.java 2000/12/19 03:50:09 1.9
@@ -65,10 +65,10 @@
/**
* Logging console display.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @author Simeon Fitch
*/
-public class Console extends AntEditor {
+public class Console extends AntModule {
/** Area where messages are printed. */
private JTextPane _text = null;
/** Selection of logging levels. */
@@ -77,12 +77,19 @@
private ConsoleStyleContext _styles = null;
/**
- * Standard ctor.
+ * Default ctor.
+ */
+ public Console() {
+ }
+
+
+ /**
+ * Using the given AppContext, initialize the display.
*
- * @param context Application context;
+ * @param context Application context.
*/
- public Console(AppContext context) {
- super(context);
+ public void contextualize(AppContext context) {
+ setContext(context);
context.getEventBus().addMember(EventBus.MONITORING, new Handler());
setLayout(new BorderLayout());
@@ -105,6 +112,7 @@
add(BorderLayout.NORTH, controls);
}
+
/** Class for handling project events. */
private class Handler implements BusMember {
1.8 +12 -5
jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java
Index: ProjectNavigator.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ProjectNavigator.java 2000/11/28 05:05:09 1.7
+++ ProjectNavigator.java 2000/12/19 03:50:09 1.8
@@ -63,21 +63,28 @@
/**
* AntEditor for displaying the project target in a
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @author Simeon Fitch
*/
-class ProjectNavigator extends AntEditor {
+class ProjectNavigator extends AntModule {
/** Navigation via a tree widget. */
private JTree _tree = null;
/**
- * Standard ctor.
+ * Default ctor.
*
+ */
+ public ProjectNavigator() {
+ }
+
+ /**
+ * Using the given AppContext, initialize the display.
+ *
* @param context Application context.
*/
- public ProjectNavigator(AppContext context) {
- super(context);
+ public void contextualize(AppContext context) {
+ setContext(context);
context.getEventBus().addMember(EventBus.MONITORING, new Handler());
setLayout(new GridLayout(1,1));
1.10 +13 -6
jakarta-ant/src/antidote/org/apache/tools/ant/gui/PropertyEditor.java
Index: PropertyEditor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/PropertyEditor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PropertyEditor.java 2000/11/19 04:21:35 1.9
+++ PropertyEditor.java 2000/12/19 03:50:10 1.10
@@ -68,10 +68,10 @@
/**
* Stub for a property editor.
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
* @author Simeon H.K. Fitch
*/
-class PropertyEditor extends AntEditor {
+public class PropertyEditor extends AntModule {
/** The editor for current bean.*/
private Customizer _customizer = null;
@@ -81,12 +81,19 @@
private JScrollPane _scroller = null;
/**
- * Standard ctor.
+ * Default ctor.
*
- * @param context Application context.
*/
- public PropertyEditor(AppContext context) {
- super(context);
+ public PropertyEditor() {
+ }
+
+ /**
+ * 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());
1.4 +13 -6
jakarta-ant/src/antidote/org/apache/tools/ant/gui/TargetMonitor.java
Index: TargetMonitor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/TargetMonitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TargetMonitor.java 2000/11/28 05:06:35 1.3
+++ TargetMonitor.java 2000/12/19 03:50:10 1.4
@@ -65,10 +65,10 @@
/**
* A widget for displaying the currently selected targets.
*
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @author Simeon Fitch
*/
-public class TargetMonitor extends AntEditor {
+public class TargetMonitor extends AntModule {
/** Place to display selected targets. */
private JLabel _text = null;
@@ -77,12 +77,19 @@
private String _defText = null;
/**
- * Standard ctor.
+ * Default ctor.
*
- * @param context Application context;
*/
- public TargetMonitor(AppContext context) {
- super(context);
+ public TargetMonitor() {
+ }
+
+ /**
+ * 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());
setLayout(new BorderLayout());
1.1
jakarta-ant/src/antidote/org/apache/tools/ant/gui/AntModule.java
Index: AntModule.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.tools.ant.gui;
import javax.swing.JComponent;
import javax.swing.BorderFactory;
/**
* Abstract base class for a "module", which is really anything that
* can send or receive events, or edit or view the model.
*
* @version $Revision: 1.1 $
* @author Simeon Fitch
*/
public abstract class AntModule extends JComponent {
/** The application context. */
private AppContext _context = null;
/**
* 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
* 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.
*/
public abstract void contextualize(AppContext 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.
*/
public AppContext getContext() {
if(_context == null) {
throw new IllegalStateException(
"The AppContext has not been set.");
}
return _context;
}
/**
* Get the name of the editor.
*
* @return Editor's name.
*/
public String getName() {
return getContext().getResources().getString(getClass(), "name");
}
}
1.15 +14 -12
jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties
Index: antidote.properties
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- antidote.properties 2000/11/28 05:05:13 1.14
+++ antidote.properties 2000/12/19 03:50:12 1.15
@@ -1,24 +1,26 @@
# This is the general properties file for the Antidote application.
-# Configure the editors that appear on the right of the UI.
-org.apache.tools.ant.gui.Antidote.right.editors=\
+# The following four module properties configure those properties that
+# should be initialized and displayed by default by the GUI. If more
+# than one module is configured for a property (as indicated providing
+# class names as a comma delimited list), then each module will appear
+# in its own tab in a JTabbedPane.
+
+# Configure the modules that appear on the right of the UI.
+org.apache.tools.ant.gui.Antidote.right.modules=\
org.apache.tools.ant.gui.PropertyEditor
-# org.apache.tools.ant.gui.SourceEditor
-# Configure the editors that appear on the left of the UI.
-org.apache.tools.ant.gui.Antidote.left.editors=\
+# Configure the modules that appear on the left of the UI.
+org.apache.tools.ant.gui.Antidote.left.modules=\
org.apache.tools.ant.gui.ProjectNavigator
-# Configure the editors that appear on the bottom of the UI.
-org.apache.tools.ant.gui.Antidote.bottom.editors=\
+# Configure the modules that appear on the bottom of the UI.
+org.apache.tools.ant.gui.Antidote.bottom.modules=\
org.apache.tools.ant.gui.Console
-# Configure the editors that appear on the top of the UI.
-org.apache.tools.ant.gui.Antidote.top.editors=\
+# Configure the modules that appear on the top of the UI.
+org.apache.tools.ant.gui.Antidote.top.modules=\
org.apache.tools.ant.gui.TargetMonitor
-
-# Set specific class properties.
-org.apache.tools.ant.gui.SourceEditor.name=Source
org.apache.tools.ant.gui.PropertyEditor.name=Properties