Changeset 7111


Ignore:
Timestamp:
2004-03-23T16:43:46+12:00 (20 years ago)
Author:
kjdon
Message:

modified how the arguments get added to the list when creating a new plugin based on an old one. also arguments keep their original owner now unless they are assigned, so that the configure plugin display looks the same after list regeneration

File:
1 edited

Legend:

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

    r7110 r7111  
    4848    private String name; // Only for Base
    4949
    50     /** Constructor used in DOMProxyListModel initializations, and Library Level.
     50    /** Constructor used in DOMProxyListModel initializations, and Library Level. Used for Base plugins (those in the list of available plugins, not ones that are in the DOMProxyList)
    5151     */
    5252    public PlugIn() {
    5353    }
    54 
     54   
     55    /** Constructor used for the plugins that are in the DOMProxyList */
     56    // Every time the list of plugins in the assigned plugins box changes, (eg plugin added or removed, not when plugin configured), the plugins seem to be regenerated, using the element from the old plugin. All known args get added to the element the first time this happens - we need to add them to the arguments list in the order they are found in the base plugins though, not this order.
    5557    public PlugIn(Element element, PlugIn base_plugin) {
    5658    super();
     
    6668        Argument argument = new Argument(option_element);
    6769        //Gatherer.println("Rebuilding existing argument: " + argument.getName());
    68         argument.setOwner(name);
    69         add(argument);
    7070        known_arguments.put(argument.getName(), argument);
     71        if (argument.isAssigned() || base_plugin == null) {
     72        // if the arg is assigned, the current plugin now becomes its owner, and we add it to the front of the ArrayList of args. But otherwise, it will retain its old owner, and we will add it in the correct place from the base plugin
     73        argument.setOwner(name);
     74        add(argument);
     75        }
    7176    }
    7277    // If a base plugin was given
    7378    if(base_plugin != null) {
    7479        //Gatherer.println("Based on previous plugin.");
    75         // Copy the details, and add a reference to whatever base_plugins super plugin is.
     80        // Copy the details, and add a reference to whatever base_plugins super plugin is. ??
    7681        description = base_plugin.getDescription();
    7782        // Now search through the 'dummy' arguments belonging to the base plugin. For each found, if it is already assigned, fill out further details such as type. If any are found that are not already assigned for this plugin, copy them and add them, but without a value.
     
    9499            existing_argument.setMinimum(base_argument.getMinimum());
    95100            existing_argument.setMaximum(base_argument.getMaximum());
    96    
     101            if (!existing_argument.isAssigned()) {
     102            // here we give it back its original owner and add it to the list. If it is assigned, these two things were done already
     103            existing_argument.setOwner(base_argument.getOwner());
     104            add(existing_argument);
     105            }
    97106           
    98107        }
Note: See TracChangeset for help on using the changeset viewer.