- Timestamp:
- 2009-01-12T11:40:15+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r18297 r18364 69 69 static final public char CANCELLED = 'c'; 70 70 static final public char UNKNOWN = 'x'; 71 static final public char SCHEDULED = 'd'; 71 72 72 73 static private int BUILD = 0; 73 74 static private int IMPORT = 1; 74 static private int MINIMUM_ROWS = 11; 75 static private int SCHEDULE = 2; 76 static private int MINIMUM_ROWS = 15; 75 77 76 78 /** All process messages are written to this log text area. */ … … 82 84 private ScriptOptions build_options = null; 83 85 private ScriptOptions import_options = null; 86 private ScriptOptions schedule_options = null; 84 87 85 88 private FileEntry file_entry = null; … … 93 96 94 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. */ 95 public OptionsPane(ScriptOptions import_options, ScriptOptions build_options ) {98 public OptionsPane(ScriptOptions import_options, ScriptOptions build_options, ScriptOptions schedule_options) { 96 99 this.build_options = build_options; 97 100 this.import_options = import_options; 101 this.schedule_options = schedule_options; 98 102 this.current_controls = new ArrayList(); 99 103 this.writing_documents = new Vector(); … … 175 179 build_arguments = null; 176 180 return pane; 181 } 182 183 /**Wendy's attempt at writing a buildSchedule Jpanel. */ 184 public JPanel buildSchedule(JPanel pane) { 185 //reset the arguments 186 if(pane == null) { 187 current_controls.clear(); 188 } 189 190 ArrayList schedule_arguments = new ArrayList(); 191 int current_mode = Configuration.getMode(); 192 193 int total_schedule_argument_count = schedule_options.getArgumentCount(); 194 195 for(int i = 0; i < total_schedule_argument_count; i++) { 196 // Retrieve the argument so we know how to format the control. 197 Argument argument = schedule_options.getArgument(i); 198 199 //A hack to make the disable_OAI option visible in the GLI for Greenstone 3 200 if(argument.getName().equals(StaticStrings.DISABLEOAI_STR) && Gatherer.GS3) { 201 argument.setHiddenGLI(false); 202 } 203 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) { 204 // Now attempt to retrieve any existing value for this argument. 205 boolean enabled = schedule_options.getValueEnabled(argument.getName()); 206 String value = schedule_options.getValue(argument.getName()); 207 MyArgumentControl argument_control = new MyArgumentControl(SCHEDULE, argument, enabled, value); 208 schedule_arguments.add(argument_control); 209 } 210 } 211 current_controls.addAll(schedule_arguments); 212 213 // 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. 214 if(pane == null || current_mode >= Configuration.EXPERT_MODE) { 215 pane = new JPanel(); 216 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 217 pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false)); 218 int argument_count = schedule_arguments.size(); 219 // 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 of lines in the grid layout 220 if(current_mode >= Configuration.EXPERT_MODE) { 221 if(argument_count < MINIMUM_ROWS) { 222 argument_count = MINIMUM_ROWS; 223 } 224 pane.setLayout(new GridLayout(argument_count, 1, 5, 5)); 225 } 226 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway 227 else { 228 // use GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will 229 // grow fat if space too large, but we don't know how many rows we'll need yet. 230 pane.setLayout(new GridLayout(0, 1, 5, 5)); 231 } 232 } 233 234 for(int j = 0; j < schedule_arguments.size(); j++) { 235 pane.add((JComponent)schedule_arguments.get(j)); 236 } 237 pane.addMouseListener(this); 238 schedule_arguments = null; 239 return pane; 240 177 241 } 178 242 … … 422 486 build_options.removeValue(name); 423 487 } 488 else if(type == SCHEDULE) { 489 schedule_options.removeValue(name); 490 } 424 491 else { 425 492 import_options.removeValue(name); … … 430 497 if(type == BUILD) { 431 498 build_options.setValue(name, enable, value); 499 } 500 else if(type == SCHEDULE) { 501 schedule_options.setValue(name, enable, value); 432 502 } 433 503 else { … … 523 593 case CANCELLED: 524 594 d.append(Dictionary.get("OptionsPane.Cancelled")); 595 break; 596 case SCHEDULED: 597 d.append(Dictionary.get("OptionsPane.Scheduled")); 525 598 break; 526 599 default:
Note:
See TracChangeset
for help on using the changeset viewer.