- Timestamp:
- 2003-09-23T14:58:18+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPrompt.java
r5359 r5527 30 30 import java.io.File; 31 31 import javax.swing.*; 32 import org.greenstone.gatherer.Configuration;33 32 import org.greenstone.gatherer.Gatherer; 34 33 import org.greenstone.gatherer.gui.TextFieldLabel; 35 import org.greenstone.gatherer.util.Utility;36 34 import org.greenstone.gatherer.gui.SimpleMenuBar; 37 35 import org.greenstone.gatherer.gui.ModalDialog; 36 import org.greenstone.gatherer.util.Utility; 38 37 39 38 /** 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. */ … … 75 74 public MetaEditPrompt(String type, boolean multiple_selection, File file, String element, String current_value, String new_value) { 76 75 super(Gatherer.g_man, true); // Needed for modal response! 77 76 78 77 // Setup 79 78 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 82 91 // Creation 83 92 JPanel content_pane = (JPanel)this.getContentPane(); 84 JLabel title_label = new JLabel( get("MetaEditPrompt." + type));93 JLabel title_label = new JLabel(type); 85 94 86 95 JPanel details_pane = new JPanel(); 87 96 JPanel filename_panel = new JPanel(); 88 JLabel filename_label = new JLabel( get("MetaEditPrompt.File"));97 JLabel filename_label = new JLabel("MetaEditPrompt.File"); 89 98 filename_label.setPreferredSize(LABEL_SIZE); 90 99 TextFieldLabel filename_field = new TextFieldLabel(Utility.trimCenter(file.getAbsolutePath(), 120)); … … 92 101 filename_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 93 102 JPanel element_panel = new JPanel(); 94 JLabel element_label = new JLabel( get("MetaEditPrompt.Element"));103 JLabel element_label = new JLabel("MetaEditPrompt.Element"); 95 104 element_label.setPreferredSize(LABEL_SIZE); 96 105 TextFieldLabel element_field = new TextFieldLabel(element); 97 106 element_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 98 107 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"); 100 109 current_value_label.setPreferredSize(LABEL_SIZE); 101 110 TextFieldLabel current_value_field = new TextFieldLabel(current_value); 102 111 current_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 103 112 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"); 105 114 new_value_label.setPreferredSize(LABEL_SIZE); 106 115 TextFieldLabel new_value_field = new TextFieldLabel(new_value, (type == ADD_PROMPT || type == UPDATE_PROMPT)); 107 116 new_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 108 117 JPanel buttons_pane = new JPanel(); 109 accumulate = new JButton(get("MetaEditPrompt.Accumulate")); 118 119 accumulate = new JButton("MetaEditPrompt.Accumulate"); 110 120 accumulate.setEnabled(type == ADD_PROMPT); 111 121 accumulate.setMnemonic(KeyEvent.VK_A); 112 accumulate_all = new JButton(get("MetaEditPrompt.Accumulate_All")); 122 123 accumulate_all = new JButton("MetaEditPrompt.Accumulate_All"); 113 124 accumulate_all.setEnabled(type == ADD_PROMPT && multiple_selection); 114 125 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"); 118 144 skip.setEnabled(multiple_selection); 119 145 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); 132 149 133 150 // Connection … … 187 204 Rectangle frame_bounds = Gatherer.g_man.getBounds(); 188 205 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); 189 222 } 190 223 … … 222 255 return value; 223 256 } 224 225 private String get(String key) {226 return Gatherer.dictionary.get(key);227 }228 257 }
Note:
See TracChangeset
for help on using the changeset viewer.