Changeset 5527 for trunk/gli/src/org/greenstone/gatherer/Dictionary.java
- Timestamp:
- 2003-09-23T14:58:18+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Dictionary.java
r5497 r5527 311 311 SwingUtilities.invokeLater(task); 312 312 } 313 313 // Register if necessary 314 314 if(!already_registered) { 315 315 put(component, args); … … 320 320 public void register(JDialog component, String[] args, boolean already_registered) { 321 321 if(component != null) { 322 322 // Determine the key 323 323 String key = ""; 324 324 if(!already_registered) { … … 328 328 key = args[args.length - 1]; 329 329 } 330 330 // Update the component using the AWTEvent queue 331 331 String value = get(key, args); 332 332 ChangeTask task = new JDialogChangeTask(component, key, value); 333 333 SwingUtilities.invokeLater(task); 334 334 // Register as necessary 335 335 if(!already_registered) { 336 336 args = ArrayTools.add(args, key); … … 342 342 public void register(JFrame component, String[] args, boolean already_registered) { 343 343 if(component != null) { 344 344 // Determine the key 345 345 String key = ""; 346 346 if(!already_registered) { … … 350 350 key = args[args.length - 1]; 351 351 } 352 352 // Update the component using the AWTEvent queue 353 353 String value = get(key, args); 354 354 ChangeTask task = new JFrameChangeTask(component, key, value); 355 355 SwingUtilities.invokeLater(task); 356 356 // Register as necessary 357 357 if(!already_registered) { 358 358 args = ArrayTools.add(args, key); … … 364 364 public void register(JLabel component, String[] args, boolean already_registered) { 365 365 if(component != null) { 366 366 // Determine the key 367 367 String key = ""; 368 368 if(!already_registered) { … … 372 372 key = args[args.length - 1]; 373 373 } 374 374 // Update the component using the AWTEvent queue 375 375 String value = get(key, args); 376 376 ChangeTask task = new JLabelChangeTask(component, key, value); 377 377 SwingUtilities.invokeLater(task); 378 378 // Register as necessary 379 379 if(!already_registered) { 380 380 args = ArrayTools.add(args, key); … … 386 386 public void register(JTabbedPane component, String[] args, boolean already_registered) { 387 387 if(component != null) { 388 388 // If not already registered then args will be null. 389 389 if(!already_registered) { 390 390 args = new String[component.getTabCount()]; 391 391 } 392 392 // Iterate through the tabbed panes tabs, updating values and recording the original key of each item in args. 393 393 for(int i = 0; i < args.length; i++) { 394 if (args[i] == null) {394 if (args[i] == null) { 395 395 args[i] = component.getTitleAt(i); 396 396 } … … 400 400 SwingUtilities.invokeLater(task); 401 401 } 402 // Register if necessary 403 if(!already_registered) { 404 put(component, args); 405 } 406 } 407 } 402 // Register if necessary 403 if(!already_registered) { 404 put(component, args); 405 } 406 } 407 } 408 408 409 /** Register a text component. */ 409 public void register(JTextComponent component, String[] args, boolean already_registered) { 410 if(component != null) { 411 // Determine the key 410 public void register(JTextComponent component, String[] args, boolean already_registered) 411 { 412 if (component != null) { 413 // Determine the key 412 414 String key = ""; 413 if (!already_registered) {415 if (!already_registered) { 414 416 key = component.getText(); 415 417 } … … 417 419 key = args[args.length - 1]; 418 420 } 419 // Update the component using the AWTEvent queue 421 422 // Update the component using the AWTEvent queue 420 423 String value = get(key, args); 421 424 String tooltip = get(key + "_Tooltip", (String[])null); 422 425 ChangeTask task = new JTextComponentChangeTask(component, key, value, tooltip); 423 426 SwingUtilities.invokeLater(task); 424 425 if (!already_registered) {427 // Register as necessary 428 if (!already_registered) { 426 429 args = ArrayTools.add(args, key); 427 430 put(component, args); … … 429 432 } 430 433 } 434 431 435 /** Register a tree component. */ 432 436 public void register(JTree component, String[] args, boolean already_registered) { 433 437 if(component != null) { 434 438 // Retrieve the tooltip using the components name 435 439 String key = component.getName(); 436 440 String tooltip = get(key + "_Tooltip", (String[])null); 437 441 ChangeTask task = new JTreeChangeTask(component, key, tooltip); 438 442 SwingUtilities.invokeLater(task); 439 443 // A tree can never be previously registered. In otherwords the keys are harvested each time. Thus for a tree to remain consistant its up to the implementer to implement DictionaryTreeNode for the tree nodes! 440 444 ArrayList nodes = new ArrayList(); 441 445 nodes.add(component.getModel().getRoot()); … … 456 460 public void register(TitledBorder component, String[] args, boolean already_registered) { 457 461 if(component != null) { 458 462 // Determine the key 459 463 String key = ""; 460 464 if(!already_registered) { … … 464 468 key = args[args.length - 1]; 465 469 } 466 470 // Update the component using the AWTEvent queue 467 471 String value = get(key, args); 468 472 ChangeTask task = new TitledBorderChangeTask(component, key, value); 469 473 SwingUtilities.invokeLater(task); 470 474 // Register as necessary 471 475 if(!already_registered) { 472 476 args = ArrayTools.add(args, key);
Note:
See TracChangeset
for help on using the changeset viewer.