Changeset 12681
- Timestamp:
- 2006-09-05T16:40:14+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java
r12665 r12681 77 77 static final private Dimension SIZE = new Dimension(800,550); 78 78 79 // we have a card pane to switch between the no set loaded view, and the 80 // set loaded view 81 private CardLayout card_layout = null; 82 private JPanel card_pane = null; 83 /** The name of the panel containing the "set loaded" card. */ 84 private String SET_LOADED_CARD = ""; 85 /** The name of the panel containing the "no set loaded" placeholder */ 86 private String NO_SET_LOADED_CARD = "No set loaded"; 87 79 88 private GEMS self = null; 80 89 … … 83 92 private NewMetadataSetPrompt new_prompt; 84 93 85 private JSplitPane splitPane = null; 86 private JSplitPane rightPane = null; 94 // this is the main panel that gets switched in once a set is loaded 95 private JSplitPane metadata_set_details_split_pane = null; 96 // this is the split with the attribute tables in it 97 private JSplitPane attribute_tables_split_pane = null; 87 98 88 99 /** Um, the size of the screen I'd guess. */ … … 154 165 addWindowFocusListener(this); 155 166 167 card_layout = new CardLayout(); 168 card_pane = new JPanel(); 169 156 170 metadata_set_model = new MetadataSetModel(msm); 157 171 msm.setMetadataSetModel(metadata_set_model); … … 204 218 JScrollPane langTablePane = new JScrollPane(language_dependent_attribute_table); 205 219 220 // no set loaded pane 221 JPanel no_set_loaded_pane = new JPanel(); 222 no_set_loaded_pane.setBackground(Color.lightGray); 223 JLabel no_set_loaded_label = new JLabel(Dictionary.get("GEMS.No_Set_Loaded")); 224 no_set_loaded_label.setHorizontalAlignment(JLabel.CENTER); 225 no_set_loaded_label.setVerticalAlignment(JLabel.CENTER); 226 227 no_set_loaded_pane.setLayout(new BorderLayout()); 228 no_set_loaded_pane.add(no_set_loaded_label, BorderLayout.CENTER); 206 229 207 230 JPanel buttonPane = new JPanel(new GridLayout(1,2)); … … 269 292 mainAttributePane.add(tablePane, BorderLayout.CENTER); 270 293 271 rightPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,mainAttributePane,languageAttributePane); 272 273 splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPane,rightPane); 274 getContentPane().add(splitPane,BorderLayout.CENTER); 294 attribute_tables_split_pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,mainAttributePane,languageAttributePane); 295 296 metadata_set_details_split_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPane,attribute_tables_split_pane); 297 298 card_pane.setLayout(card_layout); 299 card_pane.add(no_set_loaded_pane, NO_SET_LOADED_CARD); 300 card_pane.add(metadata_set_details_split_pane, SET_LOADED_CARD); 301 302 getContentPane().add(card_pane,BorderLayout.CENTER); 275 303 276 304 setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2); … … 281 309 public void setVisible(boolean visible) { 282 310 super.setVisible(visible); 283 rightPane.setDividerLocation(0.3);311 attribute_tables_split_pane.setDividerLocation(0.3); 284 312 } 285 313 314 // called from GLI 286 315 public void displayMetadataSet(String metadata_path){ 287 316 open_prompt.openMetadataSet(metadata_path); … … 289 318 } 290 319 320 // called from GLI 291 321 public void newMetadataSet(){ 292 322 new_prompt.display(); … … 312 342 public void exit(){ 313 343 //clean up things 344 cleanUpListeners(); 345 } 346 347 protected void cleanUpListeners() { 314 348 MetadataSetInfo msti= new MetadataSetInfo(); 315 349 msti.removeAllMetadataSetListeners(); 316 350 MetadataElementModel mem= new MetadataElementModel(); 317 351 mem.removeAllMetadataElementListeners(); 352 318 353 } 319 354 … … 329 364 } 330 365 366 protected void updateCardLayout(boolean set_loaded) { 367 if (set_loaded) { 368 card_layout.show(card_pane, SET_LOADED_CARD); 369 } else { 370 card_layout.show(card_pane, NO_SET_LOADED_CARD); 371 } 372 } 331 373 332 374 private class GEMSMenuBar … … 419 461 // File -> New 420 462 if (event_source == file_new) { 421 new_prompt.display(); 463 new_prompt.display(); 464 if (!new_prompt.isCancelled()) { 465 updateCardLayout(true); 466 } 422 467 return; 423 468 } … … 426 471 if (event_source == file_open) { 427 472 open_prompt.display(); 473 if (!open_prompt.isCancelled()) { 474 updateCardLayout(true); 475 } 428 476 return; 429 477 } … … 431 479 // File -> Close 432 480 if (event_source == file_close) { 433 481 metadata_set_model.save(true); 482 updateCardLayout(false); 483 return; 434 484 } 435 485 // File -> Delete
Note:
See TracChangeset
for help on using the changeset viewer.