Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
0e3c7a95
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0e3c7a95
编写于
9月 03, 2013
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #816 from jglick/hetero-list-sample
Hetero list sample
上级
3d8c78e2
e54c452c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
335 addition
and
0 deletion
+335
-0
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/HeteroList.java
.../src/main/java/jenkins/plugins/ui_samples/HeteroList.java
+150
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/ChoiceEntry/config.jelly
...ns/plugins/ui_samples/HeteroList/ChoiceEntry/config.jelly
+32
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/Config/config.jelly
...jenkins/plugins/ui_samples/HeteroList/Config/config.jelly
+39
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/SimpleEntry/config.jelly
...ns/plugins/ui_samples/HeteroList/SimpleEntry/config.jelly
+31
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/configure.jelly
...ces/jenkins/plugins/ui_samples/HeteroList/configure.jelly
+42
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/index.jelly
...sources/jenkins/plugins/ui_samples/HeteroList/index.jelly
+41
-0
未找到文件。
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/HeteroList.java
0 → 100644
浏览文件 @
0e3c7a95
/*
* The MIT License
*
* Copyright 2013 Jesse Glick.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
jenkins.plugins.ui_samples
;
import
hudson.Extension
;
import
hudson.XmlFile
;
import
hudson.model.AbstractDescribableImpl
;
import
hudson.model.Descriptor
;
import
hudson.util.FormApply
;
import
hudson.util.ListBoxModel
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
javax.servlet.ServletException
;
import
jenkins.model.Jenkins
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.HttpResponse
;
import
org.kohsuke.stapler.StaplerRequest
;
@Extension
public
final
class
HeteroList
extends
UISample
{
@Override
public
String
getDescription
()
{
return
"Show a heterogeneous list of subitems with different data bindings for radio buttons and checkboxes"
;
}
@Override
public
List
<
SourceFile
>
getSourceFiles
()
{
return
super
.
getSourceFiles
();
// TODO add others
}
@Extension
public
static
final
class
DescriptorImpl
extends
UISampleDescriptor
{}
public
XmlFile
getConfigFile
()
{
return
new
XmlFile
(
new
File
(
Jenkins
.
getInstance
().
getRootDir
(),
"stuff.xml"
));
}
private
Config
config
;
public
HeteroList
()
throws
IOException
{
XmlFile
xml
=
getConfigFile
();
if
(
xml
.
exists
())
{
xml
.
unmarshal
(
this
);
}
}
public
Config
getConfig
()
{
return
config
;
}
public
void
setConfig
(
Config
config
)
{
this
.
config
=
config
;
}
public
HttpResponse
doConfigSubmit
(
StaplerRequest
req
)
throws
ServletException
,
IOException
{
config
=
null
;
// otherwise bindJSON will never clear it once set
req
.
bindJSON
(
this
,
req
.
getSubmittedForm
());
getConfigFile
().
write
(
this
);
return
FormApply
.
success
(
"."
);
}
public
static
final
class
Config
extends
AbstractDescribableImpl
<
Config
>
{
private
final
List
<
Entry
>
entries
;
@DataBoundConstructor
public
Config
(
List
<
Entry
>
entries
)
{
this
.
entries
=
entries
!=
null
?
new
ArrayList
<
Entry
>(
entries
)
:
Collections
.<
Entry
>
emptyList
();
}
public
List
<
Entry
>
getEntries
()
{
return
Collections
.
unmodifiableList
(
entries
);
}
@Extension
public
static
class
DescriptorImpl
extends
Descriptor
<
Config
>
{
@Override
public
String
getDisplayName
()
{
return
""
;}
}
}
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
ChoiceEntry
extends
Entry
{
private
final
String
choice
;
@DataBoundConstructor
public
ChoiceEntry
(
String
choice
)
{
this
.
choice
=
choice
;
}
public
String
getChoice
()
{
return
choice
;
}
@Extension
public
static
class
DescriptorImpl
extends
Descriptor
<
Entry
>
{
@Override
public
String
getDisplayName
()
{
return
"Choice Entry"
;
}
public
ListBoxModel
doFillChoiceItems
()
{
return
new
ListBoxModel
().
add
(
"good"
).
add
(
"bad"
).
add
(
"ugly"
);
}
}
}
}
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/ChoiceEntry/config.jelly
0 → 100644
浏览文件 @
0e3c7a95
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:f=
"/lib/form"
>
<f:entry
field=
"choice"
title=
"Choice"
>
<f:select/>
</f:entry>
<!-- TODO figure out if f:radioBlock can also be used for form binding: Failed to instantiate class java.lang.String from {"value":"good"} -->
</j:jelly>
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/Config/config.jelly
0 → 100644
浏览文件 @
0e3c7a95
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:f=
"/lib/form"
>
<f:section
title=
"Entries"
>
<f:block>
<f:repeatableHeteroProperty
field=
"entries"
hasHeader=
"true"
>
<f:entry
title=
""
>
<div
align=
"right"
>
<f:repeatableDeleteButton/>
</div>
</f:entry>
</f:repeatableHeteroProperty>
</f:block>
</f:section>
</j:jelly>
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/SimpleEntry/config.jelly
0 → 100644
浏览文件 @
0e3c7a95
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:f=
"/lib/form"
>
<f:entry
field=
"text"
title=
"Text"
>
<f:textbox/>
</f:entry>
</j:jelly>
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/configure.jelly
0 → 100644
浏览文件 @
0e3c7a95
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:f=
"/lib/form"
xmlns:l=
"/lib/layout"
>
<l:layout
title=
"Configure"
>
<l:main-panel>
<h1>
Configuration
</h1>
<f:form
action=
"configSubmit"
name=
"config"
method=
"post"
>
<j:set
var=
"instance"
value=
"${it}"
/>
<j:set
var=
"descriptor"
value=
"${it.descriptor}"
/>
<f:optionalProperty
field=
"config"
title=
"Enable Configuration"
/>
<f:bottomButtonBar>
<f:submit
value=
"${%Save}"
/>
<f:apply/>
</f:bottomButtonBar>
</f:form>
</l:main-panel>
</l:layout>
</j:jelly>
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/HeteroList/index.jelly
0 → 100644
浏览文件 @
0e3c7a95
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:s=
"/lib/samples"
>
<s:sample
title=
"Hetero List Sample"
>
<p>
<a
href=
"configure"
>
Configure me!
</a>
</p>
<j:if
test=
"${it.configFile.exists()}"
>
<p>
Current configuration:
</p>
<pre>
${it.configFile.asString()}
</pre>
</j:if>
</s:sample>
</j:jelly>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录