Changeset 9249


Ignore:
Timestamp:
2005-03-02T10:30:29+13:00 (19 years ago)
Author:
mdewsnip
Message:

Fixed up CheckList selection (again), and changed WriteCDImagePrompt to only enabled the OK button when something is ticked (again), and the same for the ExportAsPrompt.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
3 edited

Legend:

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

    r9246 r9249  
    471471     */
    472472    private class CollectionListListener
    473     implements ListSelectionListener {
     473    implements ListSelectionListener
     474    {
    474475    /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
    475476     * @param  event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
    476477     */
    477     public void valueChanged(ListSelectionEvent event) {
    478         ok_button.setEnabled(false);
    479         if(!list.isSelectionEmpty()) {
    480         collection = (BasicCollectionConfiguration) ((CheckListEntry)list.getSelectedValue()).getObject();
    481         args = new String[3];
    482         args[0] = collection.getCreator();
    483         args[1] = collection.getMaintainer();
    484         args[2] = collection.getDescription();
    485         Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
    486         details_textarea.setCaretPosition(0);
    487         ok_button.setEnabled(true);
     478    public void valueChanged(ListSelectionEvent event)
     479    {
     480        // Can only export when something is ticked
     481        ok_button.setEnabled(!list.isNothingTicked());
     482
     483        if (list.isSelectionEmpty()) {
     484        // This only happens when the dialog is first entered
     485        Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
     486        return;
    488487        }
    489         else {
    490         Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
    491         ok_button.setEnabled(false);
    492         }
    493     }
    494     }
    495    
    496    /** The OK button listener implementation. */
     488
     489        collection = (BasicCollectionConfiguration) ((CheckListEntry) list.getSelectedValue()).getObject();
     490        args = new String[3];
     491        args[0] = collection.getCreator();
     492        args[1] = collection.getMaintainer();
     493        args[2] = collection.getDescription();
     494        Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
     495        details_textarea.setCaretPosition(0);
     496    }
     497    }
     498
     499
     500    /** The OK button listener implementation. */
    497501    private class OKButtonListener
    498502    implements ActionListener {
  • trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java

    r9246 r9249  
    402402    }
    403403
     404
    404405    /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
    405406     */
    406407    private class CollectionListListener
    407     implements ListSelectionListener {
     408    implements ListSelectionListener
     409    {
    408410    /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
    409411     * @param  event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
    410412     */
    411     public void valueChanged(ListSelectionEvent event) {
    412         ok_button.setEnabled(false);
    413         if(!list.isSelectionEmpty()) {
    414         collection = (BasicCollectionConfiguration) ((CheckListEntry)list.getSelectedValue()).getObject();
    415         args = new String[3];
    416         args[0] = collection.getCreator();
    417         args[1] = collection.getMaintainer();
    418         args[2] = collection.getDescription();
    419         Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
    420         details_textarea.setCaretPosition(0);
    421         ok_button.setEnabled(true);
     413    public void valueChanged(ListSelectionEvent event)
     414    {
     415        // Can only export when something is ticked
     416        ok_button.setEnabled(!list.isNothingTicked());
     417
     418        if (list.isSelectionEmpty()) {
     419        // This only happens when the dialog is first entered
     420        Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
     421        return;
    422422        }
    423         else {
    424         Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
    425         ok_button.setEnabled(false);
    426         }
    427     }
    428     }
    429    
    430    /** The OK button listener implementation. */
     423
     424        collection = (BasicCollectionConfiguration) ((CheckListEntry) list.getSelectedValue()).getObject();
     425        args = new String[3];
     426        args[0] = collection.getCreator();
     427        args[1] = collection.getMaintainer();
     428        args[2] = collection.getDescription();
     429        Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
     430        details_textarea.setCaretPosition(0);
     431    }
     432    }
     433
     434
     435    /** The OK button listener implementation. */
    431436    private class OKButtonListener
    432437    implements ActionListener {
  • trunk/gli/src/org/greenstone/gatherer/util/CheckList.java

    r9200 r9249  
    217217        checkbox.grabFocus();
    218218
    219         // This is necessary to get the checkbox to repaint in Java 1.5.0
    220         list.getSelectionModel().clearSelection();
     219        // We need to cause a ListSelectionEvent -- this is ugly but I can't find a better way quickly
     220        list.removeSelectionInterval(0, 0);
     221        list.setSelectionInterval(index, index);
    221222    }
    222223    }
Note: See TracChangeset for help on using the changeset viewer.