PageRenderTime 32ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 7ms app.codeStats 0ms

/hudson-core/src/main/resources/lib/form/combobox.jelly

http://github.com/hudson/hudson
Unknown | 54 lines | 45 code | 9 blank | 0 comment | 0 complexity | 3a98d5f769c8b663ba1ea7fb1673c736 MD5 | raw file
 1<!--
 2The MIT License
 3
 4Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Bruce Chapman, Alan Harder
 5
 6Permission is hereby granted, free of charge, to any person obtaining a copy
 7of this software and associated documentation files (the "Software"), to deal
 8in the Software without restriction, including without limitation the rights
 9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE SOFTWARE.
23-->
24
25<!-- Tomcat doesn't like us using the attribute called 'class' -->
26<?jelly escape-by-default='true'?>
27<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">
28  <st:documentation>
29    Editable drop-down combo box that supports the data binding and AJAX updates.
30    Your descriptor should have the 'doFillXyzItems' method, which returns a ComboBoxModel
31    representation of the items in your combo box, and your instance field should
32    hold the current value.
33
34    <st:attribute name="clazz">
35      Additional CSS classes that the control gets.
36    </st:attribute>
37    <st:attribute name="field">
38      Used for databinding.
39    </st:attribute>
40  </st:documentation>
41
42  <st:once>
43    <script type="text/javascript" src="${request.contextPath}/scripts/utilities.js"/>
44    <script type="text/javascript" src="${request.contextPath}/scripts/combobox.js"/>
45  </st:once>
46
47  <f:prepareDatabinding/>
48  ${descriptor.calcFillSettings(field,attrs)} <!-- this figures out the 'fillUrl' and 'fillDependsOn' attribute -->
49
50  <m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary" ATTRIBUTES="${attrs}" EXCEPT="field items clazz"
51         autocomplete="off" class="combobox2 settings-input ${attrs.clazz}${attrs.checkUrl!=null ? ' validated' : ''}"
52         name="${attrs.name ?: '_.'+attrs.field}"
53         value="${attrs.value ?: instance[attrs.field]}" />
54</j:jelly>