Ignore:
Timestamp:
2003-09-23T14:58:18+12:00 (21 years ago)
Author:
mdewsnip
Message:

Partway through tooltip assignment. Made lots of little changes, registered a whole lot more components, removed dead code, fixed help links (with SimpleMenuBars). Lots more of the same to come.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Dictionary.java

    r5497 r5527  
    311311        SwingUtilities.invokeLater(task);
    312312        }
    313                 // Register if necessary
     313        // Register if necessary
    314314        if(!already_registered) {
    315315        put(component, args);
     
    320320    public void register(JDialog component, String[] args, boolean already_registered) {
    321321    if(component != null) {
    322                 // Determine the key
     322        // Determine the key
    323323        String key = "";
    324324        if(!already_registered) {
     
    328328        key = args[args.length - 1];
    329329        }
    330                 // Update the component using the AWTEvent queue
     330        // Update the component using the AWTEvent queue
    331331        String value = get(key, args);
    332332        ChangeTask task = new JDialogChangeTask(component, key, value);
    333333        SwingUtilities.invokeLater(task);
    334                 // Register as necessary
     334        // Register as necessary
    335335        if(!already_registered) {
    336336        args = ArrayTools.add(args, key);
     
    342342    public void register(JFrame component, String[] args, boolean already_registered) {
    343343    if(component != null) {
    344                 // Determine the key
     344        // Determine the key
    345345        String key = "";
    346346        if(!already_registered) {
     
    350350        key = args[args.length - 1];
    351351        }
    352                 // Update the component using the AWTEvent queue
     352        // Update the component using the AWTEvent queue
    353353        String value = get(key, args);
    354354        ChangeTask task = new JFrameChangeTask(component, key, value);
    355355        SwingUtilities.invokeLater(task);
    356                 // Register as necessary
     356        // Register as necessary
    357357        if(!already_registered) {
    358358        args = ArrayTools.add(args, key);
     
    364364    public void register(JLabel component, String[] args, boolean already_registered) {
    365365    if(component != null) {
    366                 // Determine the key
     366        // Determine the key
    367367        String key = "";
    368368        if(!already_registered) {
     
    372372        key = args[args.length - 1];
    373373        }
    374                 // Update the component using the AWTEvent queue
     374        // Update the component using the AWTEvent queue
    375375        String value = get(key, args);
    376376        ChangeTask task = new JLabelChangeTask(component, key, value);
    377377        SwingUtilities.invokeLater(task);
    378                 // Register as necessary
     378        // Register as necessary
    379379        if(!already_registered) {
    380380        args = ArrayTools.add(args, key);
     
    386386    public void register(JTabbedPane component, String[] args, boolean already_registered) {
    387387    if(component != null) {
    388                 // If not already registered then args will be null.
     388        // If not already registered then args will be null.
    389389        if(!already_registered) {
    390390        args = new String[component.getTabCount()];
    391391        }
    392                 // Iterate through the tabbed panes tabs, updating values and recording the original key of each item in args.
     392        // Iterate through the tabbed panes tabs, updating values and recording the original key of each item in args.
    393393        for(int i = 0; i < args.length; i++) {
    394         if(args[i] == null) {
     394        if (args[i] == null) {
    395395            args[i] = component.getTitleAt(i);
    396396        }
     
    400400        SwingUtilities.invokeLater(task);
    401401        }
    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
    408409    /** 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
    412414        String key = "";
    413         if(!already_registered) {
     415        if (!already_registered) {
    414416        key = component.getText();
    415417        }
     
    417419        key = args[args.length - 1];
    418420        }
    419                 // Update the component using the AWTEvent queue
     421
     422        // Update the component using the AWTEvent queue
    420423        String value = get(key, args);
    421424        String tooltip = get(key + "_Tooltip", (String[])null);
    422425        ChangeTask task = new JTextComponentChangeTask(component, key, value, tooltip);
    423426        SwingUtilities.invokeLater(task);
    424                 // Register as necessary
    425         if(!already_registered) {
     427        // Register as necessary
     428        if (!already_registered) {
    426429        args = ArrayTools.add(args, key);
    427430        put(component, args);
     
    429432    }
    430433    }
     434
    431435    /** Register a tree component. */
    432436    public void register(JTree component, String[] args, boolean already_registered) {
    433437    if(component != null) {
    434                 // Retrieve the tooltip using the components name
     438        // Retrieve the tooltip using the components name
    435439        String key = component.getName();
    436440        String tooltip = get(key + "_Tooltip", (String[])null);
    437441        ChangeTask task = new JTreeChangeTask(component, key, tooltip);
    438442        SwingUtilities.invokeLater(task);
    439                 // 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!
     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!
    440444        ArrayList nodes = new ArrayList();
    441445        nodes.add(component.getModel().getRoot());
     
    456460    public void register(TitledBorder component, String[] args, boolean already_registered) {
    457461    if(component != null) {
    458                 // Determine the key
     462        // Determine the key
    459463        String key = "";
    460464        if(!already_registered) {
     
    464468        key = args[args.length - 1];
    465469        }
    466                 // Update the component using the AWTEvent queue
     470        // Update the component using the AWTEvent queue
    467471        String value = get(key, args);
    468472        ChangeTask task = new TitledBorderChangeTask(component, key, value);
    469473        SwingUtilities.invokeLater(task);
    470                 // Register as necessary
     474        // Register as necessary
    471475        if(!already_registered) {
    472476        args = ArrayTools.add(args, key);
Note: See TracChangeset for help on using the changeset viewer.