jsalvata    2004/01/08 14:45:07

  Modified:    src/core/org/apache/jmeter/resources Tag:
                        testbeans_experimental_branch
                        messages_no.properties messages.properties
                        messages_ja.properties messages_de.properties
               src/core/org/apache/jmeter/testbeans/gui Tag:
                        testbeans_experimental_branch WrapperEditor.java
  Log:
  Did a couple of TODOs and some code improvement. All minor.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.63.2.2  +2 -0      
jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_no.properties
  
  Index: messages_no.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_no.properties,v
  retrieving revision 1.63.2.1
  retrieving revision 1.63.2.2
  diff -u -r1.63.2.1 -r1.63.2.2
  --- messages_no.properties    7 Jan 2004 19:03:08 -0000       1.63.2.1
  +++ messages_no.properties    8 Jan 2004 22:45:07 -0000       1.63.2.2
  @@ -282,6 +282,8 @@
   property_tool_tip={0}: {1}
   property_default_param=Default value
   property_name_param=Name of property
  +property_edit=Edit
  +property_undefined=Undefined
   protocol_java_border=Java class
   protocol_java_classname=Classname:
   protocol_java_config_tile=Configure Java Sample
  
  
  
  1.80.2.2  +2 -0      
jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties,v
  retrieving revision 1.80.2.1
  retrieving revision 1.80.2.2
  diff -u -r1.80.2.1 -r1.80.2.2
  --- messages.properties       7 Jan 2004 18:20:19 -0000       1.80.2.1
  +++ messages.properties       8 Jan 2004 22:45:07 -0000       1.80.2.2
  @@ -282,6 +282,8 @@
   property_tool_tip={0}: {1}
   property_default_param=Default value
   property_name_param=Name of property
  +property_edit=Edit
  +property_undefined=Undefined
   protocol_java_border=Java class
   protocol_java_classname=Classname:
   protocol_java_config_tile=Configure Java Sample
  
  
  
  1.64.2.2  +2 -0      
jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_ja.properties
  
  Index: messages_ja.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_ja.properties,v
  retrieving revision 1.64.2.1
  retrieving revision 1.64.2.2
  diff -u -r1.64.2.1 -r1.64.2.2
  --- messages_ja.properties    7 Jan 2004 19:03:08 -0000       1.64.2.1
  +++ messages_ja.properties    8 Jan 2004 22:45:07 -0000       1.64.2.2
  @@ -282,6 +282,8 @@
   property_tool_tip={0}: {1}
   property_default_param=Default value
   property_name_param=\u30d7\u30ed\u30d1\u30c6\u30a3\u540d
  +property_edit=Edit
  +property_undefined=Undefined
   protocol_java_border=Java \u30af\u30e9\u30b9
   protocol_java_classname=\u30af\u30e9\u30b9\u540d:
   protocol_java_config_tile=Java \u30b5\u30f3\u30d7\u30eb\u306e\u8a2d\u5b9a
  
  
  
  1.67.2.2  +2 -0      
jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_de.properties
  
  Index: messages_de.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_de.properties,v
  retrieving revision 1.67.2.1
  retrieving revision 1.67.2.2
  diff -u -r1.67.2.1 -r1.67.2.2
  --- messages_de.properties    7 Jan 2004 19:03:08 -0000       1.67.2.1
  +++ messages_de.properties    8 Jan 2004 22:45:07 -0000       1.67.2.2
  @@ -282,6 +282,8 @@
   property_tool_tip={0}: {1}
   property_default_param=Default value
   property_name_param=Name of property
  +property_edit=Edit
  +property_undefined=Undefined
   protocol_java_border=Java class
   protocol_java_classname=Classname:
   protocol_java_config_tile=Configure Java Sample
  
  
  
  No                   revision
  No                   revision
  1.1.2.11  +23 -24    
jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/WrapperEditor.java
  
  Index: WrapperEditor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/WrapperEditor.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- WrapperEditor.java        8 Jan 2004 22:22:14 -0000       1.1.2.10
  +++ WrapperEditor.java        8 Jan 2004 22:45:07 -0000       1.1.2.11
  @@ -67,12 +67,12 @@
   import java.beans.PropertyEditorManager;
   import java.beans.PropertyEditorSupport;
   import java.util.Arrays;
  -import java.util.LinkedList;
   import java.util.Vector;
   
   import javax.swing.JComboBox;
   import javax.swing.text.JTextComponent;
   
  +import org.apache.jmeter.util.JMeterUtils;
   import org.apache.jorphan.logging.LoggingManager;
   import org.apache.log.Logger;
   
  @@ -98,8 +98,10 @@
   {
       private static Logger log= LoggingManager.getLoggerForClass();
   
  -    private static Object UNDEFINED= new UniqueObject("Undefined"); //TODO: should 
be a resource
  -    private static Object EDIT= new UniqueObject("Edit");//TODO: this should be a 
resource
  +    private static Object UNDEFINED=
  +     new UniqueObject(JMeterUtils.getResString("property_undefined"));
  +    private static Object EDIT=
  +     new UniqueObject(JMeterUtils.getResString("property_edit"));
   
        /**
         * Base PropertyEditor for the property at hand. Most methods in this class
  @@ -115,10 +117,9 @@
        private Class type;
        
        /**
  -      * The list of options to be offered by this editor in adition to those
  -      * defined in the wrapped editor.
  +      * The list of options to be offered by this editor.
         */
  -     private String[] additionalTags;
  +     private String[] tags;
   
        /**
         * True iif the editor should not accept (nor produce) a null value.
  @@ -190,7 +191,15 @@
       {
                this.editor= editor;
                this.type= type;
  -             this.additionalTags= additionalTags;
  +             String[] editorTags= editor.getTags();
  +             if (editorTags == null) this.tags= additionalTags;
  +             else if (additionalTags == null) this.tags= editorTags;
  +             else {
  +                     this.tags= new String[editorTags.length+additionalTags.length];
  +                     int j= 0;
  +                     for (int i=0; i<editorTags.length; i++) this.tags[j++]= 
editorTags[i];
  +                     for (int i=0; i<additionalTags.length; i++) this.tags[j++]= 
additionalTags[i];
  +             }
                this.noUndefined= noUndefined;
                this.noEdit= noEdit;
                this.defaultValue= defaultValue;
  @@ -207,7 +216,7 @@
                {
                        options.addAll(Arrays.asList(tags));
                }
  -            
  +
                // The last option is to edit a value manually:
                if (! noEdit) options.add(EDIT);
                
  @@ -233,16 +242,7 @@
        */
       public String[] getTags()
       {
  -        String[] tags= editor.getTags();
  -             
  -             if (tags == null) return additionalTags;
  -             else if (additionalTags == null) return tags;
  -             else {
  -                     LinkedList l= new LinkedList();
  -                     l.addAll(Arrays.asList(tags));
  -                     l.addAll(Arrays.asList(additionalTags));
  -                     return (String[])l.toArray(new String[0]);
  -             }
  +     return tags;
       }
   
       /**
  @@ -270,11 +270,9 @@
                                }
                                catch (IllegalArgumentException e)
                                {
  -                                     // TODO: how to warn the user?
  -                                     // Maybe we should do this check earlier in 
the edit
  -                                     // process, maybe upon ItemChangeEvents?
  -                                     // URGENT: this can return null on noUndefined 
editors!!!!
  -                                     value= null;
  +                                     // This should never happen, since we've 
assessed
  +                                     // value validity in the itemStateChanged 
event handler. 
  +                                     throw new Error(e);
                                }
                        }
                }
  @@ -501,6 +499,7 @@
                        else if (! isValidValue((String)e.getItem()))
                        {
                                // TODO: warn the user. Maybe with a pop-up? A bell?
  +
                                // Revert to the previously unselected (presumed 
valid!) value:
                                combo.setSelectedItem(lastValidValue);
                                if (combo.getSelectedIndex() >= 0) 
combo.setEditable(false);
  
  
  

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

Reply via email to