Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
6fc699ff
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,发现更多精彩内容 >>
提交
6fc699ff
编写于
3月 31, 2011
作者:
K
Kohsuke Kawaguchi
提交者:
Stephen Connolly
4月 04, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- making context richer
- simplifying Jelly view and submission handling
上级
205fea68
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
35 deletion
+26
-35
core/src/main/java/hudson/model/View.java
core/src/main/java/hudson/model/View.java
+16
-19
core/src/main/java/hudson/model/ViewProperty.java
core/src/main/java/hudson/model/ViewProperty.java
+5
-1
core/src/main/java/hudson/model/ViewPropertyDescriptor.java
core/src/main/java/hudson/model/ViewPropertyDescriptor.java
+4
-1
core/src/main/resources/hudson/model/View/configure.jelly
core/src/main/resources/hudson/model/View/configure.jelly
+1
-14
未找到文件。
core/src/main/java/hudson/model/View.java
浏览文件 @
6fc699ff
...
...
@@ -29,6 +29,8 @@ import hudson.ExtensionPoint;
import
hudson.Util
;
import
hudson.model.Descriptor.FormException
;
import
hudson.model.Node.Mode
;
import
hudson.model.labels.LabelAtomProperty
;
import
hudson.model.labels.LabelAtomPropertyDescriptor
;
import
hudson.scm.ChangeLogSet.Entry
;
import
hudson.search.CollectionSearchIndex
;
import
hudson.search.SearchIndexBuilder
;
...
...
@@ -205,6 +207,19 @@ public abstract class View extends AbstractModelObject implements AccessControll
return
properties
;
}
/**
* Returns all the {@link LabelAtomPropertyDescriptor}s that can be potentially configured
* on this label.
*/
public
List
<
ViewPropertyDescriptor
>
getApplicablePropertyDescriptors
()
{
List
<
ViewPropertyDescriptor
>
r
=
new
ArrayList
<
ViewPropertyDescriptor
>();
for
(
ViewPropertyDescriptor
pd
:
ViewProperty
.
all
())
{
if
(
pd
.
isEnabledFor
(
this
))
r
.
add
(
pd
);
}
return
r
;
}
public
void
save
()
throws
IOException
{
// persistence is a part of the owner
// due to initialization timing issue, it can be null when this method is called
...
...
@@ -620,25 +635,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
JSONObject
json
=
req
.
getSubmittedForm
();
List
<
ViewProperty
>
props
=
new
ArrayList
<
ViewProperty
>();
int
i
=
0
;
for
(
ViewPropertyDescriptor
d:
ViewProperty
.
all
())
{
ViewProperty
p
=
properties
.
get
(
d
.
clazz
);
JSONObject
o
=
json
.
optJSONObject
(
"viewProperty"
+
(
i
++));
if
(
o
!=
null
)
{
if
(
p
!=
null
)
{
p
=
p
.
reconfigure
(
req
,
o
);
}
else
{
p
=
d
.
newInstance
(
req
,
o
);
}
}
if
(
p
!=
null
)
{
props
.
add
(
p
);
}
}
properties
.
replaceBy
(
props
);
properties
.
rebuild
(
req
,
req
.
getSubmittedForm
(),
getApplicablePropertyDescriptors
());
save
();
...
...
core/src/main/java/hudson/model/ViewProperty.java
浏览文件 @
6fc699ff
...
...
@@ -25,9 +25,14 @@ package hudson.model;
import
hudson.DescriptorExtensionList
;
import
hudson.ExtensionPoint
;
import
hudson.console.ConsoleAnnotator
;
import
hudson.console.ConsoleAnnotatorFactory
;
import
net.sf.json.JSONObject
;
import
org.kohsuke.stapler.StaplerRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Extensible property of {@link View}.
*
...
...
@@ -68,5 +73,4 @@ public class ViewProperty implements Describable<ViewProperty>, ExtensionPoint {
public
ViewProperty
reconfigure
(
StaplerRequest
req
,
JSONObject
form
)
throws
Descriptor
.
FormException
{
return
getDescriptor
().
newInstance
(
req
,
form
);
}
}
core/src/main/java/hudson/model/ViewPropertyDescriptor.java
浏览文件 @
6fc699ff
...
...
@@ -67,8 +67,11 @@ public abstract class ViewPropertyDescriptor extends Descriptor<ViewProperty> {
* <p>
* This mechanism is useful if the availability of the property is
* contingent of some other settings.
*
* @param view
* View for which this property is considered. Never null.
*/
public
boolean
isEnabled
(
)
{
public
boolean
isEnabled
For
(
View
view
)
{
return
true
;
}
}
core/src/main/resources/hudson/model/View/configure.jelly
浏览文件 @
6fc699ff
...
...
@@ -51,20 +51,7 @@ THE SOFTWARE.
<st:include page="configure-entries.jelly" optional="true" />
<!-- view property configurations -->
<j:invokeStatic var="descriptors" className="hudson.model.ViewProperty" method="all" />
<j:set var="instances" value="${it.properties}" />
<j:forEach var="d" items="${descriptors}" varStatus="loop">
<j:if test="${d.enabled}">
<f:section title="${d.displayName}">
<j:set var="descriptor" value="${d}" />
<j:set var="instance" value="${instances[d]}" />
<f:rowSet name="viewProperty${loop.index}">
<st:include from="${d}" page="${d.configPage}"/>
</f:rowSet>
</f:section>
</j:if>
</j:forEach>
<f:descriptorList descriptors="${it.getApplicablePropertyDescriptors()}" instances="${it.properties}" />
<f:block>
<f:submit value="OK" />
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录