Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

FeatureWindow.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 FeatureWindow extends Feature {
  21. Button addButton = new Button("Add to application", this, "addWin");
  22. Button removeButton = new Button("Remove from application", this, "delWin");
  23. Window demoWindow;
  24. Form windowProperties;
  25. public FeatureWindow() {
  26. super();
  27. }
  28. protected Component getDemoComponent() {
  29. OrderedLayout l = new OrderedLayout();
  30. demoWindow = new Window("Feature Test Window");
  31. l.addComponent(addButton);
  32. l.addComponent(removeButton);
  33. updateWinStatus();
  34. // Properties
  35. propertyPanel = new PropertyPanel(demoWindow);
  36. propertyPanel.dependsOn(addButton);
  37. propertyPanel.dependsOn(removeButton);
  38. windowProperties = propertyPanel.createBeanPropertySet(new String[] {
  39. "width", "height", "name", "border", "theme", "scrollable",
  40. "scrollOffsetX", "scrollOffsetY" });
  41. windowProperties.replaceWithSelect("border", new Object[] {
  42. new Integer(Window.BORDER_DEFAULT),
  43. new Integer(Window.BORDER_NONE),
  44. new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default",
  45. "None", "Minimal" });
  46. propertyPanel.addProperties("Window Properties", windowProperties);
  47. setJavadocURL("ui/Window.html");
  48. return l;
  49. }
  50. protected String getExampleSrc() {
  51. return "Window win = new Window();\n"
  52. + "getApplication().addWindow(win);\n";
  53. }
  54. protected String getDescriptionXHTML() {
  55. return "The window support in IT Mill Toolkit allows for opening and closing windows, "
  56. + "refreshing one window from another (for asynchronous terminals), "
  57. + "resizing windows and scrolling window content. "
  58. + "There are also a number of preset window border styles defined by "
  59. + "this feature.";
  60. }
  61. protected String getImage() {
  62. return "window.jpg";
  63. }
  64. protected String getTitle() {
  65. return "Window";
  66. }
  67. public void addWin() {
  68. getApplication().addWindow(demoWindow);
  69. windowProperties.getField("name").setReadOnly(true);
  70. updateWinStatus();
  71. }
  72. public void delWin() {
  73. getApplication().removeWindow(demoWindow);
  74. windowProperties.getField("name").setReadOnly(false);
  75. updateWinStatus();
  76. }
  77. private void updateWinStatus() {
  78. if (demoWindow.getApplication() == null) {
  79. addButton.setEnabled(true);
  80. removeButton.setEnabled(false);
  81. } else {
  82. addButton.setEnabled(false);
  83. removeButton.setEnabled(true);
  84. }
  85. }
  86. }