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.

FeatureButton.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 FeatureButton extends Feature {
  21. public FeatureButton() {
  22. super();
  23. }
  24. protected Component getDemoComponent() {
  25. OrderedLayout l = new OrderedLayout();
  26. // Example panel
  27. Panel show = new Panel("Button component");
  28. Button b = new Button("Caption");
  29. show.addComponent(b);
  30. l.addComponent(show);
  31. // Properties
  32. PropertyPanel p = new PropertyPanel(b);
  33. Select themes = (Select) p.getField("style");
  34. themes
  35. .addItem("link")
  36. .getItemProperty(themes.getItemCaptionPropertyId())
  37. .setValue("link");
  38. Form ap = p.createBeanPropertySet(new String[] { "switchMode" });
  39. p.addProperties("Button Properties", ap);
  40. l.addComponent(p);
  41. return l;
  42. }
  43. protected String getExampleSrc() {
  44. return "Button b = new Button(\"Caption\");\n";
  45. }
  46. /**
  47. * @see com.itmill.toolkit.demo.features.Feature#getDescriptionXHTML()
  48. */
  49. protected String getDescriptionXHTML() {
  50. return "In IT Mill Toolkit, boolean input values are represented by buttons. "
  51. + "Buttons may function either as a push buttons or switches. (checkboxes)<br/><br/>"
  52. + "Button can be directly connected to any method of an object, which "
  53. + "is an easy way to trigger events: <code> new Button(\"Play\", myPiano \"playIt\")</code>. "
  54. + "Or in checkbox-mode they can be bound to a boolean proterties and create "
  55. + " simple selectors.<br /><br /> "
  56. + "See the demo and try out how the different properties affect "
  57. + "the presentation of the component.";
  58. }
  59. protected String getImage() {
  60. return "button.jpg";
  61. }
  62. protected String getTitle() {
  63. return "Button";
  64. }
  65. }