You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FeatureSelect.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* *************************************************************************
  2. IT Mill Toolkit
  3. Development of Browser User Intarfaces Made Easy
  4. Copyright (C) 2000-2006 IT Mill Ltd
  5. *************************************************************************
  6. This product is distributed under commercial license that can be found
  7. from the product package on license/license.txt. Use of this product might
  8. require purchasing a commercial license from IT Mill Ltd. For guidelines
  9. on usage, see license/licensing-guidelines.html
  10. *************************************************************************
  11. For more information, contact:
  12. IT Mill Ltd phone: +358 2 4802 7180
  13. Ruukinkatu 2-4 fax: +358 2 4802 7181
  14. 20540, Turku email: info@itmill.com
  15. Finland company www: www.itmill.com
  16. Primary source for information and releases: www.itmill.com
  17. ********************************************************************** */
  18. package com.itmill.toolkit.demo.features;
  19. import com.itmill.toolkit.ui.*;
  20. public class FeatureSelect extends Feature {
  21. public FeatureSelect() {
  22. super();
  23. }
  24. protected Component getDemoComponent() {
  25. OrderedLayout l = new OrderedLayout();
  26. // Example panel
  27. Panel show = new Panel("Select component");
  28. Select s = new Select("Select Car");
  29. s.addItem("Audi");
  30. s.addItem("BMW");
  31. s.addItem("Chrysler");
  32. s.addItem("Volvo");
  33. show.addComponent(s);
  34. l.addComponent(show);
  35. // Properties
  36. PropertyPanel p = new PropertyPanel(s);
  37. Select themes = (Select) p.getField("style");
  38. themes
  39. .addItem("optiongroup")
  40. .getItemProperty(themes.getItemCaptionPropertyId())
  41. .setValue("optiongroup");
  42. themes
  43. .addItem("twincol")
  44. .getItemProperty(themes.getItemCaptionPropertyId())
  45. .setValue("twincol");
  46. l.addComponent(p);
  47. return l;
  48. }
  49. protected String getExampleSrc() {
  50. return "Select s = new Select(\"Select Car\");\n"+
  51. "s.addItem(\"Audi\");\n"+
  52. "s.addItem(\"BMW\");\n"+
  53. "s.addItem(\"Chrysler\");\n"+
  54. "s.addItem(\"Volvo\");\n";
  55. }
  56. /**
  57. * @see com.itmill.toolkit.demo.features.Feature#getDescriptionXHTML()
  58. */
  59. protected String getDescriptionXHTML() {
  60. return "The select component combines two different modes of item selection. "
  61. + "Firstly it presents the single selection mode, which is usually represented as "
  62. + "either a drop-down menu or a radio-group of switches, secondly it "
  63. + "allows for multiple item selection, this is usually represented as either a "
  64. + "listbox of selectable items or as a group of checkboxes."
  65. + "<br/><br/>"
  66. + "Data source can be associated both with selected item and the list of selections. "+
  67. "This way you can easily present a selection based on items specified elsewhere in application. "
  68. + "<br/><br/>"
  69. + "On the demo tab you can try out how the different properties affect the"
  70. + " presentation of the component.";
  71. }
  72. protected String getImage() {
  73. return "select.jpg";
  74. }
  75. protected String getTitle() {
  76. return "Select";
  77. }
  78. }