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.terminal.ClassResource;
041: import org.millstone.base.terminal.Sizeable;
042: import org.millstone.base.ui.*;
043:
044: public class FeatureEmbedded extends Feature {
045:
046: public FeatureEmbedded() {
047: super ();
048: }
049:
050: protected Component getDemoComponent() {
051:
052: OrderedLayout l = new OrderedLayout();
053:
054: // Example panel
055: Panel show = new Panel("Embedded component");
056: Embedded emb = new Embedded("Embedded Caption");
057: emb.setClassId("clsid:F08DF954-8592-11D1-B16A-00C0F0283628");
058: emb.setWidth(100);
059: emb.setHeight(50);
060: emb.setParameter("BorderStyle", "1");
061: emb.setParameter("MousePointer", "1");
062: emb.setParameter("Enabled", "1");
063: emb.setParameter("Min", "1");
064: emb.setParameter("Max", "10");
065: show.addComponent(emb);
066: l.addComponent(show);
067:
068: // Properties
069: PropertyPanel p = new PropertyPanel(emb);
070: Form ap = p.createBeanPropertySet(new String[] { "type",
071: "source", "width", "height", "widthUnits",
072: "heightUnits", "codebase", "codetype", "archive",
073: "mimeType", "standby", "classId" });
074: ap.replaceWithSelect("type", new Object[] {
075: new Integer(Embedded.TYPE_IMAGE),
076: new Integer(Embedded.TYPE_OBJECT) }, new Object[] {
077: "Image", "Object" });
078: Object[] units = new Object[Sizeable.UNIT_SYMBOLS.length];
079: Object[] symbols = new Object[Sizeable.UNIT_SYMBOLS.length];
080: for (int i = 0; i < units.length; i++) {
081: units[i] = new Integer(i);
082: symbols[i] = Sizeable.UNIT_SYMBOLS[i];
083: }
084: ap.replaceWithSelect("heightUnits", units, symbols);
085: ap.replaceWithSelect("widthUnits", units, symbols);
086: ap.replaceWithSelect("source", new Object[] {
087: null,
088: new ClassResource("millstone-logo.gif",
089: getApplication()) }, new Object[] { "null",
090: "Millstone logo" });
091: p.addProperties("Embedded Properties", ap);
092: p.getField("standby").setDescription(
093: "The text to display while loading the object.");
094: p
095: .getField("codebase")
096: .setDescription(
097: "root-path used to access resources with relative paths.");
098: p.getField("codetype").setDescription("MIME-type of the code.");
099: p
100: .getField("classId")
101: .setDescription(
102: "Unique object id. This can be used for example to identify windows components.");
103: l.addComponent(p);
104:
105: return l;
106: }
107:
108: protected String getExampleSrc() {
109: return "// Load image from jpg-file, that is in the same package with the application\n"
110: + "Embedded e = new Embedded(\"Image title\",\n"
111: + " new ClassResource(\"image.jpg\", getApplication()));";
112: }
113:
114: protected String getDescriptionXHTML() {
115: return "<p>The embedding feature allows for adding images, multimedia and other non-specified "
116: + "content to your application. "
117: + "The feature has provisions for embedding both applets and Active X controls. "
118: + "Actual support for embedded media types is left to the terminal.</p>";
119: }
120:
121: protected String getImage() {
122: return "embedded.jpg";
123: }
124:
125: protected String getTitle() {
126: return "Embedded";
127: }
128:
129: }
|