Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config
In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/gui/src/com/babeldoc/gui/config
Modified Files:
BooleanConfigOptionComponent.java ConfigOptionComponent.java
ConfigOptionComponentFactory.java ConfigOptionPanel.java
DirectoryConfigOptionComponent.java
FilenameConfigOptionComponent.java
MultiLineConfigOptionComponent.java
StringConfigOptionComponent.java
ValueListConfigOptionComponent.java
Added Files:
ConfigOptionActionListener.java ConfigOptionFocusListener.java
ConfigOptionListenerBase.java
Removed Files:
ConfigOptionActionHandler.java
Log Message:
Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm.
--- NEW FILE: ConfigOptionActionListener.java ---
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import javax.swing.*;
import java.awt.event.ActionListener;
/**
*
*/
public abstract class ConfigOptionActionListener
extends ConfigOptionListenerBase
implements ActionListener {
ConfigOptionActionListener(JComponent component, ConfigOption option) {
super(component, option);
}
}
--- NEW FILE: ConfigOptionFocusListener.java ---
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import javax.swing.*;
import java.awt.event.FocusListener;
/**
* Base class for focus listener
*/
public abstract class ConfigOptionFocusListener
extends ConfigOptionListenerBase
implements FocusListener{
public ConfigOptionFocusListener(JComponent component, ConfigOption option) {
super(component, option);
}
}
--- NEW FILE: ConfigOptionListenerBase.java ---
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" 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 ap...@ap....
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* 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/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
* ====================================================================
*
* Babeldoc: The Universal Document Processor
*
* $Header: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionListenerBase.java,v 1.1 2003/06/27 00:14:55 triphop Exp $
* $DateTime$
* $Author: triphop $
*
*/
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
* Very lightweight listener that is used for
*/
public class ConfigOptionListenerBase {
private ConfigOption option;
private JComponent component;
/**
* Creates a new ConfigOptionListenerBase object.
*
* @param component DOCUMENT ME!
* @param option DOCUMENT ME!
*/
public ConfigOptionListenerBase(JComponent component, ConfigOption option) {
this.component = component;
this.option = option;
}
/**
* TODO: DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public JComponent getComponent() {
return component;
}
/**
* TODO: DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public ConfigOption getOption() {
return option;
}
}
Index: BooleanConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/BooleanConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BooleanConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- BooleanConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 70,73 ****
--- 70,74 ----
import java.awt.event.ActionEvent;
+ import java.awt.event.FocusEvent;
import java.util.Map;
***************
*** 118,127 ****
box = new JCheckBox();
box.setToolTipText(getOption().getDescription());
! box.addActionListener(new ConfigOptionActionHandler(box, this.getOption()) {
! public void actionPerformed(ActionEvent e) {
! boolean selected = ((JCheckBox) getComponent()).isSelected();
! getOption().setValue(Boolean.toString(selected));
! }
! });
}
--- 119,131 ----
box = new JCheckBox();
box.setToolTipText(getOption().getDescription());
! box.addFocusListener(new ConfigOptionFocusListener(box, this.getOption()) {
! public void focusGained(FocusEvent e) {
! }
!
! public void focusLost(FocusEvent e) {
! boolean selected = ((JCheckBox) getComponent()).isSelected();
! getOption().setValue(Boolean.toString(selected));
! }
! });
}
Index: ConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- ConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 104,115 ****
/**
- * Get the configuration data for the option. This is abstract as every
- * option can be different.
- *
- * @return
- */
- public abstract Map getConfigurationData();
-
- /**
* Set the focus on this component.
*/
--- 104,107 ----
***************
*** 131,140 ****
/**
! * Display the default value. This should be obtains from the configoption
*/
public abstract void displayConfigValue();
/**
! * display default value. This should be obtains from the configoption
*/
public abstract void displayDefault();
--- 123,132 ----
/**
! * Display the default value. This should be obtained from the configoption
*/
public abstract void displayConfigValue();
/**
! * display default value. This should be obtained from the configoption
*/
public abstract void displayDefault();
Index: ConfigOptionComponentFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionComponentFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConfigOptionComponentFactory.java 11 Jun 2003 23:35:37 -0000 1.4
--- ConfigOptionComponentFactory.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 98,103 ****
} else if (otype instanceof MultiLineConfigOptionType) {
return new MultiLineConfigOptionComponent(option);
! } else if (otype instanceof ComplexConfigOptionType) {
! return new ComplexConfigOptionComponent(option);
} else {
return new StringConfigOptionComponent(option);
--- 98,103 ----
} else if (otype instanceof MultiLineConfigOptionType) {
return new MultiLineConfigOptionComponent(option);
! // } else if (otype instanceof ComplexConfigOptionType) {
! // return new ComplexConfigOptionComponent(option);
} else {
return new StringConfigOptionComponent(option);
Index: ConfigOptionPanel.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionPanel.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConfigOptionPanel.java 12 Jun 2003 05:00:34 -0000 1.6
--- ConfigOptionPanel.java 27 Jun 2003 00:14:55 -0000 1.7
***************
*** 125,129 ****
ConfigOptionComponent configcomp = (ConfigOptionComponent) iterator.next();
! properties.putAll(configcomp.getConfigurationData());
}
--- 125,130 ----
ConfigOptionComponent configcomp = (ConfigOptionComponent) iterator.next();
! // TODO
! //properties.putAll(configcomp.getConfigurationData());
}
Index: DirectoryConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/DirectoryConfigOptionComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DirectoryConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.5
--- DirectoryConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.6
***************
*** 110,114 ****
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionHandler(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
--- 110,114 ----
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionListener(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
Index: FilenameConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/FilenameConfigOptionComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FilenameConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.5
--- FilenameConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.6
***************
*** 111,115 ****
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionHandler(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
--- 111,115 ----
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionListener(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
Index: MultiLineConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/MultiLineConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MultiLineConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- MultiLineConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 69,74 ****
--- 69,76 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import javax.swing.*;
+ import javax.swing.text.JTextComponent;
***************
*** 107,110 ****
--- 109,119 ----
field.setToolTipText(getOption().getDescription());
field.setPreferredSize(new Dimension(1000, 50));
+ field.addFocusListener(new ConfigOptionFocusListener (field, this.getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JTextComponent)getComponent()).getText());
+ }
+ });
}
Index: StringConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/StringConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StringConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- StringConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 69,72 ****
--- 69,73 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import java.util.Map;
***************
*** 125,128 ****
--- 126,136 ----
field.setText(getOption().getDefaultValue());
}
+ field.addFocusListener(new ConfigOptionFocusListener (field, this.getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JTextComponent)getComponent()).getText());
+ }
+ });
field.setToolTipText(getOption().getDescription());
Index: ValueListConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ValueListConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ValueListConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- ValueListConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 70,77 ****
--- 70,79 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import java.util.Map;
import javax.swing.*;
+ import javax.swing.text.JTextComponent;
***************
*** 124,127 ****
--- 126,138 ----
combo.setSelectedItem(getOption().getDefaultValue());
}
+
+ combo.addFocusListener(new ConfigOptionFocusListener(combo, getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JComboBox)getComponent()).getSelectedItem());
+ }
+ });
combo.setToolTipText(getOption().getDescription());
--- ConfigOptionActionHandler.java DELETED ---
|