Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/UIdesign/src/com/test/uidesign/client/TestTable.java

Diff revisions: vs.
  @@ -4,67 +4,55 @@
4 4
5 5 import com.google.gwt.user.client.ui.*;
6 6
7 - public class TestTable
8 - {
9 - public static class RowObject
10 - {
7 + public class TestTable {
8 + public static class RowObject {
11 9 private static int nextID = 0;
12 10
13 11 private int mID;
14 12 private String mName;
15 13 private String mDescription;
16 14
17 - public RowObject( String pName, String pDescription )
18 - {
19 - synchronized ( RowObject.class )
20 - {
15 + public RowObject( String pName, String pDescription ) {
16 + synchronized ( RowObject.class ) {
21 17 mID = nextID++;
22 18 }
23 19 mName = pName;
24 20 mDescription = pDescription;
25 21 }
26 22
27 - public Integer getID()
28 - {
23 + public Integer getID() {
29 24 return mID;
30 25 }
31 26
32 - public String getName()
33 - {
27 + public String getName() {
34 28 return mName;
35 29 }
36 30
37 - public String getDescription()
38 - {
31 + public String getDescription() {
39 32 return mDescription;
40 33 }
41 34
42 35 @Override
43 - public String toString()
44 - {
36 + public String toString() {
45 37 return mName;
46 38 }
47 39
48 40 @Override
49 - public int hashCode()
50 - {
41 + public int hashCode() {
51 42 return mID;
52 43 }
53 44
54 - public boolean equals( RowObject them )
55 - {
45 + public boolean equals( RowObject them ) {
56 46 return (this == them) || ((them != null) && (this.mID == them.mID));
57 47 }
58 48
59 49 @Override
60 - public boolean equals( Object o )
61 - {
50 + public boolean equals( Object o ) {
62 51 return (this == o) || ((o instanceof RowObject) && equals( (RowObject) o ));
63 52 }
64 53 }
65 54
66 - public static Widget create()
67 - {
55 + public static Widget create() {
68 56 ListTableModel<RowObject> zListTableModel = new ListTableModel<RowObject>();
69 57 zListTableModel.add( new RowObject( "Fred", "Comedic Lead" ) );
70 58 zListTableModel.add( new RowObject( "Wilma", "Fred's Better 5/6" ) );
  @@ -73,33 +61,25 @@
73 61 zListTableModel.add( new RowObject( "Pebbles", "Spawn of Fred & Wilma" ) );
74 62 zListTableModel.add( new RowObject( "Bam Bam", "Adopted Son of Barney & Betty" ) );
75 63
76 - return new SingleSelectRegularTable<RowObject>( zListTableModel, new TableDef(), new TableClickCommand<RowObject>()
77 - {
64 + return new SingleSelectRegularTable<RowObject>( zListTableModel, new TableDef(), new TableClickCommand<RowObject>() {
78 65 @Override
79 - public void execute( RowObject pRowValue )
80 - {
66 + public void execute( RowObject pRowValue ) {
81 67 System.out.println( "Clicked: " + pRowValue );
82 68 }
83 69 } );
84 70 }
85 71
86 - private static class TableDef extends TableDefinitionPlus<RowObject>
87 - {
88 - public TableDef()
89 - {
90 - addColumnDefinition( new TableColumnDefinition<RowObject>( "Name" )
91 - {
72 + private static class TableDef extends TableDefinitionPlus<RowObject> {
73 + public TableDef() {
74 + addColumnDefinition( new TableColumnDefinition<RowObject>( "Name" ) {
92 75 @Override
93 - public Object getCellValue( RowObject rowValue )
94 - {
76 + public Object getCellValue( RowObject rowValue ) {
95 77 return rowValue.getName();
96 78 }
97 79 } );
98 - addColumnDefinition( new TableColumnDefinition<RowObject>( "Description" )
99 - {
80 + addColumnDefinition( new TableColumnDefinition<RowObject>( "Description" ) {
100 81 @Override
101 - public Object getCellValue( RowObject rowValue )
102 - {
82 + public Object getCellValue( RowObject rowValue ) {
103 83 return rowValue.getDescription();
104 84 }
105 85 } );