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.util.Date;
041:
042: import org.millstone.base.ui.*;
043:
044: public class FeatureGridLayout extends Feature {
045:
046: public FeatureGridLayout() {
047: super ();
048: }
049:
050: protected Component getDemoComponent() {
051:
052: OrderedLayout l = new OrderedLayout();
053:
054: // Example panel
055: Panel show = new Panel("GridLayout component");
056: GridLayout gl = new GridLayout(3, 3);
057: DateField cal = new DateField("Test component 1", new Date());
058: cal.setStyle("calendar");
059: gl.addComponent(cal, 1, 0, 2, 1);
060: for (int i = 2; i < 7; i++)
061: gl.addComponent(new TextField("Test component " + i));
062: show.addComponent(gl);
063: l.addComponent(show);
064:
065: // Properties
066: PropertyPanel p = new PropertyPanel(gl);
067: Form ap = p.createBeanPropertySet(new String[] { "width",
068: "height" });
069: ap.addField("new line", new Button("New Line", gl, "newLine"));
070: ap.addField("space", new Button("Space", gl, "space"));
071: p.addProperties("GridLayout Features", ap);
072: p.getField("height").dependsOn(p.getField("add component"));
073: l.addComponent(p);
074:
075: return l;
076: }
077:
078: protected String getExampleSrc() {
079: return "GridLayout gl = new GridLayout(2,2);\n"
080: + "gl.addComponent(new Label(\"Label 1 in GridLayout\"));\n"
081: + "gl.addComponent(new Label(\"Label 2 in GridLayout\"));\n"
082: + "gl.addComponent(new Label(\"Label 3 in GridLayout\"));\n"
083: + "gl.addComponent(new Label(\"Label 4 in GridLayout\"));\n";
084: }
085:
086: /**
087: * @see org.millstone.examples.features.Feature#getDescriptionXHTML()
088: */
089: protected String getDescriptionXHTML() {
090: return "<p>This feature provides a container that lays out components "
091: + "into a grid of given width and height.</p>"
092: + "<p>On the demo tab you can try out how the different "
093: + "properties affect the presentation of the component.</p>";
094: }
095:
096: protected String getImage() {
097: return "gridlayout.jpg";
098: }
099:
100: protected String getTitle() {
101: return "GridLayout";
102: }
103: }
|