dion        2004/09/07 21:51:13

  Modified:    
jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/converters
                        DebugGraphicsConverter.java ColorConverter.java
               jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/impl
                        GridBagConstraintBean.java
               jelly/jelly-tags/swing/src/test/org/apache/commons/jelly/demos
                        HomepageBuilder.java
               jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
                        GbcTag.java ConstraintTag.java
  Log:
  detab
  
  Revision  Changes    Path
  1.5       +6 -6      
jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/converters/DebugGraphicsConverter.java
  
  Index: DebugGraphicsConverter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/converters/DebugGraphicsConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DebugGraphicsConverter.java       25 Feb 2004 01:31:51 -0000      1.4
  +++ DebugGraphicsConverter.java       8 Sep 2004 04:51:13 -0000       1.5
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -21,9 +21,9 @@
   import org.apache.commons.beanutils.Converter;
   import org.apache.commons.beanutils.ConvertUtils;
   
  -/** 
  +/**
    * A Converter that turns Strings in one of the constants of
  - *   [EMAIL PROTECTED] DebugGraphics} to their appropriate integer constant.
  + *    [EMAIL PROTECTED] DebugGraphics} to their appropriate integer constant.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Paul Libbrecht</a>
    * @version $Revision$
  @@ -32,7 +32,7 @@
   
       private static String usageText =
           "DebugGraphics options are set as a \"|\" separated list of words using one 
of the constants of DebugGraphics: log, flash, or buffered.";
  -        
  +
       public static void register() {
           ConvertUtils.register(
               new DebugGraphicsConverter(),
  
  
  
  1.5       +9 -9      
jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/converters/ColorConverter.java
  
  Index: ColorConverter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/converters/ColorConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ColorConverter.java       25 Feb 2004 01:31:51 -0000      1.4
  +++ ColorConverter.java       8 Sep 2004 04:51:13 -0000       1.5
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -22,14 +22,14 @@
   
   import org.apache.commons.beanutils.Converter;
   
  -/** 
  - * A Converter that turns Strings in the form "#uuuuuu" (as RGB triple) 
  +/**
  + * A Converter that turns Strings in the form "#uuuuuu" (as RGB triple)
    * or the name of one of the [EMAIL PROTECTED] Color}-constants of the class
    * [EMAIL PROTECTED] Color} or [EMAIL PROTECTED] SystemColor}.
  - *   <p>
  - *   TODO: provide support of ARGB colors as well.<br>
  + *    <p>
  + *    TODO: provide support of ARGB colors as well.<br>
    * Future: provide support for color-spaces, indexed colors...
  - *           (in particular theme-based colors)
  + *        (in particular theme-based colors)
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Paul Libbrecht</a>
    * @version $Revision$
  @@ -72,7 +72,7 @@
                           || !Modifier.isFinal(f.getModifiers())
                           || !Modifier.isPublic(f.getModifiers())
                           || !Color.class.isAssignableFrom(f.getType())) {
  -                            
  +
                           throw new IllegalArgumentException(usageText);
                       }
                       return (Color) f.get(SystemColor.class);
  
  
  
  1.9       +33 -33    
jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/impl/GridBagConstraintBean.java
  
  Index: GridBagConstraintBean.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/impl/GridBagConstraintBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GridBagConstraintBean.java        6 Sep 2004 02:55:04 -0000       1.8
  +++ GridBagConstraintBean.java        8 Sep 2004 04:51:13 -0000       1.9
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -22,10 +22,10 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -/** 
  +/**
    * This class is a simple "bean-wrapper" for the [EMAIL PROTECTED] 
GridBagConstraints} class
  - * which also tracks wether values are set allowing inheritance 
  - *   (using [EMAIL PROTECTED] setBasedOn}.
  + * which also tracks wether values are set allowing inheritance
  + *    (using [EMAIL PROTECTED] setBasedOn}.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Paul Libbrecht</a>
    * @version $Revision$
  @@ -42,10 +42,10 @@
       private boolean ipadySet = false;
       private boolean anchorSet = false;
       private boolean fillSet = false;
  -    
  +
       /** Logging output */
       private static final Log LOG = LogFactory.getLog(GridBagConstraintBean.class);
  -    
  +
       /** error message */
       private static final String ILLEGAL_ANCHOR_MSG = "Anchor must be one of  the 
GridBagLayout constants for the current Java version.";
   
  @@ -125,10 +125,10 @@
       }
   
       /** Returns the lower-case variant of the constant-name
  -     *       corresponding to the stored [EMAIL PROTECTED] #anchor} attribute.
  -     *
  -     *       @see    #anchor
  -     */
  +        *    corresponding to the stored [EMAIL PROTECTED] #anchor} attribute.
  +        *
  +        *    @see    #anchor
  +        */
       public String getAnchor() {
           switch (this.anchor) {
               case CENTER :
  @@ -150,7 +150,7 @@
               case NORTHWEST :
                   return "northwest";
           }
  -        
  +
           if (this.anchor == getByReflection("LINE_START"))
               return "line_start";
           else if (this.anchor == getByReflection("LINE_END"))
  @@ -167,16 +167,16 @@
               return "last_line_start";
           else if (this.anchor ==  getByReflection("LAST_LINE_END"))
               return "last_line_end";
  -        
  +
           throw new IllegalArgumentException(ILLEGAL_ANCHOR_MSG);
       }
   
  -    /** Accepts one of the strings with the same name as the constants 
  -     * and sets the [EMAIL PROTECTED] #anchor} value accordingly.
  -     *       The accepted strings are case-insensitive.
  -     *
  -     *       @see #anchor
  -     */
  +    /** Accepts one of the strings with the same name as the constants
  +        * and sets the [EMAIL PROTECTED] #anchor} value accordingly.
  +        *    The accepted strings are case-insensitive.
  +        *
  +        *    @see #anchor
  +        */
       public void setAnchor(String anchorString) {
           String lcAnchorString = anchorString.toLowerCase();
           if (lcAnchorString.equals("center"))
  @@ -219,10 +219,10 @@
       }
   
       /** Returns the lower-case variant of the constant-name
  -     *       corresponding to the stored [EMAIL PROTECTED] #fill} attribute.
  -     *
  -     *       @see    #fill
  -     */
  +        *    corresponding to the stored [EMAIL PROTECTED] #fill} attribute.
  +        *
  +        *    @see    #fill
  +        */
       public String getFill() {
           switch (fill) {
               case NONE :
  @@ -237,12 +237,12 @@
                   throw new IllegalArgumentException("Fill must be the name of one of 
 the GridBagLayoutConstants: NONE, HORIZONTAL, VERTICAL, BOTH.");
           }
       }
  -    /** Accepts one of the strings with the same name as the constants 
  -     * and sets the [EMAIL PROTECTED] #fill} value accordingly.
  -     *       The accepted strings are case-insensitive.
  -     *
  -     *       @see #fill
  -     */
  +    /** Accepts one of the strings with the same name as the constants
  +        * and sets the [EMAIL PROTECTED] #fill} value accordingly.
  +        *    The accepted strings are case-insensitive.
  +        *
  +        *    @see #fill
  +        */
       public void setFill(String fillString) {
           String lcFillString = fillString.toLowerCase();
           if (lcFillString.equals("none"))
  @@ -259,8 +259,8 @@
       }
   
       /** Reads the values in the given grid-bag-constraint-bean that are set and sets
  -     * them in this object if they have not been set yet.
  -     */
  +        * them in this object if they have not been set yet.
  +        */
       public void setBasedOn(GridBagConstraintBean from) {
           if (!gridxSet && from.gridxSet) {
               gridx = from.gridx;
  @@ -330,7 +330,7 @@
               + insets
               + "]";
       }
  -    
  +
       private int getByReflection(String field) {
           try {
               Field f = getClass().getField(field);
  
  
  
  1.5       +118 -118  
jakarta-commons/jelly/jelly-tags/swing/src/test/org/apache/commons/jelly/demos/HomepageBuilder.java
  
  Index: HomepageBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/test/org/apache/commons/jelly/demos/HomepageBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HomepageBuilder.java      7 Sep 2004 02:03:02 -0000       1.4
  +++ HomepageBuilder.java      8 Sep 2004 04:51:13 -0000       1.5
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -46,77 +46,77 @@
   
   /**
    * A sample Swing program that demonstrates the use of Jelly as a templating 
mechanism
  - * 
  + *
    * @author Otto von Wachter
    */
   public class HomepageBuilder extends JPanel {
   
  -     JTextField nameField;
  -     JTextField urlField;
  -     JTextField addField;
  -     JTextField colorField;
  -     JComboBox templateList;
  -     JList interestList;
  -     DefaultListModel listModel;
  -     
  +    JTextField nameField;
  +    JTextField urlField;
  +    JTextField addField;
  +    JTextField colorField;
  +    JComboBox templateList;
  +    JList interestList;
  +    DefaultListModel listModel;
  +
   
       public HomepageBuilder() {
  -     
  -     System.out.println("Starting Homepage Builder");
  -     
  -     JPanel leftPanel = new JPanel();
  -     leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
  -     
  -     leftPanel.add(new JLabel("Name:"));     
  -     
  -     nameField= new JTextField("James Bond");        
  -     leftPanel.add(nameField);
  -     
  -     leftPanel.add(new JLabel("Favorite Color:"));                   
  -        
  +
  +        System.out.println("Starting Homepage Builder");
  +
  +        JPanel leftPanel = new JPanel();
  +        leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
  +
  +        leftPanel.add(new JLabel("Name:"));
  +
  +        nameField= new JTextField("James Bond");
  +        leftPanel.add(nameField);
  +
  +        leftPanel.add(new JLabel("Favorite Color:"));
  +
           colorField = new JTextField("#007007");
  -     leftPanel.add(colorField);
  -        
  -     leftPanel.add(new JLabel("Picture URL:"));              
  -        
  +        leftPanel.add(colorField);
  +
  +        leftPanel.add(new JLabel("Picture URL:"));
  +
           urlField = new 
JTextField("http://www.ianfleming.org/007news/images3/c2002_pierce1.jpg";);
  -     leftPanel.add(urlField);
  +        leftPanel.add(urlField);
  +
  +        leftPanel.add(new JLabel("Choose template:"));
   
  -     leftPanel.add(new JLabel("Choose template:"));                  
  -        
           templateList = new JComboBox(new String[] 
{"template1.jelly","template2.jelly"});
  -     leftPanel.add(templateList);
  -     
  -//           JPanel rightPanel = new JPanel();
  -//           rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
  -     
  -     leftPanel.add(new JLabel("Add a Hobby:"));
  -             
  -             addField = new JTextField();
  -             leftPanel.add(addField);
  -             
  -             JButton addButton = new JButton("Add >>>");
  -             addButton.addActionListener(new ActionListener() {
  -                     public void actionPerformed(ActionEvent e) {
  +        leftPanel.add(templateList);
  +
  +//        JPanel rightPanel = new JPanel();
  +//        rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
  +
  +        leftPanel.add(new JLabel("Add a Hobby:"));
  +
  +        addField = new JTextField();
  +        leftPanel.add(addField);
  +
  +        JButton addButton = new JButton("Add >>>");
  +        addButton.addActionListener(new ActionListener() {
  +            public void actionPerformed(ActionEvent e) {
                   listModel.addElement(addField.getText());
               }
  -             });
  -             leftPanel.add(addButton);
  -     
  -     listModel = new DefaultListModel();
  -     listModel.addElement("Killing bad guys");
  -     listModel.addElement("Wrecking cars");
  -     listModel.addElement("Eating jelly");
  -     interestList = new JList(listModel);
  -                     
  -
  -             JButton submit = new JButton("Build and preview your page!");
  -             submit.addActionListener(new ActionListener() {
  -                     public void actionPerformed(ActionEvent e) {
  +        });
  +        leftPanel.add(addButton);
  +
  +        listModel = new DefaultListModel();
  +        listModel.addElement("Killing bad guys");
  +        listModel.addElement("Wrecking cars");
  +        listModel.addElement("Eating jelly");
  +        interestList = new JList(listModel);
  +
  +
  +        JButton submit = new JButton("Build and preview your page!");
  +        submit.addActionListener(new ActionListener() {
  +            public void actionPerformed(ActionEvent e) {
                   buildPage(templateList.getSelectedItem().toString(),new 
JellyContext());
                   showPage();
               }
  -             });
  +        });
   
           // Layout the demo
           setLayout(new BorderLayout());
  @@ -125,82 +125,82 @@
           add(new JScrollPane(interestList), BorderLayout.EAST);
           setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
       }
  -    
  +
       public void buildPage(String template, JellyContext ctx) {
  -     
  -//           try {
  -//           
  -//           Embedded embedded = new Embedded();
  -//           embedded.setOutputStream(new FileOutputStream("out.html"));
  -//           //embedded.setVariable("some-var","some-object");
  -//           
  -//           
embedded.setScript("file:///anoncvs/jakarta-commons-sandbox/jelly/sample.jelly");
  -//           //or one can do.
  -//           //embedded.setScript(scriptAsInputStream);
  -//           
  -//           boolean bStatus=embedded.execute();
  -//           if(!bStatus) //if error
  -//           {
  -//           System.out.println(embedded.getErrorMsg());
  -//           }
  +
  +//        try {
  +//
  +//        Embedded embedded = new Embedded();
  +//        embedded.setOutputStream(new FileOutputStream("out.html"));
  +//        //embedded.setVariable("some-var","some-object");
  +//
  +//        
embedded.setScript("file:///anoncvs/jakarta-commons-sandbox/jelly/sample.jelly");
  +//        //or one can do.
  +//        //embedded.setScript(scriptAsInputStream);
   //
  -//           } catch (Exception e) {
  -//                   e.printStackTrace();
  -//           }
  -                     
  -
  -     try {
  -             
  -             OutputStream output = new FileOutputStream("demopage.html");
  -                                             
  +//        boolean bStatus=embedded.execute();
  +//        if(!bStatus) //if error
  +//        {
  +//        System.out.println(embedded.getErrorMsg());
  +//        }
  +//
  +//        } catch (Exception e) {
  +//            e.printStackTrace();
  +//        }
  +
  +
  +        try {
  +
  +            OutputStream output = new FileOutputStream("demopage.html");
  +
               JellyContext context = new JellyContext();
               context.setVariable("name",nameField.getText());
               context.setVariable("background",colorField.getText());
               context.setVariable("url",urlField.getText());
  -            
  +
               Vector v = new Vector();
               Enumeration items = listModel.elements();
               while (items.hasMoreElements()) {
  -             v.add(items.nextElement());
  +                v.add(items.nextElement());
               }
               context.setVariable("hobbies", v);
  -    
  -             XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
  -             context.runScript( 
resolveURL("src/test/org/apache/commons/jelly/demos/"+template), xmlOutput );
  +
  +            XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
  +            context.runScript( 
resolveURL("src/test/org/apache/commons/jelly/demos/"+template), xmlOutput );
               xmlOutput.flush();
               System.out.println("Finished merging template");
  -            
  -     } catch (Exception e) {
  -             e.printStackTrace();
  -     }
  -     
  +
  +        } catch (Exception e) {
  +            e.printStackTrace();
  +        }
  +
       }
   
  -     void showPage() {
  -                             
  -             //open new window
  +    void showPage() {
  +
  +        //open new window
           JFrame frame = new JFrame("Your Homepage");
  -             
  -             //add html pane
  -             try {
  -                     
  -               URL url = resolveURL("demopage.html");
  -               JEditorPane htmlPane = new JEditorPane(url);
  -               htmlPane.setEditable(false);
  -               frame.setContentPane(new JScrollPane(htmlPane));
  -               
  -             } catch(Exception ioe) {
  -               System.err.println("Error displaying page");
  -             }
  -             
  +
  +        //add html pane
  +        try {
  +
  +          URL url = resolveURL("demopage.html");
  +          JEditorPane htmlPane = new JEditorPane(url);
  +          htmlPane.setEditable(false);
  +          frame.setContentPane(new JScrollPane(htmlPane));
  +
  +        } catch(Exception ioe) {
  +          System.err.println("Error displaying page");
  +        }
  +
           frame.pack();
  -             frame.setSize(500,500);         
  +        frame.setSize(500,500);
           frame.setVisible(true);
  -             
  -     } 
  -     
  -      /***
  -      * @return the URL for the relative file name or absolute URL 
  +
  +    }
  +
  +     /***
  +      * @return the URL for the relative file name or absolute URL
         */
       protected URL resolveURL(String name) throws MalformedURLException {
            File file = new File(name);
  @@ -217,7 +217,7 @@
           frame.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {System.exit(0);}
           });
  - 
  +
           frame.setContentPane(new HomepageBuilder());
           frame.pack();
           frame.setVisible(true);
  
  
  
  1.14      +18 -18    
jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/GbcTag.java
  
  Index: GbcTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/GbcTag.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- GbcTag.java       7 Sep 2004 06:44:44 -0000       1.13
  +++ GbcTag.java       8 Sep 2004 04:51:13 -0000       1.14
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -28,14 +28,14 @@
   import org.apache.commons.jelly.tags.swing.impl.GridBagConstraintBean;
   import org.apache.commons.lang.StringUtils;
   
  -/** 
  +/**
    * This class represents a [EMAIL PROTECTED] GridBagConstraints} constraints as 
passed in
    * the second argument of [EMAIL PROTECTED] Container#add(Component,Object)}.
    * It supports inheritence between such tags in the following fashion:
    * <ul>
  - *   <li>either using a <code>basedOn</code> attribute which is
  - *           supposed to provide a reference to another [EMAIL PROTECTED] 
GbcTag}.</li>
  - *   <li>either using a parent [EMAIL PROTECTED] GbcTag}.</li>
  + *     <li>either using a <code>basedOn</code> attribute which is
  + *         supposed to provide a reference to another [EMAIL PROTECTED] 
GbcTag}.</li>
  + *     <li>either using a parent [EMAIL PROTECTED] GbcTag}.</li>
    * </ul>
    * The first version takes precedence.
    * A Grid-bag-constraint inherits from another simply by setting other attributes
  @@ -56,15 +56,15 @@
       public GridBagConstraints getConstraints() {
           return (GridBagConstraints) getBean();
       }
  -    
  -    
  +
  +
       // ContainerTag interface
  -    //-------------------------------------------------------------------------     
               
  -    
  +    //-------------------------------------------------------------------------
  +
       /**
        * Adds a child component to this parent
        * @param component the child to add
  -     * @param constraints the constraints to use 
  +     * @param constraints the constraints to use
        * @TODO constraints looks like it's ignored
        */
       public void addChild(Component component, Object constraints) throws 
JellyTagException {
  @@ -74,15 +74,15 @@
           }
           tag.addLayoutComponent(component, getConstraints());
       }
  -    
  +
       // Implementation methods
  -    //-------------------------------------------------------------------------     
               
  -    
  +    //-------------------------------------------------------------------------
  +
       /**
        * A class may be specified otherwise the Factory will be used.
        * @param classObject the object to be converted
        */
  -    protected Class convertToClass(Object classObject) 
  +    protected Class convertToClass(Object classObject)
       throws MissingAttributeException, ClassNotFoundException {
           if (classObject == null) {
               return null;
  @@ -91,7 +91,7 @@
               return super.convertToClass(classObject);
           }
       }
  -    
  +
       /**
        * A class may be specified otherwise the Factory will be used.
        */
  @@ -118,7 +118,7 @@
           if (insetString instanceof String) {
               attributes.remove("insets");
   
  -            
  +
               String[] parts = StringUtils.split((String) insetString, ",");
   
               if (parts.length != 4) {
  
  
  
  1.10      +86 -86    
jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java
  
  Index: ConstraintTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ConstraintTag.java        1 Mar 2004 12:35:18 -0000       1.9
  +++ ConstraintTag.java        8 Sep 2004 04:51:13 -0000       1.10
  @@ -27,76 +27,76 @@
   import org.xml.sax.Attributes;
   
   /** This class represents a layout-manager constraints as passed in
  -     * the second argument of [EMAIL PROTECTED] Container#add(Component,Object)}.
  -     *       <p>
  -     *       In essence, it looks really like nothing else than a bean-class...
  -     *       with [EMAIL PROTECTED] #getConstraintObject}.
  -     *       Probably a shorter java-source is do-able.
  -     *       <p>
  -     *       TODO: this class should probably be extended with special treatment 
for dimensios
  -     *       using the converter package.
  -     */
  +    * the second argument of [EMAIL PROTECTED] Container#add(Component,Object)}.
  +    *    <p>
  +    *    In essence, it looks really like nothing else than a bean-class...
  +    *    with [EMAIL PROTECTED] #getConstraintObject}.
  +    *    Probably a shorter java-source is do-able.
  +    *    <p>
  +    *    TODO: this class should probably be extended with special treatment for 
dimensios
  +    *    using the converter package.
  +    */
   public class ConstraintTag extends DynaBeanTagSupport {
  -     
  -/*   TODO: make a gridbagconstraintTag class which supports an attribute "parent"
  -                                             (or... startWith) which is another 
gridbagconstraintTag whose gridbagconstraint
  -                                             is cloned then attributes are set
  -                                             This tag should also support the 
attributes such as fill=BOTH
  -                                             and anchor=NORTHEAST...
  -                                             Wooops... need to define setters ?? 
let's see if BeanUtils does it on public vars
  -                                             And... have an insets?? A child ?
  -     */
  -
  -     protected Factory factory;      
  -     protected String var = null;
  -     protected Object bean = null;
  -
  -             public static class HereFactory extends BeanFactory implements 
TagFactory {
  -                     public HereFactory(Class c) { super(c); }
  -                     public Tag createTag(String name, Attributes attributes) {
  -                             return new ConstraintTag ( this );
  -                             // still scratching my head about "this" usage...
  -                     }
  -             } // class HereFactory
  -             public static class ConstantFactory implements TagFactory, Factory {
  -                     public ConstantFactory(Object c) { this.constant = c;}
  -                     private Object constant;
  -                     public Object newInstance() { return constant; }
  -                     public Tag createTag(String name, Attributes attributes) 
throws JellyException {
  -                             return new ConstraintTag ( this );
  -                     }
  -             } // class ConstatnStringFactory
  -
  -             // we could be able to make factories that create their tags in 
parametrized
  -             // subclasses of the tag depending on the name and attributes
  -             // it would useful, for example, to make a cardLayout's <card name="">
  -     
  -     
  -     public ConstraintTag (Factory factory) {
  -             this.factory = factory;
  -     }
  -     
  -     protected void createBean ( Factory factory ) throws InstantiationException {
  -             bean = factory.newInstance();
  -     }
  -     
  -     // --------------------------------------------- ATTRIBUTES
  -     
  -     public void beforeSetAttributes (  ) throws JellyTagException {
  -             try {
  +
  +/*    TODO: make a gridbagconstraintTag class which supports an attribute "parent"
  +                        (or... startWith) which is another gridbagconstraintTag 
whose gridbagconstraint
  +                        is cloned then attributes are set
  +                        This tag should also support the attributes such as 
fill=BOTH
  +                        and anchor=NORTHEAST...
  +                        Wooops... need to define setters ?? let's see if BeanUtils 
does it on public vars
  +                        And... have an insets?? A child ?
  +    */
  +
  +    protected Factory factory;
  +    protected String var = null;
  +    protected Object bean = null;
  +
  +        public static class HereFactory extends BeanFactory implements TagFactory {
  +            public HereFactory(Class c) { super(c); }
  +            public Tag createTag(String name, Attributes attributes) {
  +                return new ConstraintTag ( this );
  +                // still scratching my head about "this" usage...
  +            }
  +        } // class HereFactory
  +        public static class ConstantFactory implements TagFactory, Factory {
  +            public ConstantFactory(Object c) { this.constant = c;}
  +            private Object constant;
  +            public Object newInstance() { return constant; }
  +            public Tag createTag(String name, Attributes attributes) throws 
JellyException {
  +                return new ConstraintTag ( this );
  +            }
  +        } // class ConstatnStringFactory
  +
  +        // we could be able to make factories that create their tags in parametrized
  +        // subclasses of the tag depending on the name and attributes
  +        // it would useful, for example, to make a cardLayout's <card name="">
  +
  +
  +    public ConstraintTag (Factory factory) {
  +        this.factory = factory;
  +    }
  +
  +    protected void createBean ( Factory factory ) throws InstantiationException {
  +        bean = factory.newInstance();
  +    }
  +
  +    // --------------------------------------------- ATTRIBUTES
  +
  +    public void beforeSetAttributes (  ) throws JellyTagException {
  +        try {
               createBean(factory);
           } catch (InstantiationException e) {
               throw new JellyTagException(e.toString());
           }
  -     }
  -     
  -     
  -     public void setAttribute ( String name, Object value ) throws 
JellyTagException {
  -             // no real need for DynaBeans or ?
  -             if ( "var".equals(name) ) {
  -                     var = value.toString();
  -             } else {
  -            
  +    }
  +
  +
  +    public void setAttribute ( String name, Object value ) throws JellyTagException 
{
  +        // no real need for DynaBeans or ?
  +        if ( "var".equals(name) ) {
  +            var = value.toString();
  +        } else {
  +
               try {
                 BeanUtils.setProperty( bean, name, value );
               } catch (IllegalAccessException e) {
  @@ -104,26 +104,26 @@
               } catch (InvocationTargetException e) {
                   throw new JellyTagException(e.toString());
               }
  -            
  +
           }
  -     }
  -// --------------------------------------------------        
  -     /** Children invocation... just nothing...
  -             */
  -     public void doTag ( XMLOutput output ) throws JellyTagException {
  -             if ( var != null ) context.setVariable ( var, getBean() );
  -             invokeBody ( output );
  -             // nothing else to do... the getConstraintObject method should have 
been called.
  -     }
  -     
  -     // ----------------------------------------------
  -     public Object getBean() {
  -             return bean;
  -     }
  -     
  -     /** Returns the attached constraint object.
  -             */
  -     public Object getConstraintObject() {
  -             return getBean();
  -     }
  +    }
  +// --------------------------------------------------
  +    /** Children invocation... just nothing...
  +        */
  +    public void doTag ( XMLOutput output ) throws JellyTagException {
  +        if ( var != null ) context.setVariable ( var, getBean() );
  +        invokeBody ( output );
  +        // nothing else to do... the getConstraintObject method should have been 
called.
  +    }
  +
  +    // ----------------------------------------------
  +    public Object getBean() {
  +        return bean;
  +    }
  +
  +    /** Returns the attached constraint object.
  +        */
  +    public Object getConstraintObject() {
  +        return getBean();
  +    }
   } // class ConstraintTag
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to