[Thinlet-development] thinlet/src/java/thinlet Thinlet.java,1.22,1.23
Brought to you by:
bajzat
From: Michael N. S. <sou...@us...> - 2005-01-19 03:02:26
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18207 Modified Files: Thinlet.java Log Message: Lock up problem with lists/tables fixed. Since it used to affect tree, the new code checks explicitly for tree/node and behaves as before. Simple test case: package thinlet; public class TestCase extends Thinlet { public TestCase() throws Exception { add(parse("testcase.xml")); } public void recreateTable(Object dynamic) { removeAll(dynamic); for (int i = 0; i < 5; i++) { Object row = create("row"); for (int j = 0; j <= 1; j++) { Object cell = create("cell"); setString(cell, "text", String.valueOf(j)); add(row, cell); } add(dynamic, row); } } public static void main(String[] args) throws Exception { new FrameLauncher("", new TestCase(), 800, 600); } } <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE panel SYSTEM 'https://thinlet.dev.java.net/thinlet.dtd'> <panel columns="1" weighty="1" weightx="1"> <tree selection="multiple" weighty="1" weightx="1"> <node text="Node A" icon="image.gif" selected="true"> <node text="Node B" icon="image.gif" /> <node text="Node C" icon="image.gif" /> </node> <node text="Node D" expanded="false"> <node text="Node E" icon="image.gif" /> </node> </tree> <table name="dynamic" weighty="1" weightx="1"> <header> <column text="First" /> <column text="Second" /> </header> <row> <cell text="1" /> <cell text="2" /> </row> <row> <cell text="1" /> <cell text="2" /> </row> </table> <button action="recreateTable(dynamic)" text="Recreate" mnemonic="0"/> </panel> Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Thinlet.java 18 Jan 2005 15:57:16 -0000 1.22 +++ Thinlet.java 19 Jan 2005 03:02:02 -0000 1.23 @@ -2235,9 +2235,12 @@ // ("tree" // == classname)) Object lead = get(component, ":lead"); - //if (getIndex(component, lead) == -1) { - // set(component, ":lead", lead = null); - //} + + if ("tree" != classname && "node" != classname && + 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; @@ -3460,9 +3463,13 @@ (keycode == KeyEvent.VK_DOWN) || (keycode == KeyEvent.VK_PAGE_UP) || (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); - //} + + String classname = getClass(component); + if ("tree" != classname && "node" != classname && + 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"); |