Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinston Prakash2011-09-16 00:33:31 +0000
committerWinston Prakash2011-09-16 00:33:31 +0000
commitc74a6240b309125e185126ec4214a748b73eb1a9 (patch)
tree931dd006e49f6cb506257e0e0cbc0eb399153526 /hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly
downloadorg.eclipse.hudson.core-c74a6240b309125e185126ec4214a748b73eb1a9.tar.gz
org.eclipse.hudson.core-c74a6240b309125e185126ec4214a748b73eb1a9.tar.xz
org.eclipse.hudson.core-c74a6240b309125e185126ec4214a748b73eb1a9.zip
Initial commit of hudson-core files which are approved via CQ 5461
Diffstat (limited to 'hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly')
-rw-r--r--hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly52
1 files changed, 52 insertions, 0 deletions
diff --git a/hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly b/hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly
new file mode 100644
index 00000000..854c4a89
--- /dev/null
+++ b/hudson-core/src/main/resources/lib/form/dropdownDescriptorSelector.jelly
@@ -0,0 +1,52 @@
+<!-- **************************************************************************
+#
+# Copyright (c) 2010, InfraDNA, Inc.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#
+#
+#
+#
+#************************************************************************** -->
+
+<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>
+ Renders a single &lt;select> control for choosing a Describable.
+ Depending on the currently selected value, its config.jelly will be
+ rendered below &lt;select, allowing the user to configure Describable.
+
+ <st:attribute name="field" use="required">
+ form field name. Used for databinding.
+ </st:attribute>
+ <st:attribute name="title" use="required">
+ Human readable title of this control.
+ </st:attribute>
+ <st:attribute name="descriptors">
+ Collection that lists up all the valid candidate descriptors.
+ If unspecified, inferred from the type of the field.
+ </st:attribute>
+ <st:attribute name="default">
+ If specified, this will be chosen as the default value in case the current selection is null.
+ </st:attribute>
+ </st:documentation>
+
+ <j:set target="${attrs}" property="descriptors" value="${attrs.descriptors ?: descriptor.getPropertyType(instance,attrs.field).getApplicableDescriptors()}" />
+
+ <f:dropdownList name="${attrs.field}" title="${attrs.title}" help="${descriptor.getHelpFile(attrs.field)}">
+ <d:invokeBody />
+
+ <j:set var="current" value="${instance[attrs.field]}"/>
+ <j:forEach var="descriptor" items="${attrs.descriptors}" varStatus="loop">
+ <f:dropdownListBlock value="${loop.index}" title="${descriptor.displayName}"
+ selected="${current.descriptor==descriptor || (current==null and descriptor==attrs.default)}" staplerClass="${descriptor.clazz.name}">
+ <j:set var="instance" value="${current.descriptor==descriptor ? current : null}" />
+ <st:include from="${descriptor}" page="${descriptor.configPage}" />
+ </f:dropdownListBlock>
+ </j:forEach>
+ </f:dropdownList>
+</j:jelly>

Back to the top