001: /* *************************************************************************
002:
003: Millstone(TM)
004: Open Sourced User Interface Library for
005: Internet Development with Java
006:
007: Millstone is a registered trademark of IT Mill Ltd
008: Copyright (C) 2000-2005 IT Mill Ltd
009:
010: *************************************************************************
011:
012: This library is free software; you can redistribute it and/or
013: modify it under the terms of the GNU Lesser General Public
014: license version 2.1 as published by the Free Software Foundation.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: *************************************************************************
026:
027: For more information, contact:
028:
029: IT Mill Ltd phone: +358 2 4802 7180
030: Ruukinkatu 2-4 fax: +358 2 4802 7181
031: 20540, Turku email: info@itmill.com
032: Finland company www: www.itmill.com
033:
034: Primary source for MillStone information and releases: www.millstone.org
035:
036: ********************************************************************** */
037:
038: package org.millstone.examples.features;
039:
040: import java.net.MalformedURLException;
041: import java.net.URL;
042:
043: import org.millstone.base.terminal.ExternalResource;
044: import org.millstone.base.ui.*;
045:
046: public class FeatureCustomLayout extends Feature {
047:
048: protected String getDescriptionXHTML() {
049: return "<p>A container component with freely designed layout and style. The "
050: + "container consists of items with textually represented locations. Each "
051: + "item contains one sub-component. The adapter and theme are resposible "
052: + "for rendering the layout with given style by placing the items on the "
053: + "screen in defined locations.</p>"
054: + "<p>The definition of locations is not fixed - the each style can define its "
055: + "locations in a way that is suitable for it. One typical example would be "
056: + "to create visual design for a website as a custom layout: the visual design "
057: + "could define locations for \"menu\", \"body\" and \"title\" for example. "
058: + "The layout would then be implemented as XLS-template with for given style.</p>"
059: + "<p>The default theme handles the styles that are not defined by just drawing "
060: + "the subcomponents with flowlayout.</p>";
061: }
062:
063: protected String getExampleSrc() {
064: return "CustomLayout c = new CustomLayout(\"style-name\");\n"
065: + "c.addComponent(new Label(\"foo\"),\"foo-location\");\n"
066: + "c.addComponent(new Label(\"bar\"),\"bar-location\");\n";
067: }
068:
069: protected String getImage() {
070: return "customlayout.jpg";
071: }
072:
073: protected String getTitle() {
074: return "CustomLayout";
075: }
076:
077: protected Component getDemoComponent() {
078: OrderedLayout l = new OrderedLayout();
079:
080: l
081: .addComponent(new Label(
082: "<p>For demonstration, see GO-Game example application. All of the "
083: + "layouting done in the aplication is handled by CustomLayout with \"goroom\"-style "
084: + "that is defined in \"gogame\"-theme. The theme is simply created by exteding "
085: + "default theme trough theme-inheritance and adding couple of xsl-templates</p>",
086: Label.CONTENT_UIDL));
087:
088: URL goUrl = null;
089: try {
090: goUrl = new URL(getApplication().getURL(), "../go/");
091: } catch (MalformedURLException e) {
092: }
093:
094: if (goUrl != null) {
095: Link link = new Link("Start GO-Game", new ExternalResource(
096: goUrl));
097: link.setTargetName("gogame");
098: link.setTargetBorder(Link.TARGET_BORDER_NONE);
099: l.addComponent(link);
100: }
101:
102: return l;
103: }
104:
105: }
|