當前位置: 首頁>>代碼示例>>Java>>正文


Java ListBoxModel.Option方法代碼示例

本文整理匯總了Java中hudson.util.ListBoxModel.Option方法的典型用法代碼示例。如果您正苦於以下問題:Java ListBoxModel.Option方法的具體用法?Java ListBoxModel.Option怎麽用?Java ListBoxModel.Option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.util.ListBoxModel的用法示例。


在下文中一共展示了ListBoxModel.Option方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doFillImageItems_shouldFillWithDockerImages

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
@Test
public void doFillImageItems_shouldFillWithDockerImages() {
    TestgridBuildWrapper.DescriptorImpl descriptor = jenkins.getInstance().getDescriptorByType(TestgridBuildWrapper.DescriptorImpl.class);
    List<DockerImageSettings> images = new ArrayList<DockerImageSettings>();
    images.add(new DockerImageSettings("ff","ffimage"));
    images.add(new DockerImageSettings("chrome","chromeimage"));
    
    descriptor.setDockerImages(images);

    ListBoxModel model = new BrowserInstance("").getDescriptor().doFillImageItems();
    assertEquals(images.size(),model.size());
    for (int i = 0; i < model.size(); i++) {
        DockerImageSettings image = images.get(i);
        ListBoxModel.Option o = model.get(i);
        assertEquals(image.getName(), o.name);
        assertEquals(image.getImageName(),o.value);
    }
}
 
開發者ID:DevOnGlobal,項目名稱:testgrid-plugin,代碼行數:19,代碼來源:BrowserInstanceTest.java

示例2: testListBoxEmpty

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
@Test
public void testListBoxEmpty() throws Exception {
  ListBoxModel list = GoogleRobotCredentials.getCredentialsListBox(
      FakeGoogleCredentials.class);

  assertEquals(0, list.size());

  FakeGoogleCredentials credentials = new FakeGoogleCredentials(PROJECT_ID,
      fakeCredential);
  SystemCredentialsProvider.getInstance().getCredentials().add(credentials);

  list = GoogleRobotCredentials.getCredentialsListBox(
      FakeGoogleCredentials.class);

  assertEquals(1, list.size());
  for (ListBoxModel.Option option : list) {
    assertEquals(NAME, option.name);
    assertEquals(credentials.getId(), option.value);
  }
}
 
開發者ID:jenkinsci,項目名稱:google-oauth-plugin,代碼行數:21,代碼來源:GoogleRobotCredentialsTest.java

示例3: doFillAuthenticationItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Fills the items for authentication for global configuration.
 * @return
 */
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillAuthenticationItems(){
    ListBoxModel authModel = new ListBoxModel(
            new ListBoxModel.Option("Username / Password", Authentication.plain.name()),
            new ListBoxModel.Option("OpenSSL", Authentication.openSSL.name()),
            new ListBoxModel.Option("Kerberos (TBD)", Authentication.kerberos.name())
    );


    if (authentication == null) {
        authModel.get(0).selected = true;
        return authModel;
    }

    for (ListBoxModel.Option option : authModel) {
        if (option.value.equals(Authentication.plain.name()))
            option.selected = authentication.equals(Authentication.plain.name());
        else if (option.value.equals(Authentication.openSSL.name()))
            option.selected = authentication.equals(Authentication.openSSL.name());
        else if (option.value.equals(Authentication.kerberos.name()))
            option.selected = authentication.equals(Authentication.kerberos.name());
    }

    return authModel;
}
 
開發者ID:vtunka,項目名稱:jenkins-koji-plugin,代碼行數:30,代碼來源:KojiBuilder.java

示例4: doFillApiTokenIdItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
public ListBoxModel doFillApiTokenIdItems(@QueryParameter String name, @QueryParameter String url) {
    if (Jenkins.getInstance().hasPermission(Item.CONFIGURE)) {
        AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> options = new StandardListBoxModel()
            .includeEmptyValue()
            .includeMatchingAs(ACL.SYSTEM,
                               Jenkins.getActiveInstance(),
                               StandardCredentials.class,
                               URIRequirementBuilder.fromUri(url).build(),
                               new GitLabCredentialMatcher());
        if (name != null && connectionMap.containsKey(name)) {
            String apiTokenId = connectionMap.get(name).getApiTokenId();
            options.includeCurrentValue(apiTokenId);
            for (ListBoxModel.Option option : options) {
                if (option.value.equals(apiTokenId)) {
                    option.selected = true;
                }
            }
        }
        return options;
    }
    return new StandardListBoxModel();
}
 
開發者ID:jenkinsci,項目名稱:gitlab-plugin,代碼行數:23,代碼來源:GitLabConnectionConfig.java

示例5: doCheckCredentialsId

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
public FormValidation doCheckCredentialsId(
    @AncestorInPath Item context, @QueryParameter String remote, @QueryParameter String value) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return FormValidation.ok();
  }

  value = Util.fixEmptyAndTrim(value);
  if (value == null) {
    return FormValidation.ok();
  }

  remote = Util.fixEmptyAndTrim(remote);
  if (remote == null)
  // not set, can't check
  {
    return FormValidation.ok();
  }

  for (ListBoxModel.Option o :
      CredentialsProvider.listCredentials(
          StandardUsernameCredentials.class,
          context,
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)) {
    if (StringUtils.equals(value, o.value)) {
      // TODO check if this type of credential is acceptable to the Git client or does it merit warning
      // NOTE: we would need to actually lookup the credential to do the check, which may require
      // fetching the actual credential instance from a remote credentials store. Perhaps this is
      // not required
      return FormValidation.ok();
    }
  }
  // no credentials available, can't check
  return FormValidation.warning("Cannot find any credentials with id " + value);
}
 
開發者ID:GerritForge,項目名稱:gerrit-plugin,代碼行數:40,代碼來源:GerritSCMSource.java

示例6: doFillNameItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
public ListBoxModel doFillNameItems(@QueryParameter @RelativePath("..") final String serverUrl,
                                    @QueryParameter @RelativePath("..") final String userName,
                                    @QueryParameter @RelativePath("..") final String password,
                                    @QueryParameter @RelativePath("..") final String tenant,
                                    @QueryParameter @RelativePath("..") final String workflowName,
                                    @QueryParameter final String name)
        throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, IOException,
        URISyntaxException {

    BuildParam listWorkflowBuildParam = new BuildParam(serverUrl, userName, password, tenant, null);
    OrchestratorClient listWfClient = new OrchestratorClient(listWorkflowBuildParam);
    List<Workflow> workflows = listWfClient.fetchWorkflows();
    String workflowId = null;
    for (Workflow workflow : workflows) {
        if (workflow.getName().equals(workflowName)) {
            workflowId = workflow.getId();
            break;
        }
    }

    BuildParam buildParam = new BuildParam(serverUrl, userName, password, tenant, workflowId);
    OrchestratorClient client = new OrchestratorClient(buildParam);
    List<Parameter> parameters = client.fetchWorkflowInputParameters();
    List<ListBoxModel.Option> options = new ArrayList<ListBoxModel.Option>(parameters.size());
    for (Parameter parameter : parameters) {
        String paramDisplayName = String.format("%[email protected]%s", parameter.getName(), parameter.getType());
        options.add(new ListBoxModel.Option(paramDisplayName, paramDisplayName,
                paramDisplayName.matches(name)));
    }
    ListBoxModel listBoxModel = new ListBoxModel(options);
    return listBoxModel;
}
 
開發者ID:agovindaraju,項目名稱:vmware-vrealize-orchestrator,代碼行數:33,代碼來源:Parameter.java

示例7: doFillIncreaseVersionOptionItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
public ListBoxModel doFillIncreaseVersionOptionItems() {
    return new ListBoxModel(
            new ListBoxModel.Option("Major", String.valueOf(VersionUtils.increaseVersionOptions.MAJOR), false),
            new ListBoxModel.Option("Minor", String.valueOf(VersionUtils.increaseVersionOptions.MINOR), false),
            new ListBoxModel.Option("Patch", String.valueOf(VersionUtils.increaseVersionOptions.PACTH), false),
            new ListBoxModel.Option("Build", String.valueOf(VersionUtils.increaseVersionOptions.BUILD), true)

    );
}
 
開發者ID:foundation-runtime,項目名稱:jenkins-openstack-deployment-plugin,代碼行數:10,代碼來源:ProductBuilder.java

示例8: doFillGitHubAuthIdItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillGitHubAuthIdItems(@QueryParameter("gitHubAuthId") String gitHubAuthId) {
    ListBoxModel model = new ListBoxModel();
    for (GhprcGitHubAuth auth : getGithubAuth()) {
        String description = Util.fixNull(auth.getDescription());
        int length = description.length();
        length = length > 50 ? 50 : length;
        ListBoxModel.Option next = new ListBoxModel.Option(auth.getServerAPIUrl() + " : " + description.substring(0, length), auth.getId());
        if (!StringUtils.isEmpty(gitHubAuthId) && gitHubAuthId.equals(auth.getId())) {
            next.selected = true;
        }
        model.add(next);
    }
    return model;
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:16,代碼來源:GhprcTrigger.java

示例9: doFillProjectNameItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Populate the project drop-down from the AWS Device Farm API or local cache.
 *
 * @return The ListBoxModel for the UI.
 */
@SuppressWarnings("unused")
public ListBoxModel doFillProjectNameItems(@QueryParameter String currentProjectName) {
    // Create ListBoxModel from all projects for this AWS Device Farm account.
    List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
    System.out.print("getting projects");
    List<String> projectNames = getAWSDeviceFarmProjects();
    System.out.print(String.format("project length = %d", projectNames.size()));
    for (String projectName : projectNames) {
        // We don't ignore case because these *should* be unique.
        entries.add(new ListBoxModel.Option(projectName, projectName, projectName.equals(currentProjectName)));
    }
    return new ListBoxModel(entries);
}
 
開發者ID:awslabs,項目名稱:aws-device-farm-jenkins-plugin,代碼行數:19,代碼來源:AWSDeviceFarmRecorder.java

示例10: doFillDevicePoolNameItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Populate the device pool drop-down from AWS Device Farm API or local cache.
 * based on the selected project.
 *
 * @param projectName           Name of the project selected.
 * @param currentDevicePoolName Name of the device pool selected.
 * @return The ListBoxModel for the UI.
 */
@SuppressWarnings("unused")
public ListBoxModel doFillDevicePoolNameItems(@QueryParameter String projectName, @QueryParameter String currentDevicePoolName) {
    List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
    List<String> devicePoolNames = getAWSDeviceFarmDevicePools(projectName);
    if (devicePoolNames == null) {
        return new ListBoxModel();
    }
    for (String devicePoolName : devicePoolNames) {
        // We don't ignore case because these *should* be unique.
        entries.add(new ListBoxModel.Option(devicePoolName, devicePoolName, devicePoolName.equals(currentDevicePoolName)));
    }
    return new ListBoxModel(entries);
}
 
開發者ID:awslabs,項目名稱:aws-device-farm-jenkins-plugin,代碼行數:22,代碼來源:AWSDeviceFarmRecorder.java

示例11: doFillAppiumVersionJunitItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Populate the project drop-down Appium Version.
 *
 * @return The ListBoxModel for the UI.
 */
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionJunitItems(@QueryParameter String currentAppiumVersion) {
    List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
    ArrayList<String> appiumVersions = new ArrayList<String>();
    appiumVersions.add(APPIUM_VERSION_1_6_3);
    appiumVersions.add(APPIUM_VERSION_1_6_5);
    appiumVersions.add(APPIUM_VERSION_1_4_16);
    for (String appiumVersion: appiumVersions) {
        entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
    }
    return new ListBoxModel(entries);
}
 
開發者ID:awslabs,項目名稱:aws-device-farm-jenkins-plugin,代碼行數:18,代碼來源:AWSDeviceFarmRecorder.java

示例12: doFillAppiumVersionTestngItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Populate the project drop-down Appium Version.
 *
 * @return The ListBoxModel for the UI.
 */
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionTestngItems(@QueryParameter String currentAppiumVersion) {
    List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
    ArrayList<String> appiumVersions = new ArrayList<String>();
    appiumVersions.add(APPIUM_VERSION_1_6_3);
    appiumVersions.add(APPIUM_VERSION_1_6_5);
    appiumVersions.add(APPIUM_VERSION_1_4_16);
    for (String appiumVersion: appiumVersions) {
        // We don't ignore case because these *should* be unique.
        entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
    }
    return new ListBoxModel(entries);
}
 
開發者ID:awslabs,項目名稱:aws-device-farm-jenkins-plugin,代碼行數:19,代碼來源:AWSDeviceFarmRecorder.java

示例13: doFillAppiumVersionPythonItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Populate the project drop-down Appium Version.
 *
 * @return The ListBoxModel for the UI.
 */
@SuppressWarnings("unused")
public ListBoxModel doFillAppiumVersionPythonItems(@QueryParameter String currentAppiumVersion) {
    // Create ListBoxModel from all projects for this AWS Device Farm account.
    List<ListBoxModel.Option> entries = new ArrayList<ListBoxModel.Option>();
    //System.out.print("getting appium version");
    ArrayList<String> appiumVersions = new ArrayList<String>();
    appiumVersions.add(APPIUM_VERSION_1_6_3);
    appiumVersions.add(APPIUM_VERSION_1_6_5);
    appiumVersions.add(APPIUM_VERSION_1_4_16);
    for (String appiumVersion: appiumVersions) {
        entries.add(new ListBoxModel.Option(appiumVersion, appiumVersion, appiumVersion.equals(currentAppiumVersion)));
    }
    return new ListBoxModel(entries);
}
 
開發者ID:awslabs,項目名稱:aws-device-farm-jenkins-plugin,代碼行數:20,代碼來源:AWSDeviceFarmRecorder.java

示例14: doFillKojiTaskItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
/**
 * Fills the Koji task options for project configurations.
 * @return
 */
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillKojiTaskItems(){
    ListBoxModel kojiTaskModel = new ListBoxModel(
            new ListBoxModel.Option("Koji moshimoshi (validate client configuration)", KojiTask.moshimoshi.name()),
            new ListBoxModel.Option("Run a new maven build", KojiTask.mavenBuild.name()),
            new ListBoxModel.Option("Download maven build", KojiTask.download.name()),
            new ListBoxModel.Option("List latest build for package", KojiTask.listLatest.name())
    );
    return kojiTaskModel;
}
 
開發者ID:vtunka,項目名稱:jenkins-koji-plugin,代碼行數:15,代碼來源:KojiBuilder.java

示例15: doFillServerTypeItems

import hudson.util.ListBoxModel; //導入方法依賴的package包/類
public ListBoxModel doFillServerTypeItems()
{
    return new ListBoxModel(
            new ListBoxModel.Option("Production (https://login.salesforce.com)", "https://login.salesforce.com"),
            new ListBoxModel.Option("Sandbox (https://test.salesforce.com)", "https://test.salesforce.com")
    );
}
 
開發者ID:aesanch2,項目名稱:salesforce-migration-assistant,代碼行數:8,代碼來源:SMABuilder.java


注:本文中的hudson.util.ListBoxModel.Option方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。