本文整理汇总了Java中hudson.util.ListBoxModel.Option类的典型用法代码示例。如果您正苦于以下问题:Java Option类的具体用法?Java Option怎么用?Java Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Option类属于hudson.util.ListBoxModel包,在下文中一共展示了Option类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFillConnectionIdItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Fills in the Host Connection selection box with applicable connections.
*
* @param context
* filter for host connections
* @param connectionId
* an existing host connection identifier; can be null
* @param project
* the Jenkins project
*
* @return host connection selections
*/
public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @QueryParameter String connectionId,
@AncestorInPath Item project)
{
CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
HostConnection[] hostConnections = globalConfig.getHostConnections();
ListBoxModel model = new ListBoxModel();
model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));
for (HostConnection connection : hostConnections)
{
boolean isSelected = false;
if (connectionId != null)
{
isSelected = connectionId.matches(connection.getConnectionId());
}
model.add(new Option(connection.getDescription() + " [" + connection.getHostPort() + ']', //$NON-NLS-1$
connection.getConnectionId(), isSelected));
}
return model;
}
示例2: doFillCredentialsIdItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Fills in the Login Credentials selection box with applicable connections.
*
* @param context
* filter for login credentials
* @param credentialsId
* existing login credentials; can be null
* @param project
* the Jenkins project
*
* @return login credentials selection
*/
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
@AncestorInPath Item project)
{
List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
Collections.<DomainRequirement> emptyList());
ListBoxModel model = new ListBoxModel();
model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));
for (StandardUsernamePasswordCredentials c : creds)
{
boolean isSelected = false;
if (credentialsId != null)
{
isSelected = credentialsId.matches(c.getId());
}
String description = Util.fixEmptyAndTrim(c.getDescription());
model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
c.getId(), isSelected));
}
return model;
}
示例3: doFillCredentialsIdItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Fills in the Login Credentials selection box with applicable Jenkins credentials.
*
* @param context
* filter for credentials
* @param credentialsId
* existing login credentials; can be null
* @param project
* the Jenkins project
*
* @return credential selections
*/
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId, @AncestorInPath Item project)
{
List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
Collections.<DomainRequirement> emptyList());
StandardListBoxModel model = new StandardListBoxModel();
model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));
for (StandardUsernamePasswordCredentials c : creds)
{
boolean isSelected = false;
if (credentialsId != null)
{
isSelected = credentialsId.matches(c.getId());
}
String description = Util.fixEmptyAndTrim(c.getDescription());
model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
c.getId(), isSelected));
}
return model;
}
示例4: doFillApplicationsItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Method for filling the application drop down.
*
* @return ListBoxModel used for filling the drop down.
*/
public ListBoxModel doFillApplicationsItems(StaplerRequest request, @QueryParameter("target") String targets) {
ListBoxModel applicationItems = new ListBoxModel();
try {
LOG.info("called doFillapplicationItems");
final Map<String, String> applications = parseJSON(targets, "app");
for (final Entry<String, String> application : applications.entrySet()) {
Option applicationOption = new Option(application.getKey(), application.getValue());
applicationItems.add(applicationOption);
}
} catch (FileNotFoundException ex) {
LOG.throwing(this.getClass().getName(), "doFillApplicationsItems", ex);
}
tempChoosenTarget = targets;
// tempChoosenTarget = new String[targets.length];
// for(int i = 0; i < targets.length;i++)
// {
// tempChoosenTarget[i] = trimJSON(targets[i]);
// }
// LOG.info("temp target" + tempChoosenTarget + " queryparameter " + StringUtils.join(targets,
// " TARGETS "));
return applicationItems;
}
示例5: doFillAppAttributesItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the ApplicationAttributes select.
*
* @param request Stapler request from Jenkins.
* @param tarAttributes Actual chosen Target Attribute.
* @param application Actual chosen Applcation.
* @return ListBoxModel with the ApplicationAttributes.
*/
public ListBoxModel doFillAppAttributesItems(StaplerRequest request,
@QueryParameter("tarAttributes") String tarAttributes, @QueryParameter("application") String application) {
ListBoxModel modelItems = new ListBoxModel();
if (tarAttributes.equals("applications") && !application.equals(getMissingObjectFillText())) {
//TODO check if possible to get these properties dynamically from json file
modelItems.add(new Option("id", "id"));
modelItems.add(new Option("type", "type"));
modelItems.add(new Option("Version", "Version"));
modelItems.add(new Option("directory", "directory"));
modelItems.add(new Option("host", "host"));
modelItems.add(new Option("sshCredentials", "sshCredentials"));
modelItems.add(new Option("parentApplication", "parentApplication"));
modelItems.add(new Option("childApplications", "childApplications"));
modelItems.add(new Option("Properties", "Properties"));
}
return modelItems;
}
示例6: doFillHostAttributesItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the HostAttributes select.
*
* @param request Stapler request from Jenkins.
* @param appAttributes Actual chosen Application Attribute.
* @return ListBoxModel with the HostAttributes.
*/
public ListBoxModel doFillHostAttributesItems(StaplerRequest request,
@QueryParameter("appAttributes") String appAttributes, @QueryParameter("host") String host) {
ListBoxModel modelItems = new ListBoxModel();
if (appAttributes.equals("host") && !host.equals(getMissingObjectFillText())) {
//TODO check if possible to get these properties dynamically from json file
modelItems.add(new Option("id", "id"));
modelItems.add(new Option("managementIp", "managementIp"));
modelItems.add(new Option("managementHostname", "managementHostname"));
modelItems.add(new Option("serviceIp", "serviceIp"));
modelItems.add(new Option("serviceHostname", "serviceHostname"));
modelItems.add(new Option("parentHost", "parentHost"));
modelItems.add(new Option("virtualHosts", "virtualHosts"));
modelItems.add(new Option("Properties", "Properties"));
}
return modelItems;
}
示例7: doFillHostItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the Host select.
*
* @param request Stapler request from Jenkins.
* @param appAttributes Actual chosen ApplicationAttributes.
* @param queryApplication Actual chosen application.
* @param target Actual chosen Target.
* @return ListBoxModel with the available Hosts.
* @throws IOException If access to the file fails.
*/
public ListBoxModel doFillHostItems(StaplerRequest request,
@QueryParameter("appAttributes") String appAttributes,
@QueryParameter("application") String queryApplication, @QueryParameter("../target") String target)
throws IOException {
target = request.getParameter("target");
this.target = target;
ListBoxModel modelItems = new ListBoxModel();
if (appAttributes.equals("host")) {
ArrayList<String> hosts = CCRUtils.getValueFromJSONString("host", CCRUtils.getFromCache(
TextField.Application, queryApplication, mainDescriptor.getTempChoosenClient()));
for (String host : hosts) {
modelItems.add(new Option(host, host));
}
if (hosts.size() == 0) {
modelItems.add(new Option(getMissingObjectFillText()));
}
}
return modelItems;
}
示例8: doFillApplicationItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the Application select.
*
* @param request Stapler request form Jenkins.
* @param tarAttributes Actual chosen TargetAttributes.
* @param target Actual chosen Target.
* @return ListBoxModel with the available Applications.
* @throws IOException If access to the file fails.
*/
public ListBoxModel doFillApplicationItems(StaplerRequest request,
@QueryParameter("tarAttributes") String tarAttributes, @QueryParameter("../target") String target)
throws IOException {
target = request.getParameter("target");
this.target = target;
ListBoxModel modelItems = new ListBoxModel();
if (tarAttributes.equals("applications")) {
ArrayList<String> applications = CCRUtils.getValueFromJSONString("applications", CCRUtils.getFromCache(
TextField.Target, target, mainDescriptor.getTempChoosenClient()));
for (String application : applications) {
modelItems.add(new Option(application, application));
}
if (applications.size() == 0) {
modelItems.add(new Option(getMissingObjectFillText()));
}
}
return modelItems;
}
示例9: doFillDatabaseItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the Database select.
*
* @param request Stapler request from Jenkins.
* @param databaseEnvAttributes Actual chosen DatabaseEnviroment.
* @param tarAttributes Actual chosen TargetAttribute.
* @param target Actual chosen Target.
* @return ListBoxModel with the available Databases.
* @throws IOException If access to the file fails.
*/
public ListBoxModel doFillDatabaseItems(StaplerRequest request,
@QueryParameter("databaseEnvAttributes") String databaseEnvAttributes,
@QueryParameter("tarAttributes") String tarAttributes, @QueryParameter("../target") String target)
throws IOException {
target = request.getParameter("target");
this.target = target;
ListBoxModel modelItems = new ListBoxModel();
if (databaseEnvAttributes.equals("database") && tarAttributes.equals("databaseEnvironments")) {
ArrayList<String> databases = CCRUtils.getValueFromJSONString("database", CCRUtils.getFromCache(
TextField.DatabaseEnviroments, target, mainDescriptor.getTempChoosenClient()));
for (String database : databases) {
modelItems.add(new Option(database, database));
}
if (databases.size() == 0) {
modelItems.add(new Option(getMissingObjectFillText()));
}
}
return modelItems;
}
示例10: doFillDatabaseEnviromentItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the DatabaseEnviroment select.
*
* @param request Stapler request from Jenkins.
* @param tarAttributes Actual chosen TargetAttribute.
* @param target Actual chosen Target.
* @return ListBoxModel with the available DatabaseEnviroments.
* @throws IOException If access to the file fails.
*/
public ListBoxModel doFillDatabaseEnviromentItems(StaplerRequest request,
@QueryParameter("tarAttributes") String tarAttributes, @QueryParameter("../target") String target)
throws IOException {
ListBoxModel modelItems = new ListBoxModel();
target = request.getParameter("target");
this.target = target;
if (tarAttributes.equals("databaseEnvironments")) {
ArrayList<String> databaseEnviroments = CCRUtils.getValueFromJSONString("databaseEnvironments",
CCRUtils.getFromCache(TextField.Target, target, mainDescriptor.getTempChoosenClient()));
for (String databaseEnviroment : databaseEnviroments) {
modelItems.add(new Option(databaseEnviroment, databaseEnviroment));
}
if (databaseEnviroments.size() == 0) {
modelItems.add(new Option(getMissingObjectFillText()));
}
}
return modelItems;
}
示例11: doFillCredentialsIdItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Fills in the Login Credential selection box with applicable Jenkins credentials
*
* @param context
* filter for credentials
*
* @return credential selections
*/
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
@AncestorInPath Item project)
{
List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
Collections.<DomainRequirement> emptyList());
StandardListBoxModel model = new StandardListBoxModel();
model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));
for (StandardUsernamePasswordCredentials c : creds)
{
boolean isSelected = false;
if (credentialsId != null)
{
isSelected = credentialsId.matches(c.getId());
}
String description = Util.fixEmptyAndTrim(c.getDescription());
model.add(new Option(c.getUsername() + (description != null ? " (" + description + ")" : StringUtils.EMPTY), //$NON-NLS-1$ //$NON-NLS-2$
c.getId(), isSelected));
}
return model;
}
示例12: doFillSizeItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
public ListBoxModel doFillSizeItems(@QueryParameter String size) {
return new ListBoxModel(
new Option("S1 $0.0000004/sec ($0.00144/hour): 64MB Mem, 1 CPU Core, 10GB Disk", "s1", size.matches("s1")),
new Option("S2 $0.0000006/sec ($0.00216/hour): 128MB Mem, 1 CPU Core, 10GB Disk", "s2", size.matches("s2")),
new Option("S3 $0.000001/sec ($0.0036/hour): 256MB Mem, 1 CPU Core, 10GB Disk", "s3", size.matches("s3")),
new Option("S4 $0.000002/sec ($0.0072/hour): 512MB Mem, 1 CPU Core, 10GB Disk", "s4", size.matches("s4")),
new Option("M1 $0.000004/sec ($0.0144/hour): 1GB Mem, 1 CPU Core, 10GB Disk", "m1", size.matches("m1")),
new Option("M2 $0.000008/sec ($0.0288/hour): 2GB Mem, 2 CPU Core, 10GB Disk", "m2", size.matches("m2")),
new Option("M3 $0.000015/sec ($0.054/hour): 4GB Mem, 2 CPU Core, 10GB Disk", "m3", size.matches("m3")),
new Option("L1 $0.00003/sec ($0.108/hour): 4GB Mem, 4 CPU Core, 10GB Disk", "l1", size.matches("l1")),
new Option("L2 $0.00006/sec ($0.216/hour): 8GB Mem, 4 CPU Core, 10GB Disk", "l2", size.matches("l2")),
new Option("L3 $0.00012/sec ($0.432/hour): 16GB Mem, 8 CPU Core, 10GB Disk", "l3", size.matches("l3"))
);
}
示例13: doFillDbTypeItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
public ListBoxModel doFillDbTypeItems(){
return new ListBoxModel(
new Option("MySQL", "MySQL", dbType.equals("MySQL")),
new Option("PostgreSQL", "PostgreSQL",
dbType.equals("PostgreSQL")));
}
示例14: doFillResolveItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
public static ListBoxModel doFillResolveItems() {
return new ListBoxModel(new Option("Resolve: None", "none"),
new Option("Resolve: Safe (-as)", "as"),
new Option("Resolve: Merge (-am)", "am"),
new Option("Resolve: Force Merge (-af)", "af"),
new Option("Resolve: Yours (-ay) -- keep your edits", "ay"),
new Option("Resolve: Theirs (-at) -- keep shelf content", "at"));
}
示例15: doFillTarAttributesItems
import hudson.util.ListBoxModel.Option; //导入依赖的package包/类
/**
* Returns a ListBoxModel which is used to fill the TargetAttributes select.
*
* @param request Stapler request from Jenkins.
* @param client Actual chosen client Attribute.
* @param target Actual chosen Target Attribute.
* @return ListBoxModel with the TargetAttributes.
*/
public ListBoxModel doFillTarAttributesItems(StaplerRequest request, @QueryParameter("client") String client,
@QueryParameter("../target") String target) {
mainDescriptor = (org.jenkinsci.plugins.ccrparameter.DynamicConfigurationDefinition.DescriptorImpl)Jenkins
.getInstance().getDescriptor(DynamicConfigurationDefinition.class);
ListBoxModel modelItems = new ListBoxModel();
//TODO check if possible to get these properties dynamically from json file
modelItems.add(new Option("id", "id"));
modelItems.add(new Option("description", "description"));
modelItems.add(new Option("applications", "applications"));
modelItems.add(new Option("databaseEnvironments", "databaseEnvironments"));
modelItems.add(new Option("Properties", "Properties"));
return modelItems;
}