thinlet-development Mailing List for Thinlet (Page 4)
Brought to you by:
bajzat
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(22) |
Apr
(7) |
May
(26) |
Jun
(42) |
Jul
(9) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
(12) |
Jul
(2) |
Aug
(9) |
Sep
(1) |
Oct
(8) |
Nov
(1) |
Dec
|
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(13) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ab...@us...> - 2003-07-06 22:48:08
|
Update of /cvsroot/thinlet/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv15119 Removed Files: ThinletConstants.java Log Message: Minor cleanups and javadoc additions in preparation for release. --- ThinletConstants.java DELETED --- |
From: <ab...@us...> - 2003-07-06 22:48:08
|
Update of /cvsroot/thinlet/thinlet/build In directory sc8-pr-cvs1:/tmp/cvs-serv15119/build Modified Files: build.xml Log Message: Minor cleanups and javadoc additions in preparation for release. Index: build.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/build/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- build.xml 26 Jun 2003 15:28:56 -0000 1.1 +++ build.xml 6 Jul 2003 22:48:05 -0000 1.2 @@ -71,9 +71,11 @@ destdir="${thinlet.build.dir}" optimize="${build.optimize}" srcdir="${thinlet.src.dir}"> - <include name="thinlet/Thinlet*.java"/> - <include name="thinlet/Widget.java"/> + <include name="thinlet/Thinlet.java"/> <include name="thinlet/*Launcher.java"/> + <!-- WIP - don't use for now... --> + <!--include name="thinlet/Widget.java"/--> + <!--include name="thinlet/ThinletConstants.java"/--> </javac> </target> @@ -112,8 +114,7 @@ <target depends="compile-core" name="jar-core"> <jar destfile="${thinlet.core.jar}"> <fileset dir="${thinlet.build.dir}"> - <include name="thinlet/Thinlet*.class"/> - <include name="thinlet/ThinletWidget.class"/> + <include name="thinlet/Thinlet.class"/> <include name="thinlet/*Launcher.class"/> </fileset> </jar> |
From: <ab...@us...> - 2003-07-03 11:21:28
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv19064 Modified Files: Thinlet.java Log Message: A bandaid for endless loop... Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Thinlet.java 26 Jun 2003 15:21:54 -0000 1.1 +++ Thinlet.java 3 Jul 2003 11:21:25 -0000 1.2 @@ -5114,6 +5114,7 @@ Object target = get(parent, key); while (target != component) { target = get(parent = target, key = ":next"); // (target != null) + if (target == null) return; } set(parent, key, get(target, ":next")); set(target, ":next", null); |
Update of /cvsroot/thinlet/thinlet/doc/widget In directory sc8-pr-cvs1:/tmp/cvs-serv9989 Modified Files: button.xml checkbox.xml combobox.xml component.xml desktop.xml dialog.xml label.xml list.xml menubar.xml panel.xml passwordfield.xml progressbar.xml separator.xml slider.xml spinbox.xml splitpane.xml tabbedpane.xml table.xml textarea.xml textfield.xml togglebutton.xml tree.xml Added Files: index.html widget.xsl Log Message: XSL stylesheet to navigate the widget docs. Contributed by Detlef Groth - thank you! Other small updates to docs, mostly in the example sections or better wording. --- NEW FILE: index.html --- <HTML><HEAD><TITLE>Thinlet Widget Documentation</TITLE></HEAD> <frameset cols="100%"> <frame src="component.xml" name="left"> </frameset> </HTML> --- NEW FILE: widget.xsl --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Thinlet Widget Documentation</title> <style type="text/css"> h2 { font: bold 12pt Verdana,Arial,Helvetica,sans-serif; } h3 { font: bold 15pt Verdana,Arial,Helvetica,sans-serif; } body { background: #ffffff; font: 11pt Verdana,Arial,Helvetica,sans-serif;} td, input, textarea, caption, p {font: 9pt Verdana,Arial,Helvetica,sans-serif; } p { margin-top: 6pt; margin-bottom: 6pt; } td { vertical-align: top; } a:link, a:visited, a:active { color: #3399cc; text-decoration: none; } a:hover { color: #ff9933; text-decoration: underline; } .ht { background: #000000; color: #999999; vertical-align: middle; } .hm { background: #3399cc; vertical-align: bottom; } a.hn:link, a.hn:visited, a.hn:active { color: #000000; } a.hn:hover { color: #cccccc; background: #ff9933; text-decoration: none; } .hs { background: #000000; color: #cccccc; font-weight: bold; } .hb { background: #000000; } .mb { background: #ededed; } .md { background: #999999; } .mt { } .bt { color: #999999; text-align: right; } .sec {color: #666666; margin-top: 10pt; font: bold 10pt Verdana,Arial,Helvetica,sans-serif; text-align: left;} .th, .to, .te, .tn, .tor, .ter, .tir { padding-left: 4pt; padding-right: 4pt; border-bottom: 1pt solid #cccccc; text-align: left; } .th, .tir { background: #ededed; color: #666666; font-weight: bold; border-top: 1pt solid #cccccc; border-bottom: 1pt solid #cccccc;} .te, .ter { background: #ededed; } .tn { background: #ededed; color: #666666; font-weight: bold; } .tc { color: #666666; font-weight: bold; text-align: left; } .tor, .ter { text-align: right; padding-right: 0pt; } .tir { text-align: center; border-top: 1pt solid #999966; border-bottom: 1pt solid #999966;} .code { background: #ededed; border-top: 1pt solid #cccccc; border-bottom: 1pt solid #cccccc; } </style> </head> <body > <table border="0" width="99%" cellspacing="0"> <tr> <td class="tir" width="15%"> <br /> <a href="http://www.thinlet.com/">www.thinlet.com</a><br /> <a href="http://thinlet.sourceforge.net/">thinlet.sourceforge.net</a> </td> <td class="tir"> <h3 align="center">Thinlet Widgets</h3> </td> </tr> </table> <table border="0" height="80%" cellspacing="0" cellpadding="0"><tr> <td class="th"> <br /> </td> <td width="15%" class="th"> <br /> <br /> » <a href="button.xml" >button</a> <br /> » <a href="checkbox.xml" >checkbox</a><br /> » <a href="combobox.xml" >combobox</a><br /> » <a href="component.xml" >component</a><br /> » <a href="desktop.xml" >desktop</a><br /> » <a href="dialog.xml" >dialog</a><br /> » <a href="label.xml" >label</a><br /> » <a href="list.xml" >list</a><br /> » <a href="menubar.xml" >menubar</a><br /> » <a href="panel.xml" >panel</a><br /> » <a href="passwordfield.xml" >passwordfield</a><br /> » <a href="progressbar.xml" >progressbar</a><br /> » <a href="separator.xml" >separator</a><br /> » <a href="slider.xml" >slider</a><br /> » <a href="spinbox.xml" >spinbox</a><br /> » <a href="splitpane.xml" >splitpane</a><br /> » <a href="tabbedpane.xml" >tabbedpane</a><br /> » <a href="table.xml" >table</a><br /> » <a href="textarea.xml" >textarea</a><br /> » <a href="textfield.xml" >textfield</a><br /> » <a href="togglebutton.xml" >togglebutton</a><br /> » <a href="tree.xml">tree</a><br /> <br /> <br /> <a href="../api/index.html">Thinlet API</a> </td> <td width="20px"> </td> <td> <br /> <xsl:apply-templates select="widget"/> </td> </tr> </table> </body> </html> </xsl:template> <xsl:template match="widget"> <h2><xsl:value-of select="@title"/></h2> <p><xsl:value-of select="p"/></p> <xsl:if test="xul"> <p class="sec">Example:<br/></p> <table class="th" border="0" summary="Parameters" cellpadding="5" width="90%"><tr><td> <pre style="font: 11pt; color: #000000;"><xsl:value-of select="xul"/></pre> </td></tr></table> </xsl:if> <p class="sec">Parameters:<br/></p> <xsl:apply-templates select="parameters"/> <xsl:apply-templates select="widget"/> <xsl:apply-templates select="keys"/> </xsl:template> <xsl:template match="parameters"> <table border="0" summary="Parameters" cellpadding="1" width="100%"> <tr class="th"> <th width="10%">Name</th> <th width="10%">Type</th> <th width="10%">Default</th> <th >Description</th> </tr> <xsl:apply-templates select="parameter"/> </table> </xsl:template> <xsl:template match="parameter"> <tr> <xsl:attribute name="BGCOLOR"> <xsl:choose> <xsl:when test="position() mod 2 = 1">#FFFFFF</xsl:when> <xsl:when test="position() mod 2 = 0">#EDEDED</xsl:when> </xsl:choose> </xsl:attribute> <xsl:choose> <xsl:when test="@extend"> <td colspan="4" class="code"><b>Extends <a><xsl:attribute name="href"><xsl:value-of select="@extend"/>.xml</xsl:attribute><xsl:value-of select="@extend"/></a></b>: <xsl:value-of select="."/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="@name"/></td> <td><xsl:value-of select="@type"/></td> <xsl:choose> <xsl:when test="@default"> <td><xsl:value-of select="@default"/></td> </xsl:when> <xsl:otherwise> <td>none</td> </xsl:otherwise> </xsl:choose> <td><xsl:value-of select="."/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:template> <xsl:template match="keys"> <p class="sec"><b>Keyboard actions</b></p> <table border="0" summary="Keys" cellpadding="1" width="100%"> <tr class="th"> <th>Operation</th> <th>Action</th> </tr> <xsl:apply-templates select="key"/> </table> </xsl:template> <xsl:template match="key"> <tr> <xsl:attribute name="BGCOLOR"> <xsl:choose> <xsl:when test="position() mod 2 = 1">#FFFFFF</xsl:when> <xsl:when test="position() mod 2 = 0">#EDEDED</xsl:when> </xsl:choose> </xsl:attribute> <xsl:choose> <xsl:when test="@extend"> <td colspan="2"><xsl:value-of select="."/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="@sequence"/></td> <td><xsl:value-of select="."/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:template> </xsl:stylesheet> Index: button.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/button.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- button.xml 23 Jun 2003 12:04:35 -0000 1.2 +++ button.xml 3 Jul 2003 10:08:32 -0000 1.3 @@ -1,8 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - button - - - --> <widget class="button" title="Button"> - <p>The following button displays a short text string and an image. - Its content is on the left and centered vertically.</p> - <xul><![CDATA[<button text="Button" icon="image.gif" alignment="left" tooltip="ToolTip" />]]></xul> + <p>The first button below displays a short text string and an image. + Its content is on the left and centered vertically. The second button + resembles an HTML link, and when pressed invokes the action "goHome".</p> +<xul><![CDATA[<button text="Button" icon="image.gif" alignment="left" tooltip="ToolTip" /> +<button text="www.thinlet.com" type="link" action="goHome" />]]></xul> <parameters> <parameter name="text" type="string"> The text string that the button displays. Index: checkbox.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/checkbox.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- checkbox.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ checkbox.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,10 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - checkbox - - - --> <widget class="checkbox" title="CheckBox"> <p>The first checkbox has a short text and an icon, its state is selected. - The second one is a deselected radio button, - one of a set of buttons identified by a group name.</p> + The second one is a selected radio button, + one of a set of two buttons identified by a group name.</p> <xul><![CDATA[<checkbox text="CheckBox" icon="image.gif" selected="true"/> -<checkbox text="RadioButton" group="group"/>]]></xul> +<checkbox text="RadioButton 1" group="group" selected="true"/> +<checkbox text="RadioButton 2" group="group"/>]]></xul> <parameters> <parameter name="text" type="string"> The text string that the checkbox displays. Index: combobox.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/combobox.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- combobox.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ combobox.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - combobox - - - --> <widget class="combobox" title="ComboBox"> <p>ComboBox is a combination of a text field and drop-down list. Index: component.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/component.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- component.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ component.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,6 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - component - - - --> <widget class="component" title="Component"> - <p>The folowing pages describe components, all have the following parameters.</p> + <p>Component is an abstract superclass for most Thinlet widgets. All components support the parameters listed below.</p> <parameters> <parameter name="name" type="string"> Identifies the component. @@ -62,6 +64,10 @@ <parameter name="valign" type="choice" default="fill"> Vertical alignment in the cell. Possible values are: fill, center, top, and bottom. + </parameter> + <parameter name="i18n" type="boolean" default="false"> + Enables or disables lookup of internationalized version + of texts for "text" and "tooltip" parameters. See methods "setLangResource()" and "setAllI18n()" in Thinlet API. </parameter> <parameter name="property" type="property"> Binds an arbitrary key/value client property. The format of its value Index: desktop.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/desktop.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- desktop.xml 10 May 2003 20:51:54 -0000 1.1 +++ desktop.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,7 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - desktop - - - --> <widget class="desktop" title="Desktop"> - <p>Desktop is the root pane, it contains panels (fill the available space), - dialogs (centered), combolists, popupmenus, and tooltips. You can add only + <p>Desktop is the root pane, it contains panels (that together + fill the available space on desktop), dialogs (centered), combolists, + popupmenus, and tooltips. You can add only components and dialogs to desktop, the last will be on the top.</p> <parameters> <parameter extend="component"> Index: dialog.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/dialog.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dialog.xml 10 May 2003 20:51:54 -0000 1.1 +++ dialog.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - dialog - - - --> <widget class="dialog" title="Dialog"> <p>Dialog is similar to panel, but it has border and title, Index: label.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/label.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- label.xml 10 May 2003 20:51:54 -0000 1.1 +++ label.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - label - - - --> <widget class="label" title="Label"> <p>The following label displays a short text string and an image. Index: list.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/list.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- list.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ list.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - list - - - --> <widget class="list" title="List"> <p>A list allows the user to select one or more objects from a list, Index: menubar.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/menubar.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- menubar.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ menubar.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - menubar - - - --> <widget class="menubar" title="MenuBar"> <p>The following panel contains a menubar on the top and a large text-area. Index: panel.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/panel.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- panel.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ panel.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - panel - - - --> <widget class="panel" title="Panel"> <p>Panel is a container with a layout manager similar to GridBagLayout. Index: passwordfield.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/passwordfield.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- passwordfield.xml 10 May 2003 20:51:54 -0000 1.1 +++ passwordfield.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - passwordfield - - - --> <widget class="passwordfield" title="PasswordField"> <p>PasswordField is similar to TextField component, Index: progressbar.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/progressbar.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- progressbar.xml 10 May 2003 20:51:54 -0000 1.1 +++ progressbar.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - progressbar - - - --> <widget class="progressbar" title="ProgressBar"> <p>ProressBar displays an integer value within a bounded interval, the Index: separator.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/separator.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- separator.xml 10 May 2003 20:51:54 -0000 1.1 +++ separator.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - separator - - - --> <widget class="separator" title="Separator"> <p>Separator is a horizontal or a vertical line. The following panel has Index: slider.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/slider.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- slider.xml 10 May 2003 20:51:54 -0000 1.1 +++ slider.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - slider - - - --> <widget class="slider" title="Slider"> <p>A slider lets the user graphically select a value by sliding a knob Index: spinbox.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/spinbox.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- spinbox.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ spinbox.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - spinbox - - - --> <widget class="spinbox" title="SpinBox"> <p>SpinBox is a textfield width 2 arrow buttons to change Index: splitpane.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/splitpane.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- splitpane.xml 10 May 2003 20:51:54 -0000 1.1 +++ splitpane.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - splitpane - - - --> <widget class="splitpane" title="SplitPane"> <p>SplitPane is used to divide two components. The following one has two Index: tabbedpane.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/tabbedpane.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tabbedpane.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ tabbedpane.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - tabbedpane - - - --> <widget class="tabbedpane" title="TabbedPane"> <p>TabbedPane contains tabs and components. The first tab Index: table.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/table.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- table.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ table.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - table - - - --> <widget class="table" title="Table"> <p>A table presents data in a two-dimensional table format, allows to select Index: textarea.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/textarea.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- textarea.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ textarea.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,8 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - textarea - - - --> <widget class="textarea" title="TextArea"> - <p>TextArea is a multi-line area that displays plain text + <p>TextArea is a multi-line area that displays plain text, optionally + wrapped at word boundaries (whitespace), and internally handles scrolling.</p> - <xul><![CDATA[<textarea text="TextArea" />]]></xul> + <xul><![CDATA[<textarea columns="40" rows="2" wrap="true" text="TextArea" />]]></xul> <parameters> <parameter name="text" type="string" default="''"> The text contained in this textarea. Index: textfield.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/textfield.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- textfield.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ textfield.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,8 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - textfield - - - --> <widget class="textfield" title="TextField"> <p>TextField component allows the editing of a single line of text. This field has a simple text value.</p> - <xul><![CDATA[<textfield text="TextField" />]]></xul> + <xul><![CDATA[<textfield columns="10" text="Text Field" />]]></xul> <parameters> <parameter name="text" type="string" default="''"> The text contained in this field. Index: togglebutton.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/togglebutton.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- togglebutton.xml 10 May 2003 20:51:54 -0000 1.1 +++ togglebutton.xml 3 Jul 2003 10:08:33 -0000 1.2 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - togglebutton - - - --> <widget class="togglebutton" title="ToggleButton"> <p>An implementation of a two-state button, behaves as checkbox.</p> Index: tree.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/doc/widget/tree.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tree.xml 23 Jun 2003 12:04:36 -0000 1.2 +++ tree.xml 3 Jul 2003 10:08:33 -0000 1.3 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="widget.xsl"?> <!-- - - - tree - - - --> <widget class="tree" title="Tree"> <p>Tree displays a set of hierarchical data, contains nodes |
From: <ab...@us...> - 2003-06-26 15:39:59
|
Update of /cvsroot/thinlet/thinlet/lib In directory sc8-pr-cvs1:/tmp/cvs-serv300/lib Added Files: thinlet.drafts.jar thinlet.examples.jar thinlet.icons.jar thinlet.jar Log Message: Add Thinlet JARs, so that people can use them without recompiling. --- NEW FILE: thinlet.drafts.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: thinlet.examples.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: thinlet.icons.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: thinlet.jar --- (This appears to be a binary file; contents omitted.) |
From: <ab...@us...> - 2003-06-26 15:36:29
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv28105/thinlet Log Message: Directory /cvsroot/thinlet/thinlet/src/java/thinlet added to the repository |
From: <ab...@us...> - 2003-06-26 15:28:59
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/common In directory sc8-pr-cvs1:/tmp/cvs-serv31058/src/java/thinlet/examples/common Added Files: ImageChooser.java imagechooser.xml Log Message: New CVS layout and build infrastructure, Part 2 (a.k.a catch the missing parts :-). Contributed by Campbell Boucher-Burnet. --- NEW FILE: ImageChooser.java --- package thinlet.examples.common; import java.awt.*; import java.io.*; import java.util.*; import java.util.zip.*; import thinlet.*; /** * */ public class ImageChooser { /** * */ public void load(Thinlet thinlet, Object tree) throws IOException { String classpath = System.getProperty("java.class.path"); StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator); while (st.hasMoreTokens()) { File file = new File(st.nextToken()); if (!file.exists()) { continue; } String path = file.getCanonicalPath(); if (findNode(thinlet, tree, path) != null) { continue; } // don't add twice if (file.isDirectory()) { Object node = addNode(thinlet, tree, null, path); } else { Object node = addNode(thinlet, tree, null, path); addNode(thinlet, node, null, "loading..."); thinlet.putProperty(node, "loading...", Boolean.TRUE); } } } /** * */ public void expand(Thinlet thinlet, Object node) throws ZipException, IOException{ if (thinlet.getProperty(node, "loading...") == Boolean.TRUE) { System.out.println("> " + thinlet.getString(node, "text")); thinlet.removeAll(node); thinlet.putProperty(node, "loading...", null); ZipFile zipfile = new ZipFile(new File(thinlet.getString(node, "text"))); for (Enumeration entries = zipfile.entries(); entries.hasMoreElements();) { ZipEntry zipentry = (ZipEntry) entries.nextElement(); //if (!zipentry.isDirectory()) { continue; } //System.out.println("> " + zipentry.getName()); StringTokenizer st = new StringTokenizer(zipentry.getName(), "/"); Object parent = node; while (st.hasMoreTokens()) { String text = st.nextToken(); Object current = findNode(thinlet, parent, text); if (current == null) { current = addNode(thinlet, parent, null, text); } parent = current; } /*System.out.println("Name:" + zipentry.getName() + " Directory:" + zipentry.isDirectory() + " Comment:" + zipentry.getComment() + " Extra:" + zipentry.getExtra() + " Method:" + zipentry.getMethod() + " CompressedSize:" + zipentry.getCompressedSize() + " Size:" + zipentry.getSize() + " Crc:" + zipentry.getCrc() + " Time:" + zipentry.getTime());*/ } zipfile.close(); } } /** * */ private Object addNode(Thinlet thinlet, Object parent, Image icon, String text) { Object node = thinlet.create("node"); thinlet.setString(node, "text", text); thinlet.setBoolean(node, "expanded", false); thinlet.add(parent, node); return node; } /** * */ private Object findNode(Thinlet thinlet, Object parent, String text) { Object[] nodes = thinlet.getItems(parent); for (int i = 0; i < nodes.length; i++) { if (text.equals(thinlet.getString(nodes[i], "text"))) { return nodes[i]; } } return null; } /** * */ public static void main(String[] args) throws Exception { Thinlet thinlet = new Thinlet(); thinlet.setFont(new Font("Tahoma", Font.PLAIN, 11)); thinlet.setColors(0xf2f1e4, 0x000000, 0xffffff, 0x909090, 0xb0b0b0, 0xededed, 0xd7d5c2, 0x89899a, 0xc5c5dd); thinlet.add(thinlet.parse("/thinlet/common/imagechooser.xml", new ImageChooser())); new FrameLauncher("Image chooser", thinlet, 240, 320); } } --- NEW FILE: imagechooser.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <panel gap="4" columns="1"> <tree init="load(thinlet, this)" expand="expand(thinlet, item)" weightx="1" weighty="1" /> </panel> |
Update of /cvsroot/thinlet/thinlet/demo In directory sc8-pr-cvs1:/tmp/cvs-serv31058/demo Added Files: drafts-swingproperties.bat drafts.bat examples-amazon-browser.bat examples-amazon-explorer.bat examples-demo-calculator.bat examples-demo-demo.bat Log Message: New CVS layout and build infrastructure, Part 2 (a.k.a catch the missing parts :-). Contributed by Campbell Boucher-Burnet. --- NEW FILE: drafts-swingproperties.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.drafts.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.drafts.SwingProperties --- NEW FILE: drafts.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.drafts.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.drafts.Drafts --- NEW FILE: examples-amazon-browser.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.examples.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.examples.amazon.browser.AmazonBrowser --- NEW FILE: examples-amazon-explorer.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.examples.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.examples.amazon.explorer.AmazonExplorer --- NEW FILE: examples-demo-calculator.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.examples.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.examples.demo.Calculator --- NEW FILE: examples-demo-demo.bat --- @set CP=../lib/thinlet.jar;../lib/thinlet.examples.jar;../lib/thinlet.icons.jar @java -cp %CP% thinlet.examples.demo.Demo |
From: <ab...@us...> - 2003-06-26 15:28:58
|
Update of /cvsroot/thinlet/thinlet/build In directory sc8-pr-cvs1:/tmp/cvs-serv31058/build Added Files: build-all.bat build.properties build.xml clean-all.bat Log Message: New CVS layout and build infrastructure, Part 2 (a.k.a catch the missing parts :-). Contributed by Campbell Boucher-Burnet. --- NEW FILE: build-all.bat --- ant all --- NEW FILE: build.properties --- #Ant Properties File for Thinlet build #Sat May 31 00:57:07 CST 2003 build.debug=off build.optimize=off thinlet.home.dir=${basedir}/.. thinlet.src.dir=${thinlet.home.dir}/src/java thinlet.build.dir=${thinlet.home.dir}/build/classes thinlet.lib.dir=${thinlet.home.dir}/lib thinlet.doc.dir=${thinlet.home.dir}/doc thinlet.core.jar=${thinlet.lib.dir}/thinlet.jar thinlet.drafts.jar=${thinlet.lib.dir}/thinlet.drafts.jar thinlet.examples.jar=${thinlet.lib.dir}/thinlet.examples.jar thinlet.icons.jar=${thinlet.lib.dir}/thinlet.icons.jar thinlet.midp.src.dir=${thinlet.home.dir}/src/midp thinlet.midp.converter="thinlet.midp.Converter" --- NEW FILE: build.xml --- <?xml version="1.0" encoding="UTF-8"?> <project basedir="." default="all" name="thinlet"> <description> File: build.xml Author: bou...@us... Verion: 1.0 Purpose: build the thinlet.sf.net source tree </description> <!-- ***************************** --> <!-- *** PROJECT WIDE SETTINGS *** --> <!-- ***************************** --> <property file="build.properties"/> <!-- ********************* --> <!-- *** BUILD TARGETS *** --> <!-- ********************* --> <!-- I N I T --> <target name="init"> <!-- set up a time stamp just in case we want to use it --> <tstamp> <format pattern="yyyy-MM-dd HH:mm:ss z" property="ts"/> </tstamp> </target> <!-- P R E P A R E --> <target depends="init" name="prepare"> <!-- create any required directories, etc --> <mkdir dir="${thinlet.build.dir}"/> </target> <!-- G E N E R A T E D O U T P U T --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Compile the Thinlet midp source Converter --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="prepare" name="compile-midp-converter"> <javac debug="${build.debug}" destdir="${thinlet.build.dir}" optimize="${build.optimize}" srcdir="${thinlet.midp.src.dir}"> <include name="thinlet/midp/Converter.java"/> </javac> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Generate the Thinlet midp source, using the Converter --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-midp-converter" name="generate-midp-src"> <java classname="thinlet.midp.Converter"> <classpath path="${thinlet.build.dir}"/> <arg value="${thinlet.src.dir}"/> <arg value="${thinlet.midp.src.dir}"/> </java> </target> <!-- C O M P I L E C L A S S E S --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Complile the core Thinlet clases --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="prepare" name="compile-core"> <javac debug="${build.debug}" destdir="${thinlet.build.dir}" optimize="${build.optimize}" srcdir="${thinlet.src.dir}"> <include name="thinlet/Thinlet*.java"/> <include name="thinlet/Widget.java"/> <include name="thinlet/*Launcher.java"/> </javac> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Complile the Thinlet draft package clases --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-core" name="compile-drafts"> <javac debug="${build.debug}" destdir="${thinlet.build.dir}" optimize="${build.optimize}" srcdir="${thinlet.src.dir}"> <include name="thinlet/drafts/*.java"/> </javac> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Complile the Thinlet examples package clases --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-core" name="compile-examples"> <javac debug="${build.debug}" destdir="${thinlet.build.dir}" optimize="${build.optimize}" srcdir="${thinlet.src.dir}"> <include name="thinlet/examples/**/*.java"/> </javac> </target> <!-- B U I L D J A R S --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Build the core Thinlet classes jar --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-core" name="jar-core"> <jar destfile="${thinlet.core.jar}"> <fileset dir="${thinlet.build.dir}"> <include name="thinlet/Thinlet*.class"/> <include name="thinlet/ThinletWidget.class"/> <include name="thinlet/*Launcher.class"/> </fileset> </jar> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Build the Thinlet drafts package jar --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-drafts" name="jar-drafts"> <jar destfile="${thinlet.drafts.jar}"> <fileset dir="${thinlet.build.dir}"> <include name="thinlet/drafts/**"/> </fileset> <fileset dir="${thinlet.src.dir}"> <include name="thinlet/drafts/**"/> <exclude name="thinlet/drafts/*.java"/> </fileset> </jar> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Build the Thinlet examples package jar --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="compile-examples" name="jar-examples"> <jar destfile="${thinlet.examples.jar}"> <fileset dir="${thinlet.build.dir}"> <include name="thinlet/examples/**"/> </fileset> <fileset dir="${thinlet.src.dir}"> <include name="thinlet/examples/**"/> <exclude name="thinlet/examples/**/*.java"/> </fileset> </jar> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Build the Thinlet icons package jar --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="jar-icons"> <jar destfile="${thinlet.icons.jar}"> <fileset dir="${thinlet.src.dir}"> <include name="icons/**"/> </fileset> </jar> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Build all of the jars --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="jar-core,jar-drafts,jar-examples,jar-icons" name="jar-all"> <echo message="All jars built"/> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Create JavaDocs --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="javadoc"> <mkdir dir="${thinlet.doc.dir}/api"/> <javadoc packagenames="thinlet.*,thinlet.drafts.*,thinlet.examples.demo.*,thinlet.examples.amazon.browser.*,thinlet.examples.amazon.explorer.*" sourcepath="${thinlet.src.dir}" destdir="${thinlet.doc.dir}/api" author="true" version="false" use="true" protected="true" windowtitle="Thinlet - API" doctitle="Thinlet - API" bottom="<i>Copyright © 2002 Robert Bajzát - in...@th... - All rights reserved.</i>"> </javadoc> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Do Everything --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="jar-all,javadoc, generate-midp-src" name="all"> <echo message="All build tasks performed"/> </target> <!-- C L E A N U P T A R G E T S --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Clean up the build directory --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="prepare" name="clean-compile"> <delete dir="${thinlet.build.dir}"/> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Delete all jars created by the build proccess --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="prepare" name="clean-jars"> <delete file="${thinlet.core.jar}"/> <delete file="${thinlet.drafts.jar}"/> <delete file="${thinlet.examples.jar}"/> <delete file="${thinlet.icons.jar}"/> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Delete all generated JavaDoc files --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="prepare" name="clean-javadoc"> <delete dir="${thinlet.doc.dir}/api"/> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Clean up everything --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target depends="clean-compile,clean-jars,clean-javadoc" name="clean-all"> <echo message="All clean"/> </target> <!-- R U N A P P L I C A T I O N T A R G E T S --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the demo application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-demo"> <java classname="thinlet.examples.demo.Demo" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.examples.jar}"/> </java> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the calculator application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-calculator"> <java classname="thinlet.examples.demo.Calculator" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.examples.jar}"/> </java> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the Amazon browser application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-amazon-browser"> <java classname="thinlet.examples.amazon.browser.AmazonBrowser" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.examples.jar}"/> </java> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the Amazon explorer example application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-amazon-explorer"> <java classname="thinlet.examples.amazon.explorer.AmazonExplorer" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.examples.jar}"/> </java> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the Drafts application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-drafts"> <java classname="thinlet.drafts.Drafts" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.drafts.jar}"/> </java> </target> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- Run the Drafts SwingProperties demo application --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <target name="run-swing-properties"> <java classname="thinlet.drafts.SwingProperties" fork="true"> <classpath path="${thinlet.core.jar}"/> <classpath path="${thinlet.icons.jar}"/> <classpath path="${thinlet.drafts.jar}"/> </java> </target> </project> --- NEW FILE: clean-all.bat --- ant clean-all |
From: <ab...@us...> - 2003-06-26 15:24:03
|
Update of /cvsroot/thinlet/thinlet/build In directory sc8-pr-cvs1:/tmp/cvs-serv26607/build Log Message: Directory /cvsroot/thinlet/thinlet/build added to the repository |
From: <ab...@us...> - 2003-06-26 15:22:01
|
Update of /cvsroot/thinlet/thinlet/src/midp In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/midp Added Files: MANIFEST.MF ThinletDemo.jad ThinletDemo.png eventcode.txt readme.txt Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: MANIFEST.MF --- MIDlet-1: Demo, /ThinletDemo.png, thinlet.midp.demo.Demo MIDlet-2: Calculator, /ThinletDemo.png, thinlet.midp.examples.calculator.Calculator MIDlet-Name: ThinletDemo MIDlet-Vendor: Sun Microsystems MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0 --- NEW FILE: ThinletDemo.jad --- MIDlet-1: Demo, /ThinletDemo.png, thinlet.midp.demo.Demo MIDlet-2: Calculator, /ThinletDemo.png, thinlet.midp.calculator.Calculator MIDlet-Jar-Size: 37778 MIDlet-Jar-URL: ThinletDemo.jar MIDlet-Name: ThinletDemo MIDlet-Vendor: Sun Microsystems MIDlet-Version: 1.0 --- NEW FILE: ThinletDemo.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: eventcode.txt --- private static final int MOUSE_ENTERED = 1; private static final int MOUSE_EXITED = 2; // private static final int MOUSE_PRESSED = 3; private static final int MOUSE_DRAGGED = 4; private static final int MOUSE_RELEASED = 5; private static final int DRAG_ENTERED = 6; private static final int DRAG_EXITED = 7; protected void pointerPressed(int x, int y) { findComponent(content, x, y); if (popupowner != null) { String classname = getClass(mouseinside); if ((popupowner != mouseinside) && (classname != ":popup") && (classname != ":combolist")) { closeup(); } } handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_ENTERED, mouseinside, insidepart); mousepressed = mouseinside; pressedpart = insidepart; handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_PRESSED, mousepressed, pressedpart); } protected void pointerReleased(int x, int y) { Object mouserelease = mousepressed; Object releasepart = pressedpart; mousepressed = pressedpart = null; handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_RELEASED, mouserelease, releasepart); } protected void pointerDragged(int x, int y) { Object previnside = mouseinside; Object prevpart = insidepart; findComponent(content, x, y); boolean same = (previnside == mouseinside) && (prevpart == insidepart); boolean isin = (mousepressed == mouseinside) && (pressedpart == insidepart); boolean wasin = (mousepressed == previnside) && (pressedpart == prevpart); if (wasin && !isin) { handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_EXITED, mousepressed, pressedpart); } else if (!same && (popupowner != null) && !wasin) { handleMouseEvent(x, y, 1, false, false, false, DRAG_EXITED, previnside, prevpart); } if (isin && !wasin) { handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_ENTERED, mousepressed, pressedpart); } else if (!same && (popupowner != null) && !isin) { handleMouseEvent(x, y, 1, false, false, false, DRAG_ENTERED, mouseinside, insidepart); } if (isin == wasin) { handleMouseEvent(x, y, 1, false, false, false, MouseEvent.MOUSE_DRAGGED, mousepressed, pressedpart); } } protected void keyPressed(int keyCode) { if ((popupowner != null) || (focusowner != null)) { hideTip(); if (keyCode > 0) { processKeyPress((popupowner != null) ? popupowner : focusowner, false, false, 1, keyCode, 0); } else { int keychar = 0, key = 0; switch (getGameAction(keyCode)) { case UP: key = KeyEvent.VK_UP; break; case LEFT: key = KeyEvent.VK_LEFT; break; case DOWN: key = KeyEvent.VK_DOWN; break; case RIGHT: key = KeyEvent.VK_RIGHT; break; case FIRE: key = KeyEvent.VK_ENTER; keychar = KeyEvent.VK_SPACE; break; case GAME_A: key = KeyEvent.VK_ESCAPE; break; } if (key != 0) { processKeyPress((popupowner != null) ? popupowner : focusowner, false, false, 1, keychar, key); } //if (keyCode == getKeyCode(LEFT)) { } } } protected void keyRepeated(int keyCode) { keyPressed(keyCode); } private static final Command nextcommand = new Command("Next", Command.SCREEN, 0); //private static final Command prevcommand = new Command("Previous", Command.SCREEN, 0); { addCommand(nextcommand); //addCommand(prevcommand); setCommandListener(this); } public void commandAction(Command command, Displayable displayable) { if (command == nextcommand) { setNextFocusable(focusowner, false); repaint(focusowner); closeup(); } //else if (command == prevcommand) { //setPreviousFocusable(focusowner, null, true, true, false); //repaint(focusowner); //closeup(); //} } --- NEW FILE: readme.txt --- To make a MIDP version of Thinlet you have to compile the Converter file in this directory and run it (javac Converter.java; java Converter). Now you have the thinlet\midp\Thinlet.java file. Two simple demo application is included a calculator and a widget demo, to compile and run it you need the J2ME Wireless Toolkit. Do the followings: - create a new project (e.g. ThinletDemo) - copy MANIFEST.MF and ThinletDemo.jad to \WTK104\apps\ThinletDemo\bin - copy Thinlet.java to \WTK104\apps\ThinletDemo\src\thinlet\midp - copy calculator\Calculator.java to \WTK104\apps\ThinletDemo\src\thinlet\midp\calculator - copy demo\Demo.java to \WTK104\apps\ThinletDemo\src\thinlet\midp\demo - copy ThinletDemo.png \WTK104\apps\ThinletDemo\res - copy calculator\calculator.xml to \WTK104\apps\ThinletDemo\res\thinlet\midp\calculator - copy demo\demo.xml and demo\image.png to \WTK104\apps\ThinletDemo\res\thinlet\midp\demo The MIDP version is very similar to the J2SE version, the only difference is the event handling (because there is no reflection), you have to overwrite Thinlet's protected void handle(Object source, String action) method. |
From: <ab...@us...> - 2003-06-26 15:22:01
|
Update of /cvsroot/thinlet/thinlet/src/midp/thinlet/midp/examples/demo In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/midp/thinlet/midp/examples/demo Added Files: Demo.java demo.xml image.png Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: Demo.java --- package thinlet.midp.examples.demo; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import thinlet.midp.*; public class Demo extends MIDlet { Display display; protected void startApp() throws MIDletStateChangeException { display = Display.getDisplay(this); DemoCanvas canvas = new DemoCanvas(this); display.setCurrent(canvas); } protected void pauseApp() { } void destroyImpl() { try { destroyApp(false); notifyDestroyed(); } catch (MIDletStateChangeException mste) {} } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { display.setCurrent(null); } } class DemoCanvas extends Thinlet { private static final Command exitcommand = new Command("Exit", Command.EXIT, 0); private Demo midlet; public DemoCanvas(Demo midlet) { this.midlet = midlet; try { add(parse("demo.xml")); } catch (Exception exc) { exc.printStackTrace(); } addCommand(exitcommand); } public void commandAction(Command command, Displayable displayable) { if (command == exitcommand) { midlet.destroyImpl(); } else super.commandAction(command, displayable); } protected void handle(Object source, Object part, String action) { if ("selectlist".equals(action)) { int index = getInteger(find("selectmode"), "selected"); setBoolean(find("demolist"), "visible", index == 0); setBoolean(find("demotree"), "visible", index == 1); setBoolean(find("demotable"), "visible", index == 2); } } } --- NEW FILE: demo.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <tabbedpane selected="2"> <tab text="Basic" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <label text="Label" icon="/thinlet/midp/demo/image.png" /> <button text="Button" icon="/thinlet/midp/demo/image.png" /> <checkbox text="CheckBox" selected="true" /> <progressbar value="50" /> <slider value="50" /> </panel> <tab text="Text" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <textfield text="TextField" /> <passwordfield text="Password" /> <textarea text="TextArea" weightx="1" weighty="1" /> <spinbox text="100" /> </panel> <tab text="List" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <combobox name="selectmode" editable="false" selected="1" weightx="1" action="selectlist" > <choice text="List" /> <choice text="Tree" /> <choice text="Table" /> </combobox> <list name="demolist" weighty="1" visible="false"> <item text="List item" /> <item selected="true" text="List item" /> <item text="List item" /> </list> <tree name="demotree" weighty="1"> <node text="Tree node"> <node text="Tree node" /> </node> <node text="Tree node"> <node selected="true" text="Tree node"> <node text="Tree node" /> <node selected="true" text="Tree node" /> </node> </node> <node text="Tree node" /> <node text="Tree node" /> </tree> <table name="demotable" weighty="1" visible="false"> <column text="Column" /><column text="Column" /> <row><cell text="Cell" /><cell text="Cell" /></row> <row selected="true"><cell text="Cell" /><cell text="Cell" /></row> <row><cell text="Cell" /><cell text="Cell" /></row> </table> </panel> </tabbedpane> --- NEW FILE: image.png --- (This appears to be a binary file; contents omitted.) |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/midp/thinlet/midp In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/midp/thinlet/midp Added Files: Converter.java Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: Converter.java --- package thinlet.midp; import java.io.*; import java.util.*; public class Converter { public static void main(String[] args) throws Exception { String srcDir = args[0]; String destDir = args[1]; FileInputStream fis = new FileInputStream(srcDir + "/thinlet/Thinlet.java"); byte[] data = new byte[fis.available()]; fis.read(data, 0, data.length); fis.close(); String source = new String(data); source = change(source,"package thinlet;", "package thinlet.midp;"); source = change(source,"/* import thinlet.*; */", "import thinlet.*;"); source = change(source,"c_ctrl = null;","c_ctrl;"); FileInputStream efis = new FileInputStream(destDir + "/eventcode.txt"); byte[] eventcode = new byte[efis.available()]; efis.read(eventcode, 0, eventcode.length); efis.close(); source = change(source, "/* insert midp event code */", new String(eventcode)); int index = 0; while ((index = source.indexOf("//java>")) != -1) { int end = source.indexOf("//<java", index); source = source.substring(0, index) + source.substring(end + 7); } source = change(source, "/*midp", ""); source = change(source, "midp*/", ""); while ((index = source.indexOf("//midp ")) != -1) { int end = index; while ("\n".indexOf(source.charAt(end + 1)) == -1) { end++; } source = source.substring(0, index) + source.substring(index + 7, end) + " //midp" + source.substring(end); } while ((index = source.indexOf(" //java")) != -1) { int start = index; while ((start > 0) && ("\t\n\r".indexOf(source.charAt(start - 1)) == -1)) { start--; } source = source.substring(0, start) + "//java " + source.substring(start, index) + source.substring(index + 7); } source = change(source, "Boolean.TRUE", "TRUE"); source = change(source, "Boolean.FALSE", "FALSE"); source = change(source, ".getWidth(this)", ".getWidth()"); source = change(source, ".getHeight(this)", ".getHeight()"); source = change(source, "Dimension ", "int[] "); source = change(source, ".width", "[0]"); source = change(source, ".height", "[1]"); source = change(source, "new Dimension()", "new int[] { 0, 0 }"); source = change(source, "new Dimension(1, 1)", "new int[] { 1, 1 }"); source = change(source, "new Dimension(", "new int[] { ", ");", " };"); source = change(source, "Rectangle ", "int[] "); source = change(source, ".x", "[2]"); source = change(source, ".y", "[3]"); source = change(source, "Color ", "int "); source = change(source, "new Color(", "", ")", ""); source = change(source, "fm.charWidth(", "font.charWidth("); source = change(source, "fm.getAscent() + fm.getDescent()", "font.getHeight()"); source = change(source, "fm.getHeight()", "font.getHeight()"); source = change(source, "FontMetrics fm = getFontMetrics(font);", ""); source = change(source, "fm.stringWidth(", "font.stringWidth("); source = change(source, " - fm.getLeading()", ""); source = change(source, " + fm.getLeading()", ""); source = change(source, "getFontMetrics(getFont())", "font"); source = change(source, "fm.charsWidth", "font.charsWidth"); //source = change(source, "reader.read()", "read()"); //source = change(source, "reader.close();", "data = null; inputreader = null;"); source = change(source, ".intern()", ""); //bug!!! source = change(source, "MouseEvent.MOUSE_ENTERED", "MOUSE_ENTERED"); source = change(source, "MouseEvent.MOUSE_MOVED", "0"); source = change(source, "MouseEvent.MOUSE_EXITED", "MOUSE_EXITED"); source = change(source, "MouseEvent.MOUSE_PRESSED", "MOUSE_PRESSED"); source = change(source, "MouseEvent.MOUSE_DRAGGED", "MOUSE_DRAGGED"); source = change(source, "MouseEvent.MOUSE_RELEASED", "MOUSE_RELEASED"); String[] keysfrom = { "TAB", "F6", "F8", "SPACE", "ENTER", "UP", "DOWN", "PAGE_UP", "PAGE_DOWN", "HOME", "END", "ESCAPE", "RIGHT", "LEFT", "BACK_SPACE", "DELETE", "A", "X", "C", "V" }; String[] keysto = { "'\\t'", "0x75", "0x77", "0x20", "'\\n'", "0x26", "0x28", "0x21", "0x22", "0x24", "0x23", "0x1B", "0x27", "0x25", "'\\b'", "0x7F", "0x41", "0x58", "0x43", "0x56" }; for (int i = 0; i < keysfrom.length; i++) { source = change(source, "KeyEvent.VK_" + keysfrom[i], keysto[i]); } FileOutputStream fos = new FileOutputStream(destDir + "/thinlet/midp/Thinlet.java"); fos.write(source.getBytes()); fos.close(); } private static String change(String source, String oldvalue, String newvalue) { return change(source, oldvalue, newvalue, null, null); } static StringBuffer sb = new StringBuffer(); private static String change(String source, String oldvalue, String newvalue, String oldend, String newend) { System.out.println("change(" + oldvalue + ", " + newvalue + ", " + oldend + ", " + newend + ")"); int index = 0; while ((index = source.indexOf(oldvalue, index)) != -1) { if (oldend == null) { sb.setLength(0); sb.append(source.substring(0, index)); sb.append(newvalue); sb.append(source.substring(index + oldvalue.length())); source = sb.toString(); } else { int ie = source.indexOf(oldend, index + oldvalue.length()); sb.setLength(0); sb.append(source.substring(0, index)); sb.append(newvalue); sb.append(source.substring(index + oldvalue.length(), ie)); sb.append(newend); sb.append(source.substring(ie + oldend.length())); source = sb.toString(); } } return source; } } |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/midp/thinlet/midp/examples/calculator In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/midp/thinlet/midp/examples/calculator Added Files: Calculator.java calculator.xml Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: Calculator.java --- package thinlet.midp.examples.calculator; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import thinlet.midp.*; public class Calculator extends MIDlet { Display display; protected void startApp() throws MIDletStateChangeException { display = Display.getDisplay(this); CalculatorCanvas canvas = new CalculatorCanvas(this); display.setCurrent(canvas); } protected void pauseApp() { } void destroyImpl() { try { destroyApp(false); notifyDestroyed(); } catch (MIDletStateChangeException mste) {} } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { display.setCurrent(null); } } class CalculatorCanvas extends Thinlet { private static final Command exitcommand = new Command("Exit", Command.EXIT, 0); private Calculator midlet; public CalculatorCanvas(Calculator midlet) { this.midlet = midlet; try { add(parse("calculator.xml")); } catch (Exception exc) { exc.printStackTrace(); } addCommand(exitcommand); } public void commandAction(Command command, Displayable displayable) { if (command == exitcommand) { midlet.destroyImpl(); } else super.commandAction(command, displayable); } protected void handle(Object source, Object part, String action) { if ("calculate".equals(action)) { try { int number1 = Integer.parseInt(getString(find("number1"), "text")); int number2 = Integer.parseInt(getString(find("number2"), "text")); setString(find("result"), "text", String.valueOf(number1 + number2)); } catch (NumberFormatException nfe) {} } } } --- NEW FILE: calculator.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <panel columns="2" top="4" left="4" right="4" gap="4"> <textfield name="number1" columns="4" /> <label text="+" halign="center" /> <textfield name="number2" columns="4" /> <button text="=" action="calculate" /> <textfield name="result" editable="false" columns="4" colspan="2" /> </panel> |
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/java/thinlet/examples/demo Added Files: Calculator.java Demo.java calculator.xml demo.xml demodialog.xml manifest.mf Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: Calculator.java --- package thinlet.examples.demo; import thinlet.*; public class Calculator extends Thinlet { public Calculator() { try { add(parse("calculator.xml")); } catch (Exception exc) { exc.printStackTrace(); } } public void calculate(String number1, String number2, Object result) { // Widget result try { int i1 = Integer.parseInt(number1); int i2 = Integer.parseInt(number2); setString(result, "text", String.valueOf(i1 + i2)); // result.set("text", String.valueOf(i1 + i2)); } catch (NumberFormatException nfe) { getToolkit().beep(); } } public static void main(String[] args) { new FrameLauncher("Calculator", new Calculator(), 320, 240); } } --- NEW FILE: Demo.java --- package thinlet.examples.demo; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import thinlet.*; /** * */ public class Demo extends Thinlet { /** * */ public Demo() { try { add(parse("demo.xml")); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ public static void main(String[] args) { new FrameLauncher("Demo", new Demo(), 320, 320); } boolean textinit; boolean valueinit; /** * */ public void loadText(Object textarea) { try { InputStream inputstream = null; try { inputstream = getClass().getResourceAsStream("demodialog.xml"); } catch (Throwable e) {} BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); StringBuffer text = new StringBuffer(); for (int c = reader.read(); c != -1; c = reader.read()) { if (((c > 0x1f) && (c < 0x7f)) || ((c > 0x9f) && (c < 0xffff)) || (c == '\n')) { text.append((char) c); } else if (c == '\t') { text.append(" "); } } reader.close(); setString(textarea, "text", text.toString()); textinit = true; } catch (Exception exc) { getToolkit().beep(); } } public void actionTheme(String idx) { int index = idx.charAt(1) - '0'; switch (index) { case 0: //xp setColors(0xece9d8, 0x000000, 0xf5f4f0, 0x919b9a, 0xb0b0b0, 0xededed, 0xb9b9b9, 0xff899a, 0xc5c5dd); break; case 1: //gray setColors(0xe6e6e6, 0x000000, 0xffffff, 0x909090, 0xb0b0b0, 0xededed, 0xb9b9b9, 0x89899a, 0xc5c5dd); break; case 2: //yellow setColors(0xeeeecc, 0x000000, 0xffffff, 0x999966, 0xb0b096, 0xededcb, 0xcccc99, 0xcc6600, 0xffcc66); break; case 3: //blue setColors(0x6375d6, 0xffffff, 0x7f8fdd, 0xd6dff5, 0x9caae5, 0x666666, 0x003399, 0xff3333, 0x666666); break; } } /** * */ public void changeEditable(boolean editable, Object textarea) { setBoolean(textarea, "editable", editable); } /** * */ public void changeEnabled(boolean enabled, Object textarea) { setBoolean(textarea, "enabled", enabled); } public void changeBorder(boolean enabled, Object textarea) { setBoolean(textarea, "border", enabled); } Object dialog; /** * */ public void showDialog() { try { if (dialog == null) { dialog = parse("demodialog.xml"); } add(dialog); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ public void findText(Object combobox, String what, boolean match, boolean down) { closeDialog(); if (what.length() == 0) { return; } boolean cacheditem = false; for (int i = getCount(combobox) - 1; i >= 0; i--) { String choicetext = getString(getItem(combobox, i), "text"); if (what.equals(choicetext)) { cacheditem = true; break; } } if (!cacheditem) { Object choice = create("choice"); setString(choice, "text", what); add(combobox, choice); } Object textarea = find("textarea"); int end = getInteger(textarea, "end"); String text = getString(textarea, "text"); if (!match) { what = what.toLowerCase(); text = text.toLowerCase(); } int index = text.indexOf(what, down ? end : 0); if (!down && (index != -1) && (index >= end)) { index = -1; } if (index != -1) { setInteger(textarea, "start", index); setInteger(textarea, "end", index + what.length()); requestFocus(textarea); } else { getToolkit().beep(); } } /** * */ public void closeDialog() { remove(dialog); } /** * */ public void insertList(Object list) { Object item = create("item"); setString(item, "text", "New item"); setIcon(item, "icon", getIcon("/icons/bookmarks.gif")); add(list, item, 0); } /** * */ public void deleteList(Object delete, Object list) { for (int i = getCount(list) - 1; i >= 0; i--) { Object item = getItem(list, i); if (getBoolean(item, "selected")) { remove(item); } } setBoolean(delete, "enabled", false); } /** * */ public void changeSelection(Object list, Object delete) { setBoolean(delete, "enabled", getSelectedIndex(list) != -1); } /** * */ public void setSelection(Object list, String selection, Object delete) { for (int i = getCount(list) - 1; i >= 0; i--) { setBoolean(getItem(list, i), "selected", false); } setChoice(list, "selection", selection); setBoolean(delete, "enabled", false); } /** * */ public void sliderChanged(int value, Object spinbox) { setString(spinbox, "text", String.valueOf(value)); hsbChanged(); } /** * */ public void spinboxChanged(String text, Object slider) { try { int value = Integer.parseInt(text); if ((value >= 0) && (value <= 255)) { setInteger(slider, "value", value); hsbChanged(); } } catch (NumberFormatException nfe) { getToolkit().beep(); } } private Object sl_red, sl_green, sl_blue; private Object tf_hue, tf_saturation, tf_brightness; private Object pb_hue, pb_saturation, pb_brightness; private Object rgb_label; /** * */ public void storeWidgets(Object sl_red, Object sl_green, Object sl_blue, Object tf_hue, Object tf_saturation, Object tf_brightness, Object pb_hue, Object pb_saturation, Object pb_brightness, Object rgb_label) { this.sl_red = sl_red; this.sl_green = sl_green; this.sl_blue = sl_blue; this.tf_hue = tf_hue; this.tf_saturation = tf_saturation; this.tf_brightness = tf_brightness; this.pb_hue = pb_hue; this.pb_saturation = pb_saturation; this.pb_brightness = pb_brightness; this.rgb_label = rgb_label; actionTheme("t0"); } /** * */ private void hsbChanged() { int red = getInteger(sl_red, "value"); int green = getInteger(sl_green, "value"); int blue = getInteger(sl_blue, "value"); float[] hsb = Color.RGBtoHSB(red, green, blue, null); setColor(rgb_label, "background", new Color(red, green, blue)); setString(tf_hue, "text", String.valueOf(hsb[0])); setString(tf_saturation, "text", String.valueOf(hsb[1])); setString(tf_brightness, "text", String.valueOf(hsb[2])); setInteger(pb_hue, "value", (int) (100f * hsb[0])); setInteger(pb_saturation, "value", (int) (100f * hsb[1])); setInteger(pb_brightness, "value", (int) (100f * hsb[2])); } } --- NEW FILE: calculator.xml --- <panel gap="4" top="4" left="4"> <textfield name="number1" columns="4" /> <label text="+" /> <textfield name="number2" columns="4" /> <button text="=" action="calculate(number1.text, number2.text, result)" /> <textfield name="result" editable="false" /> </panel> --- NEW FILE: demo.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <panel columns="1" gap="4"> <menubar weightx="1"> <menu text="File" mnemonic="0"> <menuitem text="New" icon="/icons/new.gif" mnemonic="0" /> <menuitem text="Open..." icon="/icons/open.gif" /> <menuitem text="Save" icon="/icons/save.gif" /> <menuitem text="Save As..." icon="/icons/saveas.gif" /> <separator /> <menuitem text="Page Setup" icon="/icons/pagesetup.gif" /> <menuitem text="Print" icon="/icons/print.gif" /> <separator /> <menuitem text="Exit" /> </menu> <menu text="Edit"> <menuitem text="Undo" icon="/icons/undo.gif" /> <separator /> <menuitem text="Cut" icon="/icons/cut.gif" /> <menuitem text="Copy" icon="/icons/copy.gif" /> <menuitem text="Paste" icon="/icons/paste.gif" /> <menuitem text="Delete" icon="/icons/delete.gif" /> <separator /> <menuitem text="Select All" /> </menu> <menu text="Search"> <menuitem text="Find..." icon="/icons/find.gif" /> <menuitem text="Find Next" icon="/icons/findagain.gif" /> </menu> <menu text="Theme"> <checkboxmenuitem text="XP" name="t0" group="theme" action="actionTheme(this.name)" selected="true"/> <checkboxmenuitem text="Gray" name="t1" group="theme" action="actionTheme(this.name)"/> <checkboxmenuitem text="Sandstone" name="t2" group="theme" action="actionTheme(this.name)"/> <checkboxmenuitem text="Ocean" name="t3" group="theme" action="actionTheme(this.name)"/> </menu> <menu text="Help"> <menuitem text="Help Topics" icon="/icons/help.gif" /> <separator /> <menuitem text="About" icon="/icons/about.gif" /> </menu> </menubar> <tabbedpane selected="1" weightx="1" weighty="1"> <tab text="Texts"> <panel columns="2" top="4" left="4" bottom="4" right="4" gap="4"> <panel columns="1" gap="2"> <label text="Find in the text:" mnemonic="10" /> <button name="b_finddialog" text="Search" tooltip="Search..." icon="/icons/find.gif" mnemonic="1" action="showDialog()" /> </panel> <panel columns="2" left="10" gap="4"> <checkbox name="cb_editable" text="Editable" mnemonic="4" selected="true" action="changeEditable(this.selected, textarea)" /> <checkbox name="cb_enabled" text="Enabled" selected="true" action="changeEnabled(this.selected, textarea)" /> <checkbox name="cb_border" text="Border" selected="true" action="changeBorder(this.selected, textarea)" /> </panel> <textarea name="textarea" init="loadText(this)" colspan="2" halign="fill" weightx="1" weighty="1" /> </panel> </tab> <tab text="Lists" mnemonic="0"> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <panel gap="4"> <label text="Update list:" /> <button icon="/icons/new.gif" tooltip="Add new item" action="insertList(list)" /> <button name="delete" icon="/icons/delete.gif" tooltip="Delete selected items" action="deleteList(this, list)" /> <label text=" & selection:" /> <combobox name="selection" selected="2" editable="false" valign="center" action="setSelection(list, this.text, delete)"> <choice text="single" /> <choice text="interval" /> <choice text="multiple" /> </combobox> </panel> <splitpane orientation="vertical" divider="100" weightx="1" weighty="1"> <splitpane divider="120"> <list name="list" selection="multiple" action="changeSelection(this, delete)" colspan="4" weightx="1" weighty="1"> <popupmenu> <menuitem text="one"/> <menuitem text="two"/> <separator/> <menuitem text="three"/> </popupmenu> <item text="List item A" /> <item text="List item B" icon="/icons/bookmarks.gif" selected="true" /> <item text="List item C" enabled="false" /> <item text="List item D" icon="/icons/bookmarks.gif" /> <item text="List item E" /> <item text="List item F" /> <item text="List item G" /> </list> <tree selection="multiple"> <popupmenu> <menuitem text="one"/> <menuitem text="two"/> <separator/> <menuitem text="three"/> </popupmenu> <node text="Tree node A" icon="/icons/open.gif"> <node text="Tree node" icon="/icons/open.gif" selected="true"> <node text="Tree node" icon="/icons/new.gif" /> </node> </node> <node text="Tree node B" enabled="false" icon="/icons/new.gif" /> <node text="Tree node C" icon="/icons/open.gif" expanded="false"> <node text="Tree node C1" icon="/icons/new.gif" /> </node> </tree> </splitpane> <table selection="multiple"> <popupmenu> <menuitem text="one"/> <menuitem text="two"/> <separator/> <menuitem text="three"/> </popupmenu> <header> <column text="Column" icon="/icons/bookmarks.gif" width="120" /> <column text="Column" alignment="center" /> <column text="Column" alignment="center" /> </header> <row> <cell text="Cell" /> <cell text="Cell" /> <cell text="Cell" icon="/icons/bookmarks.gif" /> </row> <row selected="true"> <cell text="Cell" icon="/icons/bookmarks.gif" /> <cell text="Cell" /> <cell text="Cell" /> </row> <row> <cell text="Cell" /> <cell text="Cell" icon="/icons/bookmarks.gif" enabled="false" /> <cell text="Cell" /> </row> </table> </splitpane> </panel> </tab> <tab text="Values"> <panel columns="3" top="4" left="4" gap="4" init="storeWidgets(sl_red, sl_green, sl_blue, tf_hue, tf_saturation, tf_brightness, pb_hue, pb_saturation, pb_brightness, rgb_label)"> <label text="Red, green, and blue values" colspan="3" /> <label text="Red:" alignment="right" /> <slider name="sl_red" maximum="255" valign="center" action="sliderChanged(this.value, sb_red)" /> <spinbox name="sb_red" maximum="255" text="0" columns="3" action="spinboxChanged(this.text, sl_red)" /> <label text="Green:" alignment="right" /> <slider name="sl_green" maximum="255" valign="center" action="sliderChanged(this.value, sb_green)" /> <spinbox name="sb_green" maximum="255" text="0" columns="3" action="spinboxChanged(this.text, sl_green)" /> <label text="Blue:" alignment="right" /> <slider name="sl_blue" maximum="255" valign="center" action="sliderChanged(this.value, sb_blue)" /> <spinbox name="sb_blue" maximum="255" text="0" columns="3" action="spinboxChanged(this.text, sl_blue)" /> <separator colspan="3" /> <label text="Hue, saturation, and brightness values" colspan="3" /> <label text="Hue:" alignment="right" /> <textfield name="tf_hue" text="0.0" editable="false" /> <progressbar name="pb_hue" valign="center" /> <label text="Saturation:" alignment="right" /> <textfield name="tf_saturation" text="0.0" editable="false" /> <progressbar name="pb_saturation" valign="center" /> <label text="Brightness:" alignment="right" /> <textfield name="tf_brightness" text="0.0" editable="false" /> <progressbar name="pb_brightness" valign="center" /> <separator colspan="3"/> <label colspan="3" name="rgb_label" valign="fill" weighty="1" background="#000000"/> </panel> </tab> <tab text="Other"> <panel halign="fill" weightx="1" valign="fill" weighty="1" gap="4" top="4" columns="3"> <panel halign="fill" weightx="1" columns="1" gap="2"> <label text="Sidebar widget:"/> <tabbedpane placement="stacked" halign="fill" weightx="1" valign="fill" weighty="1"> <popupmenu> <menuitem text="one"/> <menuitem text="two"/> <separator/> <menuitem text="three"/> </popupmenu> <tab text="One" property="c=123;v=345"> <panel columns="1" gap="4"> <textarea valign="fill" weighty="1" weightx="1" halign="fill" border="false" wrap="true" editable="false" text="Popup menus are supported in many components. Try to right-click on the tab name. Try it on lists, trees and tables."/> </panel> </tab> <tab text="Two" font="bold 14"> <panel scrollable="true" columns="1" gap="4"> <label text="This is a scrollable panel."/> <label text="Custom colors/fonts:"/> <button text="abcdef" font="18" background="#888888"/> <button text="abcdef" font="Courier 17" background="#882288"/> <button text="abcdef" font="Serif 16" background="#228888"/> <button text="abcdef" font="bold 15" background="#888822"/> <button text="abcdef" font="italic 14" background="#448844"/> <button text="abcdef" font="bold italic 13" background="#444488"/> <button text="abcdef" font="12" background="#884444"/> <button text="abcdef" font="11" background="#2288ff"/> <button text="abcdef" font="10" background="#ff2288"/> </panel> </tab> <tab text="Three" font="bold" foreground="#0000ff"> <panel columns="1" gap="4"> <menubar halign="fill" weightx="1"> <menu text="File"> <menuitem text="one"/> </menu> </menubar> <textarea wrap="true" valign="fill" weighty="1" halign="fill" weightx="1" border="false" editable="false" text="Menus can be placed on any panel or dialog."/> </panel> </tab> <tab text="Four" font="Serif bold 14" background="#8888ff" foreground="#ffffff"> <panel columns="1" gap="4"> <textarea valign="fill" weighty="1" weightx="1" halign="fill" border="false" wrap="true" editable="false" font="Serif italic bold 14" foreground="#88ff88" background="#446600" text="Most components support custom background / foreground colors and font settings"/> </panel> </tab> </tabbedpane> </panel> <separator/> <panel weighty="1" weightx="1" halign="fill" valign="fill" columns="1" gap="2"> <textarea halign="fill" weightx="1" border="false" editable="false" text="Border-less textareas can be used as multiline labels." wrap="true"/> <label text="Link widget:"/> <button type="link" tooltip="Link widget" halign="left" text="www.thinlet.com"/> </panel> <separator colspan="3"/> <panel colspan="3" halign="fill" weightx="1"> <menubar placement="top"> <menu text="Start" font="bold 13" tooltip="Click here to begin"> <menuitem text="Thinlet Home"/> <separator/> <menu text="Programs"> <menu text="Accessories"> <menuitem text="Thinlet!"/> <menuitem text="Thinlet!"/> <menuitem text="Thinlet!"/> </menu> <menuitem text="Amazon Browser"/> <menuitem text="Calculator"/> </menu> <menu text="Documents"> <menuitem text="one"/> <menuitem text="two"/> <menuitem text="three"/> </menu> <menu text="Settings"> <menuitem text="Control Panel"/> <separator/> <menu text="Network & Dialup"> <menuitem text="Thinlet!"/> </menu> <menuitem text="Printers"/> <menuitem text="Taskbar & Start Menu..."/> </menu> <menu text="Search"> <menuitem text="one"/> </menu> <menuitem text="Help"/> <menuitem text="Run..."/> <separator/> <menuitem text="Shut Down..."/> </menu> </menubar> <separator/> <label text=" Unfold-up menus are supported."/> </panel> </panel> </tab> </tabbedpane> </panel> --- NEW FILE: demodialog.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <dialog text="Find" icon="/icons/find.gif" modal="true" columns="4" top="4" left="4" bottom="4" right="4" gap="4"> <label text="Find what:" /> <combobox name="ch_what" colspan="2" valign="center" /> <button name="b_find" text="Find next" action="findText(ch_what, ch_what.text, cb_match.selected, rb_down.selected)" /> <label text="Direction:" alignment="right" /> <checkbox name="rb_up" text="Up" group="direction" /> <checkbox name="cb_match" text="Match case" selected="true" /> <button name="b_cancel" text="Cancel" action="closeDialog" /> <label /> <checkbox name="rb_down" text="Down" group="direction" selected="true" /> </dialog> --- NEW FILE: manifest.mf --- Main-Class: thinlet.examples.demo.Demo |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/amazon/explorer In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/java/thinlet/examples/amazon/explorer Added Files: AmazonExplorer.java about.xml details.xml error.xml exception.xml exchange.xml explorer.xml linklist.xml listmania.xml manifest.mf market.xml result.xml Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: AmazonExplorer.java --- package thinlet.examples.amazon.explorer; import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; import java.util.*; import thinlet.*; /** * */ public class AmazonExplorer extends Thinlet { private static final String[] MODES = { "baby", "books", "classical", "dvd", "electronics", "garden", "kitchen", "magazines", "music", "pc-hardware", "photo", "software", "toys", "universal", "vhs", "videogames" }; private static final String[] BOOKS = { "+pmrank", "+salesrank", "+reviewrank", "+pricerank", "+inverse-pricerank", "+daterank", "+titlerank", "-titlerank" }; private static final String[] CLASSICAL_MUSIC = { "+psrank", "+salesrank", "+artistrank", "+orig-rel-date", "+titlerank" }; private static final String[] DVD = { "+salesrank", "+titlerank" }; private static final String[] ELECTRONICS = { "+pmrank", "+salesrank", "+titlerank", "+reviewrank" }; private static final String[] GARDEN_TOOL = { "+psrank", "+salesrank", "+titlerank", "-titlerank", "+manufactrank", "-manufactrank", "+price", "-price" }; private static final String[] KITCHEN = { "+pmrank", "+salesrank", "+titlerank", "-titlerank", "+manufactrank", "-manufactrank", "+price", "-price" }; private static final String[] HARDWARE = { "+psrank", "+salesrank", "+titlerank", "-titlerank" }; private static final String[] PHOTO = { "+pmrank", "+salesrank", "+titlerank", "-titlerank" }; private static final String[] SOFTWARE = { "+pmrank", "+salesrank", "+titlerank", "+price", "-price" }; private static final String[] VHS = { "+psrank", "+salesrank", "+titlerank" }; private static final String[] VIDEOGAMES = { "+pmrank", "+salesrank", "+titlerank", "+price", "-price" }; private static final String[] SORTS = { "Featured Items", "+pmrank", "Bestselling", "+salesrank", "Average Customer Review", "+reviewrank", "Price (Low to High)", "+pricerank", "Price (High to Low)", "+inverse-pricerank", "Publication Date", "+daterank", "Alphabetical (A-Z)", "+titlerank", "Alphabetical (Z-A)", "-titlerank", "Featured Items", "+psrank", "Artist Name", "+artistrank", "Original Release Date", "+orig-rel-date", "Alphabetical", "+titlerank", "Review", "+reviewrank", "Manufacturer (A-Z)", "+manufactrank", "Manufacturer (Z-A)", "-manufactrank", "Price (Low to High)", "+price", "Price (High to Low)", "-price" }; /** * */ public AmazonExplorer() { setFont(new Font("SansSerif", Font.PLAIN, 11)); try { add(parse("explorer.xml")); selectMode(1, find("searchby"), find("keyword"), find("sort")); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ public void selectMode(int selected, Object searchby, Object keyword, Object sort) { String mode = MODES[selected]; removeAll(searchby); addChoice(searchby, "Keyword"); if ((mode == "music") || (mode == "classical")) { addChoice(searchby, "Artist"); } else if (mode == "books") { addChoice(searchby, "Author"); } else if ((mode == "dvd") || (mode == "vhs") || (mode == "video")) { addChoice(searchby, "Actor"); addChoice(searchby, "Director"); } else if ((mode == "electronics") || (mode == "kitchen") || (mode == "videogames") || (mode == "software") || (mode == "photo") || (mode == "pc-hardware")) { addChoice(searchby, "Manufacturer"); } setInteger(searchby, "selected", 0); removeAll(sort); String[] sorts = getSort(mode); if (sorts != null) { for (int i = 0; i < sorts.length; i++) { for (int j = 0; j < SORTS.length; j += 2) { if (SORTS[j + 1] == sorts[i]) { Object choice = create("choice"); setString(choice, "text", SORTS[j]); add(sort, choice); break; } } } } setInteger(sort, "selected", -1); setString(sort, "text", null); setBoolean(sort, "enabled", sorts != null); } /** * */ private void addChoice(Object combobox, String text) { Object choice = create("choice"); setString(choice, "text", text); add(combobox, choice); } /** * */ private static final String[] getSort(String mode) { if (mode == "books") { return BOOKS; } if ((mode == "classical") || (mode == "music")) { return CLASSICAL_MUSIC; } if (mode == "dvd") { return DVD; } if (mode == "electronics") { return ELECTRONICS; } if ((mode == "garden") || (mode == "universal")) { return GARDEN_TOOL; } if (mode == "kitchen") { return KITCHEN; } if (mode == "pc-hardware") { return HARDWARE; } if (mode == "photo") { return PHOTO; } if (mode == "software") { return SOFTWARE; } if (mode == "vhs") { return VHS; } if (mode == "videogames") { return VIDEOGAMES; } // if ((mode == "baby") || (mode == "magazines") || (mode == "toys")) { return null; } /** * */ public void find(int mode, String searchby, Object keyfield, String keyword, int sort) { String searchstring = searchby + "Search=" + convert(keyword) + "&mode=" + MODES[mode] + "&type=lite" + ((sort == -1) ? "" : ("&sort=" + getSort(MODES[mode])[sort])); // add the new keyword to the list boolean cacheditem = false; int n = getCount(keyfield); if (keyword.length() > 0) { for (int i = n - 1; i >= 0; i--) { String choicetext = getString(getItem(keyfield, i), "text"); if (keyword.equals(choicetext)) { cacheditem = true; break; } } if (!cacheditem) { Object choice = create("choice"); setString(choice, "text", keyword); add(keyfield, choice); if (n > 8) { remove(getItem(keyfield, 0)); } } } Object nProductInfo = getResponse(searchstring + "&page=1"); if (!isErrorMessage(nProductInfo)) { try { Object result = parse("result.xml"); Object nextresult = find(result, "nextresult"); putProperty(nextresult, "SearchString", searchstring); loadList(nProductInfo, 1, find(result, "resultlist"), find(result, "total"), nextresult); addPage(result); } catch (Exception exc) { exc.printStackTrace(); } } } /** * */ public void resultSelected(Object resultlist, Object detailsbutton) { setBoolean(detailsbutton, "enabled", getSelectedIndex(resultlist) != -1); } /** * */ public void findNext(Object nextresult, Object total, Object resultlist) { String searchstring = (String) getProperty(nextresult, "SearchString"); int page = ((Integer) getProperty(nextresult, "SearchPage")).intValue() + 1; Object nProductInfo = getResponse(searchstring + "&page=" + page); if (!isErrorMessage(nProductInfo)) { loadList(nProductInfo, page, resultlist, total, nextresult); } } /** * */ private void loadList(Object nProductInfo, int page, Object resultlist, Object total, Object nextresult) { loadDetailsList(nProductInfo, resultlist); String sTotalResults = getDOMText(nProductInfo, "TotalResults"); setString(total, "text", sTotalResults); putProperty(nextresult, "SearchPage", new Integer(page)); setBoolean(nextresult, "enabled", Integer.parseInt(sTotalResults) > getCount(resultlist)); } /** * */ private void loadDetailsList(Object nProductInfo, Object resultlist) { int n = getDOMCount(nProductInfo, "Details"); for (int i = 0; i < n; i++) { Object nDetails = getDOMNode(nProductInfo, "Details", i); Object item = create("item"); setString(item, "text", getDOMText(nDetails, "ProductName")); putProperty(item, "Details", nDetails); add(resultlist, item); } } /** * */ public void showDetails(Object resultlist) { Object item = getSelectedItem(resultlist); Object nDetails = getProperty(item, "Details"); try { Object details = parse("details.xml"); putProperty(details, "Asin", getDOMText(nDetails, "Asin")); //Info Object productname = find(details, "productname"); setString(productname, "text", getDOMText(nDetails, "ProductName")); //setIcon(productname, "icon", loadIcon(getDOMText(nDetails, "ImageUrlSmall"))); Object infoproperties = find(details, "infoproperties"); addLabel(infoproperties, "Name:", nDetails, "ProductName"); addLabel(infoproperties, "Catalog:", nDetails, "Catalog"); addList(infoproperties, "Artist:", nDetails, "Artists", "Artist"); addList(infoproperties, "Author:", nDetails, "Authors", "Author"); addLabel(infoproperties, "Released:", nDetails, "ReleaseDate"); addLabel(infoproperties, "Manufacturer:", nDetails, "Manufacturer"); addLabel(infoproperties, "List price:", nDetails, "ListPrice"); addLabel(infoproperties, "Our price:", nDetails, "OurPrice"); addLabel(infoproperties, "Used price:", nDetails, "UsedPrice"); addPage(details); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ public void checkDetails(Object details, int selectedtab) { if (selectedtab == 0) { return; } // first tab contains lite information String sAsin = (String) getProperty(details, "Asin"); if (sAsin != null) { String searchstring = "AsinSearch=" + sAsin + "&type=heavy"; Object nProductInfo = getResponse(searchstring); if (!isErrorMessage(nProductInfo)) { Object nDetails = getDOMNode(nProductInfo, "Details", 0); if (nDetails == null) { return; } //never putProperty(details, "Asin", null); //More Object moreproperties = find(details, "moreproperties"); addList(moreproperties, "Starring:", nDetails, "Starring", "Actor"); addList(moreproperties, "Director:", nDetails, "Directors", "Director"); addLabel(moreproperties, "Theatrical date:", nDetails, "TheatricalReleaseDate"); addLabel(moreproperties, "Refurbished:", nDetails, "RefurbishedPrice"); addLabel(moreproperties, "Collectible:", nDetails, "CollectiblePrice"); addLabel(moreproperties, "Third-party:", nDetails, "ThirdPartyNewPrice"); addLabel(moreproperties, "Sales rank:", nDetails, "SalesRank"); addLabel(moreproperties, "Media:", nDetails, "Media"); addLabel(moreproperties, "Number:", nDetails, "NumMedia"); addLabel(moreproperties, "Mpaa rating:", nDetails, "MpaaRating"); addLabel(moreproperties, "Availability:", nDetails, "Availability"); //Review Object nReviews = getDOMNode(nDetails, "Reviews", 0); if (nReviews != null) { Object reviewpanel = find(details, "reviewpanel"); String sAvgCustomerRating = getDOMText(nReviews, "AvgCustomerRating"); Object avgrating = find(reviewpanel, "avgrating"); setInteger(avgrating, "value", getNumber(sAvgCustomerRating)); setString(avgrating, "tooltip", sAvgCustomerRating); loadReview(reviewpanel, nReviews, 0); putProperty(reviewpanel, "Reviews", nReviews); } //Detail Object detailpanel = find(details, "detailpanel"); loadList(getDOMNode(nDetails, "Platforms", 0), "Platform", detailpanel, "platformtitle", "platformlist"); loadList(getDOMNode(nDetails, "Features", 0), "Feature", detailpanel, "featuretitle", "featurelist"); //Link Object linkpanel = find(details, "linkpanel"); loadLink(find(linkpanel, "accessories"), nDetails, "Accessories"); loadLink(find(linkpanel, "similars"), nDetails, "SimilarProducts"); loadLink(find(linkpanel, "wishlists"), nDetails, "Lists"); putProperty(find(linkpanel, "marketsearch"), "Asin", sAsin); Object nBrowseList = getDOMNode(nDetails, "BrowseList", 0); if (nBrowseList != null) { int n = getDOMCount(nBrowseList, "BrowseNode"); Object browselist = find(linkpanel, "browselist"); for (int i = 0; i < n; i++) { Object nBrowseNode = getDOMNode(nBrowseList, "BrowseNode", i); Object browseitem = create("item"); setString(browseitem, "text", getDOMText(getDOMNode(nBrowseNode, "BrowseName", 0))); add(browselist, browseitem); } } } } } /** * */ private void loadLink(Object button, Object nDetails, String listname) { Object list = getDOMNode(nDetails, listname, 0); setBoolean(button, "enabled", (list != null)); if (list != null) { putProperty(button, listname, list); } } /** * */ public void previousReview(Object reviewpanel) { int i = ((Integer) getProperty(reviewpanel, "ReviewIndex")).intValue(); loadReview(reviewpanel, getProperty(reviewpanel, "Reviews"), i - 1); } /** * */ public void nextReview(Object reviewpanel) { int i = ((Integer) getProperty(reviewpanel, "ReviewIndex")).intValue(); loadReview(reviewpanel, getProperty(reviewpanel, "Reviews"), i + 1); } /** * */ private void loadReview(Object reviewpanel, Object nReviews, int i) { int n = getDOMCount(nReviews, "CustomerReview"); if ((i >= 0) && (i < n)) { setBoolean(find(reviewpanel, "prevreview"), "enabled", i > 0); setBoolean(find(reviewpanel, "nextreview"), "enabled", i < n - 1); putProperty(reviewpanel, "ReviewIndex", new Integer(i)); Object nCustomerReview = getDOMNode(nReviews, "CustomerReview", i); String sRating = getDOMText(nCustomerReview, "Rating"); Object rating = find(reviewpanel, "rating"); setInteger(rating, "value", getNumber(sRating)); setString(rating, "tooltip", sRating); setString(find(reviewpanel, "summary"), "text", getDOMText(nCustomerReview, "Summary")); setString(find(reviewpanel, "comment"), "text", convertHTML(getDOMText(nCustomerReview, "Comment"))); } } /** * */ private void loadList(Object root, String nodename, Object panel, String titlename, String listname) { Object list = find(panel, listname); if (root != null) { int n = getDOMCount(root, nodename); for (int i = 0; i < n; i++) { Object item = create("item"); setString(item, "text", getDOMText(getDOMNode(root, nodename, i))); add(list, item); } } else { Object title = find(panel, titlename); setBoolean(title, "visible", false); setBoolean(list, "visible", false); } } /** * */ public void showAccessories(Object button) { showLinkList(getProperty(button, "Accessories"), "Accessory", "Accessories:"); } /** * */ public void showSimilars(Object button) { showLinkList(getProperty(button, "SimilarProducts"), "Product", "Similar products:"); } /** * */ private void showLinkList(Object nRoot, String leafname, String title) { StringBuffer asins = new StringBuffer(); int n = getDOMCount(nRoot, leafname); for (int i = 0; i < n; i++) { if (i != 0) asins.append(','); asins.append(getDOMText(getDOMNode(nRoot, leafname, i))); } Object nProductInfo = getResponse("ListManiaSearch=" + asins.toString() + "&type=lite"); if (!isErrorMessage(nProductInfo)) { try { Object linklist = parse("linklist.xml"); setString(find(linklist, "title"), "text", title); loadDetailsList(nProductInfo, find(linklist, "resultlist")); addPage(linklist); } catch (Exception exc) { exc.printStackTrace(); } } } /** * */ public void showWishlists(Object button) { try { Object listmania = parse("listmania.xml"); Object nLists = getProperty(button, "Lists"); putProperty(listmania, "Lists", nLists); loadWishlist(nLists, 0, listmania, find(listmania, "resultlist"), find(listmania, "listname"), find(listmania, "prevlist"), find(listmania, "nextlist")); addPage(listmania); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ public void previousWishlist(Object listmania, Object resultlist, Object listname, Object prevlist, Object nextlist) { int index = ((Integer) getProperty(listmania, "ListsIndex")).intValue(); loadWishlist(getProperty(listmania, "Lists"), index - 1, listmania, resultlist, listname, prevlist, nextlist); } /** * */ public void nextWishlist(Object listmania, Object resultlist, Object listname, Object prevlist, Object nextlist) { int index = ((Integer) getProperty(listmania, "ListsIndex")).intValue(); loadWishlist(getProperty(listmania, "Lists"), index + 1, listmania, resultlist, listname, prevlist, nextlist); } /** * */ private void loadWishlist(Object nLists, int index, Object listmania, Object resultlist, Object listname, Object prevlist, Object nextlist) { int n = getDOMCount(nLists, "ListId"); if ((index >= 0) && (index < n)) { String sListId = getDOMText(getDOMNode(nLists, "ListId", index)); Object nProductInfo = getResponse("ListManiaSearch=" + sListId + "&type=lite"); if (!isErrorMessage(nProductInfo)) { setString(listname, "text", getDOMText(nProductInfo, "ListName")); removeAll(resultlist); loadDetailsList(nProductInfo, resultlist); putProperty(listmania, "ListsIndex", new Integer(index)); setBoolean(prevlist, "enabled", index > 0); setBoolean(nextlist, "enabled", index < n - 1); } } } /** * */ public void searchMarket(Object button, Object offertype) { String asin = (String) getProperty(button, "Asin"); String type = getString(getItem(offertype, getInteger(offertype, "selected")), "text"); String searchstring = "AsinSearch=" + asin + "&type=heavy&offer=" + type; Object nProductInfo = getResponse(searchstring + "&offerpage=1"); if (!isErrorMessage(nProductInfo)) { try { Object market = parse("market.xml"); Object nDetails = getDOMNode(nProductInfo, "Details", 0); if (nDetails == null) { return; } String offerings = getDOMText(nDetails, "NumberOfOfferings"); setString(find(market, "offerings"), "text", offerings); Object nInfo = getDOMNode(nDetails, "ThirdPartyProductInfo", 0); Object detailslist = find(market, "detailslist"); int n = getDOMCount(nInfo, "ThirdPartyProductDetails"); for (int i = 0; i < n; i++) { Object nProduct = getDOMNode(nInfo, "ThirdPartyProductDetails", i); Object row = create("row"); putProperty(row, "ThirdPartyProductDetails", nProduct); Object cellNick = create("cell"); setString(cellNick, "text", getDOMText(nProduct, "SellerNickname")); add(row, cellNick); Object cellPrice = create("cell"); setString(cellPrice, "text", getDOMText(nProduct, "OfferingPrice")); add(row, cellPrice); add(detailslist, row); } addPage(market); } catch (Exception exc) { exc.printStackTrace(); } } } /** * */ public void showMarketDetails(Object detailslist) { Object nProduct = getProperty(getSelectedItem(detailslist), "ThirdPartyProductDetails"); try { Object exchange = parse("exchange.xml"); Object properties = find(exchange, "properties"); addLabel(properties, "Nickname:", nProduct, "SellerNickname"); addLabel(properties, "Price:", nProduct, "OfferingPrice"); addLabel(properties, "Condition:", nProduct, "Condition"); addField(properties, "Condition:", nProduct, "ConditionType"); addLabel(properties, "Availability:", nProduct, "ExchangeAvailability"); addLabel(properties, "Country:", nProduct, "SellerCountry"); addLabel(properties, "State:", nProduct, "SellerState"); addField(properties, "Comments:", nProduct, "ShipComments"); addLabel(properties, "Rating:", nProduct, "SellerRating"); add(exchange); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ private void addLabel(Object panel, String title, Object root, String key) { String value = getDOMText(root, key); if (value != null) { Object label = create("label"); setString(label, "text", title); add(panel, label); Object field = create("label"); setString(field, "text", value); setInteger(field, "weightx", 1); add(panel, field); } } /** * */ private void addField(Object panel, String title, Object root, String key) { String value = getDOMText(root, key); if (value != null) { Object label = create("label"); setString(label, "text", title); add(panel, label); Object field = create("textfield"); setString(field, "text", getDOMText(root, key)); setBoolean(field, "editable", false); setInteger(field, "weightx", 1); add(panel, field); } } /** * */ private void addList(Object panel, String title, Object root, String key, String itemkey) { Object mainnode = getDOMNode(root, key, 0); if (mainnode != null); int n = getDOMCount(mainnode, itemkey); for (int i = 0; i < n; i++) { Object label = create("label"); if (i == 0) { setString(label, "text", title); } add(panel, label); Object field = create("label"); setString(field, "text", getDOMText(getDOMNode(mainnode, itemkey, i))); setInteger(field, "weightx", 1); add(panel, field); } } // ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- /** * */ public void exit() { System.exit(0); } /** * */ public void defaultTheme() { setColors(0xe6e6e6, 0x000000, 0xffffff, 0x909090, 0xb0b0b0, 0xededed, 0xb9b9b9, 0x89899a, 0xc5c5dd); } /** * */ public void yellowTheme() { setColors(0xeeeecc, 0x000000, 0xffffff, 0x999966, 0xb0b096, 0xededcb, 0xcccc99, 0xcc6600, 0xffcc66); } /** * */ public void blueTheme() { setColors(0x6375d6, 0xffffff, 0x7f8fdd, 0xd6dff5, 0x9caae5, 0x666666, 0x003399, 0xff3333, 0x666666); } /** * */ public void about() { try { add(parse("about.xml")); } catch (Exception exc) { exc.printStackTrace(); } } // ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- /** * */ private Object getResponse(String path) { String associatestag = "thinlet-20"; String developertoken = "D3MAIAYX2Q6JLY"; String url = "http://xml.amazon.com/onca/xml2?t=" + associatestag + "&dev-t=" + developertoken + "&" + path + "&f=xml"; if (getParent() instanceof Applet) { String proxy = ((Applet) getParent()).getParameter("proxy"); if (proxy != null) { url = proxy + convert(url); } } try { return parseDOM(new URL(url).openStream()); } catch (Exception exc) { showException(exc); return null; } } /** * */ private void addPage(Object page) { Object mainpanel = find("mainpanel"); int n = getCount(mainpanel); setBoolean(getItem(mainpanel, n - 1), "visible", false); add(mainpanel, page); } /** * */ public void removePage() { Object mainpanel = find("mainpanel"); int n = getCount(mainpanel); setBoolean(getItem(mainpanel, n - 2), "visible", true); remove(getItem(mainpanel, n - 1)); } /** * */ protected void handleException(Throwable throwable) { showException(throwable); } /** * */ private void showException(Throwable thr) { StringWriter writer = new StringWriter(); thr.printStackTrace(new PrintWriter(writer)); String trace = writer.toString().replace('\r', ' ').replace('\t', ' '); String thrclass = thr.getClass().getName(); thrclass = thrclass.substring(thrclass.lastIndexOf('.') + 1); try { Object exceptiondialog = parse("exception.xml"); setString(exceptiondialog, "text", thrclass); setString(find(exceptiondialog, "message"), "text", thr.getMessage()); setString(find(exceptiondialog, "stacktrace"), "text", trace); add(exceptiondialog); } catch (Exception exc) { exc.printStackTrace(); } } /** * */ private boolean isErrorMessage(Object nProductInfo) { if (nProductInfo == null) { return true; } String sErrorMsg = getDOMText(nProductInfo, "ErrorMsg"); if (sErrorMsg == null) { return false; } try { Object exceptiondialog = parse("error.xml"); setString(find(exceptiondialog, "message"), "text", sErrorMsg); add(exceptiondialog); } catch (Exception exc) { exc.printStackTrace(); } return true; } /** * */ public void closeDialog(Object dialog) { remove(dialog); } // ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- /** * */ private String getDOMText(Object node, String key) { Object leaf = getDOMNode(node, key, 0); return (leaf != null) ? getDOMText(leaf) : null; } /** * */ private static int getNumber(String text) { try { if (text.startsWith("$")) { text = text.substring(1); } int dot = text.indexOf('.'); text = text + "00"; if (dot != -1) { text = text.substring(0, dot) + text.substring(dot + 1, Math.min(dot + 3, text.length())); } return Integer.parseInt(text); } catch (Exception exc) { return 0; } } /** * */ private static String convert(String text) { StringBuffer converted = new StringBuffer(text.length()); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'))) { converted.append(c); } else { converted.append('%'); converted.append(Integer.toHexString((int) c)); } } return converted.toString(); } /** * */ private static String convertHTML(String comment) { StringBuffer sb = new StringBuffer(comment.length()); for (int i = 0; i < comment.length(); i++) { if (comment.startsWith("<P>", i)) { sb.append("\n\n"); i += 5; } else if (comment.startsWith("<BR>", i)) { sb.append("\n"); i += 6; } else sb.append(comment.charAt(i)); } return sb.toString(); } /** * */ public static void main(String[] args) throws Exception { new FrameLauncher("Thinlet Amazon Explorer", new AmazonExplorer(), 208, 256); // 208x235 } } --- NEW FILE: about.xml --- <?xml version="1.0" encoding="UTF-8"?> <dialog name="dialog" icon="/icons/information.gif" text="About" modal="true" columns="1" gap="4" top="4" left="4" bottom="4" right="4" > <label text="Thinlet Amazon Explorer" alignment="center" weightx="1" /> <separator /> <label text="Lajos Szemes" alignment="center" /> <label text="(laj...@th...)" alignment="center" /> <label text="Robert Bajzat" alignment="center" /> <label text="(rob...@th...)" alignment="center" /> <button text="Close" halign="center" action="closeDialog(dialog)" /> </dialog> --- NEW FILE: details.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel name="detailspage" columns="1" weighty="1" gap="4" top="4" left="4" bottom="4" right="4"> <panel columns="2" gap="4"> <textfield name="productname" editable="false" weightx="1" /> <button text="Back" icon="/icons/history.gif" action="removePage" /> </panel> <tabbedpane weightx="1" weighty="1" action="checkDetails(detailspage, this.selected)"> <tab text="Info"> <panel name="infoproperties" columns="2" gap="4" top="4" left="4" bottom="4" right="4" weightx="1" weighty="1" /> </tab> <tab text="More"> <panel name="moreproperties" columns="2" gap="4" top="4" left="4" bottom="4" right="4" weightx="1" weighty="1" /> </tab> <tab text="Reviews"> <panel name="reviewpanel" columns="1" gap="4" top="4" left="4" bottom="4" right="4"> <panel gap="4"> <label text="Average:" /> <progressbar name="avgrating" maximum="500" valign="center" weightx="1" /> </panel> <separator /> <panel columns="4" gap="4"> <textfield name="summary" editable="false" colspan="2" /> <button name="prevreview" icon="/icons/back.gif" tooltip="Previous review" enabled="false" action="previousReview(reviewpanel)" rowspan="2" valign="top" /> <button name="nextreview" icon="/icons/forward.gif" tooltip="Next review" enabled="false" action="nextReview(reviewpanel)" rowspan="2" valign="top" /> <label text="Rating:" /> <progressbar name="rating" maximum="500" valign="center" weightx="1" /> </panel> <textarea name="comment" wrap="true" weightx="1" weighty="1" /> </panel> </tab> <tab text="Details"> <splitpane name="detailpanel" orientation="vertical"> <panel columns="1" gap="4" top="4" left="4" right="4"> <label name="platformtitle" text="Platforms:" /> <list name="platformlist" weightx="1" weighty="1" /> </panel> <panel columns="1" gap="4" left="4" bottom="4" right="4"> <label name="featuretitle" text="Features:" /> <list name="featurelist" weightx="1" weighty="1" /> </panel> </splitpane> </tab> <tab text="Links"> <panel name="linkpanel" columns="1" gap="4" top="4" left="4" bottom="4" right="4"> <panel gap="4" weightx="1"> <button name="accessories" text="Accessories" action="showAccessories(this)" weightx="1" /> <button name="similars" text="Similars" action="showSimilars(this)" weightx="1" /> <button name="wishlists" text="Listmania!" action="showWishlists(this)" weightx="1"/> </panel> <panel gap="4"> <label text="Marketplace:" /> <combobox name="offertype" editable="false" selected="0" weightx="1"> <choice text="All" /> <choice text="ThirdPartyNew" /> <choice text="Used" /> <choice text="Collectible" /> <choice text="Refurbished" /> </combobox> <button name="marketsearch" text="Search" action="searchMarket(this, offertype)" /> </panel> <label text="Browse list:" /> <list name="browselist" weighty="1" /> </panel> </tab> </tabbedpane> </panel> --- NEW FILE: error.xml --- <?xml version="1.0" encoding="UTF-8"?> <dialog name="dialog" icon="/icons/information.gif" text="Error Message" modal="true" columns="1" gap="4" top="4" left="4" bottom="4" right="4" > <label name="message" weightx="1" /> <button text="Close" halign="center" action="closeDialog(dialog)" /> </dialog> --- NEW FILE: exception.xml --- <?xml version="1.0" encoding="UTF-8"?> <dialog name="dialog" icon="/icons/information.gif" modal="true" columns="1" gap="4" top="4" left="4" bottom="4" right="4" > <label name="message" /> <textarea name="stacktrace" editable="false" width="200" height="150" weightx="1" weighty="1" /> <button text="Close" halign="center" action="closeDialog(dialog)" /> </dialog> --- NEW FILE: exchange.xml --- <?xml version="1.0" encoding="UTF-8"?> <dialog text="Third-party Product Details" name="dialog" icon="/icons/information.gif" modal="true" columns="1" gap="4" top="4" left="4" bottom="4" right="4" > <panel name="properties" gap="4" columns="2" weightx="1" /> <separator /> <button text="Close" halign="center" action="closeDialog(dialog)" /> </dialog> --- NEW FILE: explorer.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel name="mainpanel" columns="1"> <menubar weightx="1"> <menu text="File"> <menuitem text="Exit" action="exit" /> </menu> <menu text="Theme"> <checkboxmenuitem text="Default" group="theme" selected="true" action="defaultTheme" /> <checkboxmenuitem text="Sandstone" group="theme" action="yellowTheme" /> <checkboxmenuitem text="Ocean" group="theme" action="blueTheme" /> </menu> <menu text="Help"> <menuitem text="About" action="about" /> </menu> </menubar> <panel columns="2" top="4" left="4" bottom="4" right="4" gap="4"> <label text="Product:" alignment="right" /> <combobox name="modes" editable="false" selected="1" weightx="1" action="selectMode(this.selected, searchby, keyword, sort)"> <choice text="Baby" /> <choice text="Books" /> <choice text="Classical Music" /> <choice text="DVD" /> <choice text="Electronics" /> <choice text="Outdoor Living" /> <choice text="Kitchen & Housewares" /> <choice text="Magazines" /> <choice text="Popular Music" /> <choice text="Computers" /> <choice text="Camera & Photo" /> <choice text="Software" /> <choice text="Toys & Games" /> <choice text="Tools & Hardware" /> <choice text="Video" /> <choice text="Computer & Video Games" /> </combobox> <label text="By:" alignment="right" /> <combobox name="searchby" editable="false" /> <label /> <combobox name="keyword" /> <label text="Sort:" alignment="right" /> <combobox name="sort" editable="false" /> <label /> <button text="Search" icon="/icons/find.gif" halign="left" action="find(modes.selected, searchby.text, keyword, keyword.text, sort.selected)" /> </panel> </panel> --- NEW FILE: linklist.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel columns="1" weighty="1" gap="4" top="4" left="4" bottom="4" right="4"> <label name="title" weightx="1" /> <list name="resultlist" weighty="1" action="resultSelected(resultlist, detailsbutton)" /> <panel gap="4" halign="right"> <button name="detailsbutton" text="Details" enabled="false" action="showDetails(resultlist)" /> <button text="Back" icon="/icons/find.gif" action="removePage" /> </panel> </panel> --- NEW FILE: listmania.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel name="listmania" columns="1" weighty="1" gap="4" top="4" left="4" bottom="4" right="4"> <panel gap="4" weightx="1"> <textfield name="listname" editable="false" weightx="1" /> <button name="prevlist" icon="/icons/back.gif" tooltip="Previous list" enabled="false" action="previousWishlist(listmania, resultlist, listname, this, nextlist)" /> <button name="nextlist" icon="/icons/forward.gif" tooltip="Next list" enabled="false" action="nextWishlist(listmania, resultlist, listname, prevlist, this)" /> </panel> <list name="resultlist" weighty="1" action="resultSelected(resultlist, detailsbutton)" /> <panel gap="4" halign="right"> <button name="detailsbutton" text="Details" enabled="false" action="showDetails(resultlist)" /> <button text="Back" icon="/icons/find.gif" action="removePage" /> </panel> </panel> --- NEW FILE: manifest.mf --- Main-Class: thinlet.examples.amazon.explorer.AmazonExplorer --- NEW FILE: market.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel columns="1" weighty="1" gap="4" top="4" left="4" bottom="4" right="4"> <panel gap="4" weightx="1"> <label text="Number of offerings:" /> <label name="offerings" /> </panel> <table name="detailslist" weighty="1" action="resultSelected(this, detailsbutton)"> <header> <column text="Seller" width="140" /> <column text="Offering Price" /> </header> </table> <panel gap="4" halign="right"> <button name="detailsbutton" text="Details" icon="/icons/history.gif" enabled="false" action="showMarketDetails(detailslist)" /> <button text="Back" icon="/icons/back.gif" action="removePage" /> </panel> </panel> --- NEW FILE: result.xml --- <?xml version="1.0" encoding="UTF-8"?> <panel columns="2" weighty="1" gap="4" top="4" left="4" bottom="4" right="4"> <label text="Total results:" /> <label name="total" weightx="1" /> <list name="resultlist" colspan="2" weighty="1" action="resultSelected(this, detailsbutton)" /> <panel gap="4" colspan="2" halign="right"> <button name="detailsbutton" text="Details" icon="/icons/history.gif" enabled="false" action="showDetails(resultlist)" /> <button text="Back" icon="/icons/find.gif" action="removePage" /> <button name="nextresult" text="Next" icon="/icons/findagain.gif" action="findNext(this, total, resultlist)" /> </panel> </panel> |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/java/thinlet Added Files: AppletLauncher.java FrameLauncher.java Thinlet.java Widget.java Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: AppletLauncher.java --- package thinlet; import java.applet.*; import java.awt.*; /** * */ public class AppletLauncher extends Applet implements Runnable { private transient Thinlet content; private transient Image doublebuffer; /** * */ public void init() { setBackground(Color.white); setForeground(Color.darkGray); setLayout(new BorderLayout()); add(new Label("Loading...", Label.CENTER), BorderLayout.CENTER); new Thread(this).start(); } /** * */ public void run() { try { content = (Thinlet) Class.forName(getParameter("class")).newInstance(); removeAll(); add(content, BorderLayout.CENTER); } catch (Throwable exc) { removeAll(); add(new Label(exc.getMessage()), BorderLayout.CENTER); } doLayout(); repaint(); } /** * */ public void doLayout() { super.doLayout(); if (doublebuffer != null) { doublebuffer.flush(); doublebuffer = null; } } /** * */ public void stop() { if (doublebuffer != null) { doublebuffer.flush(); doublebuffer = null; } } /** * */ public void update(Graphics g) { paint(g); } /** * */ public void paint(Graphics g) { if (doublebuffer == null) { Dimension d = getSize(); doublebuffer = createImage(d.width, d.height); } Graphics dg = doublebuffer.getGraphics(); dg.setClip(g.getClipBounds()); super.paint(dg); dg.dispose(); g.drawImage(doublebuffer, 0, 0, this); } /** * */ public void destroy() { content.destroy(); } } --- NEW FILE: FrameLauncher.java --- package thinlet; import java.awt.*; import java.awt.event.*; import java.awt.image.*; /** * */ public class FrameLauncher extends Frame implements WindowListener { private transient Thinlet content; private transient Image doublebuffer; /** * @param title * @param content * @param width * @param height */ public FrameLauncher(String title, Thinlet content, int width, int height) { super(title); this.content = content; add(content, BorderLayout.CENTER); addWindowListener(this); pack(); Insets is = getInsets(); width += is.left + is.right; height += is.top + is.bottom; Dimension ss = getToolkit().getScreenSize(); width = Math.min(width, ss.width); height = Math.min(height, ss.height); setBounds((ss.width - width) / 2, (ss.height - height) / 2, width, height); setVisible(true); //maximize: setBounds(-is.left, -is.top, ss.width + is.left + is.right, ss.height + is.top + is.bottom); int[] pix = new int[16 * 16]; for (int x = 0; x < 16; x++) { int sx = ((x >= 1) && (x <= 9)) ? 1 : (((x >= 11) && (x <= 14)) ? 2 : 0); for (int y = 0; y < 16; y++) { int sy = ((y >= 1) && (y <= 9)) ? 1 : (((y >= 11) && (y <= 14)) ? 2 : 0); pix[y * 16 + x] = ((sx == 0) || (sy == 0)) ? 0xffffffff : ((sx == 1) ? ((sy == 1) ? (((y == 2) && (x >= 2) && (x <= 8)) ? 0xffffffff : (((y >= 3) && (y <= 8)) ? ((x == 5) ? 0xffffffff : (((x == 4) || (x == 6)) ? 0xffe8bcbd : 0xffb01416)) : 0xffb01416)) : 0xff377ca4) : ((sy == 1) ? 0xff3a831d : 0xfff2cc9c)); } } setIconImage(createImage(new MemoryImageSource(16, 16, pix, 0, 16))); } /** * */ public void update(Graphics g) { paint(g); } /** * */ public void paint(Graphics g) { if (doublebuffer == null) { Dimension d = getSize(); doublebuffer = createImage(d.width, d.height); } Graphics dg = doublebuffer.getGraphics(); dg.setClip(g.getClipBounds()); super.paint(dg); dg.dispose(); g.drawImage(doublebuffer, 0, 0, this); } /** * */ public void doLayout() { if (doublebuffer != null) { doublebuffer.flush(); doublebuffer = null; } super.doLayout(); } /** * */ public void windowClosing(WindowEvent e) { if (content.destroy()) { System.exit(0); } setVisible(true); } public void windowOpened(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} } --- NEW FILE: Thinlet.java --- /* Thinlet GUI toolkit - www.thinlet.com Copyright (C) 2002 Robert Bajzat (rob...@th...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ [...6490 lines suppressed...] new String[] { "top", "bottom"} } }, "menu", "choice", new Object[][] { { "integer", "mnemonic", "paint", integer_1 } }, "menuitem", "choice", new Object[][] { { "keystroke", "accelerator", "", null }, { "method", "action", "", null }, { "integer", "mnemonic", "paint", integer_1 } //... KeyStroke=keyCode+modifiers(SHIFT CTRL META ALT_MASK) }, "checkboxmenuitem", "menuitem", new Object[][] { { "boolean", "selected", "paint", Boolean.FALSE }, //...group { "string", "group", "paint", null } }, //...group "popupmenu", "component", null, // Post menu: Shift+F10 "bean", "component", new Object[][] { { "bean", "bean", "", null } } }; } } --- NEW FILE: Widget.java --- package thinlet; import java.awt.*; /** * */ public class Widget { private transient Thinlet thinlet; private transient Object widget; /** * */ public Widget(String classname) { widget = Thinlet.create(classname); } /** * */ public String getClassName() { return null; } /** * */ public void set(String key, String value) { thinlet.setString(widget, key, value); } public boolean requestFocus(Object component) { return true; } } |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/thinlet Removed Files: AppletLauncher.java FrameLauncher.java Thinlet.java Widget.java Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- AppletLauncher.java DELETED --- --- FrameLauncher.java DELETED --- --- Thinlet.java DELETED --- --- Widget.java DELETED --- |
From: <ab...@us...> - 2003-06-26 15:21:59
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/amazon/browser In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/java/thinlet/examples/amazon/browser Added Files: AmazonBrowser.java amazonbrowser.xml manifest.mf Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: AmazonBrowser.java --- package thinlet.examples.amazon.browser; import java.awt.*; import java.io.*; import java.net.*; import java.util.*; import thinlet.*; /** * */ public class AmazonBrowser extends Thinlet { private final static String[] MODES = { "baby", "books", "classical", "dvd", "electronics", "garden", "kitchen", "magazines", "music", "pc-hardware", "photo", "software", "toys", "universal", "vhs", "videogames" }; private final static String[] SEARCHBY = { "Keyword", "Asin", "Upc", "Author", "Artist", "Actor", "Director", "Manufacturer" }; int level = -1; String name; boolean listmode; Vector details = new Vector(); /** * */ public class Details { String asin; String productName; String catalog; String authors; String artists; String releaseDate; String manufacturer; String imageUrl; String listPrice; String ourPrice; String usedPrice; Image image; public Image getIcon() { if ((image == null) && (imageUrl != null)) { try { image = getToolkit().getImage(new URL(imageUrl)); } catch (Exception exc) { showException(exc); } imageUrl = null; } return image; } } /** * */ public AmazonBrowser() { try { add(parse("amazonbrowser.xml")); productSelected(); } catch (Exception exc) { showException(exc); } } /** * */ public void productSelected() { int productid = getInteger(find("product"), "selected"); boolean music = (productid == 8) || (productid == 2); boolean books = (productid == 1); boolean films = (productid == 3) || (productid == 14); //video? boolean homes = (productid == 4) || (productid == 6) || (productid == 15) || (productid == 11) || (productid == 10) || (productid == 9); Object searchType = find("searchType"); setInteger(searchType, "selected", 0); setString(find("searchText"), "text", ""); setBoolean(getItem(searchType, 2), "enabled", music); setBoolean(getItem(searchType, 3), "enabled", books); setBoolean(getItem(searchType, 4), "enabled", music); setBoolean(getItem(searchType, 5), "enabled", films); setBoolean(getItem(searchType, 6), "enabled", films); setBoolean(getItem(searchType, 7), "enabled", homes); } /** * */ public void search() { String mode = MODES[getInteger(find("product"), "selected")]; String searchby = SEARCHBY[getInteger(find("searchType"), "selected")]; String text = getString(find("searchText"), "text"); StringBuffer converted = new StringBuffer(text.length()); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'))) { converted.append(c); } else { converted.append('%'); converted.append(Integer.toHexString((int) c)); } } text = converted.toString(); setBoolean(find("errorMessage"), "visible", false); removeAll(find("resultList")); details.removeAllElements(); showProduct(null); try { parseXML(new URL("http://xml.amazon.com/onca/xml?v=1.0&" + "t=webservices-20&dev-t=D3MAIAYX2Q6JLY&" + searchby + "Search=" + text + "&mode=" + mode + "&type=lite&page=1&f=xml").openStream()); //parseXML(getClass().getResourceAsStream("xml.xml")); //parseXML(getClass().getResourceAsStream("err.xml")); } catch (Exception exc) { showException(exc); } } /** * */ public void resultSelected() { int selected = getSelectedIndex(find("resultList")); if (selected != -1) { Details detail = (Details) details.elementAt(selected); showProduct(detail); } } /** * */ private void showProduct(Details detail) { Object detailsPanel = find("detailsPanel"); setIcon(find(detailsPanel, "image"), "icon", (detail != null) ? detail.getIcon() : null); setString(find(detailsPanel, "authors"), "text", (detail != null) ? detail.authors : ""); boolean hasartists = (detail != null) && (detail.artists != null); setBoolean(find(detailsPanel, "artistsLabel"), "visible", hasartists); setBoolean(find(detailsPanel, "artists"), "visible", hasartists); if (hasartists) { setString(find(detailsPanel, "artists"), "text", (detail != null) ? detail.artists : ""); } setString(find(detailsPanel, "productName"), "text", (detail != null) ? detail.productName : ""); setString(find(detailsPanel, "manufactured"), "text", (detail != null) ? detail.manufacturer : ""); setString(find(detailsPanel, "released"), "text", (detail != null) ? detail.releaseDate : ""); setString(find(detailsPanel, "listPrice"), "text", (detail != null) ? detail.listPrice : ""); setString(find(detailsPanel, "ourPrice"), "text", (detail != null) ? detail.ourPrice : ""); setString(find(detailsPanel, "usedPrice"), "text", (detail != null) ? detail.usedPrice : ""); } /** * */ protected void startElement(String name, Hashtable attributelist) { level++; this.name = name; if (level == 1) { if ("Details".equals(name)) { details.addElement(new Details()); listmode = true; } else if ("ErrorMsg".equals(name)) { listmode = false; } } } /** * */ protected void characters(String text) { if ((level == 1) && !listmode) { Object errorMessage = find("errorMessage"); setBoolean(errorMessage, "visible", true); setString(errorMessage, "text", text); } else if (level == 2) { if ("Asin".equals(name)) { getLastDetails().asin = text; } else if ("ProductName".equals(name)) { getLastDetails().productName = text; } else if ("Catalog".equals(name)) { getLastDetails().catalog = text; } else if ("ReleaseDate".equals(name)) { getLastDetails().releaseDate = text; } else if ("Manufacturer".equals(name)) { getLastDetails().manufacturer = text; } else if ("ImageUrlMedium".equals(name)) { getLastDetails().imageUrl = text; } else if ("ListPrice".equals(name)) { getLastDetails().listPrice = text; } else if ("OurPrice".equals(name)) { getLastDetails().ourPrice = text; } else if ("UsedPrice".equals(name)) { getLastDetails().usedPrice = text; } } else if (level == 3) { if ("Author".equals(name)) { Details last = getLastDetails(); last.authors = (last.authors == null) ? text : (last.authors + ", " + text); } else if ("Artist".equals(name)) { Details last = getLastDetails(); last.artists = (last.artists == null) ? text : (last.artists + ", " + text); } } } /** * */ protected void endElement() { if (listmode && (level == 1)) { Details last = getLastDetails(); Object row = create("row"); Object productcell = create("cell"); setString(productcell, "text", last.productName); add(row, productcell); Object catalogcell = create("cell"); setString(catalogcell, "text", last.catalog); add(row, catalogcell); Object pricecell = create("cell"); setString(pricecell, "text", last.ourPrice); add(row, pricecell); add(find("resultList"), row); } level--; } /** * */ private Details getLastDetails() { return (Details) details.elementAt(details.size() - 1); } /** * */ public static void main(String[] args) throws Exception { new FrameLauncher("Amazon Browser", new AmazonBrowser(), 320, 320); } /** * */ private void showException(Throwable exc) { StringWriter writer = new StringWriter(); exc.printStackTrace(new PrintWriter(writer)); String trace = writer.toString().replace('\r', ' ').replace('\t', ' '); Object dialog = create("dialog"); setInteger(dialog, "columns", 1); setInteger(dialog, "gap", 4); setInteger(dialog, "top", 4); setInteger(dialog, "left", 4); setInteger(dialog, "bottom", 4); setInteger(dialog, "right", 4); setString(dialog, "text", exc.getMessage()); setBoolean(dialog, "modal", true); Object textarea = create("textarea"); setString(textarea, "text", trace); setInteger(textarea, "width", 240); setInteger(textarea, "height", 180); add(dialog, textarea); Object button = create("button"); setString(button, "text", "OK"); setChoice(button, "halign", "center"); add(dialog, button); try { setMethod(button, "action", "closeException", dialog, this); } catch (Exception e) {} add(dialog); } /** * */ public void closeException() { remove(getItem(getDesktop(), 0)); } } /*ProductInfo url Details* Asin? ProductName Catalog Authors? Author+ Artists? Artist+ ReleaseDate? Manufacturer? ImageUrlSmall ImageUrlMedium ImageUrlLarge ListPrice? OurPrice? UsedPrice? ShoppingCart? CartId? Items? Item+ ItemId ProductName? Description? Asin Quantity? ListPrice? OurPrice? ErrorMsg? ProductInfo Details* url Asin ProductName Catalog KeyPhrases? KeyPhrase+ Artists? Artist+ Authors? Author+ Mpn? Starring? Actor+ Directors? Director+ TheatricalReleaseDate? ReleaseDate? Manufacturer? Distributor? ImageUrlSmall? ImageUrlMedium? ImageUrlLarge? ListPrice? OurPrice? UsedPrice? RefurbishedPrice? CollectiblePrice? ThirdPartyNewPrice? SalesRank? BrowseList? BrowseNode+ BrowseId? BrowseName? Media? ReadingLevel? Publisher? NumMedia? Isbn? Features? Feature+ Platform? MpaaRating? EsrbRating? AgeGroup? Availability? Upc? Tracks? Track* ByArtist* Accessories? Accessory+ Platforms? Platform* Encoding? Reviews? AvgCustomerRating? CustomerReview* Rating Summary Comment SimilarProducts? Product* Lists? ListId* ShoppingCart? ... ErrorMsg? ...*/ --- NEW FILE: amazonbrowser.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <panel columns="1" gap="4" top="4" left="4" bottom="4" right="4" > <panel columns="3" gap="4" > <label text="Product:" /> <combobox editable="false" selected="1" colspan="2" name="product" action="productSelected"> <choice text="Baby" /> <choice text="Books" /> <choice text="Classical Music" /> <choice text="DVD" /> <choice text="Electronics" /> <choice text="Outdoor Living" /> <choice text="Kitchen & Housewares" /> <choice text="Magazines" /> <choice text="Popular Music" /> <choice text="Computers" /> <choice text="Camera & Photo" /> <choice text="Software" /> <choice text="Toys & Games" /> <choice text="Tools & Hardware" /> <choice text="Video" /> <choice text="Computer & Video Games" /> </combobox> <combobox editable="false" selected="0" name="searchType"> <choice text="Keyword:" /> <choice text="ASIN/ISBN:" /> <choice text="Upc:" /> <choice text="Author:" /> <choice text="Artist:" /> <choice text="Actor:" /> <choice text="Director:" /> <choice text="Manufacturer:" /> </combobox> <textfield name="searchText" weightx="1" /> <button text="Search" name="search" action="search" /> </panel> <label name="errorMessage" visible="false" /> <table name="resultList" action="resultSelected" weightx="1" weighty="1"> <header> <column text="Name" width="175" /> <column text="Catalog" width="75" /> <column text="OurPrice" width="40" /> </header> </table> <panel name="detailsPanel" columns="2" weightx="1" gap="4"> <label name="image" /> <panel columns="4" weightx="1" gap="4"> <label text="Author:" /> <textfield name="authors" colspan="3" editable="false" /> <label name="artistsLabel" text="Artists:" /> <textfield name="artists" colspan="3" editable="false" /> <label text="Name:" /> <textfield name="productName" colspan="3" editable="false" /> <label text="Manuf.:" /> <textfield name="manufactured" weightx="1" editable="false" /> <label text="Released:" /> <textfield name="released" columns="6" editable="false" /> <separator colspan="4" /> <panel columns="3" colspan="4" gap="4"> <label text="List Price:" /> <label text="Our Price:" /> <label text="Used Price:" /> <textfield name="listPrice" weightx="1" editable="false" /> <textfield name="ourPrice" weightx="1" editable="false" /> <textfield name="usedPrice" weightx="1" editable="false" /> </panel> </panel> </panel> </panel> --- NEW FILE: manifest.mf --- Main-Class: thinlet.examples.amazon.browser.AmazonBrowser |
From: <ab...@us...> - 2003-06-26 15:21:57
|
Update of /cvsroot/thinlet/thinlet/examples/amazon/explorer In directory sc8-pr-cvs1:/tmp/cvs-serv29772/examples/amazon/explorer Removed Files: AmazonExplorer.java about.xml details.xml error.xml exception.xml exchange.xml explorer.xml linklist.xml listmania.xml manifest.mf market.xml result.xml Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- AmazonExplorer.java DELETED --- --- about.xml DELETED --- --- details.xml DELETED --- --- error.xml DELETED --- --- exception.xml DELETED --- --- exchange.xml DELETED --- --- explorer.xml DELETED --- --- linklist.xml DELETED --- --- listmania.xml DELETED --- --- manifest.mf DELETED --- --- market.xml DELETED --- --- result.xml DELETED --- |
From: <ab...@us...> - 2003-06-26 15:21:57
|
Update of /cvsroot/thinlet/thinlet/midp/calculator In directory sc8-pr-cvs1:/tmp/cvs-serv29772/midp/calculator Removed Files: Calculator.java calculator.xml Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- Calculator.java DELETED --- --- calculator.xml DELETED --- |
From: <ab...@us...> - 2003-06-26 15:21:57
|
Update of /cvsroot/thinlet/thinlet/examples/common In directory sc8-pr-cvs1:/tmp/cvs-serv29772/examples/common Removed Files: ImageChooser.java imagechooser.xml Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- ImageChooser.java DELETED --- --- imagechooser.xml DELETED --- |
From: <ab...@us...> - 2003-06-26 15:21:57
|
Update of /cvsroot/thinlet/thinlet/examples/demo/icons In directory sc8-pr-cvs1:/tmp/cvs-serv29772/examples/demo/icons Removed Files: about.gif bookmarks.gif copy.gif cut.gif delete.gif find.gif findagain.gif help.gif new.gif open.gif pagesetup.gif paste.gif print.gif save.gif saveas.gif undo.gif Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- about.gif DELETED --- --- bookmarks.gif DELETED --- --- copy.gif DELETED --- --- cut.gif DELETED --- --- delete.gif DELETED --- --- find.gif DELETED --- --- findagain.gif DELETED --- --- help.gif DELETED --- --- new.gif DELETED --- --- open.gif DELETED --- --- pagesetup.gif DELETED --- --- paste.gif DELETED --- --- print.gif DELETED --- --- save.gif DELETED --- --- saveas.gif DELETED --- --- undo.gif DELETED --- |
Update of /cvsroot/thinlet/thinlet/examples/demo In directory sc8-pr-cvs1:/tmp/cvs-serv29772/examples/demo Removed Files: Calculator.java Demo.java calculator.xml demo.xml demodialog.xml manifest.mf Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- Calculator.java DELETED --- --- Demo.java DELETED --- --- calculator.xml DELETED --- --- demo.xml DELETED --- --- demodialog.xml DELETED --- --- manifest.mf DELETED --- |
From: <ab...@us...> - 2003-06-26 15:21:57
|
Update of /cvsroot/thinlet/thinlet/src/java/icons In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/java/icons Added Files: about.gif bookmarks.gif copy.gif cut.gif delete.gif find.gif findagain.gif help.gif new.gif open.gif pagesetup.gif paste.gif print.gif save.gif saveas.gif undo.gif Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: about.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bookmarks.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: copy.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: cut.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: delete.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: find.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: findagain.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: help.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: open.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: pagesetup.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: paste.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: print.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: save.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: saveas.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: undo.gif --- (This appears to be a binary file; contents omitted.) |