Changeset 14240 for gli


Ignore:
Timestamp:
2007-07-12T10:12:18+12:00 (17 years ago)
Author:
xiao
Message:

make the option disable_OAI visible in the GLI for Greenstone 3 (modification in method buildBuild()). By default it's hidden in the GLI.

File:
1 edited

Legend:

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

    r13591 r14240  
    5555import org.greenstone.gatherer.util.AppendLineOnlyFileDocument;
    5656import org.greenstone.gatherer.util.AppendLineOnlyFileDocumentOwner;
     57import org.greenstone.gatherer.util.StaticStrings;
    5758
    5859/** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>.
     
    118119     */
    119120    public JPanel buildBuild(JPanel pane) {
    120     // Reset the arguments
    121     if(pane == null) {
    122         current_controls.clear();
    123     }
    124     ArrayList build_arguments = new ArrayList();
    125     int current_mode = Configuration.getMode();
    126     int total_build_argument_count = build_options.getArgumentCount();
    127        
    128     for(int i = 0; i < total_build_argument_count; i++) {
    129         // Retrieve the argument so we know how to format the control.
    130         Argument argument = build_options.getArgument(i);
    131         if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) {
    132         // Now attempt to retrieve any existing value for this argument.
    133         boolean enabled = build_options.getValueEnabled(argument.getName());
    134         String value = build_options.getValue(argument.getName());
    135         MyArgumentControl argument_control = new MyArgumentControl(BUILD, argument, enabled, value);
    136         build_arguments.add(argument_control);
    137         }
    138     }
    139     current_controls.addAll(build_arguments);
    140 
    141     // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments.
    142     if(pane == null || current_mode >= Configuration.EXPERT_MODE) {
    143         pane = new JPanel();
    144         pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    145         pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
    146         int argument_count = build_arguments.size();
    147         // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number of lines in the grid layout
    148         if(current_mode >= Configuration.EXPERT_MODE) {
    149         if(argument_count < MINIMUM_ROWS) {
    150             argument_count = MINIMUM_ROWS;
    151         }
    152         pane.setLayout(new GridLayout(argument_count, 1, 5, 5));
    153         }
    154         // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway
    155         else {
    156         // use  GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will
    157         // grow fat if space too large, but we don't know how many rows we'll need yet.
    158         pane.setLayout(new GridLayout(0, 1, 5, 5));
    159         }
    160     }
    161 
    162     for(int j = 0; j < build_arguments.size(); j++) {
    163         pane.add((JComponent)build_arguments.get(j));
    164     }
    165     pane.addMouseListener(this);
    166     build_arguments = null;
    167     return pane;
     121      // Reset the arguments
     122      if(pane == null) {
     123        current_controls.clear();
     124      }
     125      ArrayList build_arguments = new ArrayList();
     126      int current_mode = Configuration.getMode();
     127      int total_build_argument_count = build_options.getArgumentCount();
     128     
     129      for(int i = 0; i < total_build_argument_count; i++) {
     130        // Retrieve the argument so we know how to format the control.
     131        Argument argument = build_options.getArgument(i);
     132       
     133        //A hack to make the disable_OAI option visible in the GLI for Greenstone 3
     134        if(argument.getName().equals(StaticStrings.DISABLEOAI_STR) && Gatherer.GS3) {
     135          argument.setHiddenGLI(false);
     136        }
     137        if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) {
     138          // Now attempt to retrieve any existing value for this argument.
     139          boolean enabled = build_options.getValueEnabled(argument.getName());
     140          String value = build_options.getValue(argument.getName());
     141          MyArgumentControl argument_control = new MyArgumentControl(BUILD, argument, enabled, value);
     142          build_arguments.add(argument_control);
     143        }
     144      }
     145      current_controls.addAll(build_arguments);
     146     
     147      // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments.
     148      if(pane == null || current_mode >= Configuration.EXPERT_MODE) {
     149        pane = new JPanel();
     150        pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     151        pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
     152        int argument_count = build_arguments.size();
     153        // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number of lines in the grid layout
     154        if(current_mode >= Configuration.EXPERT_MODE) {
     155          if(argument_count < MINIMUM_ROWS) {
     156            argument_count = MINIMUM_ROWS;
     157          }
     158          pane.setLayout(new GridLayout(argument_count, 1, 5, 5));
     159        }
     160        // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway
     161        else {
     162          // use  GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will
     163          // grow fat if space too large, but we don't know how many rows we'll need yet.
     164          pane.setLayout(new GridLayout(0, 1, 5, 5));
     165        }
     166      }
     167     
     168      for(int j = 0; j < build_arguments.size(); j++) {
     169        pane.add((JComponent)build_arguments.get(j));
     170      }
     171      pane.addMouseListener(this);
     172      build_arguments = null;
     173      return pane;
    168174    }
    169175
Note: See TracChangeset for help on using the changeset viewer.