Changeset 13158


Ignore:
Timestamp:
2006-10-20T16:25:44+13:00 (18 years ago)
Author:
mdewsnip
Message:

Made the explode metadata prompt have the exploded metadata set selected by default.

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

Legend:

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

    r12829 r13158  
    178178        }
    179179        }
     180
     181        selectValue((JComboBox) value_control, initial_value);
     182
    180183    } // end of switch
    181184
     
    458461     * @see org.greenstone.gatherer.cdm.ArgumentConfiguration.Argument.ArgumentOption
    459462     */
    460     public static boolean selectValue(JComboBox combobox, String target) {
    461     ///ystem.err.println("Searching for the target string: " + target);
    462     for(int i = 0; i < combobox.getItemCount(); i++) {
     463    public static boolean selectValue(JComboBox combobox, String target)
     464    {
     465    for (int i = 0; i < combobox.getItemCount(); i++) {
    463466        Object object = combobox.getItemAt(i);
    464         if(object instanceof Argument.ArgumentOption) {
     467
     468        if (object instanceof Argument.ArgumentOption) {
    465469        Argument.ArgumentOption opt = (Argument.ArgumentOption) object;
    466         ///ystem.err.print("/tChecking: " + lo.getValue() + "... ");
    467         if(opt.name.startsWith(target)) {
    468             ///ystem.err.println("Match!");
     470        if (opt.name.startsWith(target)) {
    469471            combobox.setSelectedIndex(i);
    470472            combobox.setToolTipText(opt.getToolTip());
    471473            return true;
    472474        }
    473         /*
    474           else {
    475           System.err.println("No Match.");
    476           }
    477         */
    478475        }
    479476        else if (object instanceof MetadataElement) {
     
    483480        }
    484481        }
    485     }
     482        else if (object.toString().equals(target)) {
     483        combobox.setSelectedIndex(i);
     484        return true;
     485        }
     486    }
     487
    486488    return false;
    487489    }
     490
     491
    488492    /** Forces the control into an 'enabled' mode. */
    489493    public void setEnabled() {
  • trunk/gli/src/org/greenstone/gatherer/gui/ExplodeMetadataPrompt.java

    r12735 r13158  
    208208        if (argument.getName().equals("metadata_set")) {
    209209            argument.setType(Argument.METADATA_SET_NAMESPACE);
     210            argument_control = new ArgumentControl(argument, true, "Exploded Metadata Set (exp)");
    210211        }
    211         // by default, all args are disabled, and no value
    212         argument_control = new ArgumentControl(argument, false, null);
     212        else {
     213            // by default, all args are disabled, and no value
     214            argument_control = new ArgumentControl(argument, false, null);
     215        }
    213216        // make sure they are coloured the way we want - this is not the standard arg control coloring
    214217        argument_control.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
Note: See TracChangeset for help on using the changeset viewer.