Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

FeatureGridLayout.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 java.util.Date;
  20. import com.itmill.toolkit.ui.*;
  21. public class FeatureGridLayout extends Feature {
  22. public FeatureGridLayout() {
  23. super();
  24. }
  25. protected Component getDemoComponent() {
  26. OrderedLayout l = new OrderedLayout();
  27. // Example panel
  28. Panel show = new Panel("GridLayout component");
  29. GridLayout gl = new GridLayout(3, 3);
  30. DateField cal = new DateField("Test component 1", new Date());
  31. cal.setStyle("calendar");
  32. gl.addComponent(cal, 1, 0, 2, 1);
  33. for (int i = 2; i < 7; i++)
  34. gl.addComponent(new TextField("Test component " + i));
  35. show.addComponent(gl);
  36. l.addComponent(show);
  37. // Properties
  38. propertyPanel = new PropertyPanel(gl);
  39. Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
  40. "height" });
  41. ap.addField("new line", new Button("New Line", gl, "newLine"));
  42. ap.addField("space", new Button("Space", gl, "space"));
  43. propertyPanel.addProperties("GridLayout Features", ap);
  44. propertyPanel.getField("height").dependsOn(
  45. propertyPanel.getField("add component"));
  46. return l;
  47. }
  48. protected String getExampleSrc() {
  49. return "GridLayout gl = new GridLayout(2,2);\n"
  50. + "gl.addComponent(new Label(\"Label 1 in GridLayout\"));\n"
  51. + "gl.addComponent(new Label(\"Label 2 in GridLayout\"));\n"
  52. + "gl.addComponent(new Label(\"Label 3 in GridLayout\"));\n"
  53. + "gl.addComponent(new Label(\"Label 4 in GridLayout\"));\n";
  54. }
  55. /**
  56. * @see com.itmill.toolkit.demo.features.Feature#getDescriptionXHTML()
  57. */
  58. protected String getDescriptionXHTML() {
  59. return "<p>This feature provides a container that lays out components "
  60. + "into a grid of given width and height.</p>"
  61. + "<p>On the demo tab you can try out how the different "
  62. + "properties affect the presentation of the component.</p>";
  63. }
  64. protected String getImage() {
  65. return "gridlayout.jpg";
  66. }
  67. protected String getTitle() {
  68. return "GridLayout";
  69. }
  70. }