提交 d0b1e4b3 编写于 作者: K kohsuke

replaced "h.defaulted(x,y)" with "x?:y"

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16489 71c3de6d-444a-0410-be80-ed276b4c234a
上级 dc6b23b4
......@@ -869,7 +869,7 @@ public class Functions {
/**
* If the value exists, return that value. Otherwise return the default value.
* <p>
* This method is useful for supplying a default value to a form field.
* Starting 1.294, JEXL supports the elvis operator "x?:y" that supercedes this.
*
* @since 1.150
*/
......
......@@ -28,7 +28,7 @@ THE SOFTWARE.
<img src="${imagesURL}/48x48/monitor.gif" alt=""/>
${%title(it.displayName)}
</h1>
<j:set var="type" value="${h.defaulted(request.getParameter('type'),'min')}" />
<j:set var="type" value="${request.getParameter('type') ?: 'min'}" />
<div>
${%Timespan}:
<j:choose>
......@@ -58,7 +58,7 @@ THE SOFTWARE.
</j:otherwise>
</j:choose>
</div>
<img src="${h.defaulted(prefix,'loadStatistics')}/graph?type=${type}&amp;width=500&amp;height=300" />
<img src="${prefix?:'loadStatistics'}/graph?type=${type}&amp;width=500&amp;height=300" />
<div style="margin-top: 2em;">
${%blurb}
</div>
......
......@@ -52,10 +52,10 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<j:set var="targetType" value="${h.defaulted(attrs.targetType,it.class)}"/>
<j:set var="targetType" value="${attrs.targetType ?: it.class}"/>
<j:set var="instances" value="${attrs.instances ?: instance[field]}"/>
<f:section title="${attrs.title}" name="${h.defaulted(attrs.field,attrs.name)}">
<f:section title="${attrs.title}" name="${attrs.field?:attrs.name}">
<j:if test="${attrs.field!=null}">
<tr>
<td>
......
......@@ -46,7 +46,7 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<j:set var="targetType" value="${h.defaulted(attrs.targetType,it.class)}"/>
<j:set var="targetType" value="${attrs.targetType?:it.class}"/>
<f:section title="${attrs.title}">
<d:invokeBody />
<j:forEach var="d" items="${descriptors}" varStatus="loop">
......
......@@ -54,7 +54,7 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
</st:documentation>
<j:set var="value" value="${h.defaulted(attrs.value,instance[attrs.field])}" />
<j:set var="value" value="${attrs.value?:instance[attrs.field]}" />
<j:choose>
<j:when test="${h.isMultiline(value)}">
<!-- multiline text area to begin with -->
......@@ -65,7 +65,7 @@ THE SOFTWARE.
<table border="0" style="width:100%" cellspacing="0" cellpadding="0">
<tr>
<td width="*">
<j:set var="name" value="${h.defaulted(attrs.name,'_.'+attrs.field)}" />
<j:set var="name" value="${attrs.name ?: '_.'+attrs.field}" />
<input class="setting-input" type="text"
name ="${name}" value="${value}"
id="textarea.${name}" />
......
......@@ -74,7 +74,7 @@ THE SOFTWARE.
</d:tag>
</d:taglib>
<j:set var="targetType" value="${h.defaulted(attrs.targetType,it.class)}"/>
<j:set var="targetType" value="${attrs.targetType?:it.class}"/>
<div class="hetero-list-container ${attrs.hasHeader!=null?'with-drag-drop':''}">
<!-- display existing items -->
<j:forEach var="i" items="${attrs.items}">
......@@ -97,7 +97,7 @@ THE SOFTWARE.
</div>
<div>
<input type="button" value="${h.defaulted(attrs.addCaption,'Add')}" class="hetero-list-add" />
<input type="button" value="${attrs.addCaption?:'Add'}" class="hetero-list-add" />
</div>
</div>
</j:jelly>
\ No newline at end of file
......@@ -49,8 +49,8 @@ THE SOFTWARE.
</st:documentation>
<f:prepareDatabinding />
<input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
name ="${h.defaulted(attrs.name,'_.'+attrs.field)}"
value="${h.defaulted(attrs.value,instance[attrs.field])}"
name ="${attrs.name ?: '_.'+attrs.field}"
value="${attrs.value ?: instance[attrs.field]}"
id="${attrs.id}"
type="password"
checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
......
......@@ -27,5 +27,5 @@ THE SOFTWARE.
As of 1.91, left for backward compatibility.
-->
<input type="button" value="${h.defaulted(attrs.value,'%Delete')}"
<input type="button" value="${attrs.value ?: '%Delete'}"
class="repeatable-delete" />
\ No newline at end of file
......@@ -36,5 +36,5 @@ THE SOFTWARE.
The text of the submit button. Something like "submit", "OK", etc.
</s:attribute>
</s:documentation>
<input type="submit" name="${h.defaulted(attrs.name,'Submit')}" value="${attrs.value}" class="submit-button" />
<input type="submit" name="${attrs.name ?: 'Submit'}" value="${attrs.value}" class="submit-button" />
</j:jelly>
\ No newline at end of file
......@@ -51,11 +51,11 @@ THE SOFTWARE.
<f:prepareDatabinding />
<textarea id="${attrs.id}" style="${attrs.style}"
name ="${h.defaulted(attrs.name,'_.'+attrs.field)}"
name ="${attrs.name ?: '_.'+attrs.field}"
class="setting-input ${checkUrl!=null?'validated':''}"
checkUrl="${checkUrl}"
rows="${h.determineRows(attrs.value)}">
<st:out value="${h.defaulted(attrs.value,instance[attrs.field])}" />
<st:out value="${attrs.value ?: instance[attrs.field]}" />
</textarea>
<!-- resize handle -->
<div class="textarea-handle"/>
......
......@@ -50,8 +50,8 @@ THE SOFTWARE.
</st:documentation>
<f:prepareDatabinding />
<input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
name ="${h.defaulted(attrs.name,'_.'+attrs.field)}"
value="${h.defaulted(attrs.value,instance[attrs.field])}"
name ="${attrs.name ?: '_.'+attrs.field}"
value="${attrs.value ?: instance[attrs.field]}"
id="${attrs.id}"
type="text"
checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册