Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
33af6b59
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
33af6b59
编写于
10月 11, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding a databinding version of <f:hetero-list />
上级
27783878
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
111 addition
and
13 deletion
+111
-13
core/src/main/java/hudson/model/Descriptor.java
core/src/main/java/hudson/model/Descriptor.java
+8
-1
core/src/main/java/hudson/model/ListView.java
core/src/main/java/hudson/model/ListView.java
+1
-2
core/src/main/java/hudson/model/ViewDescriptor.java
core/src/main/java/hudson/model/ViewDescriptor.java
+19
-0
core/src/main/resources/hudson/model/ListView/configure-entries.jelly
...n/resources/hudson/model/ListView/configure-entries.jelly
+2
-10
core/src/main/resources/lib/form/hetero-list.jelly
core/src/main/resources/lib/form/hetero-list.jelly
+2
-0
core/src/main/resources/lib/form/repeatableHeteroProperty.jelly
...rc/main/resources/lib/form/repeatableHeteroProperty.jelly
+79
-0
未找到文件。
core/src/main/java/hudson/model/Descriptor.java
浏览文件 @
33af6b59
...
...
@@ -200,11 +200,18 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
}
/**
* Returns all the descriptors that produce types assignable to the
item
type.
* Returns all the descriptors that produce types assignable to the
property
type.
*/
public
List
<?
extends
Descriptor
>
getApplicableDescriptors
()
{
return
Jenkins
.
getInstance
().
getDescriptorList
(
clazz
);
}
/**
* Returns all the descriptors that produce types assignable to the item type for a collection property.
*/
public
List
<?
extends
Descriptor
>
getApplicableItemDescriptors
()
{
return
Jenkins
.
getInstance
().
getDescriptorList
(
getItemType
());
}
}
/**
...
...
core/src/main/java/hudson/model/ListView.java
浏览文件 @
33af6b59
...
...
@@ -42,7 +42,6 @@ import org.kohsuke.stapler.interceptor.RequirePOST;
import
javax.annotation.concurrent.GuardedBy
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.LinkedHashSet
;
...
...
@@ -292,7 +291,7 @@ public class ListView extends View implements Saveable {
}
@Extension
public
static
final
class
DescriptorImpl
extends
ViewDescriptor
{
public
static
class
DescriptorImpl
extends
ViewDescriptor
{
public
String
getDisplayName
()
{
return
Messages
.
ListView_DisplayName
();
}
...
...
core/src/main/java/hudson/model/ViewDescriptor.java
浏览文件 @
33af6b59
...
...
@@ -23,9 +23,14 @@
*/
package
hudson.model
;
import
hudson.views.ListViewColumn
;
import
hudson.views.ListViewColumnDescriptor
;
import
hudson.views.ViewJobFilter
;
import
jenkins.model.Jenkins
;
import
org.kohsuke.stapler.QueryParameter
;
import
java.util.List
;
/**
* {@link Descriptor} for {@link View}.
*
...
...
@@ -88,4 +93,18 @@ public abstract class ViewDescriptor extends Descriptor<View> {
return
r
;
}
/**
* Possible {@link ListViewColumnDescriptor}s that can be used with this view.
*/
public
List
<
Descriptor
<
ListViewColumn
>>
getColumnsDescriptors
()
{
return
ListViewColumn
.
all
();
}
/**
* Possible {@link ViewJobFilter} types that can be used with this view.
*/
public
List
<
Descriptor
<
ViewJobFilter
>>
getJobFiltersDescriptors
()
{
return
ViewJobFilter
.
all
();
}
}
core/src/main/resources/hudson/model/ListView/configure-entries.jelly
浏览文件 @
33af6b59
...
...
@@ -54,24 +54,16 @@ THE SOFTWARE.
</f:optionalBlock>
<j:if test="${it.hasJobFilterExtensions()}">
<j:invokeStatic var="allJobFilters" className="hudson.views.ViewJobFilter" method="all"/>
<f:block>
<f:hetero-list name="jobFilters" hasHeader="true"
descriptors="${allJobFilters}"
items="${it.jobFilters}"
addCaption="${%Add Job Filter}" />
<f:repeatableHeteroProperty field="jobFilters" hasHeader="true" addCaption="${%Add Job Filter}" />
</f:block>
</j:if>
</f:section>
<f:section title="${%Columns}">
<j:invokeStatic var="allColumns" className="hudson.views.ListViewColumn" method="all"/>
<f:block>
<f:hetero-list name="columns" hasHeader="true"
descriptors="${allColumns}"
items="${it.columns}"
addCaption="${%Add column}"/>
<f:repeatableHeteroProperty field="columns" hasHeader="true" addCaption="${%Add column}"/>
</f:block>
</f:section>
...
...
core/src/main/resources/lib/form/hetero-list.jelly
浏览文件 @
33af6b59
...
...
@@ -29,6 +29,8 @@ THE SOFTWARE.
arbitrary items from the given list of descriptors, and configure them independently.
The submission can be data-bound into List<T> where T is the common base type for the describable instances.
For databinding use, please use <f:repeatableHeteroProperty />
<st:attribute name="name" use="required">
form name that receives an array for all the items in the heterogeneous list.
...
...
core/src/main/resources/lib/form/repeatableHeteroProperty.jelly
0 → 100644
浏览文件 @
33af6b59
<!--
The MIT License
Copyright (c) 2012, CloudBees, Inc.
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:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation> <![CDATA[
Data-bound only version of <f:hetero-list> that assumes the type pointed by the property is data-bound as well.
The nested property type must be Describable and it needs to have config.jelly.
The nested configuration fragment normally needs to have a delete button by adding a fragment like this:
<f:entry title="">
<div align="right">
<f:repeatableDeleteButton />
</div>
</f:entry>
]]>
<st:attribute name="field" use="required">
Used for the data binding.
</st:attribute>
<st:attribute name="addCaption">
caption of the 'add' button.
</st:attribute>
<st:attribute name="deleteCaption">
caption of the 'delete' button.
</st:attribute>
<st:attribute name="targetType">
the type for which descriptors will be configured. Defaults to ${it.class} (optional)
</st:attribute>
<st:attribute name="hasHeader">
For each item, add a caption from descriptor.getDisplayName().
This also activates drag&drop (where the header is a grip), and help text support.
</st:attribute>
<st:attribute name="oneEach">
If true, only allow up to one instance per descriptor.
</st:attribute>
<st:attribute name="menuAlign">
Menu alignment against the button. Defaults to tl-bl
</st:attribute>
<st:attribute name="honorOrder">
If true, insert new addition by default to their 'desired' location, which
is the order induced by the descriptors.
</st:attribute>
</st:documentation>
<!--
first try getFooBarDescriptors() then fall back to automatic inference by type
-->
<f:hetero-list name="${attrs.field}" items="${instance[attrs.field]}"
descriptors="${descriptor[attrs.field+'Descriptors'] ?: descriptor.getPropertyType(instance,attrs.field).getApplicableItemDescriptors()}"
addCaption="${attrs.addCaption}" deleteCaption="${attrs.deleteCaption}"
hasHeader="${attrs.hasHeader}" honorOrder="${attrs.honorOrder}"
menuAlign="${attrs.menuAlign}" oneEach="${attrs.oneEach}"
targetType="${attrs.targetType}"
/>
<!-- TODO: there should be a mechanism to pass-through map as parameters -->
</j:jelly>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录