ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16510] New: - Custom editors for attributes selected in attribute table
Date Tue, 28 Jan 2003 20:34:07 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16510>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16510

Custom editors for attributes selected in attribute table

           Summary: Custom editors for attributes selected in attribute
                    table
           Product: Ant
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Antidote
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: ccampbell@novell.com


Index: ./src/java/org/apache/tools/ant/gui/acs/ACSFactory.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant-
antidote/src/java/org/apache/tools/ant/gui/acs/ACSFactory.java,v
retrieving revision 1.4
diff -r1.4 ACSFactory.java
85c85
<  * @author Simeon Fitch, Christoph Wilhelms<a 
href="mailto:christoph.wilhelms@t-online.de">christoph.wilhelms@t-online.de</a>
---
>  * @author Simeon Fitch, Christoph Wilhelms<a 
href="mailto:christoph.wilhelms@t-online.de">christoph.wilhelms@t-
online.de</a>, Craig Campbell
187,188c187,188
< //                    info._attributes.put(name, type);  // for debug 
purpose only
<                     info._attributes.put(name, "");
---
>                     info._attributes.put(name, type);  // type is now needed 
for associating attribute name with a custom editor
> //                    info._attributes.put(name, "");
402a403,409
> 
> /*
> Change log:
> 
> 1/28/2003 (CC) -  added the type value to the attributes so that we can 
later use that type
>         to create a customized editor.
> */
Index: ./src/java/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant-
antidote/src/java/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java,v
retrieving revision 1.1
diff -r1.1 FilePropertyEditor.java
70c70
<  * @author Simeon Fitch 
---
>  * @author Simeon Fitch, Craig Campbell
93c93,94
<         JButton b = new JButton("Browse...");
---
>         JButton b = new JButton("...");
>         b.setBorder(BorderFactory.createEtchedBorder());
213a215,222
> 
> /*
> Change log:
> 1/28/2003 (CC) - changed the text on the button from "Browse" to an elipse 
(...) and changed
>         the border around the button to etched to create make it less 
intrusive. As well as
>         made it so there does not have to any translation for this component 
to work outside
>         english speaking countries.
> */
Index: ./src/java/org/apache/tools/ant/gui/modules/edit/AttributePropertyEditor
.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant-
antidote/src/java/org/apache/tools/ant/gui/modules/edit/AttributePropertyEditor
.java,v
retrieving revision 1.1
diff -r1.1 AttributePropertyEditor.java
61,63d60
< import java.awt.event.ActionEvent;
< import java.awt.event.ActionListener;
< 
76a74,76
> import java.beans.PropertyChangeEvent;
> import java.beans.PropertyChangeListener;
> 
77a78
> import org.apache.tools.ant.gui.customizer.DynamicTableCellEditor;
84c85
<  * @author Christoph Wilhelms<a href="mailto:christoph.wilhelms@t-
online.de">Christoph Wilhelms</a>
---
>  * @author Christoph Wilhelms<a href="mailto:christoph.wilhelms@t-
online.de">Christoph Wilhelms</a>, Craig Campbell
176,186c177,197
<         // When the combo box is updated, update the table.
<         /*
<         _combo.addActionListener(new ActionListener() {
<             public void actionPerformed(ActionEvent e) {
<                 JComboBox cb = (JComboBox)e.getSource();
<                 String newSelection = (String)cb.getSelectedItem();
< 
<                 // Should we update the table?
<                 if (newSelection != null && _table.getEditingRow() > 0) {
<                     _table.getModel().setValueAt(newSelection,
<                         _table.getEditingRow(), _table.getEditingColumn() );
---
>         // Set the second column to use a DynamicEditor
>         TableColumn secondCol = _table.getColumnModel().getColumn(1);
>         final DynamicTableCellEditor cellEditor = new DynamicTableCellEditor
();
>         secondCol.setCellEditor(cellEditor);
> 
>         // Listen for property changes to update the cell editor with
>         // registered types for editing.
>         _table.addPropertyChangeListener(new PropertyChangeListener() {
>             public void propertyChange(PropertyChangeEvent e) {
>                 String selection = (String)_table.getModel().getValueAt(
>                                 _table.getSelectedRow(), 0);
> 
>                 if(selection != null && !selection.equals("")) {
> 
>                     Class type = null;
>                     try {
>                         type = _attributes.getType(selection);
>                         cellEditor.register(selection, type);
>                     } catch (ClassNotFoundException exp) {
>                         exp.printStackTrace();
>                     }
190d200
<          */
319c329
<             if(row < _attributes.size()) {
---
>             if(((row < _attributes.size())  && (row < _keys.size())) &&
row 
> -1) {
394a405,415
> 
> /*
> Change log:
> 
> 1/28/2003 (CC) - Added to the second column of the table a dynmaic table 
cell editor.  This
>         editor will examine the type of attribute the user selects and find 
the appropriate
>         editor (StringPropertyEditor, FilePropertyEditor, 
BooleanPropertyEditor...).  Added
>         as well a property listener to catch the changes made in the table 
so the attributes
>         will have editors if they exist.
> 
> */
Index: ./src/java/org/apache/tools/ant/gui/xml/DOMAttributes.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant-
antidote/src/java/org/apache/tools/ant/gui/xml/DOMAttributes.java,v
retrieving revision 1.1
diff -r1.1 DOMAttributes.java
57,58d56
< import java.io.IOException;
< 
60d57
< import java.util.Enumeration;
68c65
<  * @author Christoph Wilhelms<a href="mailto:christoph.wilhelms@t-
online.de">christoph.wilhelms@t-online.de</a>
---
>  * @author Christoph Wilhelms<a href="mailto:christoph.wilhelms@t-
online.de">christoph.wilhelms@t-online.de</a>, Craig Campbell
71a69
>     private Map _mapElements = null;
84c82
<      * @param element provides information about possible attributes.
---
>      * @param elements provides information about possible attributes.
95a94,95
>             
>             _mapElements = elements; // save for searching for type.
114a115,135
>     
>     /**
>      * Allow the searching of type for individual attributes
>      *
>      * @param name attribute name
>      * @return Class - associated type.
>      */
>     public Class getType(String name) throws ClassNotFoundException   {
>         if(name == null)
>             return null;
> 
>         String typeName = (String)_mapElements.get(name);
>         if(typeName.equals("boolean"))
>             return boolean.class;
>         else if(typeName.equals("int"))
>             return double.class;
>         else if(typeName.equals("double"))
>             return int.class;
>         else
>             return Class.forName(typeName);
>     }
115a137,142
> 
> /*
> Change log:
> 1/28/2003 (CC) - added getType method to object to return the type of class 
the
>         attribute is associated with.
> */

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message