Package hudson.util

Examples of hudson.util.ListBoxModel$Option


    /**
     * Fills the verdict category drop-down list for the comment-added events.
     * @return a ListBoxModel for the drop-down list.
     */
    public ListBoxModel doFillVerdictCategoryItems() {
        ListBoxModel m = new ListBoxModel();
        List<VerdictCategory> list = getVerdictCategoriesList();
        for (VerdictCategory v : list) {
            m.add(v.getVerdictDescription(), v.getVerdictValue());
        }
        return m;
    }
View Full Code Here


         * Fill the server dropdown with the list of servers configured globally.
         *
         * @return list of servers.
         */
        public ListBoxModel doFillServerNameItems() {
            ListBoxModel items = new ListBoxModel();
            items.add(Messages.AnyServer(), ANY_SERVER);
            List<String> serverNames = PluginImpl.getInstance().getServerNames();
            for (String s : serverNames) {
                items.add(s);
            }
            return items;
        }
View Full Code Here

         *
         * @param serverName the name of the selected server.
         * @return list of slaves.
         */
        public ListBoxModel doFillGerritSlaveIdItems(@QueryParameter("serverName") final String serverName) {
            ListBoxModel items = new ListBoxModel();
            if (ANY_SERVER.equals(serverName)) {
                items.add(Messages.SlaveSelectionNotAllowedAnyServer(Messages.AnyServer()), "");
                return items;
            }
            GerritServer server = PluginImpl.getInstance().getServer(serverName);
            if (server == null) {
                logger.warn(Messages.CouldNotFindServer(serverName));
                items.add(Messages.CouldNotFindServer(serverName), "");
                return items;
            }
            ReplicationConfig replicationConfig = server.getConfig().getReplicationConfig();
            if (replicationConfig == null) {
                items.add(Messages.ReplicationNotConfigured(), "");
                return items;
            } else if (!replicationConfig.isEnableReplication()) {
                items.add(Messages.ReplicationNotConfigured(), "");
                return items;
            } else if (!replicationConfig.isEnableSlaveSelectionInJobs()) {
                items.add(Messages.SlaveSelectionInJobsDisabled(), "");
                return items;
            }
            for (GerritSlave slave : replicationConfig.getGerritSlaves()) {
                //if GerritTrigger.gerritSlaveId is configured, the selected value will be the good one because of
                //the stapler/jelly magic. The problem is when job was not saved since replication was configured,
                //we want the selected slave to be the default slave defined at admin level but I did not find a way
                //to do this. Jelly support default value returned by a descriptor method but I did not find a way to
                //pass the selected server to this method.
                //To work around the issue, we always put the default slave first in the list.
                if (slave.getId().equals(replicationConfig.getDefaultSlaveId())) {
                    items.add(0, new ListBoxModel.Option(slave.getName(), slave.getId()));
                } else {
                    items.add(slave.getName(), slave.getId());
                }
            }
            return items;
        }
View Full Code Here

         * @param serverName the server name.
         * @return the values.
         */
        public ListBoxModel doFillNotificationLevelItems(@QueryParameter("serverName") final String serverName) {
            Map<Notify, String> levelTextsById = GerritServer.notificationLevelTextsById();
            ListBoxModel items = new ListBoxModel(levelTextsById.size() + 1);
            items.add(getOptionForNotificationLevelDefault(serverName, levelTextsById));
            for (Entry<Notify, String> level : levelTextsById.entrySet()) {
                items.add(new Option(level.getValue(), level.getKey().toString()));
            }
            return items;
        }
View Full Code Here

         * @param serverName name of the server
         * @return list of slaves.
         */
        public ListBoxModel doFillDefaultSlaveIdItems(
            @QueryParameter("name") @RelativePath("../..") final String serverName) {
            ListBoxModel items = new ListBoxModel();
            logger.trace("filling default gerrit slave drop down for sever {}", serverName);
            GerritServer server = PluginImpl.getInstance().getServer(serverName);
            if (server == null) {
                logger.warn(Messages.CouldNotFindServer(serverName));
                items.add(Messages.CouldNotFindServer(serverName), "");
                return items;
            }
            ReplicationConfig replicationConfig = server.getConfig().getReplicationConfig();
            if (replicationConfig == null || !replicationConfig.isEnableReplication()
                || replicationConfig.getGerritSlaves().size() == 0) {
                logger.trace(Messages.GerritSlaveNotDefined());
                items.add(Messages.GerritSlaveNotDefined(), "");
                return items;
            }
            for (GerritSlave slave : replicationConfig.getGerritSlaves()) {
                boolean selected;
                if (slave.getId().equals(replicationConfig.getDefaultSlaveId())) {
                    selected = true;
                } else {
                    selected = false;
                }
                items.add(new ListBoxModel.Option(slave.getName(), slave.getId(), selected));
            }
            return items;
        }
View Full Code Here

         *
         * @return the values.
         */
        public ListBoxModel doFillNotificationLevelItems() {
            Map<Notify, String> levelTextsById = notificationLevelTextsById();
            ListBoxModel items = new ListBoxModel(levelTextsById.size());
            for (Entry<Notify, String> level : levelTextsById.entrySet()) {
                items.add(new Option(level.getValue(), level.getKey().toString()));
            }
            return items;
        }
View Full Code Here

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option inputDirOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The input directory, containing properly formatted files: "
          + "One doc per line, first entry on the line is the label, rest is the evidence")
        .withShortName("i").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The output directory").withShortName("o").create();
   
   
    Group group = gbuilder.withName("Options").withOption(helpOpt).withOption(
View Full Code Here

  public static void main(String[] args) throws IOException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option inputDirOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The input directory")
        .withShortName("i").create();
   
    Option modelOpt = obuilder.withLongName("model").withRequired(true).withArgument(
      abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
      "The directory containing the index model").withShortName("m").create();

    Group group = gbuilder.withName("Options").withOption(helpOpt)
        .withOption(inputDirOpt).withOption(modelOpt).create();
View Full Code Here

  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option inputDirOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The input directory")
        .withShortName("i").create();
   
    Option modelOpt = obuilder.withLongName("model").withRequired(true).withArgument(
      abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
      "The directory containing the index model").withShortName("m").create();
   
    Option categoryFieldOpt = obuilder.withLongName("categoryField").withRequired(true).withArgument(
        abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
        "Name of the field containing category information").withShortName("catf").create();

    Option contentFieldOpt = obuilder.withLongName("contentField").withRequired(true).withArgument(
        abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
        "Name of the field containing content information").withShortName("contf").create();
   
    Option maxResultsOpt = obuilder.withLongName("maxResults").withRequired(false).withArgument(
        abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
        "Number of results to retrive, default: 10 ").withShortName("r").create();
   
    Option gramSizeOpt = obuilder.withLongName("gramSize").withRequired(false).withArgument(
      abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "Size of the n-gram. Default Value: 1 ").withShortName("ng").create();
   
    Option typeOpt = obuilder.withLongName("classifierType").withRequired(false).withArgument(
      abuilder.withName("classifierType").withMinimum(1).withMaximum(1).create()).withDescription(
      "Type of classifier: knn|tfidf. Default: bayes").withShortName("type").create();
   
    Group group = gbuilder.withName("Options").withOption(gramSizeOpt).withOption(helpOpt).withOption(
        inputDirOpt).withOption(modelOpt).withOption(typeOpt).withOption(contentFieldOpt)
View Full Code Here

   
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = obuilder.withLongName("dir")
      .withRequired(true)
      .withArgument(
        abuilder.withName("dir")
          .withMinimum(1)
          .withMaximum(1).create())
      .withDescription("Lucene index directory containing input data")
      .withShortName("d").create();

    Option categoryOpt = obuilder.withLongName("categories")
    .withRequired(true)
    .withArgument(
      abuilder.withName("file")
        .withMinimum(1)
        .withMaximum(1).create())
    .withDescription("File containing a list of categories")
    .withShortName("c").create();
   
    Option outputOpt = obuilder.withLongName("output")
      .withRequired(false)
      .withArgument(
        abuilder.withName("output")
          .withMinimum(1)
          .withMaximum(1).create())
      .withDescription("Output directory")
      .withShortName("o").create();

    Option categoryFieldsOpt =
      obuilder.withLongName("category-fields")
      .withRequired(true)
      .withArgument(
        abuilder.withName("fields")
          .withMinimum(1)
          .withMaximum(1)
          .create())
      .withDescription("Fields to match categories against (comma-delimited)")
      .withShortName("cf").create();
   
    Option textFieldsOpt =
      obuilder.withLongName("text-fields")
      .withRequired(true)
      .withArgument(
        abuilder.withName("fields")
          .withMinimum(1)
          .withMaximum(1)
          .create())
      .withDescription("Fields from which to extract training text (comma-delimited)")
      .withShortName("tf").create();
   
    Option useTermVectorsOpt = obuilder.withLongName("use-term-vectors")
      .withDescription("Extract term vectors containing preprocessed data " +
          "instead of unprocessed, stored text values")
      .withShortName("tv").create();
   
    Option helpOpt = obuilder.withLongName("help")
      .withDescription("Print out help")
      .withShortName("h").create();
   
    Group group = gbuilder.withName("Options")
      .withOption(inputOpt)
View Full Code Here

TOP

Related Classes of hudson.util.ListBoxModel$Option

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.