gpt4 book ai didi

java - 异质 radio 不可见,jenkins 插件

转载 作者:太空宇宙 更新时间:2023-11-04 09:54:23 24 4
gpt4 key购买 nike

我正在和 Jenkins 一起玩hello world plugin并试图用异质 radio 而不是文本来定制它,但是我的用户界面不可见。我是果冻和 Jenkins 的新手。有人可以帮我解决这个问题吗?我正在尝试创建类似的东西,以红色突出显示 Hetero-radio

我的计划Demo1.java


private final HeteroRadioEntry projectVersion;
public HeteroRadioEntry getProjectVersion() { return projectVersion; }

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath filePath, @Nonnull Launcher launcher, @Nonnull TaskListener taskListener) throws InterruptedException, IOException { }

public static abstract class Entry extends AbstractDescribableImpl<Entry> {}

public static final class SimpleEntry extends Entry {
private final String text;
@DataBoundConstructor public SimpleEntry(String text) { this.text = text; }
public String getText() { return text; }
@Extension public static class DescriptorImpl extends Descriptor<Entry> {
@Override public String getDisplayName() { return "Simple Entry"; }
}
}

public static final class AutoEntry extends Entry {
private final String text;
@DataBoundConstructor public AutoEntry() { this.text = "Some fixed string"; }
public String getText() { return text; }
@Extension public static class DescriptorImpl extends Descriptor<Entry> {
@Override public String getDisplayName() { return "Auto Entry"; }
}
}

public static final class HeteroRadioEntry extends Entry {
private final Entry entry;
@DataBoundConstructor public HeteroRadioEntry(Entry entry) { this.entry = entry; }
public Entry getEntry() { return entry; }
@Extension public static class DescriptorImpl extends Descriptor<Entry> {
@Override public String getDisplayName() { return "Hetero-Radio"; }
public List<Descriptor> getEntryDescriptors() {
Jenkins jenkins = Jenkins.getInstance();
return ImmutableList.of(jenkins.getDescriptor(AutoEntry.class), jenkins.getDescriptor(SimpleEntry.class));
}
}
}

@DataBoundConstructor public Demo1(HeteroRadioEntry projectVersion) { this.projectVersion=projectVersion; }

@Symbol("greet")
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
@Override public boolean isApplicable(Class<? extends AbstractProject> aClass) { return true; }
@Override public String getDisplayName() { return "Demo1"; }
}

}

Jelly程序Demo1/config.jelly

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry field="projectVersion"></f:entry>
</j:jelly>

Demo1/HeteroListEntry/config.jelly

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:entry title="Hetero-Choice">
<f:hetero-radio field="entry" descriptors="${descriptor.entryDescriptors}" />
</f:entry>
</j:jelly>

演示1/AutoEntry/config.jelly

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:label field="text" />
</j:jelly>

Demo1/SimpleEntry/config.jelly

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:entry field="text">
<f:textbox/>
</f:entry>
</j:jelly>

最佳答案

通过大量的努力,我通过引用此link获得了结果,尽管并不令人满意。 .它解释了hetero-radio/hetero-list的功能。我将嵌套的静态类移出外部

关于java - 异质 radio 不可见,jenkins 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54361032/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com