Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

FeatureCustomLayout.java 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.net.MalformedURLException;
  20. import java.net.URL;
  21. import com.itmill.toolkit.terminal.ExternalResource;
  22. import com.itmill.toolkit.ui.*;
  23. public class FeatureCustomLayout extends Feature {
  24. protected String getDescriptionXHTML() {
  25. return "<p>A container component with freely designed layout and style. The "
  26. + "container consists of items with textually represented locations. Each "
  27. + "item contains one sub-component. The adapter and theme are resposible "
  28. + "for rendering the layout with given style by placing the items on the "
  29. + "screen in defined locations.</p>"
  30. + "<p>The definition of locations is not fixed - the each style can define its "
  31. + "locations in a way that is suitable for it. One typical example would be "
  32. + "to create visual design for a website as a custom layout: the visual design "
  33. + "could define locations for \"menu\", \"body\" and \"title\" for example. "
  34. + "The layout would then be implemented as XLS-template with for given style.</p>"
  35. + "<p>The default theme handles the styles that are not defined by just drawing "
  36. + "the subcomponents with flowlayout.</p>";
  37. }
  38. protected String getExampleSrc() {
  39. return "CustomLayout c = new CustomLayout(\"style-name\");\n"
  40. + "c.addComponent(new Label(\"foo\"),\"foo-location\");\n"
  41. + "c.addComponent(new Label(\"bar\"),\"bar-location\");\n";
  42. }
  43. protected String getImage() {
  44. return "customlayout.jpg";
  45. }
  46. protected String getTitle() {
  47. return "CustomLayout";
  48. }
  49. protected Component getDemoComponent() {
  50. OrderedLayout l = new OrderedLayout();
  51. l
  52. .addComponent(new Label(
  53. "<p>For demonstration, see GO-Game example application. All of the "
  54. + "layouting done in the aplication is handled by CustomLayout with \"goroom\"-style "
  55. + "that is defined in \"gogame\"-theme. The theme is simply created by exteding "
  56. + "default theme trough theme-inheritance and adding couple of xsl-templates</p>",
  57. Label.CONTENT_UIDL));
  58. URL goUrl = null;
  59. try {
  60. goUrl = new URL(getApplication().getURL(), "../go/");
  61. } catch (MalformedURLException e) {
  62. }
  63. if (goUrl != null) {
  64. Link link = new Link("Start GO-Game", new ExternalResource(goUrl));
  65. link.setTargetName("gogame");
  66. link.setTargetBorder(Link.TARGET_BORDER_NONE);
  67. l.addComponent(link);
  68. }
  69. return l;
  70. }
  71. }