ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meta...@apache.org
Subject cvs commit: jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/util Collections.java
Date Tue, 17 Apr 2001 00:24:29 GMT
metasim     01/04/16 17:24:29

  Modified:    src/java/org/apache/tools/ant/gui/acs ACSDocumentType.java
                        ACSDtdDefinedElement.java project-ext.dtd
                        project.dtd
               src/java/org/apache/tools/ant/gui/command NewElementCmd.java
                        NewElementDlg.java
               src/java/org/apache/tools/ant/gui/modules/edit
                        DtdAttributePropertyEditor.java
                        ElementNavigator.java
  Added:       src/java/org/apache/tools/ant/gui/acs share.dtd
               src/java/org/apache/tools/ant/gui/modules/edit DragTree.java
                        DragTreeListener.java
               src/java/org/apache/tools/ant/gui/util Collections.java
  Log:
  Copied over Nick's latest commit from the old cvs repository to the new.
  
  Revision  Changes    Path
  1.2       +57 -21    jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/ACSDocumentType.java
  
  Index: ACSDocumentType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/ACSDocumentType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ACSDocumentType.java	2001/04/08 23:42:09	1.1
  +++ ACSDocumentType.java	2001/04/17 00:24:26	1.2
  @@ -68,20 +68,36 @@
   /**
    * Reads the ANT DTD and provides information about it.
    *
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
    */
   public class ACSDocumentType extends java.lang.Object {
  +    /** ID for core elements */
  +    public final static int CORE_ELEMENT = 0;
  +    /** ID for optional elements */
  +    public final static int OPTIONAL_ELEMENT = 1;
       /** True if the DTD has been loaded */
       private boolean isInit = false;
  +    /** Hold the core DTD elements */
  +    private HashMap coreElementMap = new HashMap();
  +    /** Hold the optional DTD elements */
  +    private HashMap optionalElementMap = new HashMap();
       /** Hold the DTD elements */
  -    private HashMap elementMap = new HashMap();
  -    /** XML document used to load the DTD */
  -    final static String XMLDOC = 
  +    private HashMap elementMap;
  +    /** First part of the XML document used to load the DTD */
  +    private final static String XMLDOC_1 = 
           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
  -        "<!DOCTYPE project SYSTEM \"file:/project.dtd\">" +
  -        "<project name=\"sample-project\">" + 
  +        "<!DOCTYPE project SYSTEM \"file:/";
  +    /** Second part of the XML document used to load the DTD */
  +    private final static String XMLDOC_2 = 
  +        "\"><project name=\"sample-project\">" + 
           "</project>";
  +    /** DTD which holds the core tasks */
  +    private final static String DTD_1 = "project.dtd";
  +    /** DTD which holds the optional tasks */
  +    private final static String DTD_2 = "project-ext.dtd";
  +    /** DTD which holds the shared elements */
  +    private final static String DTD_SHARE = "share.dtd";
   
       /**
        * Standard ctor.
  @@ -114,13 +130,21 @@
               DtdHandler dtdh = new DtdHandler();
               p.setDTDHandler(dtdh);
   
  -            // Create the default xml file
  -            InputSource xmldoc = new InputSource(
  -                new ByteArrayInputStream(XMLDOC.getBytes()));
  +            String coreDoc = XMLDOC_1 + DTD_1 + XMLDOC_2;
  +            String optionalDoc = XMLDOC_1 + DTD_2 + XMLDOC_2;
               
  -            // Parse the document
  -            p.parse(xmldoc);
  +            // Parse the core task DTD
  +            elementMap = coreElementMap;
  +            InputSource xmldocCore = new InputSource(
  +                new ByteArrayInputStream(coreDoc.getBytes()));
  +            p.parse(xmldocCore);
               
  +            // Parse the core task DTD
  +            elementMap = optionalElementMap;
  +            InputSource xmldocOptional = new InputSource(
  +                new ByteArrayInputStream(optionalDoc.getBytes()));
  +            p.parse(xmldocOptional);
  +            
               isInit = true;
           } catch (Exception e) {
               System.out.println(e);
  @@ -130,10 +154,14 @@
       /**
        * Returns the dtd element.
        *
  +     * @param elementType CORE_ELEMENT or OPTIONAL_ELEMENT
        * @param name the element name
        */
  -    public DtdElement findElement(String name) {
  -        return (DtdElement) elementMap.get(name);
  +    public DtdElement findElement(int elementType, String name) {
  +        if (elementType == OPTIONAL_ELEMENT) {
  +            return (DtdElement) optionalElementMap.get(name);
  +        }
  +        return (DtdElement) coreElementMap.get(name);
       }
       
       /**
  @@ -247,7 +275,7 @@
               Iterator i = values().iterator();
               while(i.hasNext()) {
                   DtdAttribute a = (DtdAttribute)i.next();
  -                if (a.isRequired()) {
  +                if (!a.isRequired()) {
                       list.add(a.getName());
                   }
               }
  @@ -264,7 +292,7 @@
               Iterator i = values().iterator();
               while(i.hasNext()) {
                   DtdAttribute a = (DtdAttribute)i.next();
  -                if (!a.isRequired()) {
  +                if (a.isRequired()) {
                       list.add(a.getName());
                   }
               }
  @@ -438,22 +466,30 @@
               String systemId)
               throws SAXException, IOException {
                   
  -            final String PROJECT = "project.dtd";
  -            final String PROJECTEXT = "project-ext.dtd";
               InputStream result = null;
               
               // Is it the project.dtd?
  -            if (systemId.indexOf(PROJECT) != -1) {
  +            if (systemId.indexOf(DTD_1) != -1) {
                   try {
                       // Look for it as a resource
  -                    result = getClass().getResourceAsStream(PROJECT);
  +                    result = getClass().getResourceAsStream(DTD_1);
                   } catch (Exception e) {}
               }
               // Is it the project-ext.dtd?
  -            if (systemId.indexOf(PROJECTEXT) != -1) {
  +            if (systemId.indexOf(DTD_2) != -1) {
  +                try {
  +                    // Look for it as a resource
  +                    result = getClass().getResourceAsStream(DTD_2);
  +                } catch (Exception e) {}
  +            }
  +            if (result != null) {
  +                return new InputSource(result);
  +            }
  +            // Is it the share.dtd?
  +            if (systemId.indexOf(DTD_SHARE) != -1) {
                   try {
                       // Look for it as a resource
  -                    result = getClass().getResourceAsStream(PROJECTEXT);
  +                    result = getClass().getResourceAsStream(DTD_SHARE);
                   } catch (Exception e) {}
               }
               if (result != null) {
  
  
  
  1.2       +65 -9     jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java
  
  Index: ACSDtdDefinedElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ACSDtdDefinedElement.java	2001/04/08 23:42:09	1.1
  +++ ACSDtdDefinedElement.java	2001/04/17 00:24:26	1.2
  @@ -53,6 +53,7 @@
    */
   package org.apache.tools.ant.gui.acs;
   import org.apache.tools.ant.gui.command.NewElementCmd;
  +import org.apache.tools.ant.gui.util.Collections;
   import org.w3c.dom.*;
   import java.beans.*;
   import java.util.*;
  @@ -60,7 +61,7 @@
   /**
    * Element defined by the DTD.
    *
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
    */
   public class ACSDtdDefinedElement extends ACSTreeNodeElement
  @@ -96,6 +97,44 @@
           return getTagName();
       }
   
  +	/** 
  +	 * Get the display name of this.
  +	 * 
  +	 * @return Display name.
  +	 */
  +    public String getDisplayName() {
  +        String name = getTagName();
  +
  +        // Is there only one attribute?
  +        if (getAttributes().getLength() == 1) {
  +            Node onlyNode = getAttributes().item(0);
  +
  +            // Display the only attribute
  +            name += ": " + onlyNode.getNodeValue();
  +        } else {
  +            
  +            // Display one of these attributes
  +            // if they are present.
  +            final String[] DISPLAY_ATTRIBUTES =
  +            {
  +                "name",
  +                "id",
  +                "property"
  +            };
  +
  +            for(int i = 0; i < DISPLAY_ATTRIBUTES.length; i++) {
  +                Node testNode =
  +                    getAttributes().getNamedItem(DISPLAY_ATTRIBUTES[i]);
  +                if (testNode != null) {
  +                    name += ": " + testNode.getNodeValue();
  +                    break;
  +                }
  +            }
  +        }
  +        
  +        return name;
  +    }
  +    
           /** 
            * Set the task type.
            * 
  @@ -181,12 +220,21 @@
           }
           
           ACSDocumentType.DtdElement e =
  -            docType.findElement(name);
  +            docType.findElement(ACSDocumentType.CORE_ELEMENT, name);
  +        if (e == null) {
  +            e = docType.findElement(ACSDocumentType.OPTIONAL_ELEMENT, name);
  +        }
   
           if (e != null) {
               // Use the content model (all the possible
               // sub-elements) to create the menu.
               String[] temp = e.getContentModel();
  +            
  +            // Sort the items
  +            List list = Collections.fill(null, temp);
  +            java.util.Collections.sort(list);
  +            list.toArray(temp);
  +            
               int size = (temp.length > 5) ? 5 : temp.length;
   
               // The project doesn't need a delete menu
  @@ -222,15 +270,17 @@
       }
       
       /**
  -     * Retuns a string array which contains this elements
  -     * possible children.  It is created from the DTD's
  -     * content model.
  +     * Returns a string array which contains this elements
  +     * possible children.
  +     * 
  +     * @param childType ACSDocumentType.CORE_ELEMENT or
  +     * ACSDocumentType.OPTIONAL_ELEMENT
        */
  -    public String[] getPossibleChildren() {
  +    public String[] getPossibleChildren(int childType) {
           String name = getTagName();
  +        
           ACSDocumentType.DtdElement e =
  -            docType.findElement(name);
  -            
  +            docType.findElement(childType, name);
           if (e != null) {
               return e.getContentModel();
           }
  @@ -266,7 +316,13 @@
           }
   
           String name = getNodeName();
  -        _dtdElement = docType.findElement(name);
  +        
  +        _dtdElement = docType.findElement(ACSDocumentType.CORE_ELEMENT, name);
  +        if (_dtdElement == null) {
  +            _dtdElement = docType.findElement(
  +                ACSDocumentType.OPTIONAL_ELEMENT, name);
  +        }
  +        
           return _dtdElement;
       }
   }
  
  
  
  1.2       +251 -30   jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/project-ext.dtd
  
  Index: project-ext.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/project-ext.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project-ext.dtd	2001/04/08 23:42:09	1.1
  +++ project-ext.dtd	2001/04/17 00:24:26	1.2
  @@ -1,34 +1,255 @@
   <?xml version="1.0" encoding="iso-8859-1"?>
  -
   <!--
  - Copyright (c) 2000 Michel CASABIANCA.  All Rights Reserved.
  -
  - Permission to use, copy, modify, and distribute this software and its
  - documentation for any purpose and without fee or royalty is hereby
  - granted, provided that both the above copyright notice and this
  - permission notice appear in all copies of the software and
  - documentation or portions thereof, including modifications, that you
  - make.
  -
  - THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
  - REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE,
  - BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
  - WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
  - THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
  - THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
  - COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE
  - OR DOCUMENTATION.
  --->
  -
  -<!-- project ext DTD for Ant -->
  -<!-- 2000-04-03 -->
  + The Apache Software License, Version 1.1
   
  -<!ENTITY % ext "| xt">
  + Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights
  + reserved.
   
  -<!ELEMENT xt EMPTY>
  -<!ATTLIST xt
  -          xml CDATA #REQUIRED
  -          xsl CDATA #REQUIRED
  -          out CDATA #REQUIRED>
  -
  -
  + 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", "Ant", 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 apache@apache.org.
  +
  + 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/>.
  +-->
  +<!-- @author Michel CASABIANCA -->
  +<!-- @version $Revision: 1.2 $ -->
  +<!ENTITY % share-file SYSTEM "file:/share.dtd">
  +%share-file;
  +<!ELEMENT target (p4sync | p4label | p4have | p4submit | p4edit | p4change | junit | ddcreator | ejbc | wlrun | wlstop | ejbjar | weblogic | TOPLink | PropertyFile)*>
  +
  +<!-- *********** PERFORCE ************** -->
  +
  +<!ELEMENT p4sync EMPTY>
  +<!ATTLIST p4sync
  +	view CDATA #IMPLIED
  +	label CDATA #IMPLIED
  +	force CDATA #IMPLIED
  +>
  +<!ELEMENT p4change EMPTY>
  +<!ELEMENT p4edit EMPTY>
  +<!ATTLIST p4edit
  +	view CDATA #REQUIRED
  +	change CDATA #IMPLIED
  +>
  +<!ELEMENT p4submit EMPTY>
  +<!ATTLIST p4submit
  +	change CDATA #REQUIRED
  +>
  +<!ELEMENT p4have EMPTY>
  +<!ELEMENT p4label EMPTY>
  +<!ATTLIST p4label
  +	name CDATA #REQUIRED
  +	view CDATA #IMPLIED
  +	desc CDATA #IMPLIED
  +>
  +
  +<!-- *********** JUNIT ************** -->
  +
  +<!ELEMENT junit (jvmarg | batchtest | test | formatter | sysproperty)*>
  +<!ATTLIST junit
  +	printsummary CDATA #IMPLIED
  +	fork CDATA #IMPLIED
  +	haltonerror CDATA #IMPLIED
  +	haltonfailure CDATA #IMPLIED
  +	timeout CDATA #IMPLIED
  +	maxmemory CDATA #IMPLIED
  +	jvm CDATA #IMPLIED
  +	dir CDATA #IMPLIED
  +>
  +<!ELEMENT jvmarg EMPTY>
  +<!ATTLIST jvmarg
  +	value CDATA #REQUIRED
  +>
  +<!ELEMENT sysproperty EMPTY>
  +<!ATTLIST sysproperty
  +	key CDATA #REQUIRED
  +	value CDATA #REQUIRED
  +>
  +<!ELEMENT formatter EMPTY>
  +<!ATTLIST formatter
  +	type CDATA #IMPLIED
  +	classname CDATA #IMPLIED
  +	extension CDATA #REQUIRED
  +	usefile CDATA #IMPLIED
  +>
  +<!ELEMENT test EMPTY>
  +<!ATTLIST test
  +	name CDATA #REQUIRED
  +	fork CDATA #IMPLIED
  +	haltonerror CDATA #IMPLIED
  +	haltonfailure CDATA #IMPLIED
  +	todir CDATA #IMPLIED
  +	outfile CDATA #IMPLIED
  +	if CDATA #IMPLIED
  +	unless CDATA #IMPLIED
  +>
  +<!ELEMENT batchtest EMPTY>
  +<!ATTLIST batchtest
  +	fork CDATA #IMPLIED
  +	haltonerror CDATA #IMPLIED
  +	haltonfailure CDATA #IMPLIED
  +	todir CDATA #IMPLIED
  +	if CDATA #IMPLIED
  +	unless CDATA #IMPLIED
  +>
  +
  +<!-- *********** EJB ************** -->
  +
  +<!ELEMENT ddcreator (include | exclude)*>
  +<!ATTLIST ddcreator
  +	descriptors CDATA #REQUIRED
  +	dest CDATA #REQUIRED
  +	classpath CDATA #IMPLIED
  +>
  +<!ELEMENT ejbc (include | exclude)*>
  +<!ATTLIST ejbc
  +	descriptors CDATA #REQUIRED
  +	manifest CDATA #REQUIRED
  +	dest CDATA #REQUIRED
  +	src CDATA #REQUIRED
  +	classpath CDATA #IMPLIED
  +>
  +<!ELEMENT wlrun (classpath | wlclasspath)*>
  +<!ATTLIST wlrun
  +	beahome CDATA #REQUIRED
  +	home CDATA #REQUIRED
  +	Domain CDATA #REQUIRED
  +	classpath CDATA #IMPLIED
  +	wlclasspath CDATA #IMPLIED
  +	properties CDATA #IMPLIED
  +	name CDATA #IMPLIED
  +	policy CDATA #IMPLIED
  +	username CDATA #IMPLIED
  +	password CDATA #IMPLIED
  +	pkPassword CDATA #IMPLIED
  +	jvmargs CDATA #IMPLIED
  +	args CDATA #IMPLIED
  +>
  +<!ELEMENT wlstop (classpath)*>
  +<!ATTLIST wlstop
  +	beahome CDATA #REQUIRED
  +	classpath CDATA #REQUIRED
  +	user CDATA #REQUIRED
  +	password CDATA #REQUIRED
  +	url CDATA #IMPLIED
  +	delay CDATA #IMPLIED
  +>
  +<!ELEMENT ejbjar (classpath | dtd | support)*>
  +<!ATTLIST ejbjar
  +	descriptordir CDATA #IMPLIED
  +	srcdir CDATA #REQUIRED
  +	destdir CDATA #REQUIRED
  +	basejarname CDATA #IMPLIED
  +	basenameterminator CDATA #IMPLIED
  +	genericjarsuffix CDATA #IMPLIED
  +	classpath CDATA #IMPLIED
  +	latdestdir CDATA #IMPLIED
  +>
  +<!ELEMENT dtd EMPTY>
  +<!ATTLIST dtd
  +	publicId CDATA #REQUIRED
  +	location CDATA #REQUIRED
  +>
  +<!ELEMENT support (include | exclude)*>
  +<!ATTLIST support
  +	dir CDATA #IMPLIED
  +>
  +<!ELEMENT weblogic (classpath | dtd | support)*>
  +<!ATTLIST weblogic
  +	destdir CDATA #IMPLIED
  +	genericjarsuffix CDATA #IMPLIED
  +	suffix CDATA #IMPLIED
  +	wlclasspath CDATA #IMPLIED
  +	keepgeneric CDATA #IMPLIED
  +	compiler CDATA #IMPLIED
  +	rebuild CDATA #IMPLIED
  +	keepgenerated CDATA #IMPLIED
  +	args CDATA #IMPLIED
  +	weblogicdtd CDATA #IMPLIED
  +	wldtd CDATA #IMPLIED
  +	ejbdtd CDATA #IMPLIED
  +	newCMP CDATA #IMPLIED
  +	oldCMP CDATA #IMPLIED
  +>
  +<!ELEMENT TOPLink (classpath | dtd | support)*>
  +<!ATTLIST TOPLink
  +	destdir CDATA #IMPLIED
  +	genericjarsuffix CDATA #IMPLIED
  +	suffix CDATA #IMPLIED
  +	wlclasspath CDATA #IMPLIED
  +	keepgeneric CDATA #IMPLIED
  +	compiler CDATA #IMPLIED
  +	rebuild CDATA #IMPLIED
  +	keepgenerated CDATA #IMPLIED
  +	args CDATA #IMPLIED
  +	weblogicdtd CDATA #IMPLIED
  +	wldtd CDATA #IMPLIED
  +	ejbdtd CDATA #IMPLIED
  +	newCMP CDATA #IMPLIED
  +	oldCMP CDATA #IMPLIED
  +	toplinkdescriptor CDATA #IMPLIED
  +	toplinkdtd CDATA #IMPLIED
  +>
  +<!ELEMENT wlclasspath (pathelement | path | fileset)*>
  +<!ATTLIST wlclasspath
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +>
  +
  +<!-- *********** PERFORCE ************** -->
  +
  +<!ELEMENT PropertyFile (entry)*>
  +<!ATTLIST PropertyFile
  +	file CDATA #REQUIRED
  +	comment CDATA #IMPLIED
  +>
  +<!ELEMENT entry EMPTY>
  +<!ATTLIST entry
  +	key CDATA #REQUIRED
  +	value CDATA #REQUIRED
  +	type CDATA #IMPLIED
  +	operation CDATA #IMPLIED
  +	default CDATA #IMPLIED
  +	pattern CDATA #IMPLIED
  +>
  
  
  
  1.2       +223 -80   jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/project.dtd
  
  Index: project.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/project.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.dtd	2001/04/08 23:42:09	1.1
  +++ project.dtd	2001/04/17 00:24:26	1.2
  @@ -1,80 +1,84 @@
   <?xml version="1.0" encoding="iso-8859-1"?>
   <!--
  - Copyright (c) 2000 Michel CASABIANCA.  All Rights Reserved.
  + The Apache Software License, Version 1.1
   
  - Permission to use, copy, modify, and distribute this software and its
  - documentation for any purpose and without fee or royalty is hereby
  - granted, provided that both the above copyright notice and this
  - permission notice appear in all copies of the software and
  - documentation or portions thereof, including modifications, that you
  - make.
  -
  - THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
  - REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE,
  - BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
  - WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
  - THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
  - THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
  - COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE
  - OR DOCUMENTATION.
  + 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", "Ant", 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 apache@apache.org.
  +
  + 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/>.
   -->
  -<!-- project DTD for Ant -->
  -<!-- 2000-04-03 -->
  -<!ENTITY % ext-file SYSTEM "file:/project-ext.dtd">
  -%ext-file;
   
  -<!ELEMENT project (target | property | path)*>
  -<!ATTLIST project
  -	name CDATA #REQUIRED
  -	default CDATA #REQUIRED
  -	basedir CDATA #REQUIRED
  ->
  -<!ELEMENT target (ant | available | chmod | copy | cvs | delete | deltree | echo | exec | expand | filter | get | gzip | fixcrlf | jar | java | javac | javadoc | keysubst | mkdir | property | rename | replace | rmic | tar | taskdef | tstamp | zip | path | classpath)*>
  +<!-- @author Michel CASABIANCA -->
  +<!-- @version $Revision: 1.2 $ -->
  +
  +<!ENTITY % share-file SYSTEM "file:/share.dtd">
  +%share-file;
  +<!ELEMENT target (ant | antcall | available | chmod | copy | cvs | delete | deltree | echo | exec | expand | fail | filter | get | gzip | fixcrlf | jar | java | javac | javadoc | keysubst |  mail | mkdir | property  | recorder | rename | replace | rmic | tar | taskdef | tstamp | uptodate | zip | path | classpath)*>
   <!ATTLIST target
   	name CDATA #REQUIRED
   	depends CDATA #IMPLIED
   	if CDATA #IMPLIED
  ->
  -<!ELEMENT path (pathelement | path)*>
  -<!ATTLIST path
  -	id CDATA #IMPLIED
  -	refid CDATA #IMPLIED
  ->
  -<!ELEMENT classpath (pathelement | path | fileset)*>
  -<!ATTLIST classpath
  -	id CDATA #IMPLIED
  -	refid CDATA #IMPLIED
  ->
  -<!ELEMENT fileset (include | exclude)*>
  -<!ATTLIST fileset
  -	dir CDATA #IMPLIED
  ->
  -<!ELEMENT exclude EMPTY>
  -<!ATTLIST exclude
  -	name CDATA #REQUIRED
  -	unless CDATA #IMPLIED
  ->
  -<!ELEMENT include EMPTY>
  -<!ATTLIST include
  -	name CDATA #REQUIRED
  ->
  -<!ELEMENT pathelement EMPTY>
  -<!ATTLIST pathelement
  -	location CDATA #IMPLIED
  -	path CDATA #IMPLIED
  ->
  -<!ELEMENT property EMPTY>
  -<!ATTLIST property
  -	name CDATA #IMPLIED
  -	value CDATA #IMPLIED
  -	resource CDATA #IMPLIED
  -	file CDATA #IMPLIED
   >
  -<!ELEMENT ant EMPTY>
  +<!ELEMENT ant (property)*>
   <!ATTLIST ant
   	antfile CDATA #IMPLIED
   	dir CDATA #REQUIRED
   	target CDATA #IMPLIED
  +	output CDATA #IMPLIED
  +>
  +<!ELEMENT antcall (param)*>
  +<!ATTLIST antcall
  +	target CDATA #REQUIRED
  +>
  +<!ELEMENT param EMPTY>
  +<!ATTLIST param
  +	name CDATA #REQUIRED
  +	value CDATA #REQUIRED
   >
   <!ELEMENT available EMPTY>
   <!ATTLIST available
  @@ -83,16 +87,29 @@
   	resource CDATA #REQUIRED
   	file CDATA #REQUIRED
   >
  -<!ELEMENT chmod EMPTY>
  +<!ELEMENT chmod (includes | excludes | patternset | fileset)*>
   <!ATTLIST chmod
  -	src CDATA #REQUIRED
  +	file CDATA #IMPLIED
  +	dir CDATA #IMPLIED
   	perm CDATA #REQUIRED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
  +	defaultexcludes CDATA #IMPLIED
  +	parallel CDATA #IMPLIED
  +	type CDATA #IMPLIED
   >
  -<!ELEMENT copy (fileset)*>
  +<!ELEMENT copy (fileset | mapper)*>
   <!ATTLIST copy
   	file CDATA #IMPLIED
   	todir CDATA #IMPLIED
   	todir CDATA #IMPLIED
  +	preservelastmodified CDATA #IMPLIED
  +	overwrite CDATA #IMPLIED
  +	filtering CDATA #IMPLIED
  +	flatten CDATA #IMPLIED
  +	includeEmptyDirs CDATA #IMPLIED
   >
   <!ELEMENT cvs EMPTY>
   <!ATTLIST cvs
  @@ -101,9 +118,18 @@
   	package CDATA #REQUIRED
   	tag CDATA #IMPLIED
   >
  -<!ELEMENT delete EMPTY>
  +<!ELEMENT delete (fileset)*>
   <!ATTLIST delete
  -	file CDATA #REQUIRED
  +	file CDATA #IMPLIED
  +	dir CDATA #IMPLIED
  +	verbose CDATA #IMPLIED
  +	quiet CDATA #IMPLIED
  +	includeEmptyDirs CDATA #IMPLIED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
  +	defaultexcludes CDATA #IMPLIED
   >
   <!ELEMENT deltree EMPTY>
   <!ATTLIST deltree
  @@ -141,7 +167,8 @@
   	src CDATA #REQUIRED
   	zipfile CDATA #REQUIRED
   >
  -<!ELEMENT fixcrlf EMPTY>
  +<!ELEMENT fail EMPTY>
  +<!ELEMENT fixcrlf (includes | excludes | patternset)*>
   <!ATTLIST fixcrlf
   	srcdir CDATA #REQUIRED
   	destDir CDATA #IMPLIED
  @@ -150,17 +177,34 @@
   	cr CDATA #IMPLIED
   	tab CDATA #IMPLIED
   	eof CDATA #IMPLIED
  +        includesfile CDATA #IMPLIED
  +        excludesfile CDATA #IMPLIED
  +        defaultexcludes CDATA #IMPLIED
  +        tablength CDATA #IMPLIED
   >
  -<!ELEMENT jar EMPTY>
  +<!ELEMENT jar (metainf | include | exclude | patternset | fileset)*>
   <!ATTLIST jar
   	jarfile CDATA #REQUIRED
   	basedir CDATA #REQUIRED
  -	items CDATA #IMPLIED
  -	ignore CDATA #IMPLIED
  +	compress CDATA #IMPLIED
   	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
   	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
   	defaultexcludes CDATA #IMPLIED
   	manifest CDATA #IMPLIED
  +	whenempty CDATA #IMPLIED
  +>
  +<!ELEMENT metainf (include | exclude | patternset)*>
  +<!ATTLIST metainf
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +	dir CDATA #REQUIRED
  +	defaultexcludes CDATA #IMPLIED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
   >
   <!ELEMENT java EMPTY>
   <!ATTLIST java
  @@ -184,7 +228,7 @@
   	deprecation CDATA #IMPLIED
   	filtering CDATA #IMPLIED
   >
  -<!ELEMENT javadoc EMPTY>
  +<!ELEMENT javadoc (link | group | doclet | sourcepath | classpath | bootclasspath)>
   <!ATTLIST javadoc
   	sourcepath CDATA #REQUIRED
   	destdir CDATA #REQUIRED
  @@ -226,6 +270,32 @@
   	charset CDATA #IMPLIED
   	docencoding CDATA #IMPLIED
   >
  +<!ELEMENT link EMPTY>
  +<!ATTLIST link
  +	href CDATA #REQUIRED
  +	offline CDATA #IMPLIED
  +	packagelistLoc CDATA #IMPLIED
  +>
  +<!ELEMENT group EMPTY>
  +<!ATTLIST group
  +	title CDATA #REQUIRED
  +	packages CDATA #REQUIRED
  +>
  +<!ELEMENT doclet (param)*>
  +<!ATTLIST doclet
  +	name CDATA #REQUIRED
  +	path CDATA #REQUIRED
  +>
  +<!ELEMENT sourcepath (pathelement | path | fileset)*>
  +<!ATTLIST sourcepath
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +>
  +<!ELEMENT bootclasspath (pathelement | path | fileset)*>
  +<!ATTLIST bootclasspath
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +>
   <!ELEMENT keysubst EMPTY>
   <!ATTLIST keysubst
   	src CDATA #REQUIRED
  @@ -233,10 +303,35 @@
   	sep CDATA #IMPLIED
   	keys CDATA #REQUIRED
   >
  +<!ELEMENT mail EMPTY>
  +<!ATTLIST mail
  +        from CDATA #REQUIRED
  +        tolist CDATA #REQUIRED
  +        message CDATA #REQUIRED
  +        files CDATA #IMPLIED
  +        mailhost CDATA #IMPLIED
  +        subject CDATA #IMPLIED
  +>
  +<!ELEMENT mapper EMPTY>
  +<!ATTLIST mapper
  +	type CDATA #REQUIRED
  +	from CDATA #REQUIRED
  +	to CDATA #REQUIRED
  +      classname CDATA #IMPLIED
  +      classpath CDATA #IMPLIED
  +      classpathref CDATA #IMPLIED
  +>
   <!ELEMENT mkdir EMPTY>
   <!ATTLIST mkdir
   	dir CDATA #REQUIRED
   >
  +<!ELEMENT recorder EMPTY>
  +<!ATTLIST recorder
  +	name CDATA #REQUIRED
  +	action CDATA #IMPLIED
  +	append CDATA #IMPLIED
  +	loglevel CDATA #IMPLIED
  +>
   <!ELEMENT rename EMPTY>
   <!ATTLIST rename
   	src CDATA #REQUIRED
  @@ -255,7 +350,7 @@
   	classname CDATA #REQUIRED
   	filtering CDATA #IMPLIED
   >
  -<!ELEMENT tar EMPTY>
  +<!ELEMENT tar (includes | excludes | patternset | fileset | tarfileset)*>
   <!ATTLIST tar
   	tarfile CDATA #REQUIRED
   	basedir CDATA #REQUIRED
  @@ -263,13 +358,47 @@
   	excludes CDATA #IMPLIED
   	defaultexcludes CDATA #IMPLIED
   >
  -<!ELEMENT taskdef EMPTY>
  -<!ATTLIST taskdef
  -	name CDATA #REQUIRED
  -	classname CDATA #REQUIRED
  +<!ELEMENT tarfileset (include | exclude | patternset)*>
  +<!ATTLIST tarfileset
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +	dir CDATA #REQUIRED
  +	defaultexcludes CDATA #IMPLIED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
  +	prefix CDATA #IMPLIED
  +	fullpath CDATA #IMPLIED
  +	src CDATA #IMPLIED
  +	mode CDATA #IMPLIED
  +	username CDATA #IMPLIED
  +	groupname CDATA #IMPLIED
  +>
  +<!ELEMENT tstamp (format)*>
  +<!ELEMENT format EMPTY>
  +<!ATTLIST format
  +	property CDATA #REQUIRED
  +	pattern CDATA #REQUIRED
   >
  -<!ELEMENT tstamp EMPTY>
  -<!ELEMENT zip EMPTY>
  +<!ELEMENT uptodate (srcfiles | mapper)*>
  +<!ATTLIST uptodate
  +	property CDATA #REQUIRED
  +	value CDATA #IMPLIED
  +	targetfile CDATA #IMPLIED
  +>
  +<!ELEMENT srcfiles (include | exclude | patternset)*>
  +<!ATTLIST srcfiles
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +	dir CDATA #REQUIRED
  +	defaultexcludes CDATA #IMPLIED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
  +>
  +<!ELEMENT zip (fileset | zipfileset)*>
   <!ATTLIST zip
   	zipfile CDATA #REQUIRED
   	basedir CDATA #REQUIRED
  @@ -278,4 +407,18 @@
   	includes CDATA #IMPLIED
   	excludes CDATA #IMPLIED
   	defaultexcludes CDATA #IMPLIED
  +>
  +<!ELEMENT zipfileset (include | exclude | patternset)*>
  +<!ATTLIST zipfileset
  +	id CDATA #IMPLIED
  +	refid CDATA #IMPLIED
  +	dir CDATA #REQUIRED
  +	defaultexcludes CDATA #IMPLIED
  +	includes CDATA #IMPLIED
  +	includesfile CDATA #IMPLIED
  +	excludes CDATA #IMPLIED
  +	excludesfile CDATA #IMPLIED
  +	prefix CDATA #IMPLIED
  +	fullpath CDATA #IMPLIED
  +	src CDATA #IMPLIED
   >
  
  
  
  1.1                  jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/acs/share.dtd
  
  Index: share.dtd
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  <!--
   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", "Ant", 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 apache@apache.org.
  
   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/>.
  -->
  <!-- @author Michel CASABIANCA -->
  <!-- @version $Revision: 1.1 $ -->
  <!ELEMENT project (target | property | path | taskdef | patternset | fileset)*>
  <!ATTLIST project
  	name CDATA #REQUIRED
  	default CDATA #REQUIRED
  	basedir CDATA #REQUIRED
  >
  <!ELEMENT property EMPTY>
  <!ATTLIST property
  	name CDATA #IMPLIED
  	value CDATA #IMPLIED
  	resource CDATA #IMPLIED
  	file CDATA #IMPLIED
  >
  <!ELEMENT path (pathelement | path)*>
  <!ATTLIST path
  	id CDATA #IMPLIED
  	refid CDATA #IMPLIED
  >
  <!ELEMENT classpath (pathelement | path | fileset)*>
  <!ATTLIST classpath
  	id CDATA #IMPLIED
  	refid CDATA #IMPLIED
  >
  <!ELEMENT fileset (include | exclude | patternset)*>
  <!ATTLIST fileset
  	id CDATA #IMPLIED
  	refid CDATA #IMPLIED
  	dir CDATA #REQUIRED
  	defaultexcludes CDATA #IMPLIED
  	includes CDATA #IMPLIED
  	includesfile CDATA #IMPLIED
  	excludes CDATA #IMPLIED
  	excludesfile CDATA #IMPLIED
  >
  <!ELEMENT patternset (include | exclude)*>
  <!ATTLIST patternset
  	id CDATA #REQUIRED
  	refid CDATA #IMPLIED
  	includes CDATA #IMPLIED
  	includesfile CDATA #IMPLIED
  	excludes CDATA #IMPLIED
  	excludesfile CDATA #IMPLIED
  >
  <!ELEMENT exclude EMPTY>
  <!ATTLIST exclude
  	name CDATA #REQUIRED
  	unless CDATA #IMPLIED
  >
  <!ELEMENT include EMPTY>
  <!ATTLIST include
  	name CDATA #REQUIRED
  >
  <!ELEMENT pathelement EMPTY>
  <!ATTLIST pathelement
  	location CDATA #IMPLIED
  	path CDATA #IMPLIED
  >
  <!ELEMENT taskdef EMPTY>
  <!ATTLIST taskdef
  	name CDATA #REQUIRED
  	classname CDATA #REQUIRED
  >
  
  
  
  1.2       +4 -2      jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/command/NewElementCmd.java
  
  Index: NewElementCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/command/NewElementCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NewElementCmd.java	2001/04/08 23:42:10	1.1
  +++ NewElementCmd.java	2001/04/17 00:24:27	1.2
  @@ -65,7 +65,7 @@
   /**
    * Command for creating a new propertyh.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public class NewElementCmd extends AbstractCommand {
  @@ -124,7 +124,9 @@
               ACSDtdDefinedElement dtde = (ACSDtdDefinedElement) e;
               NewElementDlg dlg = new NewElementDlg(
                   getContext().getParentFrame(), true);
  -            dlg.setList(dtde.getPossibleChildren());
  +            dlg.setLists(
  +                dtde.getPossibleChildren(ACSDocumentType.CORE_ELEMENT),
  +                dtde.getPossibleChildren(ACSDocumentType.OPTIONAL_ELEMENT) );
               dlg.pack();
               WindowUtils.centerWindow(dlg);
               dlg.setTitle("Select the new element type");
  
  
  
  1.2       +86 -6     jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/command/NewElementDlg.java
  
  Index: NewElementDlg.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/command/NewElementDlg.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NewElementDlg.java	2001/04/08 23:42:11	1.1
  +++ NewElementDlg.java	2001/04/17 00:24:28	1.2
  @@ -54,11 +54,14 @@
   
   package org.apache.tools.ant.gui.command;
   import javax.swing.*;
  +import java.util.List;
  +import java.util.ArrayList;
  +import org.apache.tools.ant.gui.util.Collections;
   
   /**
    * A Dialog which asks for a new xml element's type.
    * 
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
    */
   public class NewElementDlg extends javax.swing.JDialog {
  @@ -67,6 +70,7 @@
       private javax.swing.JPanel _buttonPanel;
       private javax.swing.JButton _buttonOK;
       private javax.swing.JButton _buttonCancel;
  +    private javax.swing.JCheckBox _optionalButton;
       private javax.swing.JPanel _selectPanel;
       private javax.swing.JPanel _panelData;
       private javax.swing.JLabel _label;
  @@ -77,11 +81,17 @@
       private boolean _cancel = true;
       /** holds the element type */
       private String _elementName;
  +    /** list of core tasks */
  +    private List _coreElements;
  +    /** list of optional tasks */
  +    private List _optionalElements;
  +    /** list of tasks to display */
  +    private List _elements;
   
       /**
        * Creates new form NewElementDlg
        */
  -    public NewElementDlg(java.awt.Frame parent,boolean modal) {
  +    public NewElementDlg(java.awt.Frame parent, boolean modal) {
           super(parent, modal);
           initComponents();
           enableButtons();
  @@ -90,12 +100,54 @@
       /**
        * Fills the listbox with the input list.
        */
  -    public void setList(String[] list) {
  -        if (list == null || list.length == 0) {
  +    public void setLists(String[] coreElements, String[] optionalElements) {
  +
  +        // Are there any items to display?
  +        if ( (coreElements == null || coreElements.length == 0) &&
  +             (optionalElements == null || optionalElements.length == 0 ) ) {
  +
  +            // Hide the list
               _listScrollPane.setVisible(false);
  +            _optionalButton.setVisible(false);
           } else {
  -            _elementList.setListData(list);
  +            
  +            // Are there any core elements?
  +            if (coreElements == null) {
  +                _coreElements = new ArrayList();
  +                
  +                // Display the optional elements
  +                _optionalButton.setSelected(true);
  +                _optionalButton.setVisible(false);
  +            } else {
  +                // Create a sorted list of the core elements
  +                List temp = Collections.fill(null, coreElements);
  +                java.util.Collections.sort(temp);
  +                _coreElements = temp;
  +            }
  +            
  +            // Are there any optional elements?
  +            if (optionalElements == null) {
  +                _optionalElements = new ArrayList();
  +                
  +                // Display the core elements
  +                _optionalButton.setSelected(false);
  +                _optionalButton.setVisible(false);
  +            } else {
  +                // Create a sorted list of the optional elements
  +                List temp = Collections.fill(null, optionalElements);
  +                java.util.Collections.sort(temp);
  +                _optionalElements = temp;
  +            }
  +            
  +            // Are the lists the same?
  +            if (_optionalElements.containsAll(_coreElements) &&
  +                _coreElements.containsAll(_optionalElements) ) {
  +                    
  +                // Hide the button
  +                _optionalButton.setVisible(false);
  +            }
           }
  +        enableButtons();
       }
       
       /**
  @@ -116,11 +168,26 @@
        * Enable or disable buttons
        */
       private void enableButtons() {
  +        
  +        // Enable the OK button?
           if (isInputValid()) {
               _buttonOK.setEnabled(true);
           } else {
               _buttonOK.setEnabled(false);
           }
  +
  +        // Display the core or optional elements?
  +        Object oldList = _elements;
  +        if (_optionalButton.isSelected()) {
  +            _elements = _optionalElements;
  +        } else {
  +            _elements = _coreElements;
  +        }
  +
  +        // Did the list change?
  +        if (oldList != _elements) {
  +            _elementList.setListData(_elements.toArray());
  +        }
       }
       
       /**
  @@ -159,6 +226,8 @@
   	    return true;
   	else if (c == '>')
   	    return false;
  +	else if (c >= '0' && c <= '9')
  +	    return true;
   	else if (c == '.' || c == '-' || c == '_' || c == ':')
   	    return true;
   	else
  @@ -193,6 +262,8 @@
           _elementText = new javax.swing.JTextField();
           _listScrollPane = new javax.swing.JScrollPane();
           _elementList = new javax.swing.JList();
  +        _optionalButton = new javax.swing.JCheckBox(
  +            "show optional elements", false);
           getContentPane().setLayout(new java.awt.BorderLayout(10, 10));
           addWindowListener(new java.awt.event.WindowAdapter() {
               public void windowClosing(java.awt.event.WindowEvent evt) {
  @@ -272,7 +343,16 @@
           }
           );
           _listScrollPane.setViewportView(_elementList);
  -        
  +       
  +        _optionalButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
  +        _optionalButton.addActionListener(new java.awt.event.ActionListener() {
  +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  +                enableButtons();
  +            }
  +        }
  +        );
  +
  +        _selectPanel.add(_optionalButton, java.awt.BorderLayout.NORTH);
           _selectPanel.add(_listScrollPane, java.awt.BorderLayout.CENTER);
           getContentPane().add(_selectPanel, java.awt.BorderLayout.CENTER);
           pack();
  
  
  
  1.2       +9 -3      jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/DtdAttributePropertyEditor.java
  
  Index: DtdAttributePropertyEditor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/DtdAttributePropertyEditor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DtdAttributePropertyEditor.java	2001/04/08 23:42:14	1.1
  +++ DtdAttributePropertyEditor.java	2001/04/17 00:24:28	1.2
  @@ -66,7 +66,7 @@
   /**
    * Custom property editor for the DtdAttributes.
    *
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
    */
   public class DtdAttributePropertyEditor extends AbstractPropertyEditor {
  @@ -181,13 +181,14 @@
        */
       private void updateComboBox() {
           _combo.removeAllItems();
  +        ArrayList array = new ArrayList();
   
           // Add the optional attributes
           String[] valueArray = _attributes.getOptionalAttributes();
           if (valueArray != null) {
               for(int i = 0; i < valueArray.length; i++) {
                   if (_attributes.getProperty(valueArray[i]) == null) {
  -                    _combo.addItem(valueArray[i]);
  +                    array.add(valueArray[i]);
                   }
               }
           }
  @@ -197,9 +198,14 @@
           if (valueArray != null) {
               for(int i = 0; i < valueArray.length; i++) {
                   if (_attributes.getProperty(valueArray[i]) == null) {
  -                    _combo.addItem(valueArray[i]);
  +                    array.add(valueArray[i]);
                   }
               }
  +        }
  +        
  +        Collections.sort(array);
  +        for(int i = 0; i < array.size(); i++) {
  +            _combo.addItem(array.get(i));
           }
       }
   
  
  
  
  1.2       +53 -3     jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/ElementNavigator.java
  
  Index: ElementNavigator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/ElementNavigator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementNavigator.java	2001/04/08 23:42:14	1.1
  +++ ElementNavigator.java	2001/04/17 00:24:28	1.2
  @@ -64,17 +64,18 @@
   import java.awt.event.MouseEvent;
   import java.util.EventObject;
   import java.beans.PropertyChangeEvent;
  +import org.w3c.dom.Node;
   
   /**
    * Module for navigating build file elemenets.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public class ElementNavigator extends AntModule {
   
       /** Navigation via a tree widget. */
  -    private JTree _tree = null;
  +    private DragTree _tree = null;
       /** The selection model being used. */
       private ElementTreeSelectionModel _selections = null;
   
  @@ -96,7 +97,8 @@
   
           setLayout(new GridLayout(1,1));
   
  -        _tree = new JTree();
  +        _tree = new DragTree();
  +        _tree.addDragTreeListener(new DragHandler());
           _tree.setModel(null);
           _tree.setCellRenderer(new ElementTreeCellRenderer());
           _tree.addMouseListener(new PopupHandler());
  @@ -278,6 +280,54 @@
           }
           public void mouseClicked(MouseEvent e) {
               handle(e);
  +        }
  +    }
  +    
  +    /** Class for handling drag operation. */
  +    private static class DragHandler implements DragTreeListener {
  +        
  +        /**
  +         * Append the object to the end of the parent's child list.
  +         */
  +        public Object appendChild(Object parent, Object newChild) {
  +            
  +            ACSTreeNodeElement parentNode =
  +                (ACSTreeNodeElement) parent;
  +            ACSTreeNodeElement newChildNode =
  +                (ACSTreeNodeElement) newChild;
  +            ACSTreeNodeElement clone =
  +                (ACSTreeNodeElement) newChildNode.cloneNode(true);
  +            parentNode.appendChild(clone);
  +            return clone;
  +        }
  +
  +        /**
  +         * Append the object to the end of the parent's child list.
  +         */
  +        public Object insertBefore(Object parent, Object index, Object newChild) {
  +            
  +            ACSTreeNodeElement parentNode =
  +                (ACSTreeNodeElement) parent;
  +            ACSTreeNodeElement indexNode =
  +                (ACSTreeNodeElement) index;
  +            ACSTreeNodeElement newChildNode =
  +                (ACSTreeNodeElement) newChild;
  +            ACSTreeNodeElement clone =
  +                (ACSTreeNodeElement) newChildNode.cloneNode(true);
  +            parentNode.insertBefore(clone, indexNode);
  +            return clone;
  +        }
  +    
  +        /**
  +         * Append the object to the end of the parent's child list.
  +         */
  +        public void removeChild(Object child) {
  +            
  +            ACSTreeNodeElement childNode =
  +                (ACSTreeNodeElement) child;
  +            ACSTreeNodeElement parentNode =
  +                (ACSTreeNodeElement) childNode.getParentNode();
  +            parentNode.removeChild(childNode);
           }
       }
   }
  
  
  
  1.1                  jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/DragTree.java
  
  Index: DragTree.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", "Ant", 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 apache@apache.org.
   *
   * 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.modules.edit;
  
  import java.awt.datatransfer.*;
  import java.awt.dnd.*;
  
  import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Point;
  import java.awt.Component;
  import java.awt.Insets;
  import java.awt.Rectangle;
  
  import javax.swing.JComponent;
  import javax.swing.JTree;
  import javax.swing.tree.DefaultTreeCellRenderer;
  import javax.swing.tree.TreePath;
  import javax.swing.JScrollPane;
  
  import java.io.IOException;
  import java.util.TooManyListenersException;
  
  /**
   * A tree which allows reorganization via drop and drag
   *
   * @version $Revision: 1.1 $
   * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
   */
  public class DragTree extends JTree implements DragSourceListener, 
      DragGestureListener, DropTargetListener {
          
      /**
       * The <code>DragTreeListener</code> 
       * associated with this <code>DragTree</code>.
       */
      private DragTreeListener _dragTreeListener;
      
      /**
       * Holds the position where the dropped item should be
       * placed.  Possible values are DROP_BEFORE,  DROP_ON
       * or DROP_AFTER.
       */
      private int _dropPosition;
      
      /**
       * The point where the drop line should be drawn.
       */
      private Point _point;
      
      /**
       * The object the drop occured on.
       */
      private Object _dropOn;
      
      /**
       * The path of where the drop occured.
       */
      private TreePath _dropOnPath;
  
      /**
       * The path of the item being dropped.
       */
      private TreePath _droppedPath;
      
      /**
       * The item being dragged should be placed before (or above)
       * the item it is dropped on.
       */
      final static protected int DROP_BEFORE = 0;
      
      /**
       * The item being dragged should be placed on (as a child)
       * the item it is dropped on.
       */
      final static protected int DROP_ON = 1;
      
      /**
       * The item being dragged should be placed on (or after)
       * the item it is dropped on.
       */
      final static protected int DROP_AFTER = 2;
      
      /**
       * Default Constuctor
       */
      public DragTree() {
          
          DragSource dragSource = DragSource.getDefaultDragSource();
  
          // Use the default gesture recognizer
          dragSource.createDefaultDragGestureRecognizer(
             this,
             DnDConstants.ACTION_COPY_OR_MOVE,
             this);
          
          // Setup to be a drop target
          new DropTarget(this,
              DnDConstants.ACTION_COPY_OR_MOVE,
              this);
      }
      
      /**
       * Starts the drag operation.
       * <P>
       * @param e the <code>DragGestureEvent</code> describing 
       * the gesture that has just occurred
       */
      public void dragGestureRecognized(DragGestureEvent e) {
          
          // Find the path for the cursor position.
          Point p = e.getDragOrigin();
          _droppedPath = getPathForLocation(p.x, p.y);
          
          if (_droppedPath == null) {
              return;
          }
          
          // Select the item.
          setSelectionPath(_droppedPath);
          
          // Wrap the object and start the drag.
          Object obj = _droppedPath.getLastPathComponent();
          Wrapper wrapper = new Wrapper(obj);
          e.startDrag(DragSource.DefaultMoveNoDrop, wrapper, this);
      }
  
      // 
      // DragSourceListener methods
      // 
      public void dragDropEnd(DragSourceDropEvent e) {}
      public void dragEnter(DragSourceDragEvent e) {}
      public void dragExit(DragSourceEvent e) {}
      public void dragOver(DragSourceDragEvent e) {}
      public void dropActionChanged(DragSourceDragEvent e) {}    
      
      // 
      // DropTargetListener methods
      // 
      public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e) {}
      public void dragEnter(DropTargetDragEvent e) {
          dragOver(e);
      }
      
      /**
       * Called when a drag operation is ongoing 
       * on the <code>DropTarget</code>.
       * <P>
       * @param dtde the <code>DropTargetDragEvent</code> 
       */
      public void dragOver(DropTargetDragEvent e) {
  
          checkAutoScroll(e.getLocation());
          
          Point p = computeDropLocation(e.getLocation());
  
          // Don't allow a parent to be dropped on one of its children.
          if (_droppedPath.isDescendant(_dropOnPath)) {
              _point = null;
              _dropOn = null;
              p = null;
              e.rejectDrag();
          } else {
              e.acceptDrag(e.getDropAction());
          }
              
          // If the point has changed, repaint the display.
          if (_point == null || !p.equals(_point)) {
              _point = p;
              repaint();
          }
      }    
      
      /**
       * Determines where the item will be dropped.
       */
      private Point computeDropLocation(Point p) {
          
          int rowCount = getRowCount();
          int height = findCellHeight();
          int row = (p.y / height);
          int offset = (p.y % height);
          
          // Move the point to the top of the cell.
          p.y -= offset;
  
          int delta = 0;
          
          //  Is the point at or past the end of the list?
          if (row > (rowCount - 1) ) {
              p.y = (rowCount - 1) * height;
              row = rowCount - 1;
              delta = height;
              _dropPosition = DROP_AFTER;
          }
          //  Is the point at the begining of the list?
          else if (row <= 0) {
              p.y = 0;
              delta = height;
              if (rowCount > 1) {
                  row = 1;
                  _dropPosition = DROP_BEFORE;
              } else {
                  row = 0;
                  _dropPosition = DROP_ON;
              }
          }
          //  The point is in the middle of the tree.
          else {
              // Is the point on the top third of the cell?
              if (offset < height * 0.333) {
                  
                  // Set the line to the top of the cell.
                  delta = 0;
                  _dropPosition = DROP_BEFORE;
              }
              // Is the point on the bottom third of the cell?
              else if (offset > height * 0.666){
                  
                  // Set the line to the bottom of the cell.
                  delta = height;
                  _dropPosition = DROP_AFTER;
              }
              // The point is in the middle of the cell?
              else {
                  
                  // Set the line to the middle of the cell.
                  delta = height / 2;
                  _dropPosition = DROP_ON;
              }
          }
  
          // Find the object to use for the drop.
          _dropOnPath  = getPathForRow(row);
          if (_dropOnPath != null) {
              _dropOn = _dropOnPath.getLastPathComponent();
          } else {
              _dropOn = null;
          }
  
          // Adjust the point used to draw the drop line.
          p.y += delta;
          p.x = 0;
  
          return p;
      }    
      
      /**
       * Process the drop
       *
       * @param e the <code>DropTargetDropEvent</code> 
       * @see DropTargetListener.drop
       */
      public void drop(DropTargetDropEvent e) {
          
          if (_dropOn == null || _dropOnPath == null) {
              return;
          }
  
          // Get the object being transfered.
          Object obj = null;
          Transferable t = e.getTransferable();
          try {
              obj = t.getTransferData(_flavors[0]);
          } catch (Exception exp) {
              System.out.println(exp);
          }
          
          if (obj != null) {
              
              Object droppedObj = obj;
              Object droppedOnObj = _dropOn;
              Object parentObj = getParentOfDroppedOnObject();
  
              if (_dropPosition == DROP_ON) {
                  
                  fireAppendChild(droppedOnObj, droppedObj);
                  setExpandedState(_dropOnPath, true);
              }
              else if (_dropPosition == DROP_BEFORE) {
                  
                  fireInsertBefore(parentObj, droppedOnObj, droppedObj);
              }
              else if (_dropPosition == DROP_AFTER) {
                  
                  // If the cell is exanded, add the new item before our 
                  // first child.
                  if (isExpanded(getRowForPath(_dropOnPath))) {
                      parentObj = droppedOnObj;
                  }
  
                  // Find the next sibling
                  int index = getModel().getIndexOfChild(parentObj, droppedOnObj);
                  int count = getModel().getChildCount(parentObj);
                  
                  if (index == count-1) {
                      fireAppendChild(parentObj, droppedObj);
                  } else {
                      Object sibling = getModel().getChild(parentObj, index+1);
                      fireInsertBefore(parentObj, sibling, droppedObj);
                  }
              }
  
              if (e.getDropAction() == DnDConstants.ACTION_MOVE) {
                  fireRemoveChild(droppedObj);
              }
  
              this.updateUI();
          }
      }
  
      /**
       * Returns the parent of the dropped on object.
       */
      private Object getParentOfDroppedOnObject() {
          int count = _dropOnPath.getPathCount();
          return _dropOnPath.getPathComponent(count-2);
      }
              
      /**
       * Repaint the display to cleanup any lines.
       */
      public void dragExit(DropTargetEvent e) {
          _point = null;
          repaint();
      }
      
      /**
       * Draws the line which shows where the dropped
       * item will land.
       *
       * @see #JComponent.paintComponent
       */
      public void paintComponent(Graphics g){
          super.paintComponent(g);
          
          if (_point != null) {
              
              if (_dropPosition == DROP_ON) {
                  // If the drop is on another item, draw
                  // two short lines.
                  g.drawLine(0, _point.y, 10, _point.y);
                  g.drawLine(getWidth()-10, _point.y, getWidth(), _point.y);
              } else {
                  // If the drop is above or below an item, draw
                  // one long line.
                  g.drawLine(0, _point.y, getWidth(), _point.y);
              }
          }
      }
      
      /**
       * Wrapper holds the object to transfer
       */
      protected class Wrapper implements Transferable {
  
          /** The object to transfer */
          private Object _obj;
          
          /**
           * Creates a wrapper for the input object.
           *
           * @param obj object to wrap
           */
          public Wrapper(Object obj) {
              _obj = obj;
          }
          
          /**
           * Return out object if the DataFlavor is correct.
           *
           * @param flavor only javaJVMLocalObjectMimeType is supported
           */
          public Object getTransferData(DataFlavor flavor)
              throws UnsupportedFlavorException, IOException {
              if (isDataFlavorSupported(flavor)) {
                  return _obj;
              }
              throw new UnsupportedFlavorException(flavor);
          }
          
          /**
           * Return true if the input flavor is support.
           *
           * @param flavor DataFlavor to test
           */
          public boolean isDataFlavorSupported(DataFlavor flavor) {
  	    return flavor.equals(_flavors[0]);
          }
          
          /**
           * Return true if the input flavor is support.
           *
           * @param flavor DataFlavor to test
           */
          public DataFlavor[] getTransferDataFlavors() {
              return _flavors;
          }
      }
  
      /**
       * DataFlavors which are support for transfer
       */
      private static final DataFlavor[] _flavors = {
          createConstant(DataFlavor.javaJVMLocalObjectMimeType)
      };
  
      /**
       * Returns a new DataFlavor or null
       *
       * @param flavor the flavor 
       */
      static private DataFlavor createConstant(String flavor) {
          try {
              return new DataFlavor(flavor);
          } catch (Exception e) {
              return null;
          }
      }
      
      /**
       * Returns the cell height for the tree.
       */
      protected int findCellHeight() {
          DefaultTreeCellRenderer renderer =
              (DefaultTreeCellRenderer) getCellRenderer();
          return renderer.getPreferredSize().height;
      }
      
      /**
       * Register a new <code>DragTreeListener</code>.
       * <P>
       * @param dtl the <code>DragTreeListener</code> to register 
       * with this <code>DragTree</code>.
       */
      public synchronized void addDragTreeListener(DragTreeListener dtl) {
          _dragTreeListener = dtl;
      }
  
      /**
       * unregister the current DragTreeListener
       * <P>
       * @param dtl the <code>DragTreeListener</code> to unregister 
       * <P>
       * @throws <code>IllegalArgumentException</code> if 
       * dtl is not (equal to) the currently registered
       * <code>DragTreeListener</code>.
       */
      public synchronized void removeDragTreeListener(DragTreeListener dtl) {
  	if (_dragTreeListener == null || !_dragTreeListener.equals(dtl))
  	    throw new IllegalArgumentException();
  	else {
  	    _dragTreeListener = null;
  	}
      }
  
      /**
       * Notify the DragTreeListener that an <code>appendChild</code> has
       * been requested.
       */
      protected synchronized Object fireAppendChild(Object parent,
              Object newChild) {
                  
  	if (_dragTreeListener != null) {
  	    return _dragTreeListener.appendChild(parent, newChild);
  	}
          return null;
      }
      
      /**
       * Notify the DragTreeListener that an <code>insertBefore</code> has
       * been requested.
       */
      protected synchronized Object fireInsertBefore(Object parent, Object index,
              Object newChild) {
                  
  	if (_dragTreeListener != null) {
  	    return _dragTreeListener.insertBefore(parent, index, newChild);
  	}
          return null;
      }
      
      /**
       * Notify the DragTreeListener that an <code>removeChild</code> has
       * been requested.
       */
      protected synchronized void fireRemoveChild(Object child) {
                  
  	if (_dragTreeListener != null) {
  	    _dragTreeListener.removeChild(child);
  	}
      }
  
      /**
       * Scrolls tree if nessasary
       * <P>
       * @param p A <code>Point</code> indicating the 
       * location of the cursor that triggered this operation.
       */
      protected void checkAutoScroll(Point p) {
          
          Point locn = new Point(p);
          javax.swing.SwingUtilities.convertPointToScreen(locn, this);
          javax.swing.SwingUtilities.convertPointFromScreen(locn, getParent());
          
          Rectangle  outer = new Rectangle();
          Rectangle  inner = new Rectangle();
  
          Insets    i    = new java.awt.Insets(10, 10, 10, 10);
          Dimension size = getParent().getSize();
  
          if (size.width != outer.width || size.height != outer.height)
              outer.setBounds(0, 0, size.width, size.height);
  
          if (inner.x != i.left || inner.y != i.top)
              inner.setLocation(i.left, i.top);
  
          int newWidth  = size.width -  (i.left + i.right);
          int newHeight = size.height - (i.top  + i.bottom);
  
          if (newWidth != inner.width || newHeight != inner.height)
              inner.setSize(newWidth, newHeight);
  
          if (outer.contains(locn) && !inner.contains(locn)) {
              if (locn.y >= inner.height) { 
                  scrollDown();
              } else {
                  scrollUp();
              }
          }
      }
          
      /**
       * Scroll the tree up one cell
       */
      public void scrollUp() {
          Rectangle visibleRect = getVisibleRect();
          int height = findCellHeight();
          visibleRect.y -= height;
          visibleRect.height -= height;
          scrollRectToVisible(visibleRect);
      }
      
      /**
       * Scroll the tree down one cell
       */
      public void scrollDown() {
          Rectangle visibleRect = getVisibleRect();
          int height = findCellHeight();
          visibleRect.y += height;
          visibleRect.height += height;
          scrollRectToVisible(visibleRect);
      }
  }
  
  
  
  1.1                  jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/modules/edit/DragTreeListener.java
  
  Index: DragTreeListener.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", "Ant", 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 apache@apache.org.
   *
   * 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.modules.edit;
  
  import java.util.EventListener;
  
  /**
   * This interface is sourced from a <code>DragTree</code> and is invoked
   * when an object of that (sub)class detects the completion
   * of a drag operation.
   *
   * @version $Revision: 1.1 $
   * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
   */
  public interface DragTreeListener extends EventListener {
  
      /**
       * Append the object to the end of the parent's child list.
       *
       * @param parent parent object
       * @param newChild new child object
       * @return the new object
       */
      public Object appendChild(Object parent, Object newChild);
  
      /**
       * Append the object to the end of the parent's child list.
       *
       * @param parent parent object
       * @param index child object of parent the newChild should be added
       * before.
       * @param newChild new child object
       * @return the new object
       */
      public Object insertBefore(Object parent, Object index, Object newChild);
      
      /**
       * Removes the child object from the parent.
       *
       * @param parent parent object
       * @param child child object
       */
      public void removeChild(Object child);
  }
  
  
  
  1.1                  jakarta-ant-antidote/src/java/org/apache/tools/ant/gui/util/Collections.java
  
  Index: Collections.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", "Ant", 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 apache@apache.org.
   *
   * 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.util;
  import java.util.List;
  import java.util.ArrayList;
  
  /**
   * This class consists exclusively of static methods that operate on or return
   * collections.
   * 
   * @version $Revision: 1.1 $
   * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
   */
  public class Collections {
      /**
       * Fills the input collection with the input array.
       *
       * @param dest the collection to fill, if null an ArrayList will be
       * created and used.
       * @param source source array
       */
      public static List fill(List dest, Object[] source) {
          if (dest == null) {
              dest = new ArrayList(source.length);
          }
          for(int i = 0; i < source.length; i++) {
              dest.add(source[i]);
          }
          return dest;
      }
  }
  
  
  

Mime
View raw message