thinlet-development Mailing List for Thinlet (Page 2)
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: Andrzej B. <ab...@us...> - 2004-10-04 23:22:38
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3138 Modified Files: Thinlet.java Log Message: Change some of the more useful methods from private to protected. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Thinlet.java 4 Oct 2004 21:27:53 -0000 1.16 +++ Thinlet.java 4 Oct 2004 23:22:26 -0000 1.17 @@ -178,7 +178,7 @@ /** * */ - private void doLayout(Object component) { + protected void doLayout(Object component) { String classname = getClass(component); if ("combobox" == classname) { if (getBoolean(component, "editable", true)) { @@ -2242,7 +2242,7 @@ // == classname)) Object lead = get(component, ":lead"); if (getIndex(component, lead) == -1) { - set(component, ":lead", lead = null); + set(component, ":lead", lead = null); } int[] columnwidths = ("table" == classname) ? ((int[]) get(component, ":widths")) : null; boolean line = getBoolean(component, "line", true); @@ -4441,7 +4441,7 @@ /** * */ - private boolean invoke(Object component, Object part, String event) { + protected boolean invoke(Object component, Object part, String event) { Object method = get(component, event); if (method != null) { if (focusowner != null && "action".equals(event)) requestFocus(component); @@ -4869,7 +4869,7 @@ * @param component a focusable component * @return true if the focusowner was changed, otherwise false */ - private boolean setFocus(Object component) { + protected boolean setFocus(Object component) { if (!focusinside) { // request focus for the thinlet component requestFocus(); } @@ -5278,6 +5278,7 @@ * */ private int getIndex(Object component, Object value) { + if (value == null) return -1; int index = 0; for (Object item = get(component, ":comp"); item != null; item = get(item, ":next")) { if (value == item) { |
From: Andrzej B. <ab...@us...> - 2004-10-04 21:28:08
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6572 Modified Files: Thinlet.java Log Message: Fix for slider value 50 bug. Submitted by Mike Hartshorn and Timothy Stack. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Thinlet.java 4 Oct 2004 20:56:15 -0000 1.15 +++ Thinlet.java 4 Oct 2004 21:27:53 -0000 1.16 @@ -3956,7 +3956,7 @@ } int minimum = getInteger(component, "minimum", 0); int maximum = getInteger(component, "maximum", 100); - int value = getInteger(component, "value", 50); + int value = getInteger(component, "value", 0); Rectangle bounds = getRectangle(component, "bounds"); boolean horizontal = ("vertical" != get(component, "orientation")); int newvalue = minimum + (horizontal ? (x - referencex) : (y - referencey)) * (maximum - minimum) |
From: Andrzej B. <ab...@us...> - 2004-10-04 20:56:25
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31703 Modified Files: Thinlet.java Log Message: This reportedly fixes stability problems when running under 1.1 JVMs. As reported by: many, most recently Mike Hartshorn. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Thinlet.java 14 Sep 2004 14:05:32 -0000 1.14 +++ Thinlet.java 4 Oct 2004 20:56:15 -0000 1.15 @@ -90,7 +90,8 @@ } catch (Exception exc) { /* not 1.4 */ } } - { + + public Thinlet() { setFont(new Font("SansSerif", Font.PLAIN, 12)); //setFont((Font) // getToolkit().getDesktopProperty("win.messagebox.font")); |
From: Andrzej B. <ab...@us...> - 2004-09-14 14:05:43
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31441 Modified Files: Thinlet.java Log Message: Fix a bug in setComponent(..). Noticed by Dawid Weiss. Add RCS Id and @version tag. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Thinlet.java 17 Aug 2004 21:11:41 -0000 1.13 +++ Thinlet.java 14 Sep 2004 14:05:32 -0000 1.14 @@ -29,6 +29,7 @@ /** * + * @version $Id$ */ public class Thinlet extends Container implements Runnable, Serializable { @@ -6345,7 +6346,7 @@ */ public void setComponent(Object component, String key, Component bean) { Object[] definition = getDefinition(getClass(component), key, "bean"); - if (set(component, definition[1], font)) { + if (set(component, definition[1], bean)) { update(component, definition[2]); } } @@ -7076,4 +7077,4 @@ new Object[][] { { "bean", "bean", null, null } } }; } -} \ No newline at end of file +} |
From: Michael N. S. <mis...@ho...> - 2004-08-18 01:22:11
|
I am against it, but... Oh my God, it has already been commited ;-) Regards, Michael (sick for three days, couldn't even read email...) ----- Original Message ----- From: "Andrzej Bialecki" <ab...@ge...> To: "Stephen Colebourne" <sco...@bt...> Cc: <thi...@li...> Sent: Monday, August 16, 2004 5:25 AM Subject: Re: [Thinlet-development] Upcoming source code reformat. > Stephen Colebourne wrote: > > > Please, 4 spaces not 2. Please. Its just the standard in Java OSS. > > > > Stephen > > (Apache Jakarta Commons committer) > > Oops.. sorry for the confusion, I meant 4 spaces - I use this value > myself. However, I use 2 spaces for secondary indents... :-) > > What's the practice in Commons? What's the e.g. line-wrap length? Any > docs (in addition to the Sun's one) we might consult? > > -- > Best regards, > Andrzej Bialecki > > ------------------------------------------------- > Software Architect, System Integration Specialist > CEN/ISSS EC Workshop, ECIMF project chair > EU FP6 E-Commerce Expert/Evaluator > ------------------------------------------------- > FreeBSD developer (http://www.freebsd.org) > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Thinlet-development mailing list > Thi...@li... > https://lists.sourceforge.net/lists/listinfo/thinlet-development > |
From: Andrzej B. <ab...@us...> - 2004-08-17 23:30:21
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11407 Modified Files: Thinlet.java Log Message: Source code reformatted to use a 4-space indent. From now on please use only 4 spaces as indentation, no literal Tab characters are allowed. This is a whitespace-only commit, no functional changes made. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Thinlet.java 15 Aug 2004 22:42:40 -0000 1.12 +++ Thinlet.java 17 Aug 2004 21:11:41 -0000 1.13 @@ -1,19 +1,21 @@ -/* Thinlet GUI toolkit - www.thinlet.com - * Copyright (C) 2002-2003 Robert Bajzat (rob...@th...) +/* + * Thinlet GUI toolkit - www.thinlet.com Copyright (C) 2002-2003 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 free software; you can redistribute it and/or modify it under [...13671 lines suppressed...] + "menuitem", "choice", + new Object[][] { + { "keystroke", "accelerator", null, null }, + { "method", "action" }, + { "integer", "mnemonic", "paint", integer_1 } }, + "checkboxmenuitem", "menuitem", + new Object[][] { + { "boolean", "selected", "paint", Boolean.FALSE }, //...group + { "string", "group", "paint", null } }, //...group + "popupmenu", "component", + new Object[][] { + { "method", "menushown" } }, // Post + // menu: + // Shift+F10 + "bean", "component", + new Object[][] { + { "bean", "bean", null, null } } }; + } +} \ No newline at end of file |
From: Stephen C. <sco...@bt...> - 2004-08-16 18:40:46
|
Commons uses 4 spaces for all indents. Line length is typically 80 characters, but allowing longer line to extend to 120 characters. The commons style is generally follow Sun coding style, brackets at end of line etc. if (a < b) { // do stuff } else { // do other stuff } There is no commons coding standards guide itself, just common practices, which I've tried to summarise above. The main thing is to go with the Sun Java defaults (and thus IDE and Java OSS) as much as possible. So, +1 to the reformat ;-) Stephen Stephen Colebourne wrote: > > > Please, 4 spaces not 2. Please. Its just the standard in Java OSS. > > > > Stephen > > (Apache Jakarta Commons committer) > > Oops.. sorry for the confusion, I meant 4 spaces - I use this value > myself. However, I use 2 spaces for secondary indents... :-) > > What's the practice in Commons? What's the e.g. line-wrap length? Any > docs (in addition to the Sun's one) we might consult? > > -- > Best regards, > Andrzej Bialecki |
From: Andrzej B. <ab...@ge...> - 2004-08-16 08:25:14
|
Stephen Colebourne wrote: > Please, 4 spaces not 2. Please. Its just the standard in Java OSS. > > Stephen > (Apache Jakarta Commons committer) Oops.. sorry for the confusion, I meant 4 spaces - I use this value myself. However, I use 2 spaces for secondary indents... :-) What's the practice in Commons? What's the e.g. line-wrap length? Any docs (in addition to the Sun's one) we might consult? -- Best regards, Andrzej Bialecki ------------------------------------------------- Software Architect, System Integration Specialist CEN/ISSS EC Workshop, ECIMF project chair EU FP6 E-Commerce Expert/Evaluator ------------------------------------------------- FreeBSD developer (http://www.freebsd.org) |
From: Stephen C. <sco...@bt...> - 2004-08-15 23:06:28
|
Could we rename the parameter to 'align' please ? This would fit better with HTML, and result in less head scratching when using both HTML and thinlet. Stephen ----- Original Message ----- From: "Andrzej Bialecki" <ab...@us...> Sent: Sunday, August 15, 2004 11:42 PM Subject: [Thinlet-development] thinlet/src/java/thinlet Thinlet.java,1.11,1.12 > Update of /cvsroot/thinlet/thinlet/src/java/thinlet > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8209 > > Modified Files: > Thinlet.java > Log Message: > Enable textfields and textareas to take an "alignment" attribute. Change > the Demo to illustrate this functionality. > > Submitted by Don Ledford. Thank you! > > > > Index: Thinlet.java > =================================================================== > RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v > retrieving revision 1.11 > retrieving revision 1.12 > diff -u -d -r1.11 -r1.12 > --- Thinlet.java 7 Jun 2004 23:23:07 -0000 1.11 > +++ Thinlet.java 15 Aug 2004 22:42:40 -0000 1.12 > @@ -1,6789 +1,6830 @@ > -/* Thinlet GUI toolkit - www.thinlet.com > - * Copyright (C) 2002-2003 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 > [...13588 lines suppressed...] > + { "boolean", "expanded", null, Boolean.TRUE } }, > + "separator", "component", null, > + "menubar", "component", new Object[][] { > + { "choice", "placement", "validate", new String[] { "top", "bottom" } } }, > + "menu", "choice", new Object[][] { > + { "integer", "mnemonic", "paint", integer_1 } }, > + "menuitem", "choice", new Object[][] { > + { "keystroke", "accelerator", null, null }, > + { "method", "action" }, > + { "integer", "mnemonic", "paint", integer_1 } }, > + "checkboxmenuitem", "menuitem", new Object[][] { > + { "boolean", "selected", "paint", Boolean.FALSE }, //...group > + { "string", "group", "paint", null } }, //...group > + "popupmenu", "component", new Object[][] { > + { "method", "menushown" } }, // Post menu: Shift+F10 > + "bean", "component", new Object[][] { > + { "bean", "bean", null, null } } > + }; > + } > +} > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Thinlet-development mailing list > Thi...@li... > https://lists.sourceforge.net/lists/listinfo/thinlet-development |
From: Stephen C. <sco...@bt...> - 2004-08-15 23:05:09
|
Please, 4 spaces not 2. Please. Its just the standard in Java OSS. Stephen (Apache Jakarta Commons committer) ----- Original Message ----- From: "Andrzej Bialecki" <ab...@ge...> To: <th...@ya...> Cc: < > Sent: Sunday, August 15, 2004 11:48 PM Subject: [Thinlet-development] Upcoming source code reformat. > Hi, > > Following an overall positive reaction to my proposal, I plan to > reformat the source code of thinlet.* classes to use 2-space indent and > no literal Tab (\t) character. From now on only such whitespace > formatting will be allowed. > > This will hopefully help in readability of the source code, but > unfortunately it will result in a massive whitespace-only diff. > > -- > Best regards, > Andrzej Bialecki > > ------------------------------------------------- > Software Architect, System Integration Specialist > CEN/ISSS EC Workshop, ECIMF project chair > EU FP6 E-Commerce Expert/Evaluator > ------------------------------------------------- > FreeBSD developer (http://www.freebsd.org) > > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Thinlet-development mailing list > Thi...@li... > https://lists.sourceforge.net/lists/listinfo/thinlet-development |
From: Andrzej B. <ab...@ge...> - 2004-08-15 22:48:48
|
Hi, Following an overall positive reaction to my proposal, I plan to reformat the source code of thinlet.* classes to use 2-space indent and no literal Tab (\t) character. From now on only such whitespace formatting will be allowed. This will hopefully help in readability of the source code, but unfortunately it will result in a massive whitespace-only diff. -- Best regards, Andrzej Bialecki ------------------------------------------------- Software Architect, System Integration Specialist CEN/ISSS EC Workshop, ECIMF project chair EU FP6 E-Commerce Expert/Evaluator ------------------------------------------------- FreeBSD developer (http://www.freebsd.org) |
From: Andrzej B. <ab...@us...> - 2004-08-15 22:43:02
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8209 Modified Files: Thinlet.java Log Message: Enable textfields and textareas to take an "alignment" attribute. Change the Demo to illustrate this functionality. Submitted by Don Ledford. Thank you! Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Thinlet.java 7 Jun 2004 23:23:07 -0000 1.11 +++ Thinlet.java 15 Aug 2004 22:42:40 -0000 1.12 @@ -1,6789 +1,6830 @@ -/* Thinlet GUI toolkit - www.thinlet.com - * Copyright (C) 2002-2003 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 [...13588 lines suppressed...] + { "boolean", "expanded", null, Boolean.TRUE } }, + "separator", "component", null, + "menubar", "component", new Object[][] { + { "choice", "placement", "validate", new String[] { "top", "bottom" } } }, + "menu", "choice", new Object[][] { + { "integer", "mnemonic", "paint", integer_1 } }, + "menuitem", "choice", new Object[][] { + { "keystroke", "accelerator", null, null }, + { "method", "action" }, + { "integer", "mnemonic", "paint", integer_1 } }, + "checkboxmenuitem", "menuitem", new Object[][] { + { "boolean", "selected", "paint", Boolean.FALSE }, //...group + { "string", "group", "paint", null } }, //...group + "popupmenu", "component", new Object[][] { + { "method", "menushown" } }, // Post menu: Shift+F10 + "bean", "component", new Object[][] { + { "bean", "bean", null, null } } + }; + } +} |
From: Andrzej B. <ab...@us...> - 2004-08-15 22:42:58
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8209/examples/demo Modified Files: demo.xml Log Message: Enable textfields and textareas to take an "alignment" attribute. Change the Demo to illustrate this functionality. Submitted by Don Ledford. Thank you! Index: demo.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/demo.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- demo.xml 7 Jun 2004 23:10:25 -0000 1.4 +++ demo.xml 15 Aug 2004 22:42:46 -0000 1.5 @@ -298,6 +298,14 @@ <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> + <tab text="Five"> + <panel columns="1" gap="4"> + <label text="Text alignment:"/> + <textfield alignment="left" columns="15" text="left"/> + <textfield alignment="center" columns="15" text="center"/> + <textfield alignment="right" columns="15" text="right"/> + </panel> + </tab> </tabbedpane> </panel> <separator/> |
From: John K. <joh...@gm...> - 2004-07-23 08:04:32
|
Hi, Is there a plan for the further development of thinlet? Are there plans to support native look and feel (even as plugins which would allow you to keep the core jar small)? I was looking at the code as well and noticed that it is poorly formatted (no indentation for example). This is a barrier to entry and inhibits people from joining the project and from contributing patches. Have you considered using 'jalopy' to format your code? Another point is the lack of error messages. Throwing exceptions without a message string seems a bit pointless to me. If someone is using the binary distribution they do not even have line numbers to help them figure out what the problem is. Thinlet is a cool project, thanks, -John K |
From: Michael N. S. <mis...@ho...> - 2004-07-18 07:57:32
|
> If the diff is small, just send it to the list, otherwise you can post it > on the "files" section on the yahoo web site. Please, cc thi...@li... when you do it, no matter how big it is. Regards, ------------------------------------------------------------- Michael Nascimento Santos JSR 207 Expert Group Member JSR Community Manager - http://community.java.net/jsr Organizacao SouJava - http://www.soujava.org.br Thinlet - http://www.thinlet.com http://www.javablogs.com.br/blogs/page/soujavamisterm http://today.java.net/pub/au/80 |
From: Norbert B. <sj...@cl...> - 2004-06-25 20:59:03
|
> I am copying the dev-list on that. We've just fixed some bugs and added > support for resizable, sortable columns for tables. I am supposed to fix the > dtd and to implement maxlength for textfield/textarea. What do you all > think? Should we roll a release after that? > +1 for me And changing all the following method policy, to allow me to package my scriptableThinlet as a true thinlet extension: - private boolean invoke(Object component, Object part, String event) { + protected boolean invoke(Object component, Object part, String event) { - private static boolean set(Object component, Object key, Object value) { + protected static boolean set(Object component, Object key, Object value) - private static Object get(Object component, Object key) { + protected static Object get(Object component, Object key) { - private static int getItemCountImpl(Object component, String key) { + protected static int getItemCountImpl(Object component, String key) { - private void insertItem(Object parent, + protected void insertItem(Object parent, - private void finishParse(Vector methods, Object root, Object handler) { + protected void finishParse(Vector methods, Object root, Object handler) - private void addImpl(Object parent, Object component, int index) { + protected void addImpl(Object parent, Object component, int index) { - private boolean instance(Object classname, Object extendclass) { + protected boolean instance(Object classname, Object extendclass) { - private boolean setString(Object component, + protected boolean setString(Object component, - private static Object[] dtd; + protected static Object[] dtd; |
From: Michael N. S. <mis...@ho...> - 2004-06-25 19:58:55
|
> My only request to Robert and other thinlet developers > right now is to please adding a richTextArea component > or something that renders HTML. That somewhat defeats the "thin" characteristic of Thinlet, unless you want VERY BASIC support for it. So, forget css, div, mal-formed html etc. Would that be ok? Even if it was, people would need to have a high demand for it. > BTW, does anyone know the plan for the next thinlet > release, such as schedule, features, bug fix, etc. We > can all be benefitted from this kind of knowledge so > it could help us better plan our own projects. I am copying the dev-list on that. We've just fixed some bugs and added support for resizable, sortable columns for tables. I am supposed to fix the dtd and to implement maxlength for textfield/textarea. What do you all think? Should we roll a release after that? Regards, Michael Nascimento Santos JSR-207 Expert Group Member http://www.javablogs.com.br/blogs/page/soujavamisterm http://today.java.net/pub/au/80 Sun Certified Programmer for the Java 2 Platform 1.2 & 1.4 Sun Certified Web Component Developer for J2EE Sun Certified Mobile Application Developer |
From: Michael N. S. <mis...@ho...> - 2004-06-11 05:16:45
|
Hi folks, Besides some "comestic" changes we did for our project - enter triggers action for any button, the cursor is drawn with 2 pixels instead of 1 etc. -, there is at least one issue with Thinlet right now and one feature I'd like to implement in the core. It's not possible to show Latin characters properly if they are part of a XML document - and I'm pretty sure it aplies to lots of other charsets as well -, since using a Reader without specifying an encoding uses the default platform encoding, which may not be appropriate (that's the case for most Linux distributions, for example). The right behaviour would be to use the value of the xml encoding property when building the Reader. This attribute is ignored right now and processing it before reading the rest of the document isn't trivial. I intend to provide support for that if no one has a patch already. Apart from that, a key missing feature for widgets that accept text entry is a maxlength attribute. Has anyone done it? Would it be ok to include it in the main Thinlet? A final issue: has the java.net DTD been updated to support the last changes (resizable/sortable column headers, etc.)? If it's not even ready, I'd be glad to update it, although I don't have commit permissions in java.net. Regards, Michael Nascimento Santos JSR 207 Expert Group Member http://www.javablogs.com.br/blogs/page/soujavamisterm http://today.java.net/pub/au/80 Sun Certified Programmer for the Java 2 Platform Sun Certified Mobile Application Developer Sun Certified Web Component Developer for J2EE Moderador SouJava - http://www.soujava.org.br |
From: Michael N. S. <mis...@ho...> - 2004-06-08 20:37:34
|
I was able to get it. Thank you. Regards, Michael ----- Original Message ----- From: "Andrzej Bialecki" <ab...@ge...> To: "Michael Nascimento Santos" <mis...@ho...> Cc: <thi...@li...> Sent: Tuesday, June 08, 2004 3:42 PM Subject: Re: [Thinlet-development] thinlet/src/java/thinlet Thinlet.java,1.10,1.11 > Michael Nascimento Santos wrote: > > > The latest release I can check out from CVS using developer (ssh) access is > > 1.9. Is it right? Is it due to some kind of delay? > > Yes, I sometimes notice such delay, too - the reason is unknown to me, > some kind of weird setup at SF... > > -- > Best regards, > Andrzej Bialecki > > ------------------------------------------------- > Software Architect, System Integration Specialist > CEN/ISSS EC Workshop, ECIMF project chair > EU FP6 E-Commerce Expert/Evaluator > ------------------------------------------------- > FreeBSD developer (http://www.freebsd.org) > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: GNOME Foundation > Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. > GNOME Users and Developers European Conference, 28-30th June in Norway > http://2004/guadec.org > _______________________________________________ > Thinlet-development mailing list > Thi...@li... > https://lists.sourceforge.net/lists/listinfo/thinlet-development > |
From: Andrzej B. <ab...@ge...> - 2004-06-08 18:43:35
|
Michael Nascimento Santos wrote: > The latest release I can check out from CVS using developer (ssh) access is > 1.9. Is it right? Is it due to some kind of delay? Yes, I sometimes notice such delay, too - the reason is unknown to me, some kind of weird setup at SF... -- Best regards, Andrzej Bialecki ------------------------------------------------- Software Architect, System Integration Specialist CEN/ISSS EC Workshop, ECIMF project chair EU FP6 E-Commerce Expert/Evaluator ------------------------------------------------- FreeBSD developer (http://www.freebsd.org) |
From: Michael N. S. <mis...@ho...> - 2004-06-08 02:45:46
|
The latest release I can check out from CVS using developer (ssh) access is 1.9. Is it right? Is it due to some kind of delay? Regards, Michael Nascimento Santos JSR 207 Expert Group Member http://today.java.net/pub/au/80 Sun Certified Programmer for the Java 2 Platform Sun Certified Mobile Application Developer Sun Certified Web Component Developer for J2EE Moderador SouJava - http://www.soujava.org.br ----- Original Message ----- From: "Andrzej Bialecki" <ab...@us...> To: <thi...@li...> Sent: Monday, June 07, 2004 8:23 PM Subject: [Thinlet-development] thinlet/src/java/thinlet Thinlet.java,1.10,1.11 > Update of /cvsroot/thinlet/thinlet/src/java/thinlet > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8873 > > Modified Files: > Thinlet.java > Log Message: > Several fixes submitted by Michael Nascimento Santos: > > "The following patch should solve the following problems: > > - While using a Thinlet application with a keyboard and doing dynamic > removal/addition of components, such as rows, the app may halt when a key is > pressed inside some components (eg. table, when all the rows are removed and > some are added later); > - Invoking an action using the keyboard does not focus the current component > as expected." > > Thank you! > > > Index: Thinlet.java > =================================================================== > RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v > retrieving revision 1.10 > retrieving revision 1.11 > diff -u -d -r1.10 -r1.11 > --- Thinlet.java 7 Jun 2004 23:08:24 -0000 1.10 > +++ Thinlet.java 7 Jun 2004 23:23:07 -0000 1.11 > @@ -2136,6 +2136,9 @@ > } > else { //if (("list" == classname) || ("table" == classname) || ("tree" == classname)) > Object lead = get(component, ":lead"); > + if (getIndex(component, lead) == -1) { > + set(component, ":lead", lead = null); > + } > int[] columnwidths = ("table" == classname) ? ((int []) get(component, ":widths")) : null; > boolean line = getBoolean(component, "line", true); int iline = line ? 1 : 0; > boolean angle = ("tree" == classname) && getBoolean(component, "angle", false); > @@ -3278,6 +3281,9 @@ > (keycode == KeyEvent.VK_PAGE_DOWN) || > (keycode == KeyEvent.VK_HOME) || (keycode == KeyEvent.VK_END)) { > Object lead = get(component, ":lead"); > + if (getIndex(component, lead) == -1) { > + set(component, ":lead", lead = null); > + } > Object row = getListItem(component, component, keycode, lead, recursive); > if (row != null) { > String selection = getString(component, "selection", "single"); > @@ -4284,6 +4290,8 @@ > private boolean invoke(Object component, Object part, String event) { > Object method = get(component, event); > if (method != null) { > + if (focusowner != null && "action".equals(event)) > + requestFocus(component); > invokeImpl(method, part); > return true; > } > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: GNOME Foundation > Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. > GNOME Users and Developers European Conference, 28-30th June in Norway > http://2004/guadec.org > _______________________________________________ > Thinlet-development mailing list > Thi...@li... > https://lists.sourceforge.net/lists/listinfo/thinlet-development > |
From: Andrzej B. <ab...@us...> - 2004-06-07 23:23:17
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8873 Modified Files: Thinlet.java Log Message: Several fixes submitted by Michael Nascimento Santos: "The following patch should solve the following problems: - While using a Thinlet application with a keyboard and doing dynamic removal/addition of components, such as rows, the app may halt when a key is pressed inside some components (eg. table, when all the rows are removed and some are added later); - Invoking an action using the keyboard does not focus the current component as expected." Thank you! Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Thinlet.java 7 Jun 2004 23:08:24 -0000 1.10 +++ Thinlet.java 7 Jun 2004 23:23:07 -0000 1.11 @@ -2136,6 +2136,9 @@ } else { //if (("list" == classname) || ("table" == classname) || ("tree" == classname)) Object lead = get(component, ":lead"); + if (getIndex(component, lead) == -1) { + set(component, ":lead", lead = null); + } int[] columnwidths = ("table" == classname) ? ((int []) get(component, ":widths")) : null; boolean line = getBoolean(component, "line", true); int iline = line ? 1 : 0; boolean angle = ("tree" == classname) && getBoolean(component, "angle", false); @@ -3278,6 +3281,9 @@ (keycode == KeyEvent.VK_PAGE_DOWN) || (keycode == KeyEvent.VK_HOME) || (keycode == KeyEvent.VK_END)) { Object lead = get(component, ":lead"); + if (getIndex(component, lead) == -1) { + set(component, ":lead", lead = null); + } Object row = getListItem(component, component, keycode, lead, recursive); if (row != null) { String selection = getString(component, "selection", "single"); @@ -4284,6 +4290,8 @@ private boolean invoke(Object component, Object part, String event) { Object method = get(component, event); if (method != null) { + if (focusowner != null && "action".equals(event)) + requestFocus(component); invokeImpl(method, part); return true; } |
From: Andrzej B. <ab...@us...> - 2004-06-07 23:10:35
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6674 Modified Files: Demo.java demo.xml demodialog.xml Log Message: Show off new features: resizeable and sortable table columns, and a close action for dialogs. Index: demo.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/demo.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- demo.xml 19 Apr 2004 17:42:30 -0000 1.3 +++ demo.xml 7 Jun 2004 23:10:25 -0000 1.4 @@ -116,25 +116,25 @@ <separator/> <menuitem text="three"/> </popupmenu> - <header> + <header action="sortAction(this)"> <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" /> + <cell text="Cell A" /> + <cell text="Cell B" /> + <cell text="Cell C" icon="/icons/bookmarks.gif" /> </row> <row selected="true"> - <cell text="Cell" icon="/icons/bookmarks.gif" /> - <cell text="Cell" /> - <cell text="Cell" /> + <cell text="Cell B" icon="/icons/bookmarks.gif" /> + <cell text="Cell C" /> + <cell text="Cell A" /> </row> <row> - <cell text="Cell" /> - <cell text="Cell" icon="/icons/bookmarks.gif" enabled="false" /> - <cell text="Cell" /> + <cell text="Cell C" /> + <cell text="Cell A" icon="/icons/bookmarks.gif" enabled="false" /> + <cell text="Cell B" /> </row> </table> </splitpane> Index: Demo.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/Demo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Demo.java 19 Apr 2004 17:42:30 -0000 1.3 +++ Demo.java 7 Jun 2004 23:10:25 -0000 1.4 @@ -260,6 +260,62 @@ setBoolean(delete, "enabled", false); } + public void sortAction(Object header) { + int idx = getSelectedIndex(header); + Object column = getSelectedItem(header); + String sort = getChoice(column, "sort"); + if (sort == "none") return; + Object table = getParent(header); + Object[] rows = getItems(table); + removeAll(table); + sortArray(rows, new RowComparator(this, idx, sort == "ascent")); + for (int i = 0; i < rows.length; i++) add(table, rows[i]); + repaint(table); + } + + /** + * Basic sort for small arrays. + */ + private void sortArray(Object[] arr, Comparator comp) { + + boolean swapped; + + do { + swapped = false; + for (int i = 0; i < arr.length - 1; i++) { + if (comp.compare(arr[i], arr[i + 1]) > 0) { + Object temp = arr[i + 1]; + arr[i + 1] = arr[i]; + arr[i] = temp; + swapped = true; + } + } + } while (swapped); + } + + + static class RowComparator implements Comparator { + private boolean ascending = false; + private int column = 0; + private Thinlet thinlet = null; + + public RowComparator(Thinlet thinlet, int column, boolean ascending) { + this.thinlet = thinlet; + this.column = column; + this.ascending = ascending; + } + + public int compare(Object row1, Object row2) { + Object cell1 = thinlet.getItem(row1, column); + Object cell2 = thinlet.getItem(row2, column); + String s1 = thinlet.getString(cell1, "text"); + String s2 = thinlet.getString(cell2, "text"); + if (s1 == null) return ascending? -1 : 1; + if (s2 == null) return ascending? 1 : -1; + return (ascending ? 1 : -1 ) * s1.compareTo(s2); + } + } + /** * */ Index: demodialog.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/demodialog.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- demodialog.xml 26 Jun 2003 15:21:55 -0000 1.1 +++ demodialog.xml 7 Jun 2004 23:10:25 -0000 1.2 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<dialog text="Find" icon="/icons/find.gif" modal="true" +<dialog text="Find" icon="/icons/find.gif" modal="true" close="remove(this)" columns="4" top="4" left="4" bottom="4" right="4" gap="4"> <label text="Find what:" /> <combobox name="ch_what" colspan="2" valign="center" /> |
From: Andrzej B. <ab...@us...> - 2004-06-07 23:08:35
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5710 Modified Files: Thinlet.java Log Message: Combined patch from Stephan at stean dot ch, including: * resizeable table columns (enabled by default) * sortable table columns (see Demo for an example) * close action and decorator on dialogs. For now the docs are available only in the source and the Demo. Thank you Stephan - this is a very useful contribution! Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Thinlet.java 20 Apr 2004 11:10:29 -0000 1.9 +++ Thinlet.java 7 Jun 2004 23:08:24 -0000 1.10 @@ -13,7 +13,7 @@ * * 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 */ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 0212111-1307 USA */ package thinlet; import java.awt.*; @@ -144,7 +144,7 @@ hgradient = vgradient = null; repaint(); } - + //setDesktopProperty+ /** @@ -1638,16 +1638,17 @@ g, clipx, clipy, clipwidth, clipheight, true, true, false, true, 1, 2, 1, 2, false, 'g', "left", false, false); int controlx = bounds.width - titleheight - 1; - if (getBoolean(component, "closable", false)) { - paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'c'); + // close dialog button + if (get(component, "close") != null) { + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'c', pressedpart==":closebutton"?'p':insidepart==":closebutton"?'h':'g'); controlx -= titleheight; } if (getBoolean(component, "maximizable", false)) { - paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'm'); + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'm', 'g'); controlx -= titleheight; } if (getBoolean(component, "iconifiable", false)) { - paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'i'); + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'i', 'g'); } paintRect(g, 0, 3 + titleheight, bounds.width, bounds.height - 3 - titleheight, c_border, c_press, false, true, true, true, true); // lower part excluding titlebar @@ -1662,7 +1663,7 @@ g, clipx, clipy, clipwidth, clipheight, false, false, false, false, 0, 3, 0, 3, false, enabled ? 'x' : 'd', "left", false, false); } - + if (get(component, ":port") != null) { paintScroll(component, classname, pressed, inside, focus, enabled, g, clipx, clipy, clipwidth, clipheight); @@ -1687,7 +1688,7 @@ String text = getString(tooltipowner, "tooltip", null); g.setColor(c_text); g.drawString(text, r.x + 2, r.y + g.getFontMetrics().getAscent() + 2); //+nullpointerexception - } + } } else if ("spinbox" == classname) { paintField(g, clipx, clipy, clipwidth, clipheight, component, @@ -1949,9 +1950,6 @@ * @param clipy y location of the cliping area relative to the component * @param clipwidth width of the cliping area * @param clipheight height of the cliping area - * @param header column height - * @param topborder bordered on the top if true - * @param border define left, bottom, and right border if true */ private void paintScroll(Object component, String classname, boolean pressed, boolean inside, boolean focus, boolean enabled, @@ -2038,14 +2036,14 @@ if (i != 0) { column = get(column, ":next"); } boolean lastcolumn = (i == columnwidths.length - 1); int width = lastcolumn ? (view.width - x + 2) : columnwidths[i]; - + //pressed (p), hovered (h), selected (b), default (g) or disabled (d) paint(column, x - view.x, 0, width, port.y - 1, g, clipx, clipy, clipwidth, clipheight, true, true, false, lastcolumn, 1, 1, 0, 0, false, - enabled ? 'g' : 'd', "left", false, false); - + enabled ? (pressedpart==column?'p':(insidepart==column?'h':(getBoolean(column,"selected")?'b':'g'))) : 'd', "left", false, false); + Object sort = get(column, "sort"); // "none", "ascent", "descent" - if (sort != null) { + if (sort != null && sort != "none") { paintArrow(g, x - view.x + width - block, 0, block, port.y, (sort == "ascent") ? 'S' : 'N'); } @@ -2062,15 +2060,15 @@ if ((x2 > x1) && (y2 > y1)) { g.clipRect(x1, y1, x2 - x1, y2 - y1); g.translate(port.x - view.x, port.y - view.y); - + paint(component, classname, focus, enabled, g, view.x - port.x + x1, view.y - port.y + y1, x2 - x1, y2 - y1, port.width, view.width); - + g.translate(view.x - port.x, view.y - port.y); g.setClip(clipx, clipy, clipwidth, clipheight); } } - + /** * Paint scrollable content * @param component a panel @@ -2376,12 +2374,12 @@ } /** - * + * Paints the dialog close, maximize and iconify buttons */ private void paint(Object component, Graphics g, - int x, int y, int width, int height, char type) { - paint(component, x, y, width, height, g, true, true, true, true, 'g'); - g.setColor(Color.black); + int x, int y, int width, int height, char type, char mode) { + paint(component, x, y, width, height, g, true, true, true, true, mode); + g.setColor(c_text); switch (type) { case 'c': // closable dialog button g.drawLine(x + 3, y + 4, x + width - 5, y + height - 4); @@ -2681,7 +2679,6 @@ ((keychar >= 0x7f) && (keychar <= 0x9f)) || (keychar >= 0xffff) || ke.isControlDown(); int keycode = control ? ke.getKeyCode() : 0; - if ((control == (id == KeyEvent.KEY_PRESSED)) && processKeyPress((popupowner != null) ? popupowner : focusowner, ke.isShiftDown(), ke.isControlDown(), ke.getModifiers(), @@ -3523,7 +3520,123 @@ } if (!getBoolean(component, "enabled", true)) { return; } String classname = getClass(component); - if (("button" == classname) || + + if (("list" == classname) || + ("table" == classname) || ("tree" == classname)) { + // check if we need to change the column selection and invoke the header's action + Object header = get(component, "header"); + boolean noScroll = false; + if (header != null && get(header, ":resizecomponent") != null) { + noScroll = true; + if (id == MouseEvent.MOUSE_PRESSED) { + referencex = x; + set(header, ":resizing", "true"); + } else if (id == MouseEvent.MOUSE_DRAGGED) { + //resize the column, but limit its minimum size to a width of 10 + Object column = get(header,":resizecomponent"); + int newSize = getInteger(column, "width") + x - referencex; + if (newSize > 10) { + setInteger(column, "width", newSize); + referencex = x; + doLayout(component); + repaint(component); + } + } + else if (id == MouseEvent.MOUSE_RELEASED) set(header, ":resizing", null); + else if (id == MouseEvent.MOUSE_ENTERED) setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); + } + if (header != null && get(header, ":resizecomponent") == null) { + set(header, ":resizing", null); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + if (header != null && get(header, "action") != null) { + if (insidepart != null && insidepart instanceof Object[] && "column" == getClass(insidepart)) { + noScroll = true; + if (id == MouseEvent.MOUSE_ENTERED || + id == MouseEvent.MOUSE_PRESSED || + id == MouseEvent.MOUSE_RELEASED ) { + if (id == MouseEvent.MOUSE_RELEASED && mouseinside == component) { + //set selected column its sort and selected property + //and set the sort of all other columns to none (null) + Object column = get(get(component, "header"), ":comp"); + Object sort = null; + while (column != null) { + if (column == insidepart) { + sort = get(column, "sort"); + if (null == sort || "none" == sort || "descent" == sort) sort = "ascent"; + else if ("ascent" == sort) sort = "descent"; + } else sort = null; + set(column, "sort", sort); + setBoolean(column, "selected", sort != null && sort != "none"); + column = get(column, ":next"); + } + invoke(header, null, "action"); + } + repaint(component); + } + } + else if (id == MouseEvent.MOUSE_EXITED) repaint(component); + } + if (!noScroll && !processScroll(x, y, id, component, part)) { + if (((id == MouseEvent.MOUSE_PRESSED) || + ((id == MouseEvent.MOUSE_DRAGGED) && + !shiftdown && !controldown))) { + //Rectangle view = getRectangle(component, ":view"); + Rectangle port = getRectangle(component, ":port"); + int my = y + port.y - referencey; + for (Object item = get(component, ":comp"); item != null;) { + Rectangle r = getRectangle(item, "bounds"); + if (my < r.y + r.height) { + if (id == MouseEvent.MOUSE_DRAGGED) { //!!! + scrollToVisible(component, r.x, r.y, 0, r.height); + } + else if ("tree" == classname) { + int mx = x + port.x - referencex; + if (mx < r.x) { + if ((mx >= r.x - block) && (get(item, ":comp") != null)) { + boolean expanded = getBoolean(item, "expanded", true); + setBoolean(item, "expanded", !expanded, true); + selectItem(component, item, true); + setLead(component, get(component, ":lead"), item); + setFocus(component); + validate(component); + invoke(component, item, expanded ? "collapse" : "expand"); //item + } + break; + } + } + if ((id != MouseEvent.MOUSE_DRAGGED) || + !getBoolean(item, "selected", false)) { + if (id != MouseEvent.MOUSE_DRAGGED) { + if (setFocus(component)) { repaint(component, classname, item); } //? + } + select(component, item, ("tree" == classname), shiftdown, controldown); + if (clickcount == 2) { invoke(component, item, "perform"); } + } + break; + } + item = getNextItem(component, item, ("tree" == classname)); + } + } + } + } + else if ("bean" == classname) { + Component bean = (Component) get(component, "bean"); + int modifiers = 0; + if(shiftdown) modifiers|=KeyEvent.SHIFT_MASK; + if(controldown) modifiers|=KeyEvent.CTRL_MASK; + if(id==MouseEvent.MOUSE_PRESSED || + id==MouseEvent.MOUSE_RELEASED || + id==MouseEvent.MOUSE_EXITED || + id==MouseEvent.MOUSE_ENTERED || + id==MouseEvent.MOUSE_MOVED || + id==MouseEvent.MOUSE_DRAGGED) { + bean.dispatchEvent(new MouseEvent(this,id,System.currentTimeMillis(),modifiers, + ((Integer)get(component, ":mousex")).intValue(), + ((Integer)get(component, ":mousey")).intValue(), clickcount, popuptrigger)); + } + } + else if (("button" == classname) || ("checkbox" == classname) || ("togglebutton" == classname)) { if ((id == MouseEvent.MOUSE_ENTERED) || (id == MouseEvent.MOUSE_EXITED) || @@ -3723,51 +3836,6 @@ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } - else if (("list" == classname) || - ("table" == classname) || ("tree" == classname)) { - if (!processScroll(x, y, id, component, part)) { - if (((id == MouseEvent.MOUSE_PRESSED)|| - ((id == MouseEvent.MOUSE_DRAGGED) && - !shiftdown && !controldown))) { - //Rectangle view = getRectangle(component, ":view"); - Rectangle port = getRectangle(component, ":port"); - int my = y + port.y - referencey; - for (Object item = get(component, ":comp"); item != null;) { - Rectangle r = getRectangle(item, "bounds"); - if (my < r.y + r.height) { - if (id == MouseEvent.MOUSE_DRAGGED) { //!!! - scrollToVisible(component, r.x, r.y, 0, r.height); - } - else if ("tree" == classname) { - int mx = x + port.x - referencex; - if (mx < r.x) { - if ((mx >= r.x - block) && (get(item, ":comp") != null)) { - boolean expanded = getBoolean(item, "expanded", true); - setBoolean(item, "expanded", !expanded, true); - selectItem(component, item, true); - setLead(component, get(component, ":lead"), item); - setFocus(component); - validate(component); - invoke(component, item, expanded ? "collapse" : "expand"); //item - } - break; - } - } - if ((id != MouseEvent.MOUSE_DRAGGED) || - !getBoolean(item, "selected", false)) { - if (id != MouseEvent.MOUSE_DRAGGED) { - if (setFocus(component)) { repaint(component, classname, item); } //? - } - select(component, item, ("tree" == classname), shiftdown, controldown); - if (clickcount == 2) { invoke(component, item, "perform"); } - } - break; - } - item = getNextItem(component, item, ("tree" == classname)); - } - } - } - } else if ("menubar" == classname) { Object selected = get(component, "selected"); if (((id == MouseEvent.MOUSE_ENTERED) || (id == MouseEvent.MOUSE_EXITED)) && @@ -3854,6 +3922,16 @@ } } } + // close dialog button + else if ( part == ":closebutton" ) { + if ( id == MouseEvent.MOUSE_ENTERED || + id == MouseEvent.MOUSE_EXITED || + id == MouseEvent.MOUSE_PRESSED || + id == MouseEvent.MOUSE_RELEASED ) { + if ( id == MouseEvent.MOUSE_RELEASED && mouseinside == component ) invoke( component, null, "close" ); + repaint( component ); + } + } else if (!processScroll(x, y, id, component, part) && (part != null)) { if (id == MouseEvent.MOUSE_PRESSED) { referencex = x; referencey = y; @@ -3892,7 +3970,7 @@ } } } - + if (popuptrigger) {// && (id == MouseEvent.MOUSE_RELEASED)) { Object popupmenu = get(component, "popupmenu"); if (popupmenu != null) { @@ -3905,7 +3983,7 @@ * Calculate the given point in a component relative to the thinlet desktop and * set as reference value * @param component a widget - * @param x reference point relative to the component left edge + * @param x reference point relative to the component left edge * @param y relative to the top edge */ private void setReference(Object component, int x, int y) { @@ -4279,6 +4357,10 @@ insidepart = "down"; } } + else if ("bean" == classname) { + set(component,":mousex",new Integer(x)); + set(component,":mousey",new Integer(y)); + } else if (":combolist" == classname) { if (!findScroll(component, x, y)) { y += getRectangle(component, ":view").y; @@ -4314,6 +4396,7 @@ else if (("panel" == classname) || ("desktop" == classname) || ("dialog" == classname)) { if ("dialog" == classname) { + int titleheight = getInteger(component, ":titleheight", 0); boolean resizable = getBoolean(component, "resizable", false); if (resizable && (x < 4)) { insidepart = (y < block) ? ":nw" : @@ -4332,11 +4415,16 @@ (x >= bounds.width - block) ? ":se" : ":s"; } else { - int titleheight = getInteger(component, ":titleheight", 0); if (y < 4 + titleheight) { insidepart = "header"; } } + // close dialog button + if (get(component, "close") != null) { + int buttonX = bounds.width - titleheight -1; + int buttonY = 3 ; + if (x > buttonX && x < buttonX + titleheight - 2 && y > buttonY && y < buttonY + titleheight - 2) insidepart = ":closebutton"; + } } if ((insidepart == null) && !findScroll(component, x, y)) { Rectangle port = getRectangle(component, ":port"); @@ -4356,7 +4444,7 @@ insidepart = (x <= bounds.width - block) ? null : ((y <= bounds.height / 2) ? "up" : "down"); } - else if ("splitpane" == classname) { + else if ("splitpane" == classname) { Object comp1 = get(component, ":comp"); if (comp1 != null) { if (!findComponent(comp1, x, y)) { @@ -4371,8 +4459,43 @@ findScroll(component, x, y); } else if ("table" == classname) { - if (!findScroll(component, x, y)) { + // check if we are inside the header, then if we have an action on this header or it is a + // resizable one, do further checks to see if we need to change the column drawing states or + // even need to invoke the action or to resize the column. We do not need to make this whole + // block if we are resizing a column right now + Object header = get(component, "header"); + if (header != null && get(header, ":resizing") == null) { + boolean isResizable = getBoolean(header, "resizable"); + boolean hasAction = null != get(header, "action"); + if (isResizable || hasAction) { + Rectangle view = getRectangle(component, ":view"); + Rectangle port = getRectangle(component, ":port"); + if (0 < x && x < port.width && 0 < y && y < port.y - 1) { + int[] columnwidths = (int []) get(component, ":widths"); + Object column = get(header, ":comp"); + int left = -view.x; + for (int i = 0; i < columnwidths.length; i++) { + if (i != 0) column = get(column, ":next"); + int width = (i == columnwidths.length - 1) ? (view.width - left + 2) : columnwidths[i]; + if (isResizable && ((x > left + width - 4 && x < left + width) || (i < columnwidths.length - 1 && x >= left + width && x < left + width + 4))) { + set(header, ":resizecomponent", column); + break; + } else { + set(header, ":resizecomponent", null); + if (hasAction && getCount(component) > 0 && left < x && x < left + width) { + insidepart = column; + break; + } + } + left += width; + } + } else if (isResizable) { + set(header, ":resizecomponent", null); + set(header, ":resizing", null); + } + } } + if (insidepart == null && get(header, ":resizecomponent") == null) findScroll(component, x, y); } else if ("tree" == classname) { findScroll(component, x, y); @@ -4742,7 +4865,7 @@ /** * */ - private static boolean set(Object component, Object key, Object value) { + static boolean set(Object component, Object key, Object value) { Object[] previous = (Object[]) component; for (Object[] entry = previous; entry != null; entry = (Object[]) entry[2]) { @@ -4768,9 +4891,11 @@ } /** - * + * Get a specified sub-component or component part. Key is e.g. "header" (table header), + * ":parent" (parent component), ":comp" (head of a component list), + * ":next" (next component in a list), "popupmenu" is a popupmenu, etc ... */ - private static Object get(Object component, Object key) { + static Object get(Object component, Object key) { for (Object[] entry = (Object[]) component; entry != null; entry = (Object[]) entry[2]) { if (entry[0] == key) { @@ -4781,7 +4906,7 @@ } /** - * Gets the count of subcomponents in the list of the given component + * Gets the count of sub-components in the list of the given component * * @param component a widget * @return the number of components in this component @@ -4803,7 +4928,7 @@ /** * Gets the index of the first selected item in the given component * - * @param component a widget (combobox, tabbedpane, list, table, or tree) + * @param component a widget (combobox, tabbedpane, list, table, header, or tree) * @return the first selected index or -1 */ public int getSelectedIndex(Object component) { @@ -4811,7 +4936,7 @@ if ((classname == "combobox") || (classname == "tabbedpane")) { return getInteger(component, "selected", (classname == "combobox") ? -1 : 0); } - if ((classname == "list") || (classname == "table") || (classname == "tree")) { + if ((classname == "list") || (classname == "table") || (classname == "header") || (classname == "tree")) { Object item = get(component, ":comp"); for (int i = 0; item != null; i++) { if (getBoolean(item, "selected", false)) { return i; } @@ -4821,11 +4946,11 @@ } throw new IllegalArgumentException(classname); } - + /** * Gets the first selected item of the given component * - * @param component a widget (combobox, tabbedpane, list, table, or tree) + * @param component a widget (combobox, tabbedpane, list, table, header or tree) * @return the first selected item or null */ public Object getSelectedItem(Object component) { @@ -4835,7 +4960,7 @@ (classname == "combobox") ? -1 : 0); return (index != -1) ? getItemImpl(component, ":comp", index) : null; } - if ((classname == "list") || (classname == "table") || (classname == "tree")) { + if ((classname == "list") || (classname == "table") || (classname == "header") || (classname == "tree")) { for (Object item = findNextItem(component, classname, null); item != null; item = findNextItem(component, classname, item)) { if (getBoolean(item, "selected", false)) { return item; } @@ -5101,7 +5226,8 @@ * @param component * @param parent check upwards if true * @param checked this leaf is already checked - * @param mnemonic + * @param keycode + * @param modifiers * @return true if the char was consumed */ private boolean checkMnemonic(Object component, @@ -5792,7 +5918,7 @@ } else if ("bean" == definition[0]) { try { - Component bean = (Component) Class.forName(value).newInstance(); + Component bean = (Component)Class.forName(value).newInstance(); set(component, key, bean); } catch (Exception exc) { throw new IllegalArgumentException(value); } } @@ -6399,7 +6525,7 @@ /** * */ - private Rectangle getRectangle(Object component, String key) { + Rectangle getRectangle(Object component, String key) { return (Rectangle) get(component, key); } @@ -6576,7 +6702,7 @@ "dialog", "panel", new Object[][] { { "boolean", "modal", null, Boolean.FALSE }, { "boolean", "resizable", null, Boolean.FALSE }, - { "boolean", "closable", "paint", Boolean.FALSE }, + { "method", "close" }, { "boolean", "maximizable", "paint", Boolean.FALSE }, { "boolean", "iconifiable", "paint", Boolean.FALSE } }, "spinbox", "textfield", new Object[][] { @@ -6612,7 +6738,9 @@ new String[] { "singlerow", "rowinterval", "multiplerow", "cell", "cellinterval", "singlecolumn", "columninterval", "multiplecolumn" } }*/ }, - "header", null, null, + "header", null, new Object[][] { + { "method", "action" }, + { "boolean", "resizable", null, Boolean.TRUE } }, // reordering allowed // autoresize mode: off next (column boundries) subsequents last all columns // column row selection @@ -6620,7 +6748,8 @@ // editing row/column "column", "choice", new Object[][] { { "integer", "width", null, new Integer(80) }, - { "choice", "sort", null, new String[] { "none", "ascent", "descent" } } }, + { "choice", "sort", null, new String[] { "none", "ascent", "descent" } }, + { "boolean", "selected", null, Boolean.FALSE } }, "row", null, new Object[][] { { "boolean", "selected", null, Boolean.FALSE } }, "cell", "choice", null, @@ -6649,4 +6778,4 @@ { "bean", "bean", null, null } } }; } -} \ No newline at end of file +} |
From: Michael N. S. <mis...@ho...> - 2004-06-05 23:21:16
|
Hi folks, The following patch should solve the following problems: - While using a Thinlet application with a keyboard and doing dynamic removal/addition of components, such as rows, the app may halt when a key is pressed inside some components (eg. table, when all the rows are removed and some are added later); - Invoking an action using the keyboard does not focus the current component as expected If Robert or Andrzej are able to commit it, I'd be glad. It'd be better if you could fix the pending commit acccess issues, though. Regards, Michael Nascimento Santos JSR 207 Expert Group Member http://today.java.net/pub/au/80 Sun Certified Programmer for the Java 2 Platform Sun Certified Mobile Application Developer Sun Certified Web Component Developer for J2EE Moderador SouJava - http://www.soujava.org.br Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.9 diff -w -b -u -r1.9 Thinlet.java --- Thinlet.java 20 Apr 2004 11:10:29 -0000 1.9 +++ Thinlet.java 5 Jun 2004 22:08:44 -0000 @@ -2138,6 +2138,11 @@ } else { //if (("list" == classname) || ("table" == classname) || ("tree" == classname)) Object lead = get(component, ":lead"); + + if (getIndex(component, lead) == -1) { + set(component, ":lead", lead = null); + } + int[] columnwidths = ("table" == classname) ? ((int []) get(component, ":widths")) : null; boolean line = getBoolean(component, "line", true); int iline = line ? 1 : 0; boolean angle = ("tree" == classname) && getBoolean(component, "angle", false); @@ -3281,6 +3286,11 @@ (keycode == KeyEvent.VK_PAGE_DOWN) || (keycode == KeyEvent.VK_HOME) || (keycode == KeyEvent.VK_END)) { Object lead = get(component, ":lead"); + + if (getIndex(component, lead) == -1) { + set(component, ":lead", lead = null); + } + Object row = getListItem(component, component, keycode, lead, recursive); if (row != null) { String selection = getString(component, "selection", "single"); @@ -4206,6 +4216,8 @@ private boolean invoke(Object component, Object part, String event) { Object method = get(component, event); if (method != null) { + if (focusowner!=null && "action".equals(event)) + requestFocus(component); invokeImpl(method, part); return true; } @@ -4954,6 +4966,10 @@ * */ private int getIndex(Object component, Object value) { + if (value == null) { + return -1; + } + int index = 0; for (Object item = get(component, ":comp"); item != null; item = get(item, ":next")) { if (value == item) { return index; } |