1 package thinlet.drafts; 2 3 import thinlet.*; 4 5 public class Lists { 6 7 public void listSelectionChanged(Thinlet thinlet, Object list, Object button) { 8 thinlet.setBoolean(button, "enabled", thinlet.getSelectedIndex(list) != -1); 9 } 10 11 public void moveListItem(Thinlet thinlet, Object sourcelist, Object targetlist) { 12 Object [] items = thinlet.getSelectedItems(sourcelist); 13 for (int i = 0; i < items.length; i++) { 14 thinlet.remove(items[i]); 15 thinlet.add(targetlist, items[i]); 16 } 17 } 18 19 public void addTableRows(Thinlet thinlet, Object table) { 20 for (int i = 1; i <= 30 ; i++) { 21 Object row = Thinlet.create("row"); 22 for (int j = 1; j <= 3; j++) { 23 Object cell = Thinlet.create("cell"); 24 thinlet.setString(cell, "text", "Cell-" + i + "-" + j); 25 thinlet.add(row, cell); 26 } 27 thinlet.add(table, row); 28 } 29 } 30 public void clearTable(Thinlet thinlet, Object table) { 31 thinlet.removeAll(table); 32 } 33 } | Popular Tags |