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 org.millstone.base.ui.*;
041:
042: public class FeatureOrderedLayout extends Feature {
043:
044: public FeatureOrderedLayout() {
045: super ();
046: }
047:
048: protected Component getDemoComponent() {
049:
050: OrderedLayout l = new OrderedLayout();
051:
052: // Example panel
053: Panel show = new Panel("OrderedLayout component");
054: OrderedLayout ol = new OrderedLayout();
055: for (int i = 1; i < 5; i++)
056: ol.addComponent(new TextField("Test component " + i));
057: show.addComponent(ol);
058: l.addComponent(show);
059:
060: // Properties
061: PropertyPanel p = new PropertyPanel(ol);
062: Form ap = p
063: .createBeanPropertySet(new String[] { "orientation" });
064: ap.replaceWithSelect("orientation", new Object[] {
065: new Integer(OrderedLayout.ORIENTATION_HORIZONTAL),
066: new Integer(OrderedLayout.ORIENTATION_VERTICAL) },
067: new Object[] { "Horizontal", "Vertical" });
068: Select themes = (Select) p.getField("style");
069: themes.addItem("form").getItemProperty(
070: themes.getItemCaptionPropertyId()).setValue("form");
071: p.addProperties("OrderedLayout Properties", ap);
072: l.addComponent(p);
073:
074: return l;
075: }
076:
077: protected String getExampleSrc() {
078: return "OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_FLOW);\n"
079: + "ol.addComponent(new TextField(\"Textfield caption\"));\n"
080: + "ol.addComponent(new Label(\"Label\"));\n";
081:
082: }
083:
084: /**
085: * @see org.millstone.examples.features.Feature#getDescriptionXHTML()
086: */
087: protected String getDescriptionXHTML() {
088: return "This feature provides a container for laying out components either "
089: + "vertically, horizontally or flowingly. The orientation may be changed "
090: + "during runtime. It also defines a special style for themes to implement called \"form\""
091: + "that is used for input forms where the components are layed-out side-by-side "
092: + "with their captions."
093: + "<br/><br/>"
094: + "On the demo tab you can try out how the different properties "
095: + "affect the presentation of the component.";
096: }
097:
098: protected String getImage() {
099: return "orderedlayout.jpg";
100: }
101:
102: protected String getTitle() {
103: return "OrderedLayout";
104: }
105:
106: }
107:
108: /* This Millstone sample code is public domain. *
109: * For more information see www.millstone.org. */
|