Ignore:
Timestamp:
2003-09-23T14:58:18+12:00 (21 years ago)
Author:
mdewsnip
Message:

Partway through tooltip assignment. Made lots of little changes, registered a whole lot more components, removed dead code, fixed help links (with SimpleMenuBars). Lots more of the same to come.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPrompt.java

    r5359 r5527  
    3030import java.io.File;
    3131import javax.swing.*;
    32 import org.greenstone.gatherer.Configuration;
    3332import org.greenstone.gatherer.Gatherer;
    3433import org.greenstone.gatherer.gui.TextFieldLabel;
    35 import org.greenstone.gatherer.util.Utility;
    3634import org.greenstone.gatherer.gui.SimpleMenuBar;
    3735import org.greenstone.gatherer.gui.ModalDialog;
     36import org.greenstone.gatherer.util.Utility;
    3837
    3938/** Displays a dynamic prompt to allow the user to choose how metadata is to be added, updated or removed from target FileNodes. The prompt changes depending on the action requested, the file nodes encountered and the number of file nodes in the selection. */
     
    7574    public MetaEditPrompt(String type, boolean multiple_selection, File file, String element, String current_value, String new_value) {
    7675    super(Gatherer.g_man, true); // Needed for modal response!
    77          
     76
    7877    // Setup
    7978    this.setSize(SIZE);
    80     this.setTitle(get("MetaEditPrompt.Title"));
    81     this.setJMenuBar(new SimpleMenuBar("6.3"));
     79    this.setTitle("MetaEditPrompt.Title");
     80
     81    if (type.equals(ADD_PROMPT)) {
     82        this.setJMenuBar(new SimpleMenuBar("appendingmetadata"));
     83    }
     84    else if (type.equals(UPDATE_PROMPT)) {
     85        this.setJMenuBar(new SimpleMenuBar("updatingmetadata"));
     86    }
     87    else if (type.equals(REMOVE_PROMPT)) {
     88        this.setJMenuBar(new SimpleMenuBar("removingmetadata"));
     89    }
     90
    8291    // Creation
    8392    JPanel content_pane = (JPanel)this.getContentPane();
    84     JLabel title_label = new JLabel(get("MetaEditPrompt." + type));
     93    JLabel title_label = new JLabel(type);
    8594
    8695    JPanel details_pane = new JPanel();
    8796    JPanel filename_panel = new JPanel();
    88     JLabel filename_label = new JLabel(get("MetaEditPrompt.File"));
     97    JLabel filename_label = new JLabel("MetaEditPrompt.File");
    8998    filename_label.setPreferredSize(LABEL_SIZE);
    9099    TextFieldLabel filename_field = new TextFieldLabel(Utility.trimCenter(file.getAbsolutePath(), 120));
     
    92101    filename_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    93102    JPanel element_panel = new JPanel();
    94     JLabel element_label = new JLabel(get("MetaEditPrompt.Element"));
     103    JLabel element_label = new JLabel("MetaEditPrompt.Element");
    95104    element_label.setPreferredSize(LABEL_SIZE);
    96105    TextFieldLabel element_field = new TextFieldLabel(element);
    97106    element_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    98107    JPanel current_value_panel = new JPanel();
    99     JLabel current_value_label = new JLabel(get("MetaEditPrompt.Current_Value"));
     108    JLabel current_value_label = new JLabel("MetaEditPrompt.Current_Value");
    100109    current_value_label.setPreferredSize(LABEL_SIZE);
    101110    TextFieldLabel current_value_field = new TextFieldLabel(current_value);
    102111    current_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    103112    JPanel new_value_panel = new JPanel();
    104     JLabel new_value_label = new JLabel(get("MetaEditPrompt.New_Value"));
     113    JLabel new_value_label = new JLabel("MetaEditPrompt.New_Value");
    105114    new_value_label.setPreferredSize(LABEL_SIZE);
    106115    TextFieldLabel new_value_field = new TextFieldLabel(new_value, (type == ADD_PROMPT || type == UPDATE_PROMPT));
    107116    new_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    108117    JPanel buttons_pane = new JPanel();
    109     accumulate = new JButton(get("MetaEditPrompt.Accumulate"));
     118
     119    accumulate = new JButton("MetaEditPrompt.Accumulate");
    110120    accumulate.setEnabled(type == ADD_PROMPT);
    111121    accumulate.setMnemonic(KeyEvent.VK_A);
    112     accumulate_all = new JButton(get("MetaEditPrompt.Accumulate_All"));
     122
     123    accumulate_all = new JButton("MetaEditPrompt.Accumulate_All");
    113124    accumulate_all.setEnabled(type == ADD_PROMPT && multiple_selection);
    114125    accumulate_all.setMnemonic(KeyEvent.VK_L);
    115     cancel = new JButton(get("MetaEditPrompt.Cancel"));
    116     cancel.setMnemonic(KeyEvent.VK_C);
    117     skip = new JButton(get("MetaEditPrompt.Skip"));
     126
     127    overwrite = new JButton("MetaEditPrompt.Overwrite");
     128    overwrite.setEnabled(type == UPDATE_PROMPT);
     129    overwrite.setMnemonic(KeyEvent.VK_R);
     130
     131    overwrite_all = new JButton("MetaEditPrompt.Overwrite_All");
     132    overwrite_all.setEnabled(type == UPDATE_PROMPT && multiple_selection);
     133    overwrite_all.setMnemonic(KeyEvent.VK_P);
     134
     135    remove = new JButton("MetaEditPrompt.Remove");
     136    remove.setEnabled(type == REMOVE_PROMPT);
     137    remove.setMnemonic(KeyEvent.VK_R);
     138
     139    remove_all = new JButton("MetaEditPrompt.Remove_All");
     140    remove_all.setEnabled(type == REMOVE_PROMPT && multiple_selection);
     141    remove_all.setMnemonic(KeyEvent.VK_A);
     142
     143    skip = new JButton("MetaEditPrompt.Skip");
    118144    skip.setEnabled(multiple_selection);
    119145    skip.setMnemonic(KeyEvent.VK_S);
    120     overwrite = new JButton(get("MetaEditPrompt.Overwrite"));
    121     overwrite.setEnabled(type == UPDATE_PROMPT);
    122     overwrite.setMnemonic(KeyEvent.VK_R);
    123     overwrite_all = new JButton(get("MetaEditPrompt.Overwrite_All"));
    124     overwrite_all.setEnabled(type == UPDATE_PROMPT && multiple_selection);
    125     overwrite_all.setMnemonic(KeyEvent.VK_P);
    126     remove = new JButton(get("MetaEditPrompt.Remove"));
    127     remove.setEnabled(type == REMOVE_PROMPT);
    128     remove.setMnemonic(KeyEvent.VK_R);
    129     remove_all = new JButton(get("MetaEditPrompt.Remove_All"));
    130     remove_all.setEnabled(type == REMOVE_PROMPT && multiple_selection);
    131     remove_all.setMnemonic(KeyEvent.VK_A);
     146
     147    cancel = new JButton("MetaEditPrompt.Cancel");
     148    cancel.setMnemonic(KeyEvent.VK_C);
    132149
    133150    // Connection
     
    187204    Rectangle frame_bounds = Gatherer.g_man.getBounds();
    188205    this.setLocation(frame_bounds.x + ((frame_bounds.width - SIZE.width) / 2), frame_bounds.y + ((frame_bounds.height - SIZE.height) / 2));
     206
     207    // Dictionary registration
     208    Gatherer.dictionary.register(title_label, null, false);
     209    Gatherer.dictionary.register(filename_label, null, false);
     210    Gatherer.dictionary.register(element_label, null, false);
     211    Gatherer.dictionary.register(current_value_label, null, false);
     212    Gatherer.dictionary.register(new_value_label, null, false);
     213
     214    Gatherer.dictionary.register(accumulate, null, false);
     215    Gatherer.dictionary.register(accumulate_all, null, false);
     216    Gatherer.dictionary.register(cancel, null, false);
     217    Gatherer.dictionary.register(skip, null, false);
     218    Gatherer.dictionary.register(overwrite, null, false);
     219    Gatherer.dictionary.register(overwrite_all, null, false);
     220    Gatherer.dictionary.register(remove, null, false);
     221    Gatherer.dictionary.register(remove_all, null, false);
    189222    }
    190223
     
    222255    return value;
    223256    }
    224 
    225     private String get(String key) {
    226     return Gatherer.dictionary.get(key);
    227     }
    228257}
Note: See TracChangeset for help on using the changeset viewer.