Changeset 6389 for trunk/gli/src/org/greenstone/gatherer/gui
- Timestamp:
- 2004-01-09T15:08:11+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r6318 r6389 44 44 import javax.swing.text.*; 45 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.Configuration; 46 47 import org.greenstone.gatherer.Dictionary; 47 48 import org.greenstone.gatherer.Gatherer; … … 91 92 extends JPanel 92 93 implements GShellListener { 94 95 static private Dimension ARGUMENT_SIZE = new Dimension(800,90); 96 /** The size of the buttons at the bottom of the screen. */ 97 static private Dimension BUTTON_SIZE = new Dimension (256, 50);//(386, 50); 98 /** The size of the labels on the progress pane. */ 99 static private Dimension LABEL_SIZE = new Dimension(140, 25); 100 /** The threshold for when the simple view is replaced by the complex one. */ 101 static private final int THRESHOLD = Configuration.EXPERT_MODE; 102 /** An identifier for the control panel within the card layout. */ 103 static private String CONTROL = "Control"; 104 /** An identifier for the progress panel within the card layout. */ 105 static private String PROGRESS = "Progress"; 106 /** An identifier for the simple panel within the card layout. */ 107 static private String SIMPLE = "Simple"; 108 93 109 /** Determines the current view that should be shown for this pane. */ 94 110 public boolean processing = false; … … 120 136 /** The label alongside the import progress bar gets some special treatment so... */ 121 137 private JLabel progress_import_label = null; 138 /** A panel containing the two progress bars. */ 139 private JPanel bar_area; 140 /** The panel on which buttons are rendered on higher detail modes. */ 141 private JPanel button_pane; 122 142 /** The pane which contains the controls for configuration. */ 123 143 private JPanel control_pane = null; … … 126 146 /** The pane which contains the progress information. */ 127 147 private JPanel progress_pane = null; 128 /** the pane on the right-hand side - shows the requested options view */148 /** The pane on the right-hand side - shows the requested options view */ 129 149 private JPanel right = null; 150 /** The simple panel on which all of the available arguments are rendered. */ 151 private JPanel sargument_configuration_panel; 152 /** The panel on which buttons are rendered on lower details modes. */ 153 private JPanel sbutton_panel; 154 /** A simplified version for lower detail modes containing both the control and progress panes smooshed together. */ 155 private JPanel simple_panel; 156 /** The inner panel of the simple pane which is global so that the bar_area can be added and removed from it. */ 157 private JPanel sinner_panel; 158 /** The outer panel of the simple pane which is global so that the arguments pane can be added and removed from it. */ 159 private JPanel souter_panel; 160 /** The scrolling pane for the log. */ 161 private JScrollPane log_scroll; 162 /** The scrolling pane the simple arguments are rendered within. */ 163 private JScrollPane sargument_configuration_scroll; 130 164 /** the scrolling pane the righthand side is inside - only used for import and build options. the log and log list are not inside a scrollpane */ 131 165 private JScrollPane scroll_pane; … … 138 172 /** The homepage address of the current collection */ 139 173 private String homepage = null; 140 /** The size of the buttons at the bottom of the screen. */ 141 static private Dimension BUTTON_SIZE = new Dimension (256, 50);//(386, 50); 142 /** The size of the labels on the progress pane. */ 143 static private Dimension LABEL_SIZE = new Dimension(140, 25); 144 /** An identifier for the control panel within the card layout. */ 145 static private String CONTROL = "Control"; 146 /** An identifier for the progress panel within the card layout. */ 147 static private String PROGRESS = "Progress"; 174 148 175 149 176 /** The constructor creates important helper classes, and initializes all the components. … … 162 189 Collection collection = Gatherer.c_man.getCollection(); 163 190 log_textarea = new JTextArea(); 191 log_scroll = new JScrollPane(log_textarea); 164 192 165 193 // Create components … … 168 196 control_pane = new JPanel(); 169 197 tree = new OptionTree(); 198 button_pane = new JPanel(); 170 199 171 200 // Progress Pane 172 progress_pane = new JPanel(); 201 progress_pane = new JPanel(); // One owner of the bar component 202 bar_area = new JPanel(); // This component will be shared about 173 203 174 204 progress_copy_label = new JLabel(); … … 202 232 Dictionary.registerText(progress_build_label, "CreatePane.Build_Progress"); 203 233 204 build_monitor = new GBuildProgressMonitor( (GImportProgressMonitor)import_monitor); //GBasicProgressMonitor();234 build_monitor = new GBuildProgressMonitor(); //GBasicProgressMonitor(); 205 235 Gatherer.c_man.registerBuildMonitor(build_monitor); 236 237 // And the simple panel 238 simple_panel = new JPanel(); 239 sbutton_panel = new JPanel(); 240 sinner_panel = new JPanel(); 206 241 207 242 // Buttons … … 240 275 } 241 276 Collection current_collection = Gatherer.c_man.getCollection(); 242 if (current_collection != previous_collection ) {277 if (current_collection != previous_collection && !Gatherer.c_man.isImporting()) { 243 278 this.options_pane = new OptionsPane(current_collection.build_options); 244 279 previous_collection = current_collection; 280 } 281 // If we are in simple mode, we have to rebuild the simple arguments list 282 if(Gatherer.config.getMode() < THRESHOLD) { 283 souter_panel.remove(sargument_configuration_scroll); 284 souter_panel.remove(sinner_panel); 285 sargument_configuration_panel = options_pane.buildImport(null); 286 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 287 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 288 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 289 souter_panel.add(sargument_configuration_scroll); 290 souter_panel.add(sinner_panel); 245 291 } 246 292 tree.valueChanged(null); … … 253 299 } 254 300 } 301 302 public void destroy() { 303 if(document != null) { 304 document.destroy(); 305 } 306 } 255 307 256 308 /** This method is called to actually layout the components. … … 260 312 public void display() { 261 313 314 int current_mode = Gatherer.config.getMode(); 315 262 316 // Build control_pane 263 317 JPanel left = new JPanel(); … … 276 330 options_area.add(right, BorderLayout.CENTER); 277 331 332 button_pane = new JPanel(); 333 button_pane.setBorder(BorderFactory.createEmptyBorder(5,10,10,10)); 334 button_pane.setLayout(new GridLayout(1,2)); 335 if(current_mode >= THRESHOLD) { 336 button_pane.add(build_button); 337 button_pane.add(cancel_button); 338 button_pane.add(preview_button); 339 } 340 278 341 control_pane.setLayout(new BorderLayout()); 279 342 control_pane.add(options_area, BorderLayout.CENTER); 343 control_pane.add(button_pane, BorderLayout.SOUTH); 280 344 281 345 // Build progress_pane … … 295 359 build_pane.add(build_monitor.getProgress(), BorderLayout.CENTER); 296 360 297 JPanel bar_area = new JPanel();298 361 bar_area.setBorder(BorderFactory.createEmptyBorder(10,10,5,10)); 299 362 … … 304 367 progress_pane.setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); 305 368 progress_pane.setLayout(new BorderLayout()); 306 progress_pane.add(bar_area, BorderLayout.NORTH); 307 progress_pane.add(new JScrollPane(log_textarea), BorderLayout.CENTER); 369 if(current_mode >= THRESHOLD) { 370 progress_pane.add(bar_area, BorderLayout.NORTH); 371 progress_pane.add(log_scroll, BorderLayout.CENTER); 372 } 373 374 // Simple panel 375 sbutton_panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); 376 sbutton_panel.setLayout(new GridLayout(3,1)); 377 if(current_mode < THRESHOLD) { 378 sbutton_panel.add(build_button); 379 sbutton_panel.add(cancel_button); 380 sbutton_panel.add(preview_button); 381 } 382 383 sinner_panel.setBorder(BorderFactory.createEmptyBorder(5,0,5,0)); 384 sinner_panel.setLayout(new BorderLayout()); 385 if(current_mode < THRESHOLD) { 386 sinner_panel.add(bar_area, BorderLayout.CENTER); 387 } 388 sinner_panel.add(sbutton_panel, BorderLayout.EAST); 389 390 if(options_pane != null) { 391 sargument_configuration_panel = options_pane.buildImport(null); 392 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 393 } 394 else { 395 sargument_configuration_panel = new JPanel(); 396 } 397 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 398 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 399 souter_panel = new JPanel(); 400 souter_panel.setSize(new Dimension(400,800)); 401 souter_panel.setLayout(new GridLayout(2,1)); 402 souter_panel.add(sargument_configuration_scroll); 403 souter_panel.add(sinner_panel); 404 405 simple_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 406 simple_panel.setLayout(new BorderLayout()); 407 simple_panel.add(souter_panel, BorderLayout.NORTH); 408 if(current_mode < THRESHOLD) { 409 simple_panel.add(log_scroll, BorderLayout.CENTER); 410 } 308 411 309 412 // Main pane 310 413 main_pane = new JPanel(card_layout); 414 if(current_mode < THRESHOLD) { // Simple mode - add first 415 main_pane.add(simple_panel, SIMPLE); 416 } 311 417 main_pane.add(control_pane, CONTROL); 312 418 main_pane.add(progress_pane, PROGRESS); 313 314 // Buttons 315 JPanel button_pane = new JPanel(); 316 button_pane.setBorder(BorderFactory.createEmptyBorder(5,10,10,10)); 317 button_pane.setLayout(new GridLayout(1,2)); 318 button_pane.add(build_button); 319 button_pane.add(cancel_button); 320 button_pane.add(preview_button); 419 if(current_mode >= THRESHOLD) { // Expert mode - add last 420 main_pane.add(simple_panel, SIMPLE); 421 } 321 422 322 423 this.setLayout(new BorderLayout()); 323 424 this.add(main_pane, BorderLayout.CENTER); 324 this.add(button_pane, BorderLayout.SOUTH);325 425 } 326 426 … … 331 431 */ 332 432 public void gainFocus() { 333 if(!processing) { 433 if(Gatherer.config.getMode() < THRESHOLD) { 434 card_layout.show(main_pane, SIMPLE); 435 } 436 else if(!processing) { 334 437 card_layout.show(main_pane, CONTROL); 438 } 439 else { 440 card_layout.show(main_pane, PROGRESS); 335 441 } 336 442 // Refresh the set of controls. … … 339 445 tree.setSelectionPath(path); 340 446 } 341 342 /** Method to acquire the progress monitor associated with builds.343 * @return The build <strong>GShellProgressMonitor</strong>.344 */345 /* private GShellProgressMonitor getBuildProgress() {346 return build_monitor;347 } */348 349 /** Method to acquire the progress monitor associated with copying.350 * @return The copying <strong>GShellProgressMonitor</strong>.351 */352 /* private GShellProgressMonitor getCopyProgress() {353 return copy_monitor;354 } */355 356 /** Method to acquire the progress monitor associated with import.357 * @return The import <strong>GShellProgressMonitor</strong>.358 */359 /* private GShellProgressMonitor getImportProgress() {360 return import_monitor;361 } */362 447 363 448 /** We are informed when this view pane loses focus so we can update build options. */ … … 376 461 document.appendLine(event.getMessage()); 377 462 log_textarea.setCaretPosition(document.getLengthToNearestLine()); 463 } 464 465 /** Called when the detail mode has changed which in turn may cause several import/build configuration arguments to be available/hidden 466 * @param mode the new mode as an int 467 */ 468 public void modeChanged(int mode) { 469 // If we are below the complexity threshold ensure the simple controls are being shown 470 if(Gatherer.config.getMode() < THRESHOLD) { 471 // Update the arguments 472 souter_panel.remove(sargument_configuration_scroll); 473 souter_panel.remove(sinner_panel); 474 if(options_pane != null) { 475 sargument_configuration_panel = options_pane.buildImport(null); 476 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 477 } 478 else { 479 sargument_configuration_panel = new JPanel(); 480 } 481 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 482 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 483 souter_panel.add(sargument_configuration_scroll); 484 souter_panel.add(sinner_panel); 485 // Remove the shared components from the expert panels 486 button_pane.remove(build_button); 487 button_pane.remove(cancel_button); 488 button_pane.remove(preview_button); 489 progress_pane.remove(bar_area); 490 progress_pane.remove(log_scroll); 491 // And add to simple one 492 sbutton_panel.add(build_button); 493 sbutton_panel.add(cancel_button); 494 sbutton_panel.add(preview_button); 495 sinner_panel.add(bar_area, BorderLayout.CENTER); 496 simple_panel.add(log_scroll, BorderLayout.CENTER); 497 // And bring the card to the front 498 card_layout.show(main_pane, SIMPLE); 499 } 500 // And if we are above the threshold change to the complex controls 501 else { 502 // Remove the shared components from the simple panel 503 sbutton_panel.remove(build_button); 504 sbutton_panel.remove(cancel_button); 505 sbutton_panel.remove(preview_button); 506 sinner_panel.remove(bar_area); 507 simple_panel.remove(log_scroll); 508 // And add then to the expert ones 509 button_pane.add(build_button); 510 button_pane.add(cancel_button); 511 button_pane.add(preview_button); 512 progress_pane.add(bar_area, BorderLayout.NORTH); 513 progress_pane.add(log_scroll, BorderLayout.CENTER); 514 // And bring the appropriate card to the front 515 if(!processing) { 516 card_layout.show(main_pane, CONTROL); 517 } 518 else { 519 card_layout.show(main_pane, PROGRESS); 520 } 521 } 522 tree.valueChanged(null); // Ensure tree argument panels are rebuilt 378 523 } 379 524 … … 397 542 document.setSpecialCharacter(OptionsPane.SUCCESSFUL); 398 543 options_pane.resetFileEntry(); 399 card_layout.show(main_pane, CONTROL); 544 build_monitor.reset(); 545 import_monitor.reset(); 546 if(Gatherer.config.getMode() >= THRESHOLD) { 547 card_layout.show(main_pane, CONTROL); 548 } 400 549 } 401 550 // Otherwise its completed import but still got build to go … … 414 563 } 415 564 options_pane.resetFileEntry(); 416 card_layout.show(main_pane, CONTROL); 565 if(Gatherer.config.getMode() >= THRESHOLD) { 566 card_layout.show(main_pane, CONTROL); 567 } 417 568 } 418 569 } … … 457 608 // First we force the build options to be updated if we haven't already. 458 609 tree.valueChanged(null); 610 611 // Remember that for lower thresholds the above doesn't work, so try this instead 612 if(Gatherer.config.getMode() < THRESHOLD) { 613 options_pane.update(sargument_configuration_panel); 614 } 615 459 616 // Now go about building. 460 617 build_button.setEnabled(false); 461 618 cancel_button.setEnabled(true); 462 619 preview_button.setEnabled(false); 463 // Create a new log document and assign it to the two textareas464 620 document = options_pane.createNewLogDocument(); 465 621 log_textarea.setDocument(document); … … 467 623 // Change the view. 468 624 processing = true; 469 card_layout.show(main_pane, PROGRESS); 625 if(Gatherer.config.getMode() >= THRESHOLD) { 626 card_layout.show(main_pane, PROGRESS); 627 } 470 628 // Reset the stop flag in all the process monitors, just incase. 471 629 ((GBuildProgressMonitor)build_monitor).reset(); … … 496 654 processing = false; 497 655 document.setSpecialCharacter(OptionsPane.CANCELLED); 498 card_layout.show(main_pane, CONTROL); 656 if(Gatherer.config.getMode() >= THRESHOLD) { 657 card_layout.show(main_pane, CONTROL); 658 } 499 659 // Set the stop flag in all the process monitor. 500 660 build_monitor.setStop(true); 661 build_monitor.reset(); 501 662 copy_monitor.setStop(true); 502 663 import_monitor.setStop(true); 664 import_monitor.reset(); 503 665 // Set removeold automatically. 504 666 Gatherer.c_man.getCollection().build_options.setImportValue("removeold", true, null); … … 591 753 } 592 754 if(node != null && node.equals(building)) { 593 previous_pane = options_pane.buildBuild( );755 previous_pane = options_pane.buildBuild(null); 594 756 scroll_pane = new JScrollPane(previous_pane); 595 757 right.add(scroll_pane, BorderLayout.CENTER); … … 597 759 } 598 760 else if(node != null && node.equals(importing)) { 599 previous_pane = options_pane.buildImport( );761 previous_pane = options_pane.buildImport(null); 600 762 scroll_pane = new JScrollPane(previous_pane); 601 763 right.add(scroll_pane, BorderLayout.CENTER); -
trunk/gli/src/org/greenstone/gatherer/gui/Filter.java
r6051 r6389 72 72 private DragTree tree = null; 73 73 /** The default size for the label. */ 74 static final private Dimension SIZE = new Dimension(100, 25);74 static final private Dimension SIZE = new Dimension(100,30); 75 75 /** Preprogrammed default filters. */ 76 76 static final private String DEFAULTS[] = {"^.*\\.html?$", "^.*\\.xml$", "^.*\\.txt$", "(^.*\\.jpe?g$)|(^.*\\.png$)|(^.*\\.gif$)|(^.*\\.bmp$)|(^.*\\.tif$)"}; … … 97 97 this.tree = tree; 98 98 // Create components. 99 combobox = new GComboBox( );99 combobox = new GComboBox(true); 100 100 combobox.add(new Entry()); 101 101 for(int i = 0; i < DEFAULTS.length; i++) { … … 108 108 } 109 109 } 110 combobox.setEditable(true);111 110 label = new JLabel(); 112 111 label.setPreferredSize(SIZE); … … 153 152 combobox.setSelectedItem(selection); 154 153 ignore = false; 154 } 155 156 /** Sets whether this combobox is editable or not 157 * @param value true to make the control editable, false otherwise 158 */ 159 public void setEditable(boolean value) { 160 combobox.setEditable(value); 155 161 } 156 162 -
trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java
r6321 r6389 45 45 /** 46 46 * @author John Thompson, Greenstone Digital Library, University of Waikato 47 * @version 47 * @version 2.3 48 48 */ 49 49 public class GComboBox … … 175 175 super.setEditable(editable); 176 176 this.editable = editable; 177 setEditor(new Editor()); 178 setRenderer(new Renderer()); 177 if(editable) { 178 this.setBackground(editable_background); 179 this.setForeground(editable_foreground); 180 } 181 else { 182 this.setBackground(background); 183 this.setForeground(foreground); 184 } 185 setEditor(new Editor()); 186 setRenderer(new Renderer()); 187 updateUI(); 179 188 } 180 189 … … 201 210 ComboBoxModel old_model = (ComboBoxModel) getModel(); 202 211 setModel(model); 212 setOpaque(true); 203 213 // Restore any data given into our model 204 214 for(int i = 0; i < old_model.getSize(); i++) { … … 226 236 setBorder(BorderFactory.createLoweredBevelBorder()); 227 237 setEditor(new Editor()); 228 setOpaque(true);229 238 setRenderer(new Renderer()); 230 239 } … … 234 243 implements ComboBoxEditor { 235 244 public Editor() { 236 setBackground(editable_background);237 setForeground(editable_foreground);238 245 setOpaque(true); 239 246 if(editable) { 240 setSelectionColor(selection_background); 241 setSelectedTextColor(selection_foreground); 242 } 247 setBackground(editable_background); 248 setForeground(editable_foreground); 249 } 250 else { 251 setBackground(background); 252 setForeground(foreground); 253 } 254 setSelectionColor(selection_background); 255 setSelectedTextColor(selection_foreground); 243 256 } 244 257 … … 301 314 public Renderer() { 302 315 super(""); 303 this.setBackground(background);304 this.setForeground(foreground);305 316 this.setOpaque(true); 306 317 } … … 312 323 this.setText(""); 313 324 } 314 if(editable) { 325 if(isSelected) { 326 this.setBackground(selection_background); 327 this.setForeground(selection_foreground); 328 } 329 else if(editable) { 315 330 this.setBackground(editable_background); 316 331 this.setForeground(editable_foreground); -
trunk/gli/src/org/greenstone/gatherer/gui/GConfigPane.java
r5658 r6389 104 104 } 105 105 } 106 107 /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching) 108 * @param mode the mode level as an int 109 */ 110 public void modeChanged(int mode) { 111 cdm.modeChanged(mode); 112 } 106 113 107 114 public Rectangle setSelectedElement(ElementWrapper element) { -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r6220 r6389 74 74 import org.greenstone.gatherer.gui.tree.WorkspaceTree; 75 75 import org.greenstone.gatherer.help.HelpFrame; 76 import org.greenstone.gatherer.mem.MetadataEditorManager; 76 77 import org.greenstone.gatherer.msm.ElementWrapper; 77 78 import org.greenstone.gatherer.msm.Metadata; … … 392 393 } 393 394 395 public void destroy() { 396 // Destroying create pane ensures the latest log has been closed 397 if(create_pane != null) { 398 create_pane.destroy(); 399 } 400 } 401 394 402 /** Enabled events on the window to be trapped, creates all the visual components, then builds the tab and other layouts. 395 403 */ … … 511 519 } 512 520 else { 513 if(help != null) { 521 // Deal to help 522 if(help != null) { 514 523 help.destroy(); 515 524 help = null; 516 525 } 517 526 Gatherer.self.exit(); 518 527 } … … 547 556 int config_pos = tab_pane.indexOfComponent(config_pane); 548 557 tab_pane.setEnabledAt(config_pos, !lock); 558 } 559 } 560 561 public void modeChanged(int mode) { 562 // Set the title 563 String collection_title = null; 564 String collection_name = null; 565 if (Gatherer.c_man.ready()) { 566 Collection collection = Gatherer.c_man.getCollection(); 567 collection_title = collection.getTitle(); 568 collection_name = collection.getName(); 569 collection = null; 570 } 571 setTitle(collection_title, collection_name); 572 collection_title = null; 573 collection_name = null; 574 // Now pass on the message to anyone who cares 575 if(collection_pane != null) { 576 collection_pane.modeChanged(mode); 577 } 578 if(config_pane != null) { 579 config_pane.modeChanged(mode); 580 } 581 if(create_pane != null) { 582 create_pane.modeChanged(mode); 583 } 584 if(metaedit_pane != null) { 585 metaedit_pane.modeChanged(mode); 549 586 } 550 587 } … … 615 652 // Finally display the collection name in the title bar. 616 653 StringBuffer title_buffer = new StringBuffer(Utility.PROGRAM_NAME); 617 title_buffer.append(StaticStrings.COLON_CHARACTER);618 654 title_buffer.append(StaticStrings.SPACE_CHARACTER); 655 title_buffer.append(StaticStrings.SPACE_CHARACTER); 656 // Describe the current user mode 657 title_buffer.append(StaticStrings.MODE_STR); 658 title_buffer.append(Gatherer.config.getModeAsString()); 659 title_buffer.append(StaticStrings.SPACE_CHARACTER); 660 title_buffer.append(StaticStrings.SPACE_CHARACTER); 661 // Now for the current collection 662 title_buffer.append(StaticStrings.COLLECTION_STR); 619 663 if (title != null && name != null) { 620 664 title_buffer.append(title); … … 635 679 public void showEditMetadataBox() { 636 680 if(Gatherer.c_man.getCollection() != null) { 637 Gatherer.c_man.getCollection().msm.editMDS( );681 Gatherer.c_man.getCollection().msm.editMDS(null, MetadataEditorManager.NORMAL); 638 682 } 639 683 } … … 964 1008 } 965 1009 if(config_pos != -1) { 966 tab_pane.setEnabledAt(config_pos, ready && Gatherer.config.get("workflow.design", false) );1010 tab_pane.setEnabledAt(config_pos, ready && Gatherer.config.get("workflow.design", false) && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE); 967 1011 } 968 1012 if(export_pos != -1) { … … 994 1038 } 995 1039 } 1040 1041 -
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r6318 r6389 46 46 import javax.swing.table.*; 47 47 import javax.swing.tree.*; 48 import org.greenstone.gatherer.Configuration; 48 49 import org.greenstone.gatherer.Dictionary; 49 50 import org.greenstone.gatherer.Gatherer; … … 140 141 * @param tree_sync The <strong>TreeSynchronizer</strong> to be used on the collection tree 141 142 * @see org.greenstone.gatherer.Configuration 142 * @see org.greenstone.gatherer.gui.table.GTable 143 * @see org.greenstone.gatherer.valuetree.GValueTree 143 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 144 144 */ 145 145 public MetaEditPane(TreeSynchronizer tree_sync) … … 190 190 * @param event An <strong>ActionEvent</strong> containing information about the event. 191 191 * @see org.greenstone.gatherer.collection.CollectionManager 192 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 192 193 * @see org.greenstone.gatherer.gui.table.GTableModel 193 194 * @see org.greenstone.gatherer.msm.ElementWrapper 194 195 * @see org.greenstone.gatherer.msm.MetadataSetManager 195 196 * @see org.greenstone.gatherer.msm.MSMEvent 196 * @see org.greenstone.gatherer.valuetree.GValueTree197 197 */ 198 198 public void actionPerformed(ActionEvent event) { … … 317 317 * @param ready <i>true</i> if there is a collection currently ready to be editing, <i>false</i> otherwise. 318 318 * @see org.greenstone.gatherer.collection.CollectionManager 319 * @see org.greenstone.gatherer.collection.CollectionModel320 * @see org.greenstone.gatherer.tree.GTree321 319 * @see org.greenstone.gatherer.util.TreeSynchronizer 322 320 */ … … 358 356 * @see org.greenstone.gatherer.Gatherer 359 357 * @see org.greenstone.gatherer.collection.CollectionManager 360 * @see org.greenstone.gatherer.collection.CollectionModel361 358 * @see org.greenstone.gatherer.file.FileOpenActionListener 362 359 * @see org.greenstone.gatherer.gui.Filter 363 360 * @see org.greenstone.gatherer.gui.GComboBox 364 361 * @see org.greenstone.gatherer.gui.table.GTableModel 365 * @see org.greenstone.gatherer.tree.GTree366 * @see org.greenstone.gatherer.tree.GTreeModel367 * @see org.greenstone.gatherer.valuetree.GValueTree368 362 */ 369 363 public void display() { … … 403 397 filter = Gatherer.g_man.getFilter(collection_tree); 404 398 filter.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); 405 // Change the default colours of this filters combobox. 406 GComboBox fcb = filter.getComboBox(); 407 fcb.setBackgroundNonSelectionColor(Color.white); 408 fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.collection_tree_foreground", false)); 409 fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 410 fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 411 Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip"); 412 fcb = null; 399 filter.setEditable(Gatherer.config.getMode() > Configuration.LIBRARIAN_MODE); 400 Dictionary.registerTooltip(filter.getComboBox(), "Collection.Filter_Tooltip"); 413 401 414 402 // Connection … … 584 572 /** Ensures a certain tree path is expanded, visible and selected within the collection tree. 585 573 * @param path The <strong>TreePath</strong> to make visible. 586 * @see org.greenstone.gatherer. tree.GTree574 * @see org.greenstone.gatherer.gui.tree.DragTree 587 575 */ 588 576 private void expandPath(TreePath path) { … … 591 579 } 592 580 /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab. 593 * @see org.greenstone.gatherer. tree.GTree581 * @see org.greenstone.gatherer.gui.tree.DragTree 594 582 */ 595 583 public void gainFocus() { … … 630 618 */ 631 619 public void metadataChanged(MSMEvent event) {} 620 621 /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching) 622 * @param mode the mode level as an int 623 */ 624 public void modeChanged(int mode) { 625 filter.setEditable(mode > Configuration.LIBRARIAN_MODE); 626 } 632 627 633 628 public void refreshTrees() { … … 717 712 * @param event The <strong>ListSelectionEvent</strong> which contains all the information about the event that has been fired. 718 713 * @see org.greenstone.gatherer.gui.table.GTableModel 719 * @see org.greenstone.gatherer. valuetree.GValueTree714 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 720 715 */ 721 716 public void valueChanged(ListSelectionEvent event) { … … 750 745 * @param event A <strong>TreeSelectionEvent</strong> containing information about the event. 751 746 * @see org.greenstone.gatherer.Gatherer 752 * @see org.greenstone.gatherer. collection.FileNode747 * @see org.greenstone.gatherer.file.FileNode 753 748 * @see org.greenstone.gatherer.gui.GUIManager 754 749 * @see org.greenstone.gatherer.gui.MenuBar 755 750 * @see org.greenstone.gatherer.gui.table.GTableModel 756 751 * @see org.greenstone.gatherer.msm.MetadataSetManager 757 * @see org.greenstone.gatherer. tree.GTree752 * @see org.greenstone.gatherer.gui.tree.DragTree 758 753 * @see org.greenstone.gatherer.util.ArrayTools 759 754 */ -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r6321 r6389 44 44 import javax.swing.event.*; 45 45 import javax.swing.text.*; 46 import org.greenstone.gatherer.Configuration; 46 47 import org.greenstone.gatherer.Dictionary; 47 48 import org.greenstone.gatherer.Gatherer; … … 69 70 static final public char UNKNOWN = 'x'; 70 71 72 static private int BUILD = 0; 73 static private int IMPORT = 1; 74 static private int MINIMUM_ROWS = 11; 75 static private Dimension LABEL_SIZE = new Dimension(180, 25); 76 static private Dimension ROW_SIZE = new Dimension(610, 30); 77 static private Dimension SPINNER_SIZE = new Dimension(100, 25); 78 static private String DESCRIPTION_SEP = " + "; 79 71 80 /** All process messages are written to this log text area. */ 72 81 public JTextArea log_textarea = null; … … 85 94 private Vector writing_documents; 86 95 87 static private int BUILD = 0;88 static private int IMPORT = 1;89 static private Dimension LABEL_SIZE = new Dimension(180, 25);90 static private Dimension ROW_SIZE = new Dimension(610, 25);91 static private Dimension SPINNER_SIZE = new Dimension(100, 25);92 static private String DESCRIPTION_SEP = " + ";93 94 96 95 97 /** The default constructor creates the few session length options, but either retrieves the rest from the current collection, or creates a default set of options. */ … … 105 107 106 108 /** This method creates the panel with all the build only options on it. 107 * @return A <strong>JPanel</strong> which can be used to display all the build only options. 109 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together 110 * @return a JPanel which can be used to display all the build only options 111 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE 112 * @see org.greenstone.gatherer.Configuration#getColor 113 * @see org.greenstone.gatherer.Configuration#getMode 114 * @see org.greenstone.gatherer.Gatherer#config 115 * @see org.greenstone.gatherer.cdm.Argument 116 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgument 117 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgumentCount 118 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValue 119 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValueEnabled 120 * @see org.greenstone.gatherer.gui.OptionsPane#ArgumentControl 108 121 */ 109 public JPanel buildBuild() { 110 current_controls.clear(); 111 JPanel pane = new JPanel(); 112 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 113 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 114 int build_argument_count = build_options.getBuildArgumentCount(); 115 pane.setLayout(new GridLayout(build_argument_count, 1, 5, 5)); 116 for(int i = 0; i < build_argument_count; i++) { 122 public JPanel buildBuild(JPanel pane) { 123 // Reset the arguments 124 if(pane == null) { 125 current_controls.clear(); 126 } 127 ArrayList build_arguments = new ArrayList(); 128 int current_mode = Gatherer.config.getMode(); 129 int total_build_argument_count = build_options.getBuildArgumentCount(); 130 for(int i = 0; i < total_build_argument_count; i++) { 117 131 // Retrieve the argument so we know how to format the control. 118 132 Argument argument = build_options.getBuildArgument(i); 119 // Now attempt to retrieve any existing value for this argument. 120 boolean enabled = build_options.getBuildValueEnabled(argument.getName()); 121 String value = build_options.getBuildValue(argument.getName()); 122 ArgumentControl argument_control = new ArgumentControl(BUILD, argument, enabled, value); 123 pane.add(argument_control); 124 current_controls.add(argument_control); 133 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) { 134 // Now attempt to retrieve any existing value for this argument. 135 boolean enabled = build_options.getBuildValueEnabled(argument.getName()); 136 String value = build_options.getBuildValue(argument.getName()); 137 ArgumentControl argument_control = new ArgumentControl(BUILD, argument, enabled, value); 138 build_arguments.add(argument_control); 139 } 140 } 141 current_controls.addAll(build_arguments); 142 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments. 143 if(pane == null || current_mode >= Configuration.EXPERT_MODE) { 144 pane = new JPanel(); 145 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 146 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 147 int argument_count = build_arguments.size(); 148 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number or lines in the grid layout 149 if(current_mode >= Configuration.EXPERT_MODE) { 150 if(argument_count < MINIMUM_ROWS) { 151 argument_count = MINIMUM_ROWS; 152 } 153 pane.setLayout(new GridLayout(argument_count, 1, 5, 5)); 154 } 155 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway 156 else { 157 pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); 158 } 159 } 160 for(int j = 0; j < build_arguments.size(); j++) { 161 pane.add((JComponent)build_arguments.get(j)); 125 162 } 126 163 pane.addMouseListener(this); 164 build_arguments = null; 127 165 return pane; 128 166 } 167 129 168 /** This method creates the panel with all the import only options on it. 130 * @return A <strong>JPanel</strong> which can be used to display all the import only options. 169 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together 170 * @return a JPanel which can be used to display all the build only options 171 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE 172 * @see org.greenstone.gatherer.Configuration#getColor 173 * @see org.greenstone.gatherer.Configuration#getMode 174 * @see org.greenstone.gatherer.Gatherer#config 175 * @see org.greenstone.gatherer.cdm.Argument 176 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgument 177 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgumentCount 178 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValue 179 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValueEnabled 180 * @see org.greenstone.gatherer.gui.OptionsPane#ArgumentControl 131 181 */ 132 public JPanel buildImport() { 133 current_controls.clear(); 134 JPanel pane = new JPanel(); 135 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 136 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 137 int import_argument_count = build_options.getImportArgumentCount(); 138 pane.setLayout(new GridLayout(import_argument_count, 1, 5, 5)); 139 for(int i = 0; i < import_argument_count; i++) { 182 public JPanel buildImport(JPanel pane) { 183 // Reset the arguments 184 if(pane == null) { 185 current_controls.clear(); 186 } 187 ArrayList import_arguments = new ArrayList(); 188 int current_mode = Gatherer.config.getMode(); 189 int total_import_argument_count = build_options.getImportArgumentCount(); 190 for(int i = 0; i < total_import_argument_count; i++) { 140 191 // Retrieve the argument so we know how to format the control. 141 192 Argument argument = build_options.getImportArgument(i); 142 // Now attempt to retrieve any existing value for this argument. 143 boolean enabled = build_options.getImportValueEnabled(argument.getName()); 144 String value = build_options.getImportValue(argument.getName()); 145 ArgumentControl argument_control = new ArgumentControl(IMPORT, argument, enabled, value); 146 pane.add(argument_control); 147 current_controls.add(argument_control); 193 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) { 194 // Now attempt to retrieve any existing value for this argument. 195 boolean enabled = build_options.getImportValueEnabled(argument.getName()); 196 String value = build_options.getImportValue(argument.getName()); 197 ArgumentControl argument_control = new ArgumentControl(IMPORT, argument, enabled, value); 198 import_arguments.add(argument_control); 199 } 200 } 201 current_controls.addAll(import_arguments); 202 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments. 203 if(pane == null || current_mode >= Configuration.EXPERT_MODE) { 204 pane = new JPanel(); 205 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 206 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 207 int argument_count = import_arguments.size(); 208 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number or lines in the grid layout 209 if(current_mode >= Configuration.EXPERT_MODE) { 210 if(argument_count < MINIMUM_ROWS) { 211 argument_count = MINIMUM_ROWS; 212 } 213 pane.setLayout(new GridLayout(argument_count, 1, 5, 5)); 214 } 215 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway 216 else { 217 pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); 218 } 219 } 220 for(int j = 0; j < import_arguments.size(); j++) { 221 pane.add((JComponent)import_arguments.get(j)); 148 222 } 149 223 pane.addMouseListener(this); 224 import_arguments = null; 150 225 return pane; 151 226 } 227 152 228 /** This method is used to build a panel based on the message log, which is nothing like any of the other panels. 153 229 * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log. … … 322 398 setLayout(new BorderLayout()); 323 399 setPreferredSize(ROW_SIZE); 400 setMaximumSize(ROW_SIZE); 324 401 325 402 // Try to determine what the value_controls value should be. … … 425 502 value_control = textfield; 426 503 break; 504 case Argument.METADATUM: 505 GComboBox gcombobox = new GComboBox(Gatherer.c_man.getCollection().msm.getAssignedElements(), false); 506 gcombobox.setEnabled(enable); 507 // Now ensure we have the existing value or default value selected if either exist. 508 if(value != null) { 509 boolean found = selectValue(gcombobox, value); 510 // Its possible that this is a custom value and so doesn't exist in the combobox. If so add it and then select it 511 if(!found) { 512 gcombobox.addItem(value); 513 gcombobox.setSelectedItem(value); 514 } 515 } 516 add(gcombobox, BorderLayout.CENTER); 517 value_control = gcombobox; 518 break; 427 519 } 428 520 … … 454 546 } 455 547 548 /** Method to ensure that a certain value is selected, if it exists within that combobox to begin with. 549 * @param combobox the JComboBox whose selection we are trying to preset 550 * @param target The desired value of the selection as a String 551 * @return true if the item was found and selected, false otherwise 552 */ 553 public boolean selectValue(JComboBox combobox, String target) { 554 for(int i = 0; i < combobox.getItemCount(); i++) { 555 if(combobox.getItemAt(i).toString().equals(target)) { 556 combobox.setSelectedIndex(i); 557 return true; 558 } 559 } 560 return false; 561 } 562 456 563 /** Update the values stored in the collection so as to rememebr the current state of this argument. */ 457 564 public void update() { … … 472 579 } 473 580 else if(value_control instanceof JComboBox) { 474 value = ( String) ((JComboBox)value_control).getSelectedItem();475 } 476 581 value = (((JComboBox)value_control).getSelectedItem()).toString(); 582 } 583 // If this argument was a flag, but is now disabled, remove from the build options altogether 477 584 if(!enable && value == null) { 478 585 if(type == BUILD) { … … 483 590 } 484 591 } 485 592 // Otherwise update the argument value 486 593 else { 487 594 if(type == BUILD) { … … 638 745 public void valueChanged(ListSelectionEvent e) { 639 746 if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one) 747 ///ystem.err.println("Log change detected."); 640 748 JList source = (JList)e.getSource(); 641 749 file_entry = (FileEntry) source.getSelectedValue(); 642 750 // First we determine if the old log has been completely written to file 643 751 Document document = log_textarea.getDocument(); 644 if(document instanceof AppendLineOnlyFileDocument) { 645 AppendLineOnlyFileDocument append_line_only_file_document = (AppendLineOnlyFileDocument) document; 752 ///ystem.err.println(" * current document: " + document); 753 ///ystem.err.println(" * new document: " + file_entry.getDocument()); 754 // If we are dealing with the same document don't do anything. 755 if(document != file_entry.getDocument()) { 756 if(document instanceof AppendLineOnlyFileDocument) { 757 AppendLineOnlyFileDocument append_line_only_file_document = (AppendLineOnlyFileDocument) document; 646 758 if(append_line_only_file_document.isStillWriting()) { 759 ///ystem.err.println("Current log is still active... finishing."); 647 760 writing_documents.add(append_line_only_file_document); // We have to maintain a reference until they are all done. 648 761 append_line_only_file_document.setOwner(OptionsPane.this); 649 762 append_line_only_file_document.setExit(); 650 763 } 651 } 652 // Load the new log 653 log_textarea.setDocument(file_entry.getDocument()); 764 else { 765 ///ystem.err.println("Current log is complete. Nothing to do."); 766 } 767 } 768 // Load the new log 769 log_textarea.setDocument(file_entry.getDocument()); 770 } 654 771 } 655 772 } -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r6319 r6389 76 76 private JLabel recursion_depth_label; 77 77 private JLabel title_label; 78 private JRadioButton assistant_mode_radio_button; 79 private JRadioButton expert_mode_radio_button; 80 private JRadioButton librarian_mode_radio_button; 81 private JRadioButton systems_mode_radio_button; 82 private JSpinner proxy_port_field; 83 private JSpinner recursion_depth_spinner; 78 84 private JTabbedPane tab_pane; 85 private JTextArea mode_description_textarea; 79 86 private JTextField library_path_field; 80 87 private JTextField proxy_host_field; 81 private JSpinner proxy_port_field;82 private JSpinner recursion_depth_spinner;83 88 private Preferences self; 84 89 85 static final Dimension LABEL_SIZE = new Dimension( 175, 25);90 static final Dimension LABEL_SIZE = new Dimension(240, 25); 86 91 static final Dimension ROW_SIZE = new Dimension(640, 25); 87 92 static final Dimension SIZE = new Dimension(640, 345); … … 101 106 JPanel general_preferences = createGeneralPreferences(); 102 107 tab_pane.add("Preferences.General", general_preferences); 108 tab_pane.add("Preferences.Mode", createModePreferences()); 103 109 tab_pane.add("Preferences.Workflow", createWorkflowPreferences()); 104 110 tab_pane.add("Preferences.Connection", createConnectionPreferences()); … … 330 336 } 331 337 338 /** Generate the controls for altering the detail mode. 339 * @return a JPanel of controls 340 */ 341 private JPanel createModePreferences() { 342 // Create Controls 343 JPanel mode_panel = new JPanel(); 344 JPanel button_panel = new JPanel(); 345 ButtonGroup mode_button_group = new ButtonGroup(); 346 assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant")); 347 assistant_mode_radio_button.setOpaque(false); 348 mode_button_group.add(assistant_mode_radio_button); 349 expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert")); 350 expert_mode_radio_button.setOpaque(false); 351 mode_button_group.add(expert_mode_radio_button); 352 librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian")); 353 librarian_mode_radio_button.setOpaque(false); 354 mode_button_group.add(librarian_mode_radio_button); 355 systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems")); 356 systems_mode_radio_button.setOpaque(false); 357 mode_button_group.add(systems_mode_radio_button); 358 mode_description_textarea = new JTextArea(); 359 mode_description_textarea.setEditable(false); 360 mode_description_textarea.setLineWrap(true); 361 mode_description_textarea.setWrapStyleWord(true); 362 // Determine which value is already selected 363 switch(Gatherer.config.getMode()) { 364 case Configuration.ASSISTANT_MODE: 365 assistant_mode_radio_button.setSelected(true); 366 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description")); 367 break; 368 case Configuration.SYSTEMS_MODE: 369 systems_mode_radio_button.setSelected(true); 370 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description")); 371 break; 372 case Configuration.EXPERT_MODE: 373 expert_mode_radio_button.setSelected(true); 374 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description")); 375 break; 376 default: 377 librarian_mode_radio_button.setSelected(true); 378 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description")); 379 } 380 // Connection - when a radio button is selected we have to change the description 381 ModeRadioButtonListener listener = new ModeRadioButtonListener(); 382 assistant_mode_radio_button.addActionListener(listener); 383 expert_mode_radio_button.addActionListener(listener); 384 librarian_mode_radio_button.addActionListener(listener); 385 systems_mode_radio_button.addActionListener(listener); 386 listener = null; 387 // Layout 388 button_panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 389 button_panel.setLayout(new GridLayout(4,1,2,2)); 390 button_panel.add(assistant_mode_radio_button); 391 button_panel.add(librarian_mode_radio_button); 392 button_panel.add(systems_mode_radio_button); 393 button_panel.add(expert_mode_radio_button); 394 395 mode_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 396 mode_panel.setLayout(new BorderLayout()); 397 mode_panel.add(button_panel, BorderLayout.NORTH); 398 mode_panel.add(new JScrollPane(mode_description_textarea), BorderLayout.CENTER); 399 400 return mode_panel; 401 } 402 332 403 /** The warning preferences are controlled through a checklist. */ 333 404 private JPanel createWarningPreferences() { … … 504 575 Gatherer.config.setInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC, ((Integer)recursion_depth_spinner.getValue()).intValue()); 505 576 577 // Mode preferences 578 int current_mode = Gatherer.config.getMode(); 579 int new_mode; 580 if(assistant_mode_radio_button.isSelected()) { 581 new_mode = Configuration.ASSISTANT_MODE; 582 } 583 else if(systems_mode_radio_button.isSelected()) { 584 new_mode = Configuration.SYSTEMS_MODE; 585 } 586 else if(expert_mode_radio_button.isSelected()) { 587 new_mode = Configuration.EXPERT_MODE; 588 } 589 else { 590 new_mode = Configuration.LIBRARIAN_MODE; 591 } 592 // If there has been a change in modes, update the config, and also inform the persistant gui views that have a need to know 593 if(new_mode != current_mode) { 594 Gatherer.config.setMode(new_mode); 595 Gatherer.c_man.getCollection().cdm.modeChanged(new_mode); 596 Gatherer.g_man.modeChanged(new_mode); 597 } 506 598 // Warning preferences 507 599 for(int i = 0; i < warning_preferences_check_list.getEntryCount(); i++) { … … 522 614 Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected()); 523 615 Gatherer.g_man.workflowUpdate("Enrich", workflow_enrich.isSelected()); 524 Gatherer.g_man.workflowUpdate("Design", workflow_design.isSelected());616 Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE)); 525 617 Gatherer.g_man.workflowUpdate("Export", workflow_export.isSelected()); 526 618 Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected()); … … 568 660 return locale.getDisplayName(); 569 661 } 662 } 663 } 664 665 /** This listener updates the mode description depending on what mode is selected. */ 666 private class ModeRadioButtonListener 667 implements ActionListener { 668 public void actionPerformed(ActionEvent event) { 669 Object source = event.getSource(); 670 if(source == assistant_mode_radio_button) { 671 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description")); 672 } 673 else if(source == expert_mode_radio_button) { 674 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description")); 675 } 676 else if(source == systems_mode_radio_button) { 677 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description")); 678 } 679 else { 680 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description")); 681 } 682 source = null; 570 683 } 571 684 }
Note:
See TracChangeset
for help on using the changeset viewer.