thinlet-development Mailing List for Thinlet (Page 3)
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: Michael N. S. <mis...@ho...> - 2004-06-03 14:04:23
|
> I'd like to start with the patch that adds resizeable columns to the > table widget, then proceed to resizeable dialogs. > > Any comments? +1 []s Michael |
From: Andrzej B. <ab...@ge...> - 2004-06-02 06:47:07
|
Hello, I propose to integrate the patches from Stephan, one by one if they can be easily separated, or together if not. I'd like to start with the patch that adds resizeable columns to the table widget, then proceed to resizeable dialogs. Any comments? Any updates from the versions originally published by Stephan (in March)? -- 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-05-31 20:10:21
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18742 Modified Files: FrameLauncher.java Log Message: Add ability to set your own icon in the constructor to FrameLauncher. Submitted by Benjamin Brown. Index: FrameLauncher.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/FrameLauncher.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FrameLauncher.java 13 Oct 2003 11:46:17 -0000 1.3 +++ FrameLauncher.java 31 May 2004 20:09:57 -0000 1.4 @@ -1,116 +1,137 @@ -/* Thinlet GUI toolkit - www.thinlet.com - * Copyright (C) 2002-2003 Robert Bajzat (rob...@th...) */ -package thinlet; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; - -/** - * <code>FrameLauncher</code> is a double buffered frame - * to launch any <i>thinlet</i> component as an application - */ -public class FrameLauncher extends Frame implements WindowListener { - - private transient Thinlet content; - private transient Image doublebuffer; - - /** - * Construct and show a new frame with the specified title, including the - * given <i>thinlet</i> component. The frame is centered on the screen, and its - * preferred size is specified (excluding the frame's borders). The icon is - * the thinlet logo - * - * @param title the title to be displayed in the frame's border - * @param content a <i>thinlet</i> instance - * @param width the preferred width of the content - * @param height the preferred height of the content - */ - 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))); - } - - /** - * Call the paint method to redraw this component without painting a - * background rectangle - */ - public void update(Graphics g) { - paint(g); - } - - /** - * Create a double buffer if needed, - * the <i>thinlet</i> component paints the content - */ - 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); - } - - /** - * Clear the double buffer image (because the frame has been resized), - * the overriden method lays out its components - * (centers the <i>thinlet</i> component) - */ - public void doLayout() { - if (doublebuffer != null) { - doublebuffer.flush(); - doublebuffer = null; - } - super.doLayout(); - } - - /** - * Notify the <i>thinlet</i> component and terminates the Java Virtual Machine, - * or redisplay the frame depending on the return value of <i>thinlet</i>'s - * <code>destroy</code> method (true by default, - * thus terminates the VM if not overriden) - */ - 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) {} -} \ No newline at end of file +/* Thinlet GUI toolkit - www.thinlet.com + * Copyright (C) 2002-2003 Robert Bajzat (rob...@th...) */ +package thinlet; + +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; + +/** + * <code>FrameLauncher</code> is a double buffered frame + * to launch any <i>thinlet</i> component as an application + */ +public class FrameLauncher extends Frame implements WindowListener { + + private transient Thinlet content; + private transient Image doublebuffer; + + /** + * Construct and show a new frame with the specified title, including the + * given <i>thinlet</i> component. The frame is centered on the screen, and its + * preferred size is specified (excluding the frame's borders). The icon is + * the thinlet logo + * + * @param title the title to be displayed in the frame's border + * @param content a <i>thinlet</i> instance + * @param width the preferred width of the content + * @param height the preferred height of the content + */ + public FrameLauncher(String title, Thinlet content, int width, int height) { + this(title, null, content, width, height, true) ; + } + + /** + * Construct a new frame with the specified title, including the + * given <i>thinlet</i> component. The frame is centered on the screen, and its + * preferred size is specified (excluding the frame's borders). The frame icon is + * the parameter icon unless it is null, or has not completed loading in which + * case the default thinlet one will be used instead + * + * @param title the title to be displayed in the frame's border + * @param icon the image to be displayed in the frame's border + * @param content a <i>thinlet</i> instance + * @param width the preferred width of the content + * @param height the preferred height of the content + * @param visible whether to make the frame visible immediately + */ + public FrameLauncher(String title, Image icon, Thinlet content, int width, int height, boolean visible) { + 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); + //maximize: setBounds(-is.left, -is.top, ss.width + is.left + is.right, ss.height + is.top + is.bottom); + + if (icon == null || icon.getWidth(null) <=0 || icon.getHeight(null) <= 0) { + 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)); + } + } + icon = createImage(new MemoryImageSource(16, 16, pix, 0, 16)) ; + } + setIconImage(icon); + setVisible(visible); + } + + /** + * Call the paint method to redraw this component without painting a + * background rectangle + */ + public void update(Graphics g) { + paint(g); + } + + /** + * Create a double buffer if needed, + * the <i>thinlet</i> component paints the content + */ + 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); + } + + /** + * Clear the double buffer image (because the frame has been resized), + * the overriden method lays out its components + * (centers the <i>thinlet</i> component) + */ + public void doLayout() { + if (doublebuffer != null) { + doublebuffer.flush(); + doublebuffer = null; + } + super.doLayout(); + } + + /** + * Notify the <i>thinlet</i> component and terminates the Java Virtual Machine, + * or redisplay the frame depending on the return value of <i>thinlet</i>'s + * <code>destroy</code> method (true by default, + * thus terminates the VM if not overriden) + */ + 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) {} +} |
From: Gerald B. <lux...@ya...> - 2004-05-24 14:39:18
|
Hello, to help the Thinlet community grow I've kicked off a new mailinglist over at Yahoo! Groups chartered for questions, tips & tricks, announcements and more about the Thinlet XUL Toolkit. To get the Thinlet mailinglist off the ground. I've posted a couple of annoucements including: * Thinlet in Action: XML Universal Packet Archiver (PKT) * Thinlet RSS Reader Case Study by Mark Wilcox * Scriptable Thinlet: Script Thinlets Using Beanshell (bsh) * Thinlet-Helper: JEdit Plugin For Thinlet XUL Updated I invite you to sign up and help the discussion get going. More @ http://groups.yahoo.com/group/thinlet - Gerald ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca |
From: <ben...@id...> - 2004-05-22 12:55:12
|
Dear Open Source developer I am doing a research project on "Fun and Software Development" in which I kindly invite you to participate. You will find the online survey under http://fasd.ethz.ch/qsf/. The questionnaire consists of 53 questions and you will need about 15 minutes to complete it. With the FASD project (Fun and Software Development) we want to define the motivational significance of fun when software developers decide to engage in Open Source projects. What is special about our research project is that a similar survey is planned with software developers in commercial firms. This procedure allows the immediate comparison between the involved individuals and the conditions of production of these two development models. Thus we hope to obtain substantial new insights to the phenomenon of Open Source Development. With many thanks for your participation, Benno Luthiger PS: The results of the survey will be published under http://www.isu.unizh.ch/fuehrung/blprojects/FASD/. We have set up the mailing list fa...@we... for this study. Please see http://fasd.ethz.ch/qsf/mailinglist_en.html for registration to this mailing list. _______________________________________________________________________ Benno Luthiger Swiss Federal Institute of Technology Zurich 8092 Zurich Mail: benno.luthiger(at)id.ethz.ch _______________________________________________________________________ |
From: Robert B. <rob...@th...> - 2004-05-18 18:57:05
|
This mailing list and 3 hardly used discussion forums are available on sourceforge.net for a long while. I've created the previous forum groups on java.net and updated all the html pages. I'll try to create a simple application and upload the current 1500 messages somehow. |
From: Andrzej B. <ab...@ge...> - 2004-05-18 18:22:50
|
Norbert Barbosa wrote: > Hello all, > The regular thinlet forum is out since 1 week. > I think it's can be an opportunity to switch for the sourceforge forum, > instead I wholeheartedly agree. I'll try to arrange to create the usual set of mailing lists... -- 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: Norbert B. <sj...@cl...> - 2004-05-18 09:53:57
|
Hello all, The regular thinlet forum is out since 1 week. I think it's can be an opportunity to switch for the sourceforge forum, instead |
From: Norbert B. <sj...@cl...> - 2004-04-22 11:17:36
|
Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.9 diff -b -d -u -r1.9 Thinlet.java --- Thinlet.java 20 Apr 2004 11:10:29 -0000 1.9 +++ Thinlet.java 21 Apr 2004 22:08:06 -0000 @@ -4203,7 +4203,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) { invokeImpl(method, part); @@ -4742,7 +4742,7 @@ /** * */ - private static boolean set(Object component, Object key, Object value) { + protected static boolean set(Object component, Object key, Object value) { Object[] previous = (Object[]) component; for (Object[] entry = previous; entry != null; entry = (Object[]) entry[2]) { @@ -4770,7 +4770,7 @@ /** * */ - private static Object get(Object component, Object key) { + protected static Object get(Object component, Object key) { for (Object[] entry = (Object[]) component; entry != null; entry = (Object[]) entry[2]) { if (entry[0] == key) { @@ -4903,7 +4903,7 @@ /** * */ - private static int getItemCountImpl(Object component, String key) { + protected static int getItemCountImpl(Object component, String key) { int i = 0; for (Object comp = get(component, key); comp != null; comp = get(comp, ":next")) { i++; @@ -5000,7 +5000,7 @@ /** * Referenced by DOM */ - private void insertItem(Object parent, + protected void insertItem(Object parent, Object key, Object component, int index) { Object item = parent, next = get(parent, key); for (int i = 0;; i++) { @@ -5417,6 +5417,21 @@ this.resourcebundle = resourcebundle; } + /** extract a CDATA section, and call the addContent */ + private void extractCDATA(Reader reader, StringBuffer text) throws IOException { + int c; + while ((c = reader.read()) != ']') + text.append((char)c); + if((c = reader.read()) != ']'){ + text.append(']'); + text.append((char)c); + extractCDATA(reader, text); + } else if((c = reader.read()) != '>'){ + text.append(']'); + text.append((char)c); + extractCDATA(reader, text); + } + } /** * * @param inputstream @@ -5450,9 +5465,9 @@ characters(text.toString()); } } - // else { - //addContent(current, text.toString()); - //} + else { + addContent(current, text.toString()); + } text.setLength(0); } String tagname = (String) parentlist[2]; //getClass(current); @@ -5473,7 +5488,17 @@ current = parentlist[0]; parentlist = (Object[]) parentlist[1]; } - else if (c == '!') { // DOCTYPE + else if (c == '!') { // DOCTYPE or comment or CDATA + c = reader.read(); + if(c == '['){ + if (reader.read() != 'C' & reader.read() != 'D' & + reader.read() != 'A' & reader.read() != 'T' & + reader.read() != 'A' & reader.read() != '[') + throw new IllegalArgumentException("bad CDATA"); // '>' + text.setLength(0); + extractCDATA(reader, text); + c = reader.read(); + } else if(c != '>') while ((c = reader.read()) != '>'); //+(-1) } else if (c == '?') { // Processing Instructions @@ -5481,6 +5506,18 @@ while (((c = reader.read()) != '>') || !question) { question = (c == '?'); } } else { //start or standalone tag + if(text.length() != 0){ // manage pending CDATA + if (!validate) { + if (dom) { + set(current, ":text", text.toString()); + } else { + characters(text.toString()); + } + } + else { + addContent(current, text.toString()); + } + } text.setLength(0); boolean iscomment = false; while (">/ \t\n\r".indexOf(c) == -1) { @@ -5615,10 +5652,14 @@ } } + /** during the parse, add the following text content to the current component */ + protected void addContent(Object current, String text){ + + } /** * */ - private void finishParse(Vector methods, Object root, Object handler) { + protected void finishParse(Vector methods, Object root, Object handler) { if (methods != null) { for (int i = 0; i < methods.size(); i += 3) { Object component = methods.elementAt(i); @@ -5650,7 +5691,7 @@ * @param index add at the specified index * @throws java.lang.IllegalArgumentException */ - private void addImpl(Object parent, Object component, int index) { + protected void addImpl(Object parent, Object component, int index) { String parentclass = getClass(parent); String classname = getClass(component); if ((("combobox" == parentclass) && ("choice" == classname)) || @@ -5682,7 +5723,7 @@ /** * */ - private boolean instance(Object classname, Object extendclass) { + protected boolean instance(Object classname, Object extendclass) { if (classname == extendclass) { return true; } for (int i = 0; i < dtd.length; i += 3) { if (classname == dtd[i]) { @@ -6191,7 +6232,7 @@ /** * */ - private boolean setString(Object component, + protected boolean setString(Object component, String key, String value, String defaultvalue) { if (allI18n && (langResource != null) && ((key == "text") || (key == "tooltip"))) { @@ -6473,7 +6514,7 @@ return true; } - private static Object[] dtd; + protected static Object[] dtd; static { Integer integer_1 = new Integer(-1); Integer integer0 = new Integer(0); |
From: Norbert B. <sj...@cl...> - 2004-04-21 22:57:15
|
Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.9 diff -b -d -u -r1.9 Thinlet.java --- Thinlet.java 20 Apr 2004 11:10:29 -0000 1.9 +++ Thinlet.java 21 Apr 2004 22:08:06 -0000 @@ -4203,7 +4203,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) { invokeImpl(method, part); @@ -4742,7 +4742,7 @@ /** * */ - private static boolean set(Object component, Object key, Object value) { + protected static boolean set(Object component, Object key, Object value) { Object[] previous = (Object[]) component; for (Object[] entry = previous; entry != null; entry = (Object[]) entry[2]) { @@ -4770,7 +4770,7 @@ /** * */ - private static Object get(Object component, Object key) { + protected static Object get(Object component, Object key) { for (Object[] entry = (Object[]) component; entry != null; entry = (Object[]) entry[2]) { if (entry[0] == key) { @@ -4903,7 +4903,7 @@ /** * */ - private static int getItemCountImpl(Object component, String key) { + protected static int getItemCountImpl(Object component, String key) { int i = 0; for (Object comp = get(component, key); comp != null; comp = get(comp, ":next")) { i++; @@ -5000,7 +5000,7 @@ /** * Referenced by DOM */ - private void insertItem(Object parent, + protected void insertItem(Object parent, Object key, Object component, int index) { Object item = parent, next = get(parent, key); for (int i = 0;; i++) { @@ -5417,6 +5417,21 @@ this.resourcebundle = resourcebundle; } + /** extract a CDATA section, and call the addContent */ + private void extractCDATA(Reader reader, StringBuffer text) throws IOException { + int c; + while ((c = reader.read()) != ']') + text.append((char)c); + if((c = reader.read()) != ']'){ + text.append(']'); + text.append((char)c); + extractCDATA(reader, text); + } else if((c = reader.read()) != '>'){ + text.append(']'); + text.append((char)c); + extractCDATA(reader, text); + } + } /** * * @param inputstream @@ -5450,9 +5465,9 @@ characters(text.toString()); } } - // else { - //addContent(current, text.toString()); - //} + else { + addContent(current, text.toString()); + } text.setLength(0); } String tagname = (String) parentlist[2]; //getClass(current); @@ -5473,7 +5488,17 @@ current = parentlist[0]; parentlist = (Object[]) parentlist[1]; } - else if (c == '!') { // DOCTYPE + else if (c == '!') { // DOCTYPE or comment or CDATA + c = reader.read(); + if(c == '['){ + if (reader.read() != 'C' & reader.read() != 'D' & + reader.read() != 'A' & reader.read() != 'T' & + reader.read() != 'A' & reader.read() != '[') + throw new IllegalArgumentException("bad CDATA"); // '>' + text.setLength(0); + extractCDATA(reader, text); + c = reader.read(); + } else if(c != '>') while ((c = reader.read()) != '>'); //+(-1) } else if (c == '?') { // Processing Instructions @@ -5481,6 +5506,18 @@ while (((c = reader.read()) != '>') || !question) { question = (c == '?'); } } else { //start or standalone tag + if(text.length() != 0){ // manage pending CDATA + if (!validate) { + if (dom) { + set(current, ":text", text.toString()); + } else { + characters(text.toString()); + } + } + else { + addContent(current, text.toString()); + } + } text.setLength(0); boolean iscomment = false; while (">/ \t\n\r".indexOf(c) == -1) { @@ -5615,10 +5652,14 @@ } } + /** during the parse, add the following text content to the current component */ + protected void addContent(Object current, String text){ + + } /** * */ - private void finishParse(Vector methods, Object root, Object handler) { + protected void finishParse(Vector methods, Object root, Object handler) { if (methods != null) { for (int i = 0; i < methods.size(); i += 3) { Object component = methods.elementAt(i); @@ -5650,7 +5691,7 @@ * @param index add at the specified index * @throws java.lang.IllegalArgumentException */ - private void addImpl(Object parent, Object component, int index) { + protected void addImpl(Object parent, Object component, int index) { String parentclass = getClass(parent); String classname = getClass(component); if ((("combobox" == parentclass) && ("choice" == classname)) || @@ -5682,7 +5723,7 @@ /** * */ - private boolean instance(Object classname, Object extendclass) { + protected boolean instance(Object classname, Object extendclass) { if (classname == extendclass) { return true; } for (int i = 0; i < dtd.length; i += 3) { if (classname == dtd[i]) { @@ -6191,7 +6232,7 @@ /** * */ - private boolean setString(Object component, + protected boolean setString(Object component, String key, String value, String defaultvalue) { if (allI18n && (langResource != null) && ((key == "text") || (key == "tooltip"))) { @@ -6473,7 +6514,7 @@ return true; } - private static Object[] dtd; + protected static Object[] dtd; static { Integer integer_1 = new Integer(-1); Integer integer0 = new Integer(0); |
From: Andrzej B. <ab...@us...> - 2004-04-20 11:10:53
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32477 Modified Files: Thinlet.java Log Message: Revert last change - it introduced unwanted JDK 1.2 dependency. Pointed out by: Campbell Boucher-Burnet Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Thinlet.java 19 Apr 2004 22:05:22 -0000 1.8 +++ Thinlet.java 20 Apr 2004 11:10:29 -0000 1.9 @@ -44,8 +44,6 @@ private transient Color c_ctrl = null; private transient int block; private transient Image hgradient, vgradient; - private transient Stroke dash = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f, new float[]{0.5f, 1.5f}, 0.0f); - private transient Stroke solid = new BasicStroke(1.0f); private transient Thread timer; private transient long watchdelay; @@ -2165,12 +2163,8 @@ if (angle) { Object nodebelow = get(item, ":next"); if (nodebelow != null) { // and the next node is bellow clipy - ((Graphics2D)g).setStroke(dash); - Rectangle nbr = getRectangle(nodebelow, "bounds"); - if (nbr == null) nbr = new Rectangle(r.x, r.y + block, r.width, r.height); - g.setColor(c_text); int x = r.x - block / 2; - g.drawLine(x, r.y, x, nbr.y); - ((Graphics2D)g).setStroke(solid); + g.setColor(c_bg); int x = r.x - block / 2; + g.drawLine(x, r.y, x, getRectangle(nodebelow, "bounds").y); } } continue; // clip rectangle is bellow @@ -2193,14 +2187,12 @@ if ("tree" == classname) { int x = r.x - block / 2; int y = r.y + (r.height - 1) / 2; if (angle) { - g.setColor(c_text); - ((Graphics2D)g).setStroke(dash); + g.setColor(c_bg); g.drawLine(x, r.y, x, y); g.drawLine(x, y, r.x - 1, y); Object nodebelow = get(item, ":next"); if (nodebelow != null) { g.drawLine(x, y, x, getRectangle(nodebelow, "bounds").y); } - ((Graphics2D)g).setStroke(solid); } if (subnode) { paintRect(g, x - 4, y - 4, 9, 9, itemenabled ? c_border : c_disable, @@ -6657,4 +6649,4 @@ { "bean", "bean", null, null } } }; } -} +} \ No newline at end of file |
From: Andrzej B. <ab...@us...> - 2004-04-19 22:05:38
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23442 Modified Files: Thinlet.java Log Message: Improve visibility and LnF of tree lines if angle="true". Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Thinlet.java 19 Apr 2004 17:42:29 -0000 1.7 +++ Thinlet.java 19 Apr 2004 22:05:22 -0000 1.8 @@ -44,6 +44,8 @@ private transient Color c_ctrl = null; private transient int block; private transient Image hgradient, vgradient; + private transient Stroke dash = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f, new float[]{0.5f, 1.5f}, 0.0f); + private transient Stroke solid = new BasicStroke(1.0f); private transient Thread timer; private transient long watchdelay; @@ -2163,8 +2165,12 @@ if (angle) { Object nodebelow = get(item, ":next"); if (nodebelow != null) { // and the next node is bellow clipy - g.setColor(c_bg); int x = r.x - block / 2; - g.drawLine(x, r.y, x, getRectangle(nodebelow, "bounds").y); + ((Graphics2D)g).setStroke(dash); + Rectangle nbr = getRectangle(nodebelow, "bounds"); + if (nbr == null) nbr = new Rectangle(r.x, r.y + block, r.width, r.height); + g.setColor(c_text); int x = r.x - block / 2; + g.drawLine(x, r.y, x, nbr.y); + ((Graphics2D)g).setStroke(solid); } } continue; // clip rectangle is bellow @@ -2187,12 +2193,14 @@ if ("tree" == classname) { int x = r.x - block / 2; int y = r.y + (r.height - 1) / 2; if (angle) { - g.setColor(c_bg); + g.setColor(c_text); + ((Graphics2D)g).setStroke(dash); g.drawLine(x, r.y, x, y); g.drawLine(x, y, r.x - 1, y); Object nodebelow = get(item, ":next"); if (nodebelow != null) { g.drawLine(x, y, x, getRectangle(nodebelow, "bounds").y); } + ((Graphics2D)g).setStroke(solid); } if (subnode) { paintRect(g, x - 4, y - 4, 9, 9, itemenabled ? c_border : c_disable, @@ -6649,4 +6657,4 @@ { "bean", "bean", null, null } } }; } -} \ No newline at end of file +} |
From: Andrzej B. <ab...@us...> - 2004-04-19 17:42:39
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31207/examples/demo Modified Files: Demo.java demo.xml Log Message: Synchronize with the latest official release (7 Mar 2004). Fix API change in Demo.java . Change tree properties in Demo to demonstrate new functionality. Index: Demo.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/Demo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Demo.java 18 Aug 2003 23:42:07 -0000 1.2 +++ Demo.java 19 Apr 2004 17:42:30 -0000 1.3 @@ -132,7 +132,10 @@ int r = c.getRed(); int g = c.getGreen(); int b = c.getBlue(); - int val = getInteger(spin, "value"); + int val = 0; + try { + val = Integer.parseInt(getString(spin, "text")); + } catch (Exception e) {}; if (name.endsWith("r")) { r = val; } else if (name.endsWith("g")) { Index: demo.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/demo.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- demo.xml 18 Aug 2003 23:42:07 -0000 1.2 +++ demo.xml 19 Apr 2004 17:42:30 -0000 1.3 @@ -91,7 +91,7 @@ <item text="List item F" /> <item text="List item G" /> </list> - <tree selection="multiple"> + <tree selection="multiple" angle="true" line="false"> <popupmenu> <menuitem text="one"/> <menuitem text="two"/> @@ -174,7 +174,7 @@ <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"/> + <label colspan="3" name="rgb_label" valign="fill" weighty="1" background="#000000" text="Thinlet!" font="40 bold italic" alignment="center"/> </panel> </tab> |
From: Andrzej B. <ab...@us...> - 2004-04-19 17:42:39
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/drafts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31207/drafts Modified Files: drafts.html Log Message: Synchronize with the latest official release (7 Mar 2004). Fix API change in Demo.java . Change tree properties in Demo to demonstrate new functionality. Index: drafts.html =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/drafts/drafts.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- drafts.html 26 Jun 2003 15:21:55 -0000 1.1 +++ drafts.html 19 Apr 2004 17:42:29 -0000 1.2 @@ -1,5 +1,5 @@ -<html><body> - <applet code="thinlet.AppletLauncher" codebase="../.." width="480" height="270"> - <param name="class" value="thinlet.drafts.Drafts"> - </applet> +<html><body> + <applet code="thinlet.AppletLauncher" codebase="../.." width="480" height="270"> + <param name="class" value="thinlet.drafts.Drafts"> + </applet> </body></html> \ No newline at end of file |
From: Andrzej B. <ab...@us...> - 2004-04-19 17:42:38
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31207 Modified Files: Thinlet.java Log Message: Synchronize with the latest official release (7 Mar 2004). Fix API change in Demo.java . Change tree properties in Demo to demonstrate new functionality. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Thinlet.java 13 Oct 2003 11:40:28 -0000 1.6 +++ Thinlet.java 19 Apr 2004 17:42:29 -0000 1.7 @@ -103,9 +103,10 @@ AWTEvent.FOCUS_EVENT_MASK | AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | WHEEL_MASK); // EVM has larger fillRect, fillOval, and drawImage(part), others are correct - // contributed by Ibsen Ramos-Bonilla + // contributed by Ibsen Ramos-Bonilla and AK try { - if (System.getProperty("java.vendor").indexOf("Insignia") != -1) { evm = -1; } + if ((System.getProperty("java.vendor").indexOf("Insignia") != -1) && + System.getProperty("os.name").indexOf("Windows CE") == -1) { evm = -1; } } catch (Exception exc) { /* never */ } } @@ -279,7 +280,7 @@ } else if (("panel" == classname) || (classname == "dialog")) { int gap = getInteger(component, "gap", 0); - int[][] grid = getGrid(component, gap); + int[][] grid = getGrid(component); int top = 0; int left = 0; int contentwidth = 0; int contentheight = 0; if (grid != null) { // has subcomponents @@ -1127,7 +1128,7 @@ size.height += getInteger(component, "top", 0) + getInteger(component, "bottom", 0); // add content preferred size int gap = getInteger(component, "gap", 0); - int[][] grid = getGrid(component, gap); + int[][] grid = getGrid(component); if (grid != null) { // has components size.width += getSum(grid[0], 0, grid[0].length, gap, false); size.height += getSum(grid[1], 0, grid[1].length, gap, false); @@ -1197,12 +1198,11 @@ if ("bean" == classname) { return ((Component) get(component, "bean")).getPreferredSize(); } - throw new IllegalArgumentException((String) classname); + throw new IllegalArgumentException(classname); } /** * @param component a container - * @param gap space between components * @return null for zero visible subcomponent, otherwise an array contains the following lists: * <ul><li>columnwidths, preferred width of grid columns</li> * <li>rowheights, preferred heights of grid rows</li> @@ -1213,7 +1213,7 @@ * <li>gridwidth, column spans</li> * <li>gridheight, row spans</li></ul> */ - private int[][] getGrid(Object component, int gap) { + private int[][] getGrid(Object component) { int count = 0; // count of the visible subcomponents for (Object comp = get(component, ":comp"); comp != null; comp = get(comp, ":next")) { @@ -1364,7 +1364,6 @@ * */ private Dimension getFieldSize(Object component) { - String text = getString(component, "text", ""); int columns = getInteger(component, "columns", 0); Font currentfont = (Font) get(component, "font"); FontMetrics fm = getFontMetrics((currentfont != null) ? currentfont : font); @@ -1445,33 +1444,6 @@ //g.setClip(0, 0, getSize().width, getSize().height); //g.setColor(Color.red); g.drawRect(clip.x, clip.y, clip.width - 1, clip.height - 1); } - - /** - * Fill a given part of a MemoryImageSource with gradient - * @param pix arrays of source pixels - * @param offset image width - * @param x gradient left location - * @param y fill top location - * @param width gradient width size - * @param height fill height size - * @param color1 top/left color - * @param color2 bottom/right color - * @param horizontal horizontal if true, vertical otherwise - */ - private static void fillGradient(int[] pix, int offset, int x, int y, int width, int height, - int color1, int color2, boolean horizontal) { - int r1 = (color1 >> 16) & 0xff; int rd = ((color2 >> 16) & 0xff) - r1; - int g1 = (color1 >> 8) & 0xff; int gd = ((color2 >> 8) & 0xff) - g1; - int b1 = color1 & 0xff; int bd = (color2 & 0xff) - b1; - int gs = horizontal ? width : height; int fs = horizontal ? height : width; - for (int i = 0; i < gs; i++) { - int color = 0xff000000 | ((r1 + rd * i / gs) << 16) | - ((g1 + gd * i / gs) << 8) | (b1 + bd * i / gs); - for (int j = 0; j < fs; j++) { - pix[x + (horizontal ? i : j) + (y + (horizontal ? j : i)) * offset] = color; - } - } - } /** * @param clipx the cliping rectangle is relative to the component's @@ -1577,8 +1549,7 @@ Image icon = getIcon(component, "icon", null); int left = (icon != null) ? icon.getWidth(this) : 0; paintField(g, clipx, clipy, clipwidth, clipheight, component, - bounds.width - block, bounds.height, - inside, pressed, focus, enabled, false, left); + bounds.width - block, bounds.height, focus, enabled, false, left); if (icon != null) { g.drawImage(icon, 2, (bounds.height - icon.getHeight(this)) / 2, this); } @@ -1595,16 +1566,15 @@ } } else if (":combolist" == classname) { - paintScroll(component, classname, bounds, pressed, inside, focus, enabled, + paintScroll(component, classname, pressed, inside, focus, enabled, g, clipx, clipy, clipwidth, clipheight); } else if (("textfield" == classname) || ("passwordfield" == classname)) { paintField(g, clipx, clipy, clipwidth, clipheight, component, - bounds.width, bounds.height, - inside, pressed, focus, enabled, ("passwordfield" == classname), 0); + bounds.width, bounds.height, focus, enabled, ("passwordfield" == classname), 0); } else if ("textarea" == classname) { - paintScroll(component, classname, bounds, pressed, inside, focus, enabled, + paintScroll(component, classname, pressed, inside, focus, enabled, g, clipx, clipy, clipwidth, clipheight); } else if ("tabbedpane" == classname) { @@ -1669,16 +1639,15 @@ 1, 2, 1, 2, false, 'g', "left", false, false); int controlx = bounds.width - titleheight - 1; if (getBoolean(component, "closable", false)) { - paint(component, controlx, 3, titleheight - 2, titleheight - 2, - g, true, true, true, true, 'g'); controlx -= titleheight; + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'c'); + controlx -= titleheight; } if (getBoolean(component, "maximizable", false)) { - paint(component, controlx, 3, titleheight - 2, titleheight - 2, - g, true, true, true, true, 'g'); controlx -= titleheight; + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'm'); + controlx -= titleheight; } if (getBoolean(component, "iconifiable", false)) { - paint(component, controlx, 3, titleheight - 2, titleheight - 2, - g, true, true, true, true, 'g'); + paint(component, g, controlx, 3, titleheight - 2, titleheight - 2, 'i'); } paintRect(g, 0, 3 + titleheight, bounds.width, bounds.height - 3 - titleheight, c_border, c_press, false, true, true, true, true); // lower part excluding titlebar @@ -1695,7 +1664,7 @@ } if (get(component, ":port") != null) { - paintScroll(component, classname, bounds, pressed, inside, focus, enabled, + paintScroll(component, classname, pressed, inside, focus, enabled, g, clipx, clipy, clipwidth, clipheight); } else { @@ -1722,8 +1691,7 @@ } else if ("spinbox" == classname) { paintField(g, clipx, clipy, clipwidth, clipheight, component, - bounds.width - block, bounds.height, - inside, pressed, focus, enabled, false, 0); + bounds.width - block, bounds.height, focus, enabled, false, 0); paintArrow(g, bounds.width - block, 0, block, bounds.height / 2, 'N', enabled, inside, pressed, "up", true, false, false, true, true); paintArrow(g, bounds.width - block, bounds.height / 2, @@ -1801,7 +1769,7 @@ } else if (("list" == classname) || ("table" == classname) || ("tree" == classname)) { - paintScroll(component, classname, bounds, pressed, inside, focus, enabled, + paintScroll(component, classname, pressed, inside, focus, enabled, g, clipx, clipy, clipwidth, clipheight); } else if ("separator" == classname) { @@ -1891,7 +1859,7 @@ ((Component) get(component, "bean")).paint(g); g.setClip(clipx, clipy, clipwidth, clipheight); } - else throw new IllegalArgumentException((String) classname); + else throw new IllegalArgumentException(classname); g.translate(-bounds.x, -bounds.y); clipx += bounds.x; clipy += bounds.y; } @@ -1920,7 +1888,7 @@ */ private void paintField(Graphics g, int clipx, int clipy, int clipwidth, int clipheight, Object component, - int width, int height, boolean inside, boolean pressed, + int width, int height, boolean focus, boolean enabled, boolean hidden, int left) { boolean editable = getBoolean(component, "editable", true); paintRect(g, 0, 0, width, height, enabled ? c_border : c_disable, @@ -1972,7 +1940,6 @@ /** * @param component scrollable widget * @param classname - * @param bounds * @param pressed * @param inside * @param focus @@ -1986,8 +1953,7 @@ * @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, Rectangle bounds, + private void paintScroll(Object component, String classname, boolean pressed, boolean inside, boolean focus, boolean enabled, Graphics g, int clipx, int clipy, int clipwidth, int clipheight) { Rectangle port = getRectangle(component, ":port"); @@ -2098,7 +2064,7 @@ 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, port.height, view.width); + 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); @@ -2112,7 +2078,7 @@ private void paint(Object component, String classname, boolean focus, boolean enabled, Graphics g, int clipx, int clipy, int clipwidth, int clipheight, - int portwidth, int portheight, int viewwidth) { + int portwidth, int viewwidth) { if ("textarea" == classname) { char[] chars = (char[]) get(component, ":text"); int start = focus ? getInteger(component, "start", 0) : 0; @@ -2408,7 +2374,33 @@ if (mode != 'x') { g.fillRect(x, y, width + evm, height + evm); } } } - + + /** + * + */ + 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); + switch (type) { + case 'c': // closable dialog button + g.drawLine(x + 3, y + 4, x + width - 5, y + height - 4); + g.drawLine(x + 3, y + 3, x + width - 4, y + height - 4); + g.drawLine(x + 4, y + 3, x + width - 4, y + height - 5); + g.drawLine(x + width - 5, y + 3, x + 3, y + height - 5); + g.drawLine(x + width - 4, y + 3, x + 3, y + height - 4); + g.drawLine(x + width - 4, y + 4, x + 4, y + height - 4); + break; + case 'm': // maximizable dialog button + g.drawRect(x + 3, y + 3, width - 7, height - 7); + g.drawLine(x + 4, y + 4, x + width - 5, y + 4); + break; + case 'i': // iconifiable dialog button + g.fillRect(x + 3, y + height - 5, width - 6, 2); + break; + } + } + /** * Paint component icon and text (using default or custom font) * @param mnemonic find mnemonic index and underline text @@ -2953,7 +2945,7 @@ } } else if (("list" == classname) || ("table" == classname)) { - return processList(component, shiftdown, controldown, keychar, keycode, modifiers, false); + return processList(component, shiftdown, controldown, keychar, keycode, false); } else if ("tree" == classname) { //? clear childs' selection, select this is its subnode was selected @@ -2993,7 +2985,7 @@ return true; } } - return processList(component, shiftdown, controldown, keychar, keycode, modifiers, true); + return processList(component, shiftdown, controldown, keychar, keycode, true); } else if (("menubar" == classname) || ("popupmenu" == classname)) { // find the last open :popup and the previous one @@ -3221,7 +3213,7 @@ insert = filter(insert, multiline); } } - if (filter) { + if (filter && (insert != null)) { // contributed by Michael Nascimento for (int i = insert.length() - 1; i >= 0; i--) { if (!Character.isDigit(insert.charAt(i))) { return false; } } @@ -3283,7 +3275,7 @@ * */ private boolean processList(Object component, boolean shiftdown, boolean controldown, - int keychar, int keycode, int modifiers, boolean recursive) { + int keychar, int keycode, boolean recursive) { if ((keycode == KeyEvent.VK_UP) || // select previous/next/first/... item (keycode == KeyEvent.VK_DOWN) || (keycode == KeyEvent.VK_PAGE_UP) || (keycode == KeyEvent.VK_PAGE_DOWN) || @@ -3566,7 +3558,7 @@ int left = ((id == MouseEvent.MOUSE_PRESSED) && ((icon = getIcon(component, "icon", null)) != null)) ? icon.getWidth(this) : 0; - processField(x, y, clickcount, id, component, part, false, false, left); + processField(x, y, clickcount, id, component, false, false, left); } else if (part != "icon") { // part = "down" if (((id == MouseEvent.MOUSE_ENTERED) || @@ -3608,12 +3600,12 @@ } } else if (("textfield" == classname) || ("passwordfield" == classname)) { - processField(x, y, clickcount, id, component, part, + processField(x, y, clickcount, id, component, false, ("passwordfield" == classname), 0); } else if ("textarea" == classname) { if (!processScroll(x, y, id, component, part)) { - processField(x, y, clickcount, id, component, part, true, false, 0); + processField(x, y, clickcount, id, component, true, false, 0); } } else if ("panel" == classname) { @@ -3631,7 +3623,7 @@ } else if ("spinbox" == classname) { if (part == null) { - processField(x, y, clickcount, id, component, part, false, false, 0); + processField(x, y, clickcount, id, component, false, false, 0); } else { // part = "up" || "down" if ((id == MouseEvent.MOUSE_ENTERED) || @@ -3990,7 +3982,7 @@ */ private void processField(int x, int y, int clickcount, int id, Object component, - Object part, boolean multiline, boolean hidden, int left) { + boolean multiline, boolean hidden, int left) { if (id == MouseEvent.MOUSE_PRESSED) { //+ middle=alt paste clipboard content setReference(component, 2 + left, 2); @@ -4214,7 +4206,7 @@ private boolean invoke(Object component, Object part, String event) { Object method = get(component, event); if (method != null) { - invokeImpl(method, component, part); + invokeImpl(method, part); return true; } return false; @@ -4223,7 +4215,7 @@ /** * */ - private void invokeImpl(Object method, Object component, Object part) { + private void invokeImpl(Object method, Object part) { Object[] data = (Object[]) method; Object[] args = (data.length > 2) ? new Object[(data.length - 2) / 3] : null; if (args != null) for (int i = 0; i < args.length; i++) { @@ -4322,24 +4314,28 @@ else if (("panel" == classname) || ("desktop" == classname) || ("dialog" == classname)) { if ("dialog" == classname) { - if (getBoolean(component, "resizable", false)) { - if (x < 4) { - insidepart = (y < block) ? ":nw" : - (y >= bounds.height - block) ? ":sw" : ":w"; - } else if (y < 4) { - insidepart = (x < block) ? ":nw" : - (x >= bounds.width - block) ? ":ne" : ":n"; - } else if (x >= bounds.width - 4) { - insidepart = (y < block) ? ":ne" : - (y >= bounds.height - block) ? ":se" : ":e"; - } else if (y >= bounds.height - 4) { - insidepart = (x < block) ? ":sw" : - (x >= bounds.width - block) ? ":se" : ":s"; - } + boolean resizable = getBoolean(component, "resizable", false); + if (resizable && (x < 4)) { + insidepart = (y < block) ? ":nw" : + (y >= bounds.height - block) ? ":sw" : ":w"; } - if ((insidepart == null) && - (y < 4 + getInteger(component, ":titleheight", 0))) { - insidepart = "header"; + else if (resizable && (y < 4)) { + insidepart = (x < block) ? ":nw" : + (x >= bounds.width - block) ? ":ne" : ":n"; + } + else if (resizable && (x >= bounds.width - 4)) { + insidepart = (y < block) ? ":ne" : + (y >= bounds.height - block) ? ":se" : ":e"; + } + else if (resizable && (y >= bounds.height - 4)) { + insidepart = (x < block) ? ":sw" : + (x >= bounds.width - block) ? ":se" : ":s"; + } + else { + int titleheight = getInteger(component, ":titleheight", 0); + if (y < 4 + titleheight) { + insidepart = "header"; + } } } if ((insidepart == null) && !findScroll(component, x, y)) { @@ -5632,7 +5628,7 @@ if ("method" == definition[0]) { Object[] method = getMethod(component, value, root, handler); if ("init" == definition[1]) { - invokeImpl(method, component, null); + invokeImpl(method, null); } else { set(component, definition[1], method); @@ -5796,7 +5792,8 @@ } else if ("bean" == definition[0]) { try { - set(component, key, (Component) Class.forName(value).newInstance()); + Component bean = (Component) Class.forName(value).newInstance(); + set(component, key, bean); } catch (Exception exc) { throw new IllegalArgumentException(value); } } else throw new IllegalArgumentException((String) definition[0]); @@ -5914,7 +5911,7 @@ */ public void setIcon(Object component, String key, Image icon) { Object[] definition = getDefinition(getClass(component), key, "icon"); - if (set(component, (String) definition[1], icon)) { + if (set(component, definition[1], icon)) { update(component, definition[2]); } } @@ -5935,6 +5932,17 @@ setKeystrokeImpl(component, (String) definition[1], value); update(component, definition[2]); } + + /** + * Get the AWT component of the given (currently <i>bean</i>) widget + * + * @param component a <i>bean</i> widget + * @param key the identifier of the parameter + * @return an AWT component, or null + */ + public Component getComponent(Object component, String key) { + return (Component) get(component, key, "bean"); + } /** * Set custom font on a component, @@ -5952,7 +5960,7 @@ */ public void setFont(Object component, String key, Font font) { Object[] definition = getDefinition(getClass(component), key, "font"); - if (set(component, (String) definition[1], font)) { + if (set(component, definition[1], font)) { update(component, definition[2]); } } @@ -5972,7 +5980,21 @@ */ public void setColor(Object component, String key, Color color) { Object[] definition = getDefinition(getClass(component), key, "color"); - if (set(component, (String) definition[1], color)) { + if (set(component, definition[1], color)) { + update(component, definition[2]); + } + } + + /** + * Set the AWT component for the given (currently <i>bean</i>) widget + * + * @param component a <i>bean</i> widget + * @param key the identifier of the parameter + * @param bean an AWT component, or null + */ + public void setComponent(Object component, String key, Component bean) { + Object[] definition = getDefinition(getClass(component), key, "bean"); + if (set(component, definition[1], font)) { update(component, definition[2]); } } @@ -6017,7 +6039,7 @@ */ private static Object get(Object component, String key, String type) { Object[] definition = getDefinition(getClass(component), key, type); - Object value = get(component, (String) definition[1]); + Object value = get(component, definition[1]); return (value != null) ? value : definition[3]; } @@ -6175,7 +6197,7 @@ ((key == "text") || (key == "tooltip"))) { putProperty(component, "i18n." + key, null); // for I18N } - return set(component, key, value); + return set(component, key, value); // use defaultvalue } /** @@ -6320,14 +6342,6 @@ /** * */ - private boolean setIcon(Object component, - String key, String path, Image defaultvalue) { - return set(component, key, (path != null) ? getIcon(path) : defaultvalue); - } - - /** - * - */ private Image getIcon(Object component, String key, Image defaultvalue) { Object value = get(component, key); return (value == null) ? defaultvalue : (Image) value; @@ -6442,7 +6456,7 @@ MediaTracker mediatracker = new MediaTracker(this); mediatracker.addImage(image, 1); try { - mediatracker.waitForID(1, 50); + mediatracker.waitForID(1, 5000); } catch (InterruptedException ie) { } //imagepool.put(path, image); } |
From: <ba...@us...> - 2003-10-13 11:46:21
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv25763 Modified Files: AppletLauncher.java FrameLauncher.java Log Message: applet parameter in constructor and docs Index: AppletLauncher.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/AppletLauncher.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AppletLauncher.java 6 Jul 2003 22:48:05 -0000 1.2 +++ AppletLauncher.java 13 Oct 2003 11:46:17 -0000 1.3 @@ -1,88 +1,116 @@ -package thinlet; - -import java.applet.*; -import java.awt.*; - -/** - * Useful utility class to start Thinlet application in an applet window. - */ -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(); - } -} +/* Thinlet GUI toolkit - www.thinlet.com + * Copyright (C) 2002-2003 Robert Bajzat (rob...@th...) */ +package thinlet; + +import java.applet.*; +import java.awt.*; + +/** + * <code>AppletLauncher</code> is a double buffered applet + * to launch any <i>thinlet</i> component + */ +public class AppletLauncher extends Applet implements Runnable { + + private transient Thinlet content; + private transient Image doublebuffer; + + /** + * Applet instance is created by the browser or applet viewer + */ + public AppletLauncher() { + super(); // for javadoc + } + + /** + * Called by the browser to inform this applet that it has been loaded into + * the system, it displays the <i>Loading...</i> label and starts the loader thread + */ + public void init() { + setBackground(Color.white); setForeground(Color.darkGray); + setLayout(new BorderLayout()); + add(new Label("Loading...", Label.CENTER), BorderLayout.CENTER); + new Thread(this).start(); + } + + /** + * Create a new <i>thinlet</i> instance of the class given as + * <code>class</code> applet parameter, and show it or the + * message of the thrown exception. First try a contructor with + * an applet parameter (thus you get this applet instance e.g. for + * the parameters of the applet HTML tag), then the empty constructor + */ + public void run() { + try { + Class thinletclass = Class.forName(getParameter("class")); + try { + content = (Thinlet) thinletclass.getConstructor(new Class[] { + Applet.class }).newInstance(new Object[] { this }); + } catch (NoSuchMethodException nsme) { + content = (Thinlet) thinletclass.newInstance(); + } + removeAll(); + add(content, BorderLayout.CENTER); + } catch (Throwable exc) { + removeAll(); + add(new Label(exc.getClass().getName() + " " + + exc.getMessage(), Label.CENTER), BorderLayout.CENTER); + } + doLayout(); repaint(); + } + + /** + * Clear the double buffer image, the overriden method lays out its + * components (centers the <i>thinlet</i> component) + */ + public void doLayout() { + super.doLayout(); + if (doublebuffer != null) { + doublebuffer.flush(); + doublebuffer = null; + } + } + + /** + * Called by the browser to inform this applet that it should stop its execution, + * it clears the double buffer image + */ + public void stop() { + if (doublebuffer != null) { + doublebuffer.flush(); + doublebuffer = null; + } + } + + /** + * Call the paint method to redraw this component without painting a + * background rectangle + */ + public void update(Graphics g) { + paint(g); + } + + /** + * Create a double buffer if needed, + * the <i>thinlet</i> component paints the content + */ + 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); + } + + /** + * Called by the browser to inform this applet that it is being reclaimed, + * it calls the <i>thinlet</i> component's <code>destroy</code> method + * (its return value is irrelevant) + */ + public void destroy() { + content.destroy(); + } +} \ No newline at end of file Index: FrameLauncher.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/FrameLauncher.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FrameLauncher.java 6 Jul 2003 22:48:05 -0000 1.2 +++ FrameLauncher.java 13 Oct 2003 11:46:17 -0000 1.3 @@ -1,104 +1,116 @@ -package thinlet; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; - -/** - * Useful utility class to start a Thinlet application in AWT Frame. - */ -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(); - } - - /** - * This method calls Thinlet.destroy(), and exits only if that method - * returns true. This provides a way for programmers to perform - * cleanup tasks on exit, or disallow exiting altogether. - */ - 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) {} -} +/* Thinlet GUI toolkit - www.thinlet.com + * Copyright (C) 2002-2003 Robert Bajzat (rob...@th...) */ +package thinlet; + +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; + +/** + * <code>FrameLauncher</code> is a double buffered frame + * to launch any <i>thinlet</i> component as an application + */ +public class FrameLauncher extends Frame implements WindowListener { + + private transient Thinlet content; + private transient Image doublebuffer; + + /** + * Construct and show a new frame with the specified title, including the + * given <i>thinlet</i> component. The frame is centered on the screen, and its + * preferred size is specified (excluding the frame's borders). The icon is + * the thinlet logo + * + * @param title the title to be displayed in the frame's border + * @param content a <i>thinlet</i> instance + * @param width the preferred width of the content + * @param height the preferred height of the content + */ + 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))); + } + + /** + * Call the paint method to redraw this component without painting a + * background rectangle + */ + public void update(Graphics g) { + paint(g); + } + + /** + * Create a double buffer if needed, + * the <i>thinlet</i> component paints the content + */ + 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); + } + + /** + * Clear the double buffer image (because the frame has been resized), + * the overriden method lays out its components + * (centers the <i>thinlet</i> component) + */ + public void doLayout() { + if (doublebuffer != null) { + doublebuffer.flush(); + doublebuffer = null; + } + super.doLayout(); + } + + /** + * Notify the <i>thinlet</i> component and terminates the Java Virtual Machine, + * or redisplay the frame depending on the return value of <i>thinlet</i>'s + * <code>destroy</code> method (true by default, + * thus terminates the VM if not overriden) + */ + 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) {} +} \ No newline at end of file |
From: <ba...@us...> - 2003-10-13 11:40:37
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv24660 Modified Files: Thinlet.java Log Message: Resizable property for dialogs (see the dialog demo in drafts). Popup (of menu, or combobox) location bug fixed in scrollable dialogs. Panel border is interrupted behind its title content. Angle tree property to draw lines detailing the relationships between nodes. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Thinlet.java 18 Aug 2003 10:59:02 -0000 1.5 +++ Thinlet.java 13 Oct 2003 11:40:28 -0000 1.6 @@ -1,6567 +1,6638 @@ -/* - 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 [...13175 lines suppressed...] + "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 } } + }; + } +} \ No newline at end of file |
From: <ab...@us...> - 2003-08-18 23:42:10
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo In directory sc8-pr-cvs1:/tmp/cvs-serv13283 Modified Files: Demo.java demo.xml Log Message: Add theme editor. Index: Demo.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/Demo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Demo.java 26 Jun 2003 15:21:55 -0000 1.1 +++ Demo.java 18 Aug 2003 23:42:07 -0000 1.2 @@ -13,6 +13,34 @@ */ public class Demo extends Thinlet { + // current theme index + private int ct = 0; + // theme definitions + private int[][] defT = { + { + 0xece9d8, 0x000000, 0xf5f4f0, + 0x919b9a, 0xb0b0b0, 0xededed, + 0xb9b9b9, 0xff899a, 0xc5c5dd + }, + { + 0xe6e6e6, 0x000000, 0xffffff, + 0x909090, 0xb0b0b0, 0xededed, + 0xb9b9b9, 0x89899a, 0xc5c5dd + }, + { + 0xeeeecc, 0x000000, 0xffffff, + 0x999966, 0xb0b096, 0xededcb, + 0xcccc99, 0xcc6600, 0xffcc66 + }, + { + 0x6375d6, 0xffffff, 0x7f8fdd, + 0xd6dff5, 0x9caae5, 0x666666, + 0x003399, 0xff3333, 0x666666 + } + }; + + private int[][] t = new int[4][9]; + /** * */ @@ -20,13 +48,18 @@ try { add(parse("demo.xml")); } catch (Exception exc) { exc.printStackTrace(); } + // copy values from defaults to current + for (int i = 0; i < 4; i++) + for (int j = 0; j < 9; j++) + t[i][j] = defT[i][j]; + actionTheme("t0"); } /** * */ public static void main(String[] args) { - new FrameLauncher("Demo", new Demo(), 320, 320); + new FrameLauncher("Demo", new Demo(), 340, 340); } boolean textinit; @@ -59,26 +92,69 @@ } 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; + ct = idx.charAt(1) - '0'; + setColors( + t[ct][0], t[ct][1], t[ct][2], + t[ct][3], t[ct][4], t[ct][5], + t[ct][6], t[ct][7], t[ct][8]); + + adjustColors(null); + + } + + public void resetColors() { + for (int i = 0; i < 9; i++) + t[ct][i] = defT[ct][i]; + actionTheme("t" + ct); + } + + public void adjustColors(Object spin) { + if (spin == null) { + // set the spinboxes after theme change + for (int i = 0; i < 9; i++) { + Object sp = find(i + "_r"); + setString(sp, "text", String.valueOf(new Color(t[ct][i]).getRed())); + sp = find(i + "_g"); + setString(sp, "text", String.valueOf(new Color(t[ct][i]).getGreen())); + sp = find(i + "_b"); + setString(sp, "text", String.valueOf(new Color(t[ct][i]).getBlue())); + sp = find(i + "_h"); + setString(sp, "text", "#" + toHexString(t[ct][i])); + } + return; } + String name = getString(spin, "name"); + int idx = 0; + try { + idx = Integer.parseInt(name.substring(0, 1)); + } catch (Exception e) {}; + Color c = new Color(t[ct][idx]); + int r = c.getRed(); + int g = c.getGreen(); + int b = c.getBlue(); + int val = getInteger(spin, "value"); + if (name.endsWith("r")) { + r = val; + } else if (name.endsWith("g")) { + g = val; + } else b = val; + c = new Color(r, g, b); + t[ct][idx] = c.getRGB(); + Object sp = find(idx + "_h"); + setString(sp, "text", "#" + toHexString(t[ct][idx])); + setColors( + t[ct][0], t[ct][1], t[ct][2], + t[ct][3], t[ct][4], t[ct][5], + t[ct][6], t[ct][7], t[ct][8]); + } + + private String toHexString(int num) { + String res = Integer.toHexString(0x00ffffff & num); + int len = res.length(); + if (len < 6) for (int i = 0; i < 6 - len; i++) res = "0" + res; + return res; } + /** * */ @@ -242,7 +318,6 @@ this.pb_saturation = pb_saturation; this.pb_brightness = pb_brightness; this.rgb_label = rgb_label; - actionTheme("t0"); } /** Index: demo.xml =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/examples/demo/demo.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- demo.xml 26 Jun 2003 15:21:55 -0000 1.1 +++ demo.xml 18 Aug 2003 23:42:07 -0000 1.2 @@ -178,6 +178,80 @@ </panel> </tab> + + <tab text="Themes"> + <panel columns="3" top="4" left="4" gap="4"> + <label text="Adjust colors of the current theme" colspan="2" /> + <button text="Reset" action="resetColors"/> + <label text="Color" font="bold" halign="center"/> + <label text="R G B" font="bold" halign="center"/> + <label text="Hex value" font="bold" halign="center"/> + <separator colspan="3"/> + <label text="Panel background" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="0_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="0_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="0_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="0_h" font="courier"/> + <label text="Text foreground" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="1_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="1_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="1_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="1_h" font="courier"/> + <label text="Text background" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="2_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="2_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="2_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="2_h" font="courier"/> + <label text="Border" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="3_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="3_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="3_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="3_h" font="courier"/> + <label text="Disabled foreground" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="4_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="4_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="4_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="4_h" font="courier"/> + <label text="Hover background" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="5_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="5_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="5_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="5_h" font="courier"/> + <label text="Pressed / gradient" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="6_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="6_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="6_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="6_h" font="courier"/> + <label text="Focus" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="7_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="7_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="7_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="7_h" font="courier"/> + <label text="Selected background" alignment="right" /> + <panel gap="1"> + <spinbox columns="3" name="8_r" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="8_g" maximum="255" text="0" action="adjustColors(this)" /> + <spinbox columns="3" name="8_b" maximum="255" text="0" action="adjustColors(this)" /> + </panel> + <label text="" name="8_h" font="courier"/> + </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"> |
From: <ab...@us...> - 2003-08-18 11:04:23
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv2493 Modified Files: Thinlet.java Log Message: Fix a textarea bug which was affecting cursor and selection positioning. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Thinlet.java 8 Aug 2003 20:32:34 -0000 1.4 +++ Thinlet.java 18 Aug 2003 10:59:02 -0000 1.5 @@ -4115,7 +4115,7 @@ if (!multiline) { mx += getInteger(component, ":offset", 0); } else { - Rectangle view = getRectangle(component, ":view"); + Rectangle view = getRectangle(component, ":port"); mx += view.x - 1; my = y - referencey + view.y - 1; } @@ -4141,7 +4141,7 @@ if (!multiline) { mx += getInteger(component, ":offset", 0); } else { - Rectangle view = getRectangle(component, ":view"); + Rectangle view = getRectangle(component, ":port"); mx += view.x - 1; my = y - referencey + view.y - 1; } |
From: <ab...@us...> - 2003-08-08 20:32:38
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv31440 Modified Files: Thinlet.java Log Message: Fix spinbox bugs: * disable non-numeric input * re-parse text value when getting latest integer value Reported by: pb...@ds... (Paul Becker) Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Thinlet.java 8 Jul 2003 01:29:01 -0000 1.3 +++ Thinlet.java 8 Aug 2003 20:32:34 -0000 1.4 @@ -3400,6 +3400,14 @@ return false; } if (insert != null) { + if (getClass(component).equals("spinbox") && !insert.equals("")) { + // allow only numeric values + try { + Integer.parseInt(insert); + } catch(NumberFormatException e) { + return false; + } + } int min = Math.min(movestart, moveend); set(component, "text", text.substring(0, min) + insert + text.substring(Math.max(movestart, moveend))); @@ -5981,6 +5989,16 @@ * Gets the int attribute value of the given component by the attribute key */ public int getInteger(Object component, String key) { + String classname = getClass(component); + // special case for spinbox - try to parse text to get the current value + // if it fails, then return last good value + if (classname.equals("spinbox") && key.equals("value")) { + try { + return Integer.parseInt((String)get(component, "text", "string")); + } catch (NumberFormatException e) { + // fall-through + } + } return ((Integer) get(component, key, "integer")).intValue(); } |
From: <ab...@us...> - 2003-07-11 21:55:37
|
Update of /cvsroot/thinlet/thinlet/doc In directory sc8-pr-cvs1:/tmp/cvs-serv27674 Added Files: index.html Log Message: Add a trivial index of documentation. If you think it's ugly, you're right, and maybe it's waiting for your contribution... --- NEW FILE: index.html --- <html> <head> <title>Thinlet Documentation</title> </head> <body> <center><h1>Thinlet Documentation</h1></center> <ul> <li><a href="api/index.html">JavaDoc API</a></li> <li><a href="widget/index.html">Thinlet Widget Documentation</a></li> </ul> </body> </html> |
From: <ab...@us...> - 2003-07-08 01:31:15
|
Update of /cvsroot/thinlet/thinlet/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9986 Modified Files: thinlet.drafts.jar thinlet.examples.jar thinlet.icons.jar thinlet.jar Log Message: Re-gen after change. This now becomes BETA6. Index: thinlet.drafts.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.drafts.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsPd0zj0 and /tmp/cvs6utveQ differ Index: thinlet.examples.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.examples.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvscW6oi1 and /tmp/cvskR6RdS differ Index: thinlet.icons.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.icons.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvs9yVo43 and /tmp/cvsidy8PX differ Index: thinlet.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsmsiM64 and /tmp/cvsS0NsKZ differ |
From: <ab...@us...> - 2003-07-08 01:29:05
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv9713 Modified Files: Thinlet.java Log Message: Fix for table scrolling bug, contributed by Tim Dwelle - thank you! (Note: this is a workaround, repaint(Object, Object, Object) needs to be fixed to properly account for table headers) Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Thinlet.java 3 Jul 2003 11:21:25 -0000 1.2 +++ Thinlet.java 8 Jul 2003 01:29:01 -0000 1.3 @@ -2287,18 +2287,23 @@ for (int i = 0; i < columnwidths.length; i++) { if (i != 0) { column = get(column, ":next"); } boolean lastcolumn = (i == columnwidths.length - 1); - int width = lastcolumn ? (port.width - x + 2) : columnwidths[i]; - paintRect(g, x - view.x, 0, width, port.y - 1, - enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, - true, true, false, lastcolumn, true); - paintContent(column, g, clipx, clipy, clipwidth, clipheight, - x + 2 - view.x, 1, width - 2, - port.y - 3, enabled ? c_text : c_disable, "left", false); + int width = lastcolumn ? Math.max(port.width - x, columnwidths[i]) + 2 : columnwidths[i]; + if (x - view.x + Math.min(port.width - (x - view.x), width) > 0 && + Math.max(0, x - view.x) <= port.width) { + int truncwidth = (port.width - (x - view.x)) + 2; + if (truncwidth > width) truncwidth = -1; + paintRect(g, Math.max(0, x - view.x), 0, (truncwidth > 0)? truncwidth: (lastcolumn? width : Math.min(port.width - (x - view.x), width)), port.y - 1, + enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, + true, true, false, lastcolumn || (truncwidth > 0), true); + paintContent(column, g, clipx, clipy, clipwidth, clipheight, + x + 2 - view.x, 1, width - 2, + port.y - 3, enabled ? c_text : c_disable, "left", false); - Object sort = get(column, "sort"); // "none", "ascent", "descent" - if (sort != null) { - paintArrow(g, x - view.x + width - block, 0, block, port.y, - (sort == "ascent") ? 'S' : 'N'); + Object sort = get(column, "sort"); // "none", "ascent", "descent" + if (sort != null) { + paintArrow(g, x - view.x + width - block, 0, block, port.y, + (sort == "ascent") ? 'S' : 'N'); + } } x += width; } @@ -3432,6 +3437,14 @@ return true; } } + else if (keycode == KeyEvent.VK_LEFT) { + processScroll(component, "left"); + return true; + } + else if (keycode == KeyEvent.VK_RIGHT) { + processScroll(component, "right"); + return true; + } else if (keychar == KeyEvent.VK_SPACE) { // select the current item select(component, get(component, ":lead"), recursive, shiftdown, controldown); //... return true; @@ -4219,6 +4232,9 @@ if (view.x != viewx) { view.x = viewx; repaint(component, null, "horizontal"); + // XXX needed for tables, because table headers are not included in the + // XXX repaint area. Needs to be fixed in repaint(Object, Object, Object). + repaint(component); } } else { // (part == "vknob") @@ -4272,6 +4288,9 @@ if ((dx == 0) && (dy == 0)) { return false; } view.x += dx; view.y += dy; repaint(component, null, (dx != 0) ? "horizontal" : "vertical"); + // XXX needed for tables, because table headers are not included in the + // XXX repaint area. Needs to be fixed in repaint(Object, Object, Object). + repaint(component); return (((part == "left") || (part == "lefttrack")) && (view.x > 0)) || (((part == "right") || (part == "righttrack")) && (view.x < view.width - port.width)) || |
From: <ab...@us...> - 2003-07-06 22:48:09
|
Update of /cvsroot/thinlet/thinlet/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15119/lib Modified Files: thinlet.drafts.jar thinlet.examples.jar thinlet.icons.jar thinlet.jar Log Message: Minor cleanups and javadoc additions in preparation for release. Index: thinlet.drafts.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.drafts.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsipeS4o and /tmp/cvsycUzLD differ Index: thinlet.examples.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.examples.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsjwXPYp and /tmp/cvsseguzF differ Index: thinlet.icons.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.icons.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsIVh7Lq and /tmp/cvskzmThH differ Index: thinlet.jar =================================================================== RCS file: /cvsroot/thinlet/thinlet/lib/thinlet.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsp1QN3t and /tmp/cvsgKDVFN differ |
From: <ab...@us...> - 2003-07-06 22:48:09
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv15119/src/java/thinlet Modified Files: AppletLauncher.java FrameLauncher.java Widget.java Added Files: ThinletConstants.java Log Message: Minor cleanups and javadoc additions in preparation for release. --- NEW FILE: ThinletConstants.java --- package thinlet; /** * WORK IN PROGRESS - DON'T USE * Eventually all string literals used for widget names and their * properties will be defined here... */ public interface ThinletConstants { public static final String NAME = "name"; public static final String ENABLED = "enabled"; public static final String VISIBLE = "visible"; public static final String TOOLTIP = "tooltip"; public static final String FONT = "font"; public static final String FOREGROUND = "foreground"; public static final String BACKGROUND = "background"; public static final String WIDTH = "width"; public static final String HEIGHT = "height"; public static final String COLSPAN = "colspan"; public static final String ROWSPAN = "rowspan"; public static final String WEIGHTX = "weightx"; public static final String WEIGHTY = "weighty"; public static final String HALIGN = "halign"; public static final String VALIGN = "valign"; public static final String PROPERTY = "property"; public static final String INIT = "init"; public static final String LABEL = "label"; public static final String TEXT = "text"; public static final String ICON = "icon"; public static final String ALIGNMENT = "alignment"; public static final String MNEMONIC = "mnemonic"; public static final String FOR = "for"; public static final String BUTTON = "button"; public static final String ACTION = "action"; public static final String TYPE = "type"; public static final String CHECKBOX = "checkbox"; public static final String SELECTED = "selected"; public static final String GROUP = "group"; public static final String TOGGLEBUTTON = "togglebutton"; public static final String COMBOBOX = "combobox"; public static final String CHOICE = "choice"; public static final String TEXTFIELD = "textfield"; public static final String COLUMNS = "columns"; public static final String EDITABLE = "editable"; public static final String START = "start"; public static final String END = "end"; public static final String INSERT = "insert"; public static final String REMOVE = "remove"; public static final String CARET = "caret"; public static final String PERFORM = "perform"; public static final String PASSWORDFIELD = "passwordfield"; public static final String TEXTAREA = "textarea"; public static final String ROWS = "rows"; public static final String WRAP = "wrap"; public static final String TABBEDPANE = "tabbedpane"; public static final String PLACEMENT = "placement"; public static final String TAB = "tab"; public static final String PANEL = "panel"; public static final String TOP = "top"; public static final String LEFT = "left"; public static final String BOTTOM = "bottom"; public static final String RIGHT = "right"; public static final String GAP = "gap"; public static final String BORDER = "border"; public static final String SCROLLABLE = "scrollable"; public static final String DESKTOP = "desktop"; public static final String DIALOG = "dialog"; public static final String MODAL = "modal"; public static final String SPINBOX = "spinbox"; public static final String PROGRESSBAR = "progressbar"; public static final String ORIENTATION = "orientation"; public static final String MINIMUM = "minimum"; public static final String MAXIMUM = "maximum"; public static final String VALUE = "value"; public static final String SLIDER = "slider"; public static final String UNIT = "unit"; public static final String BLOCK = "block"; public static final String SPLITPANE = "splitpane"; public static final String DIVIDER = "divider"; public static final String LIST = "list"; public static final String SELECTION = "selection"; public static final String LINE = "line"; public static final String ITEM = "item"; public static final String TABLE = "table"; public static final String HEADER = "header"; public static final String COLUMN = "column"; public static final String SORT = "sort"; public static final String ROW = "row"; public static final String CELL = "cell"; public static final String TREE = "tree"; public static final String EXPAND = "expand"; public static final String COLLAPSE = "collapse"; public static final String NODE = "node"; public static final String EXPANDED = "expanded"; public static final String SEPARATOR = "separator"; public static final String MENUBAR = "menubar"; public static final String MENU = "menu"; public static final String MENUITEM = "menuitem"; public static final String ACCELERATOR = "accelerator"; public static final String CHECKBOXMENUITEM = "checkboxmenuitem"; public static final String POPUPMENU = "popupmenu"; public static final String BEAN = "bean"; } Index: AppletLauncher.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/AppletLauncher.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AppletLauncher.java 26 Jun 2003 15:21:54 -0000 1.1 +++ AppletLauncher.java 6 Jul 2003 22:48:05 -0000 1.2 @@ -4,7 +4,7 @@ import java.awt.*; /** - * + * Useful utility class to start Thinlet application in an applet window. */ public class AppletLauncher extends Applet implements Runnable { Index: FrameLauncher.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/FrameLauncher.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FrameLauncher.java 26 Jun 2003 15:21:54 -0000 1.1 +++ FrameLauncher.java 6 Jul 2003 22:48:05 -0000 1.2 @@ -5,7 +5,7 @@ import java.awt.image.*; /** - * + * Useful utility class to start a Thinlet application in AWT Frame. */ public class FrameLauncher extends Frame implements WindowListener { @@ -84,7 +84,9 @@ } /** - * + * This method calls Thinlet.destroy(), and exits only if that method + * returns true. This provides a way for programmers to perform + * cleanup tasks on exit, or disallow exiting altogether. */ public void windowClosing(WindowEvent e) { if (content.destroy()) { @@ -92,6 +94,7 @@ } setVisible(true); } + public void windowOpened(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowIconified(WindowEvent e) {} Index: Widget.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Widget.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Widget.java 26 Jun 2003 15:21:54 -0000 1.1 +++ Widget.java 6 Jul 2003 22:48:05 -0000 1.2 @@ -3,7 +3,9 @@ import java.awt.*; /** - * + * WORK IN PROGRESS - DON'T USE. + * Eventually this class will encapsulate most of the widget-related API + * now implemented in Thinlet.java. */ public class Widget { |