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.

FeatureLabel.java 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* *************************************************************************
  2. IT Mill Toolkit
  3. Development of Browser User Interfaces 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.pdf. Use of this product might
  8. require purchasing a commercial license from IT Mill Ltd. For guidelines
  9. on usage, see 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 FeatureLabel extends Feature {
  21. public FeatureLabel() {
  22. super();
  23. }
  24. protected Component getDemoComponent() {
  25. OrderedLayout l = new OrderedLayout();
  26. // Example panel
  27. Panel show = new Panel("Label component");
  28. Label lab = new Label("Label text");
  29. show.addComponent(lab);
  30. l.addComponent(show);
  31. // Properties
  32. propertyPanel = new PropertyPanel(lab);
  33. Form ap = propertyPanel.createBeanPropertySet(new String[] {
  34. "contentMode", "value" });
  35. ap.replaceWithSelect("contentMode", new Object[] {
  36. new Integer(Label.CONTENT_PREFORMATTED),
  37. new Integer(Label.CONTENT_TEXT),
  38. new Integer(Label.CONTENT_UIDL),
  39. new Integer(Label.CONTENT_XHTML),
  40. new Integer(Label.CONTENT_XML) },
  41. new Object[] { "Preformatted", "Text", "UIDL (Must be valid)",
  42. "XHTML Fragment(Must be valid)",
  43. "XML (Subtree with namespace)" });
  44. propertyPanel.addProperties("Label Properties", ap);
  45. return l;
  46. }
  47. protected String getExampleSrc() {
  48. return "Label l = new Label(\"Caption\");\n";
  49. }
  50. /**
  51. * @see com.itmill.toolkit.demo.features.Feature#getDescriptionXHTML()
  52. */
  53. protected String getDescriptionXHTML() {
  54. return "Labels components are for captions and plain text. "
  55. + "By default, it is a light-weight component for presenting "
  56. + "text content in application, but it can be also used to present "
  57. + "formatted information and even XML."
  58. + "<br /><br />"
  59. + "Label can also be directly associated with data property to display "
  60. + "information from different data sources automatically. This makes it "
  61. + "trivial to present the current user in the corner of applications main window. "
  62. + "<br /><br />"
  63. + "On the demo tab you can try out how the different properties affect "
  64. + "the presentation of the component.";
  65. }
  66. protected String getImage() {
  67. return "label.jpg";
  68. }
  69. protected String getTitle() {
  70. return "Label";
  71. }
  72. }