1   /*
2    *  Copyright (c) 1998-2001, The University of Sheffield.
3    *
4    *  This file is part of GATE (see http://gate.ac.uk/), and is free
5    *  software, licenced under the GNU Library General Public License,
6    *  Version 2, June 1991 (in the distribution as file licence.html,
7    *  and also available at http://gate.ac.uk/gate/licence.html).
8    *
9    *  Valentin Tablan 03/10/2001
10   *
11   *  $Id: ResourceParametersEditor.java,v 1.28 2002/07/16 11:04:50 valyt Exp $
12   *
13   */
14  
15  package gate.gui;
16  
17  import java.awt.Frame;
18  import java.awt.BorderLayout;
19  import java.awt.Component;
20  import java.awt.Dimension;
21  import java.awt.Insets;
22  import java.awt.Graphics;
23  import java.awt.Window;
24  import java.awt.event.*;
25  import javax.swing.*;
26  import javax.swing.table.*;
27  import javax.swing.tree.*;
28  import javax.swing.event.*;
29  import javax.swing.border.*;
30  
31  import java.util.*;
32  import java.net.URL;
33  import java.io.IOException;
34  import java.text.*;
35  
36  import gate.*;
37  import gate.util.*;
38  import gate.swing.*;
39  import gate.creole.*;
40  import gate.event.*;
41  
42  /**
43   * Allows the editing of a set of parameters for a resource. It needs a pointer
44   * to the resource and a list of the parameter names for the parameters that
45   * should be displayed. The list of the parameters is actually a list of lists
46   * of strings representing parameter disjunctions.
47   */
48  public class ResourceParametersEditor extends XJTable implements CreoleListener{
49  
50    public ResourceParametersEditor(){
51      initLocalData();
52      initGuiComponents();
53      initListeners();
54    }
55  
56    /**
57     * Initialises this GUI component.
58     * @param resource the resource for which the parameters need to be set.
59     * @param paramaters a list of lists of {@link Parameter} representing
60     * parameter disjunctions.
61     */
62    public void init(Resource resource, List parameters){
63      this.resource = resource;
64      if(parameters != null){
65        parameterDisjunctions = new ArrayList(parameters.size());
66        for(int i = 0; i < parameters.size(); i++){
67          parameterDisjunctions.add(
68                              new ParameterDisjunction(resource,
69                                                       (List)parameters.get(i)));
70        }
71      }else{
72        parameterDisjunctions = null;
73      }
74      tableModel.fireTableDataChanged();
75      adjustSizes();
76    }
77  
78    protected void initLocalData(){
79      resource = null;
80      parameterDisjunctions = null;
81    }// protected void initLocalData()
82  
83    protected void initGuiComponents(){
84      setModel(tableModel = new ParametersTableModel());
85  
86      getColumnModel().getColumn(0).
87                       setCellRenderer(new ParameterDisjunctionRenderer());
88  
89      getColumnModel().getColumn(1).
90                       setCellRenderer(new DefaultTableCellRenderer());
91  
92      getColumnModel().getColumn(2).
93                       setCellRenderer(new BooleanRenderer());
94  
95      getColumnModel().getColumn(3).
96                       setCellRenderer(new ParameterValueRenderer());
97  
98  
99      getColumnModel().getColumn(0).
100                      setCellEditor(new ParameterDisjunctionEditor());
101 
102     getColumnModel().getColumn(3).
103                      setCellEditor(new ParameterValueEditor());
104 
105     setIntercellSpacing(new Dimension(5, 5));
106   }// protected void initGuiComponents()
107 
108 
109   protected void initListeners(){
110     Gate.getCreoleRegister().addCreoleListener(this);
111     addKeyListener(new KeyAdapter() {
112       public void keyTyped(KeyEvent e) {
113         if(e.getKeyCode() == e.VK_ENTER){
114           if(getEditingColumn() == -1 && getEditingRow() == -1){
115             getParent().dispatchEvent(e);
116           }
117         }
118       }
119 
120       public void keyPressed(KeyEvent e) {
121       }
122 
123       public void keyReleased(KeyEvent e) {
124       }
125     });
126   }
127 
128   /**
129    * Cleans the internal data and prepares this object to be collected
130    */
131   public void cleanup(){
132     Gate.getCreoleRegister().removeCreoleListener(this);
133   }
134 
135   /**
136    * Disable key handling for most keys by JTable when not editing.
137    */
138   protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
139                                       int condition, boolean pressed) {
140     int keyCode = e.getKeyCode();
141     if(isEditing() ||
142        keyCode == KeyEvent.VK_UP ||
143        keyCode == KeyEvent.VK_DOWN ||
144        keyCode == KeyEvent.VK_LEFT ||
145        keyCode == KeyEvent.VK_RIGHT ||
146        keyCode == KeyEvent.VK_TAB) return super.processKeyBinding(ks, e,
147                                                                   condition,
148                                                                   pressed);
149     return false;
150   }
151 
152   /**
153    * Should this GUI comonent allow editing?
154    */
155 
156   /**
157    * Sets the parameters for the resource to their new values as resulted
158    * from the user's edits.
159    */
160   public void setParameters() throws ResourceInstantiationException{
161     if(resource == null || parameterDisjunctions == null) return;
162     //stop current edits
163     if(getEditingColumn() != -1 && getEditingRow() != -1){
164       editingStopped(new ChangeEvent(getCellEditor(getEditingRow(),
165                                                    getEditingColumn())));
166     }
167     //set the parameters
168     for(int i = 0; i < parameterDisjunctions.size(); i++){
169       ParameterDisjunction pDisj = (ParameterDisjunction)
170                                    parameterDisjunctions.get(i);
171       resource.setParameterValue(pDisj.getName(), pDisj.getValue());
172     }
173   }
174 
175   /**
176    * Does this GUI component allow editing?
177    */
178 
179   public Resource getResource() {
180     return resource;
181   }
182 
183   /**
184    * Gets the current values for the parameters.
185    * @return a {@link FeatureMap} conatining the curent values for the curently
186    * selected parameters in each disjunction.
187    */
188   public FeatureMap getParameterValues(){
189     //stop current edits
190     if(getEditingColumn() != -1 && getEditingRow() != -1){
191       editingStopped(new ChangeEvent(getCellEditor(getEditingRow(),
192                                                    getEditingColumn())));
193     }
194     //get the parameters
195     FeatureMap values = Factory.newFeatureMap();
196     if(parameterDisjunctions != null){
197       for(int i = 0; i < parameterDisjunctions.size(); i++){
198         ParameterDisjunction pDisj = (ParameterDisjunction)
199                                      parameterDisjunctions.get(i);
200         values.put(pDisj.getName(), pDisj.getValue());
201       }
202     }
203     return values;
204   }
205 
206   public void resourceLoaded(CreoleEvent e) {
207     repaint();
208   }
209   public void resourceUnloaded(CreoleEvent e) {
210     repaint();
211   }
212 
213   public void resourceRenamed(Resource resource, String oldName,
214                               String newName){
215     repaint();
216   }
217   public void datastoreOpened(CreoleEvent e) {
218   }
219   public void datastoreCreated(CreoleEvent e) {
220   }
221   public void datastoreClosed(CreoleEvent e) {
222   }
223   public void setEditable(boolean editable) {
224     this.editable = editable;
225   }
226   public boolean isEditable() {
227     return editable;
228   }
229 
230   ParametersTableModel tableModel;
231   Resource resource;
232 
233 
234 
235   /**
236    * A list of {@link ParameterDisjunction}
237    */
238   protected List parameterDisjunctions;
239   protected boolean editable = true;
240 
241   //inner classes
242   protected class ParametersTableModel extends AbstractTableModel{
243 
244     public int getColumnCount(){return 4;}
245 
246     public Class getColumnClass(int columnIndex){
247       switch(columnIndex){
248         case 0: return ParameterDisjunction.class;
249         case 1: return String.class;
250         case 2: return Boolean.class;
251         case 3: return Object.class;
252         default: return Object.class;
253       }
254     }// public Class getColumnClass(int columnIndex)
255 
256     public String getColumnName(int columnIndex){
257       switch(columnIndex){
258         case 0: return "Name";
259         case 1: return "Type";
260         case 2: return "Required";
261         case 3: return "Value";
262         default: return "?";
263       }
264     }//public String getColumnName(int columnIndex)
265 
266     public boolean isCellEditable(int rowIndex,
267                               int columnIndex) {
268       switch(columnIndex){
269         case 0: return editable &&
270                       ((ParameterDisjunction)
271                         parameterDisjunctions.get(rowIndex)).size() > 1;
272         case 1: return false;
273         case 2: return false;
274         case 3: return editable;
275         default: return false;
276       }
277     }// public boolean isCellEditable
278 
279     public int getRowCount(){
280       return (parameterDisjunctions == null) ? 0 : parameterDisjunctions.size();
281     }
282 
283     public Object getValueAt(int rowIndex,
284                          int columnIndex) {
285       ParameterDisjunction pDisj = (ParameterDisjunction)
286                                    parameterDisjunctions.get(rowIndex);
287       switch(columnIndex){
288         case 0: return pDisj;
289         case 1: return pDisj.getType();
290         case 2: return pDisj.isRequired();
291         case 3: return pDisj.getValue();
292         default: return "?";
293       }
294     }// public Object getValueAt
295 
296     public void setValueAt(Object aValue, int rowIndex, int columnIndex){
297       ParameterDisjunction pDisj = (ParameterDisjunction)
298                                    parameterDisjunctions.get(rowIndex);
299       switch(columnIndex){
300         case 0:{
301           pDisj.setSelectedIndex(((Integer)aValue).intValue());
302           break;
303         }
304         case 1:{
305           break;
306         }
307         case 2:{
308           break;
309         }
310         case 3:{
311           pDisj.setValue(aValue);
312           break;
313         }
314         default:{}
315       }
316     }// public void setValueAt
317   }///class FeaturesTableModel extends DefaultTableModel
318 
319   class ParameterDisjunctionRenderer extends DefaultTableCellRenderer {
320     public ParameterDisjunctionRenderer(){
321       combo = new JComboBox();
322       class CustomRenderer extends JLabel implements ListCellRenderer {
323         public Component getListCellRendererComponent(JList list,
324                                                       Object value,
325                                                       int index,
326                                                       boolean isSelected,
327                                                       boolean cellHasFocus){
328 
329           setText(text);
330           setIcon(MainFrame.getIcon(iconName));
331           return this;
332         }
333       };
334       combo.setRenderer(new CustomRenderer());
335     }
336 
337     public Component getTableCellRendererComponent(JTable table,
338                                                    Object value,
339                                                    boolean isSelected,
340                                                    boolean hasFocus,
341                                                    int row,
342                                                    int column) {
343       ParameterDisjunction pDisj = (ParameterDisjunction)value;
344       text = pDisj.getName();
345       String type = pDisj.getType();
346       iconName = "param.gif";
347       if(Gate.isGateType(type)){
348         ResourceData rData = (ResourceData)Gate.getCreoleRegister().get(type);
349         if(rData != null) iconName = rData.getIcon();
350       }
351       if(pDisj.size() > 1){
352         combo.setModel(new DefaultComboBoxModel(new Object[]{text}));
353         return combo;
354       }
355       //prepare the renderer
356       Component comp = super.getTableCellRendererComponent(table,
357                                                            text,
358                                                            isSelected, hasFocus,
359                                                            row, column);
360       setIcon(MainFrame.getIcon(iconName));
361       return this;
362     }// public Component getTableCellRendererComponent
363 
364     //combobox used for OR parameters
365     JComboBox combo;
366     String iconName;
367     String text;
368   }//class ParameterDisjunctionRenderer
369 
370 
371   /**
372    * A renderer that displays a File Open button next to a text field.
373    * Used for setting URLs from files.
374    */
375   class ParameterValueRenderer extends ObjectRenderer {
376     ParameterValueRenderer() {
377       fileButton = new JButton(MainFrame.getIcon("loadFile.gif"));
378       fileButton.setToolTipText("Set from file...");
379       listButton = new JButton(MainFrame.getIcon("editList.gif"));
380       listButton.setToolTipText("Edit the list");
381       textButtonBox = new JPanel();
382       textButtonBox.setLayout(new BoxLayout(textButtonBox, BoxLayout.X_AXIS));
383       textButtonBox.setOpaque(false);
384 
385       combo = new JComboBox();
386       combo.setRenderer(new ResourceRenderer());
387     }// CustomObjectRenderer()
388 
389     public Component getTableCellRendererComponent(JTable table,
390                                                    Object value,
391                                                    boolean isSelected,
392                                                    boolean hasFocus,
393                                                    int row,
394                                                    int column) {
395 
396       String type = ((ParameterDisjunction)table.getValueAt(row, 0)).getType();
397 
398       if(Gate.isGateType(type)){
399         //Gate type
400         if(ResourceParametersEditor.this.isEditable()){
401           combo.setModel(new DefaultComboBoxModel(new Object[]{value == null ?
402                                                                "<none>" :
403                                                                value }));
404           return combo;
405         }else{
406           //not editable; we'll just use the text field
407           //prepare the renderer
408           String text = value == null ? "<none>" : value.toString();
409           super.getTableCellRendererComponent(table, text, isSelected,
410                                                 hasFocus, row, column);
411           return this;
412         }
413       }else{
414         Class typeClass = null;
415         try{
416           typeClass = Class.forName(type);
417         }catch(ClassNotFoundException cnfe){
418         }
419         //non Gate type -> we'll use the text field
420         String text = (value == null) ?
421                       "                                        " +
422                       "                                        " :
423                       value.toString();
424         //prepare the renderer
425         super.getTableCellRendererComponent(table, text, isSelected,
426                                               hasFocus, row, column);
427 
428         if(type.equals("java.net.URL")){
429           if(ResourceParametersEditor.this.isEditable()){
430             textButtonBox.removeAll();
431             textButtonBox.add(this);
432             this.setMaximumSize(new Dimension(Integer.MAX_VALUE,
433                                               getPreferredSize().height));
434             textButtonBox.add(Box.createHorizontalStrut(5));
435             textButtonBox.add(fileButton);
436             return textButtonBox;
437           }else{
438             return this;
439           }
440         }else if(typeClass != null &&
441                  List.class.isAssignableFrom(typeClass)){
442           //List value
443           setText(textForList((List)value));
444           if(ResourceParametersEditor.this.isEditable()){
445           textButtonBox.removeAll();
446           textButtonBox.add(this);
447           this.setMaximumSize(new Dimension(Integer.MAX_VALUE,
448                                             getPreferredSize().height));
449           textButtonBox.add(Box.createHorizontalStrut(5));
450           textButtonBox.add(listButton);
451           return textButtonBox;
452           }else{
453             return this;
454           }
455         }else return this;
456       }
457     }// public Component getTableCellRendererComponent
458 
459     /**
460      * Gets a string representation for a list value
461      */
462     protected String textForList(List list){
463       if(list == null || list.isEmpty()) return "[]";
464       StringBuffer res = new StringBuffer("[");
465       Iterator elemIter = list.iterator();
466       while(elemIter.hasNext()){
467         Object elem = elemIter.next();
468         res.append( ((elem instanceof NameBearer) ?
469                     ((NameBearer)elem).getName() :
470                     elem.toString()) + ", ");
471       }
472       res.delete(res.length() - 2, res.length() - 1);
473       res.append("]");
474       return res.toString();
475     }
476 
477     JButton fileButton;
478     JButton listButton;
479     JComboBox combo;
480     JPanel textButtonBox;
481   }//class ObjectRenderer extends DefaultTableCellRenderer
482 
483   class ParameterDisjunctionEditor extends DefaultCellEditor{
484     public ParameterDisjunctionEditor(){
485       super(new JComboBox());
486       combo = (JComboBox)super.getComponent();
487       class CustomRenderer extends JLabel implements ListCellRenderer {
488         public CustomRenderer(){
489           setOpaque(true);
490         }
491         public Component getListCellRendererComponent(JList list,
492                                                       Object value,
493                                                       int index,
494                                                       boolean isSelected,
495                                                       boolean cellHasFocus){
496           if (isSelected) {
497               setBackground(list.getSelectionBackground());
498               setForeground(list.getSelectionForeground());
499           }
500           else {
501               setBackground(list.getBackground());
502               setForeground(list.getForeground());
503           }
504 
505           setFont(list.getFont());
506 
507           setText((String)value);
508 
509           String iconName = "param.gif";
510           Parameter[] params = pDisj.getParameters();
511           for(int i = 0; i < params.length; i++){
512             Parameter param = (Parameter)params[i];
513             if(param.getName().equals(value)){
514               String type = param.getTypeName();
515               if(Gate.getCreoleRegister().containsKey(type)){
516                 ResourceData rData = (ResourceData)
517                                      Gate.getCreoleRegister().get(type);
518                 if(rData != null) iconName = rData.getIcon();
519               }
520               break;
521             }//if(params[i].getName().equals(value))
522           }//for(int i = 0; params.length; i++)
523 
524           setIcon(MainFrame.getIcon(iconName));
525           return this;
526         }
527       };//class CustomRenderer extends JLabel implements ListCellRenderer
528       combo.setRenderer(new CustomRenderer());
529       combo.addActionListener(new ActionListener() {
530         public void actionPerformed(ActionEvent e) {
531           stopCellEditing();
532         }
533       });
534     }// public ParameterDisjunctionEditor()
535 
536     public Component getTableCellEditorComponent(JTable table,
537                                              Object value,
538                                              boolean isSelected,
539                                              int row,
540                                              int column){
541      pDisj = (ParameterDisjunction)value;
542      combo.setModel(new DefaultComboBoxModel(pDisj.getNames()));
543      return combo;
544     }// public Component getTableCellEditorComponent
545 
546     public Object getCellEditorValue(){
547       return new Integer(combo.getSelectedIndex());
548     }
549 
550     public boolean stopCellEditing(){
551       combo.hidePopup();
552       return super.stopCellEditing();
553     }
554 
555     JComboBox combo;
556     ParameterDisjunction pDisj;
557   }// class ParameterDisjunctionEditor extends DefaultCellEditor
558 
559   class ParameterValueEditor extends AbstractCellEditor
560                              implements TableCellEditor{
561     ParameterValueEditor(){
562       combo = new JComboBox();
563       combo.setRenderer(new ResourceRenderer());
564       combo.setEditable(false);
565 
566       textField = new JTextField();
567 
568       fileChooser = MainFrame.getFileChooser();
569       fileButton = new JButton(MainFrame.getIcon("loadFile.gif"));
570       fileButton.setToolTipText("Set from file...");
571       fileButton.addActionListener(new ActionListener() {
572         public void actionPerformed(ActionEvent e) {
573           fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
574           fileChooser.setDialogTitle("Select a file");
575           int res = fileChooser.showOpenDialog(ResourceParametersEditor.this);
576           if(res == fileChooser.APPROVE_OPTION){
577             try {
578               textField.setText(fileChooser.getSelectedFile().
579                                 toURL().toExternalForm());
580             } catch(IOException ioe){}
581             fireEditingStopped();
582           }else{
583             fireEditingCanceled();
584           }
585         }
586       });
587 
588       listButton = new JButton(MainFrame.getIcon("editList.gif"));
589       listButton.setToolTipText("Edit the list");
590       listButton.addActionListener(new ActionListener() {
591         public void actionPerformed(ActionEvent e) {
592           List returnedList = listEditor.showDialog();
593           if(returnedList != null){
594             listValue = returnedList;
595             fireEditingStopped();
596           }else{
597             fireEditingCanceled();
598           }
599         }
600       });
601 
602       textButtonBox = new JPanel();
603       textButtonBox.setLayout(new BoxLayout(textButtonBox, BoxLayout.X_AXIS));
604       textButtonBox.setOpaque(false);
605       label = new JLabel(){
606         public boolean isFocusTraversable(){
607           return true;
608         }
609       };
610       label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
611       label.addMouseListener(new MouseAdapter() {
612         public void mouseClicked(MouseEvent e) {
613           Boolean value = new Boolean(label.getText());
614           value = new Boolean(!value.booleanValue());
615           label.setText(value.toString());
616         }
617       });
618       label.addKeyListener(new KeyAdapter() {
619         public void keyTyped(KeyEvent e) {
620           Boolean value = new Boolean(label.getText());
621           value = new Boolean(!value.booleanValue());
622           label.setText(value.toString());
623         }
624       });
625     }//ParameterValueEditor()
626 
627     public Component getTableCellEditorComponent(JTable table,
628                                                  Object value,
629                                                  boolean isSelected,
630                                                  int row,
631                                                  int column){
632       comboUsed = false;
633       listUsed = false;
634       ParameterDisjunction pDisj = (ParameterDisjunction)
635                                    table.getValueAt(row, 0);
636       type = pDisj.getType();
637 //      ResourceData rData = (ResourceData)Gate.getCreoleRegister().get(type);
638 
639       if(Gate.isGateType(type)){
640         //Gate type
641         comboUsed = true;
642         ArrayList values = new ArrayList();
643         try{
644           values.addAll(Gate.getCreoleRegister().
645                         getAllInstances(type));
646         }catch(GateException ge){
647           ge.printStackTrace(Err.getPrintWriter());
648         }
649         values.add(0, "<none>");
650         combo.setModel(new DefaultComboBoxModel(values.toArray()));
651         combo.setSelectedItem(value == null ? "<none>" : value);
652         return combo;
653       }else{
654         //non Gate type
655         Class typeClass = null;
656         try{
657           typeClass = Class.forName(type);
658         }catch(ClassNotFoundException cnfe){
659         }
660 
661         textField.setText((value == null) ? "" : value.toString());
662         if(type.equals("java.net.URL")){
663           //clean up all filters
664           fileChooser.resetChoosableFileFilters();
665           fileChooser.setAcceptAllFileFilterUsed(true);
666           fileChooser.setFileFilter(fileChooser.getAcceptAllFileFilter());
667           Parameter param = pDisj.getParameter();
668           Set sufixes = param.getSuffixes();
669           if(sufixes != null){
670             ExtensionFileFilter fileFilter = new ExtensionFileFilter();
671             Iterator sufIter = sufixes.iterator();
672             while(sufIter.hasNext()){
673               fileFilter.addExtension((String)sufIter.next());
674             }
675             fileFilter.setDescription("Known file types " + sufixes.toString());
676             fileChooser.addChoosableFileFilter(fileFilter);
677             fileChooser.setFileFilter(fileFilter);
678           }
679 
680           textField.setEditable(true);
681           textButtonBox.removeAll();
682           textButtonBox.add(textField);
683           textButtonBox.add(Box.createHorizontalStrut(5));
684           textButtonBox.add(fileButton);
685           return textButtonBox;
686         }else if(type.equals("java.lang.Boolean")){
687           label.setText(value == null ? "false" : value.toString());
688           return label;
689         }else if(typeClass != null &&
690                       List.class.isAssignableFrom(typeClass)){
691           //List value
692           listUsed = true;
693           Parameter param = pDisj.getParameter();
694           Set sufixes = param.getSuffixes();
695 
696           listValue = (List)value;
697           listEditor = new ListEditorDialog(
698                 SwingUtilities.getAncestorOfClass(
699                 Window.class, ResourceParametersEditor.this),
700                 (List)value, param.getItemClassName());
701 
702           textField.setEditable(false);
703           textField.setText(textForList((List)value));
704           textButtonBox.removeAll();
705           textButtonBox.add(textField);
706           textButtonBox.add(Box.createHorizontalStrut(5));
707           textButtonBox.add(listButton);
708           return textButtonBox;
709         }else{
710           textField.setEditable(true);
711           return textField;
712         }
713       }
714     }//getTableCellEditorComponent
715 
716     /**
717      * Gets a string representation for a list value
718      */
719     protected String textForList(List list){
720       if(list == null) return "[]";
721       StringBuffer res = new StringBuffer("[");
722       Iterator elemIter = list.iterator();
723       while(elemIter.hasNext()){
724         Object elem = elemIter.next();
725         res.append( ((elem instanceof NameBearer) ?
726                     ((NameBearer)elem).getName() :
727                     elem.toString()) + ", ");
728       }
729       res.delete(res.length() - 2, res.length() - 1);
730       res.append("]");
731       return res.toString();
732     }
733 
734     public Object getCellEditorValue(){
735       if(comboUsed){
736         Object value = combo.getSelectedItem();
737          return value == "<none>" ? null : value;
738       }
739       else if(listUsed){
740         return listValue;
741       }else{
742         if(type.equals("java.lang.Boolean")){
743           //get the value from the label
744           return new Boolean(label.getText());
745         }else{
746           //get the value from the text field
747           return textField.getText();
748 //          return ((textField.getText().equals("")) ? null :
749 //                                                     textField.getText());
750         }
751       }
752     }//public Object getCellEditorValue()
753 
754     /**
755      * The type of the value currently being edited
756      */
757     String type;
758 
759     /**
760      * Combobox use as editor for Gate objects (chooses between instances)
761      */
762     JComboBox combo;
763 
764     /**
765      * Editor used for boolean values
766      */
767     JLabel label;
768 
769     /**
770      * Generic editor for all types that are not treated special
771      */
772     JTextField textField;
773 
774     /**
775      * A pointer to the filechooser from MainFrame;
776      */
777     JFileChooser fileChooser;
778 
779     ListEditorDialog listEditor = null;
780     List listValue;
781 
782     boolean comboUsed;
783     boolean listUsed;
784     JButton fileButton;
785     JButton listButton;
786     JPanel textButtonBox;
787   }///class ParameterValueEditor
788 
789 
790 
791 }//class NewResourceDialog