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