Changeset 12708


Ignore:
Timestamp:
2006-09-08T09:41:27+12:00 (18 years ago)
Author:
kjdon
Message:

changed the variable list slightly - moved the label to be the first element in the list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java

    r12641 r12708  
    240240    {
    241241    ArrayList variable_model = new ArrayList();
    242         variable_model.add("");
     242        variable_model.add(Dictionary.get("CDM.FormatManager.Insert_Variable"));
    243243    variable_model.add("[Text]");
    244244    ArrayList every_metadata_set_element = MetadataSetManager.getEveryMetadataSetElement();
     
    344344       
    345345        JPanel variable_pane = new JPanel();
    346         JLabel variable_label = new JLabel(Dictionary.get("CDM.FormatManager.Variable"));
    347        
     346               
    348347        variable_combobox = new JComboBox(variable_model.toArray());
    349348        variable_combobox.setToolTipText(Dictionary.get("CDM.FormatManager.Variable_Tooltip"));
     
    427426        variable_pane.setBorder(BorderFactory.createEmptyBorder(2,0,2,0));
    428427        variable_pane.setLayout(new GridLayout(1,3));
    429         variable_pane.add(variable_label);
     428        variable_pane.add(new JPanel());
    430429        variable_pane.add(variable_combobox);
    431430        variable_pane.add(rupanel);
     
    483482        feature_combobox.setSelectedItem(selected_feature);
    484483
    485         // Update the variable model, trying to maintain the same selected object
    486         Object selected_variable = variable_combobox.getSelectedItem();
     484        // Update the variable model,
    487485        variable_model = buildVariableModel();
    488486        variable_combobox.setModel(new DefaultComboBoxModel(variable_model.toArray()));
    489         variable_combobox.setSelectedItem(selected_variable);
    490         }   
     487        }   
    491488    }
    492489
     
    835832        implements ActionListener {
    836833        public void actionPerformed(ActionEvent event) {
     834        int selected_index = variable_combobox.getSelectedIndex();
     835        if (selected_index == 0) return;
    837836                String selected_value = (String)variable_combobox.getSelectedItem();
    838              
    839         if (!selected_value.equals("")){
    840             editor_textarea.insert(selected_value, editor_textarea.getCaretPosition());   
    841             undo_button.setEnabled(true);
    842 
    843         }
    844         }
    845        
     837        editor_textarea.insert(selected_value, editor_textarea.getCaretPosition());   
     838        undo_button.setEnabled(true);
     839        variable_combobox.setSelectedIndex(0);
     840        }
     841               
    846842    }
    847843
Note: See TracChangeset for help on using the changeset viewer.