| author | akozak | 2011-11-22 10:00:21 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:01 (EST) |
| commit | 185241439b8c1c816718fffe717be46d4eea1504 (patch) (side-by-side diff) | |
| tree | c76f961ae90109007ff332bf8eea675ea894ca73 | |
| parent | 6d53605ff6bdfb4414cd1cf4c431908accc866fa (diff) | |
| download | org.eclipse.hudson.core-185241439b8c1c816718fffe717be46d4eea1504.zip org.eclipse.hudson.core-185241439b8c1c816718fffe717be46d4eea1504.tar.gz org.eclipse.hudson.core-185241439b8c1c816718fffe717be46d4eea1504.tar.bz2 | |
Rename jelly tag attribute 'isCascadingValue' to 'isOverriddenProperty'. Add 'isOverriddenProperty' to f:entry tag. Add ProjectProperty support for AbstractProject.JDK value. Implement legacy test case for jdk conversion
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
15 files changed, 56 insertions, 37 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java index 4c9af61..5f2f1df 100644 --- a/hudson-core/src/main/java/hudson/model/AbstractProject.java +++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java @@ -126,6 +126,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A public static final String QUIET_PERIOD_PROPERTY_NAME = "quietPeriod"; public static final String SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME = "scmCheckoutRetryCount"; public static final String CUSTOM_WORKSPACE_PROPERTY_NAME = "customWorkspace"; + public static final String JDK_PROPERTY_NAME = "jdk"; /** * {@link SCM} associated with the project. @@ -217,6 +218,9 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A * are saved independently. * * @see Hudson#getJDK(String) + * @deprecated as of 2.2.0 + * don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}. + * Use getter/setter for accessing to this field. */ private volatile String jdk; @@ -336,6 +340,10 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A setScmCheckoutRetryCount(scmCheckoutRetryCount); scmCheckoutRetryCount = null; } + if (null == getProperty(JDK_PROPERTY_NAME)) { + setJDK(jdk); + jdk = null; + } } @Override @@ -997,11 +1005,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A /** * @return name of jdk chosen for current project. Could taken from parent */ - protected String getJDKName() { - if (StringUtils.isNotBlank(jdk)) { - return jdk; - } - return hasCascadingProject()? getCascadingProject().getJDKName() : null; + public String getJDKName() { + return getStringProperty(JDK_PROPERTY_NAME).getValue(); } /** @@ -1020,12 +1025,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A } public void setJDK(String jdk) { - if (!(hasCascadingProject() - && StringUtils.equalsIgnoreCase(getCascadingProject().getJDKName(), jdk))) { - this.jdk = jdk; - } else { - this.jdk = null; - } + getStringProperty(JDK_PROPERTY_NAME).setValue(jdk); } public BuildAuthorizationToken getAuthToken() { diff --git a/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly b/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly index 5daf4f0..9bcdf61 100644 --- a/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly +++ b/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly @@ -57,13 +57,13 @@ checked="${runSequentially}" field="runSequentially" title="${%Run each configuration sequentially}" - isCascadingValue="${runSequentiallyProperty.isPropertyOverridden()}"/> + isPropertyOverridden="${runSequentiallyProperty.isPropertyOverridden()}"/> <j:set var="combinationFilterProperty" value="${it.getStringProperty(it.COMBINATION_FILTER_PROPERTY_NAME)}"/> <j:set var="combinationFilter" value="${combinationFilterProperty.getValue()}"/> <f:optionalBlock name="hasCombinationFilter" title="${%Combination Filter}" checked="${!empty(combinationFilter)}" - isCascadingValue="${combinationFilterProperty.isPropertyOverridden()}" + isPropertyOverridden="${combinationFilterProperty.isPropertyOverridden()}" help="/help/matrix/combinationfilter.html"> <f:entry title="${%Filter}"> <f:textbox name="combinationFilter" value="${combinationFilter}" /> @@ -74,7 +74,7 @@ <j:set var="touchStoneCombinationFilter" value="${touchStoneCombinationFilterProperty.getValue()}"/> <f:optionalBlock name="hasTouchStoneCombinationFilter" title="${%Execute touchstone builds first}" checked="${!empty(touchStoneCombinationFilter)}" - isCascadingValue="${touchStoneCombinationFilterProperty.isPropertyOverridden()}" + isPropertyOverridden="${touchStoneCombinationFilterProperty.isPropertyOverridden()}" help="/help/matrix/touchstone.html"> <f:entry title="${%Filter}"> <f:textbox name="touchStoneCombinationFilter" value="${touchStoneCombinationFilter}" /> diff --git a/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly b/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly index 8347018..3215af7 100644 --- a/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly +++ b/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly @@ -29,12 +29,13 @@ <j:if test="${jdks.size() gt 1}"> <!-- if there's only one JDK configured, always use that. --> <f:entry title="JDK" - description="${%JDK to be used for this project}"> + description="${%JDK to be used for this project}" + isPropertyOverridden="${it.getStringProperty(it.JDK_PROPERTY_NAME).isPropertyOverridden()}"> <select class="setting-input validated" name="jdk" checkUrl="'${rootURL}/defaultJDKCheck?value='+this.value"> <option>${%default.value}</option> <j:forEach var="inst" items="${jdks}"> - <f:option selected="${inst.name==it.JDK.name}" value="${inst.name}">${inst.name}</f:option> + <f:option selected="${inst.name==it.getJDKName()}" value="${inst.name}">${inst.name}</f:option> </j:forEach> </select> </f:entry> diff --git a/hudson-core/src/main/resources/hudson/model/Job/configure.jelly b/hudson-core/src/main/resources/hudson/model/Job/configure.jelly index 80691cd..3e3c9d8 100644 --- a/hudson-core/src/main/resources/hudson/model/Job/configure.jelly +++ b/hudson-core/src/main/resources/hudson/model/Job/configure.jelly @@ -23,7 +23,7 @@ <st:include page="sidepanel.jelly" /> <l:main-panel> <div class="behavior-loading">${%LOADING}</div> - <f:form method="post" action="configSubmit" name="config"> + <f:form method="post" action="configSubmit" name="config" tableClass="configure"> <j:set var="descriptor" value="${it.descriptor}" /> <j:set var="instance" value="${it}" /> diff --git a/hudson-core/src/main/resources/lib/form/entry.jelly b/hudson-core/src/main/resources/lib/form/entry.jelly index 3199e0a..e822b29 100644 --- a/hudson-core/src/main/resources/lib/form/entry.jelly +++ b/hudson-core/src/main/resources/lib/form/entry.jelly @@ -39,6 +39,9 @@ is somewhat de-emphasized, in favor of the inline foldable help page specified via @help. </st:attribute> + <st:attribute name="isPropertyOverridden"> + if present and true - value is overridden + </st:attribute> <st:attribute name="help"> URL to the HTML page. When this attribute is specified, the entry gets a (?) icon on the right, and if the user clicks it, the contents of the @@ -54,9 +57,12 @@ <j:set target="${attrs}" property="help" value="${descriptor.getHelpFile(attrs.field)}" /> </j:if> + <j:if test="${attrs.isPropertyOverridden==null}"> + <j:set target="${attrs}" property="isPropertyOverridden" value="false"/> + </j:if> <!-- expose this so that we can look up the @field value later from prepareDatabinding.jelly --> <j:set var="entry" value="${attrs}" /> - <tr> + <tr class="${attrs.isPropertyOverridden? 'modified': 'original'}"> <td class="setting-leftspace"><st:nbsp/></td> <td class="setting-name"> ${attrs.title} @@ -66,7 +72,7 @@ </td> <j:if test="${attrs.help!=null}"> <td class="setting-help"> - <a href="#" class="help-button" helpURL="${rootURL}${attrs.help}"><img src="${imagesURL}/16x16/help.png" alt="Help for feature: ${title}" /></a> + <a href="#" class="help-button" helpURL="${rootURL}${attrs.help}"><img src="${imagesURL}/16x16/help.gif" alt="Help for feature: ${title}" /></a> </td> </j:if> </tr> @@ -80,4 +86,4 @@ <j:if test="${attrs.help!=null}"> <f:helpArea /> </j:if> -</j:jelly> +</j:jelly>
\ No newline at end of file diff --git a/hudson-core/src/main/resources/lib/form/optionalBlock.jelly b/hudson-core/src/main/resources/lib/form/optionalBlock.jelly index f978dc2..5c042b7 100644 --- a/hudson-core/src/main/resources/lib/form/optionalBlock.jelly +++ b/hudson-core/src/main/resources/lib/form/optionalBlock.jelly @@ -44,8 +44,8 @@ <st:attribute name="inline"> if present, the foldable section will not be grouped into a separate JSON object upon submission </st:attribute> - <st:attribute name="isCascadingValue"> - if present and true - value is taken from cascading parent + <st:attribute name="isPropertyOverridden"> + if present and true - value is overridden </st:attribute> </st:documentation> <j:if test="${attrs.help==null}"> @@ -53,12 +53,12 @@ <j:set target="${attrs}" property="help" value="${descriptor.getHelpFile(attrs.field)}" /> </j:if> - <j:if test="${attrs.isCascadingValue==null}"> - <j:set target="${attrs}" property="isCascadingValue" value="false"/> + <j:if test="${attrs.isPropertyOverridden==null}"> + <j:set target="${attrs}" property="isPropertyOverridden" value="false"/> </j:if> <tr class="optional-block-start ${attrs.inline?'':'row-set-start'}" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning --> - <td colspan="3" class="${attrs.isCascadingValue? 'modified': 'original'}"> + <td colspan="3" class="${attrs.isPropertyOverridden? 'modified': 'original'}"> <f:checkbox name="${attrs.name}" onclick="javascript:updateOptionalBlock(this,true)" negative="${attrs.negative}" checked="${attrs.checked}" field="${attrs.field}" title="${title}" /> </td> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly index 979074a..f1d15f3 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly @@ -24,5 +24,5 @@ title="${%Block build when downstream project is building}" help="/help/project-config/block-downstream-building.html" checked="${blockBuildWhenDownstreamBuilding}" - isCascadingValue="${blockBuildWhenDownstreamBuildingProperty.isPropertyOverridden()}"/> -</j:jelly> + isPropertyOverridden="${blockBuildWhenDownstreamBuildingProperty.isPropertyOverridden()}"/> +</j:jelly>
\ No newline at end of file diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly index 4b0477b..6878b69 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly @@ -24,5 +24,5 @@ title="${%Block build when upstream project is building}" help="/help/project-config/block-upstream-building.html" checked="${blockBuildWhenUpstreamBuilding}" - isCascadingValue="${blockBuildWhenUpstreamBuildingProperty.isPropertyOverridden()}"/> + isPropertyOverridden="${blockBuildWhenUpstreamBuildingProperty.isPropertyOverridden()}"/> </j:jelly> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly index 9bf46fb..ee8b606 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly @@ -21,6 +21,6 @@ <j:set var="cleanWorkspaceRequired" value="${cleanWorkspaceRequiredProperty.getValue()}"/> <f:optionalBlock name="cleanWorkspaceRequired" title="${%Clean workspace before build}" checked="${cleanWorkspaceRequired}" - isCascadingValue="${cleanWorkspaceRequiredProperty.isPropertyOverridden()}" + isPropertyOverridden="${cleanWorkspaceRequiredProperty.isPropertyOverridden()}" help="/help/project-config/cleanWorkspace.html" /> </j:jelly> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly index c591a95..52e82e8 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly @@ -20,11 +20,10 @@ <j:set var="customWorkspaceProperty" value="${it.getStringProperty(it.CUSTOM_WORKSPACE_PROPERTY_NAME)}"/> <j:set var="customWorkspace" value="${customWorkspaceProperty.getValue()}"/> <f:optionalBlock name="customWorkspace" title="${%Use custom workspace}" checked="${customWorkspace!=null}" - isCascadingValue="${customWorkspaceProperty.isPropertyOverridden()}" + isPropertyOverridden="${customWorkspaceProperty.isPropertyOverridden()}" help="/help/project-config/custom-workspace.html"> <f:entry title="${%Directory}"> <f:textbox name="customWorkspace.directory" value="${customWorkspace}" /> </f:entry> </f:optionalBlock> </j:jelly> - diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly index 7aa261b..0c01df3 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly @@ -21,7 +21,7 @@ <j:set var="quietPeriod" value="${quietPeriodProperty.getValue()}"/> <f:optionalBlock name="hasCustomQuietPeriod" title="${%Quiet period}" checked="${quietPeriod!=null and quietPeriod!=quietPeriodProperty.getDefaultValue()}" - isCascadingValue="${quietPeriodProperty.isPropertyOverridden()}" + isPropertyOverridden="${quietPeriodProperty.isPropertyOverridden()}" help="/help/project-config/quietPeriod.html"> <f:entry title="${%Quiet period}" description="${%Number of seconds}"> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly index 0918a82..99c402c 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly @@ -21,7 +21,7 @@ <j:set var="scmCheckoutRetryCount" value="${scmCheckoutRetryCountProperty.getValue()}"/> <f:optionalBlock name="hasCustomScmCheckoutRetryCount" title="${%Retry Count}" checked="${scmCheckoutRetryCount!=null and scmCheckoutRetryCount!=scmCheckoutRetryCountProperty.getDefaultValue()}" - isCascadingValue="${scmCheckoutRetryCountProperty.isPropertyOverridden()}" + isPropertyOverridden="${scmCheckoutRetryCountProperty.isPropertyOverridden()}" help="/help/project-config/scmCheckoutRetryCount.html"> <f:entry title="${%SCM checkout retry count}"> <f:textbox name="scmCheckoutRetryCount" value="${scmCheckoutRetryCount}"/> diff --git a/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java b/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java index 77f9fac..3e7790a 100644 --- a/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java +++ b/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java @@ -70,6 +70,7 @@ public class LegacyProjectTest { assertNull(project.getProperty(AbstractProject.CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME)); assertNull(project.getProperty(AbstractProject.QUIET_PERIOD_PROPERTY_NAME)); assertNull(project.getProperty(AbstractProject.SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME)); + assertNull(project.getProperty(AbstractProject.JDK_PROPERTY_NAME)); project.buildProjectProperties(); assertNotNull(project.getProperty(AbstractProject.BLOCK_BUILD_WHEN_UPSTREAM_BUILDING_PROPERTY_NAME)); assertNotNull(project.getProperty(AbstractProject.BLOCK_BUILD_WHEN_DOWNSTREAM_BUILDING_PROPERTY_NAME)); @@ -77,5 +78,6 @@ public class LegacyProjectTest { assertNotNull(project.getProperty(AbstractProject.CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME)); assertNotNull(project.getProperty(AbstractProject.QUIET_PERIOD_PROPERTY_NAME)); assertNotNull(project.getProperty(AbstractProject.SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME)); + assertNotNull(project.getProperty(AbstractProject.JDK_PROPERTY_NAME)); } } diff --git a/hudson-core/src/test/resources/hudson/model/freestyle/config.xml b/hudson-core/src/test/resources/hudson/model/freestyle/config.xml index ff6dedb..8490d89 100644 --- a/hudson-core/src/test/resources/hudson/model/freestyle/config.xml +++ b/hudson-core/src/test/resources/hudson/model/freestyle/config.xml @@ -31,6 +31,7 @@ <sendToIndividuals>true</sendToIndividuals> </hudson.tasks.Mailer> </publishers> + <jdk>jdk1.5</jdk> <buildWrappers/> <customWorkspace>/tmp</customWorkspace> </project>
\ No newline at end of file diff --git a/hudson-war/src/main/webapp/css/style.css b/hudson-war/src/main/webapp/css/style.css index 6d32271..ccce54a 100644 --- a/hudson-war/src/main/webapp/css/style.css +++ b/hudson-war/src/main/webapp/css/style.css @@ -1,6 +1,6 @@ /******************************************************************************* * - * Copyright (c) 2004-2009 Oracle Corporation. + * Copyright (c) 2004-2011 Oracle Corporation. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -9,7 +9,7 @@ * * Contributors: * - * Kohsuke Kawaguchi, Daniel Dyer, Stephen Connolly + * Kohsuke Kawaguchi, Daniel Dyer, Stephen Connolly, Nikita Levyankov * *******************************************************************************/ @@ -1000,8 +1000,18 @@ div.deleteSlaveDialog div.radioButtons { div.deleteSlaveDialog h4 { color: #F89938; } - /* ======================== "Cascading project" ==========================*/ -tr.optional-block-start > td.modified { +/* --- Optional Block, Entry Block --- */ +tr.optional-block-start > td.modified, +tr.modified > td.setting-name, tr.modified > td.setting-main, tr.modified > td.setting-leftspace { background-color: #FFE8C9; +} + +/* ======================= Job Configuration table ========================== */ +table.configure { + border-spacing: 0px; + border-collapse: collapse; +} +table.configure > td { + padding: 0px; }
\ No newline at end of file |

