Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/table/client/RadioCellEditor.java

Diff revisions: vs.
  @@ -15,19 +15,18 @@
15 15 */
16 16 package com.google.gwt.gen2.table.client;
17 17
18 - import java.util.*;
19 -
20 18 import com.google.gwt.core.client.*;
21 19 import com.google.gwt.user.client.ui.*;
22 20
21 + import java.util.*;
22 +
23 23 /**
24 24 * An {@link InlineCellEditor} that allows the user to select a {@link String}
25 25 * from a list of {@link RadioButton RadioButtons}.
26 26 *
27 27 * @param <ColType> the data type of the column
28 28 */
29 - public class RadioCellEditor<ColType> extends InlineCellEditor<ColType>
30 - {
29 + public class RadioCellEditor<ColType> extends InlineCellEditor<ColType> {
31 30 /**
32 31 * A mapping of {@link RadioButton RadioButtons} to the value for the buttons.
33 32 */
  @@ -41,8 +40,7 @@
41 40 /**
42 41 * Construct a new {@link RadioCellEditor}.
43 42 */
44 - public RadioCellEditor()
45 - {
43 + public RadioCellEditor() {
46 44 this( GWT.<InlineCellEditorImages>create( InlineCellEditorImages.class ) );
47 45 }
48 46
  @@ -51,8 +49,7 @@
51 49 *
52 50 * @param images the images to use for the accept/cancel buttons
53 51 */
54 - public RadioCellEditor( InlineCellEditorImages images )
55 - {
52 + public RadioCellEditor( InlineCellEditorImages images ) {
56 53 this( new VerticalPanel(), images );
57 54 }
58 55
  @@ -61,8 +58,7 @@
61 58 *
62 59 * @param images the images to use for the accept/cancel buttons
63 60 */
64 - private RadioCellEditor( VerticalPanel vPanel, InlineCellEditorImages images )
65 - {
61 + private RadioCellEditor( VerticalPanel vPanel, InlineCellEditorImages images ) {
66 62 super( vPanel, images );
67 63 this.vpanel = vPanel;
68 64 }
  @@ -73,22 +69,18 @@
73 69 * @param radio the radio button to add
74 70 * @param value the value associated with the {@link RadioButton}
75 71 */
76 - public void addRadioButton( RadioButton radio, ColType value )
77 - {
72 + public void addRadioButton( RadioButton radio, ColType value ) {
78 73 vpanel.add( radio );
79 74 radioMap.put( radio, value );
80 75 }
81 76
82 77 @Override
83 - public void editCell( CellEditInfo cellEditInfo, ColType cellValue, Callback<ColType> callback )
84 - {
78 + public void editCell( CellEditInfo cellEditInfo, ColType cellValue, Callback<ColType> callback ) {
85 79 super.editCell( cellEditInfo, cellValue, callback );
86 80 Iterator<Widget> it = vpanel.iterator();
87 - while ( it.hasNext() )
88 - {
81 + while ( it.hasNext() ) {
89 82 RadioButton radio = (RadioButton) it.next();
90 - if ( radio.getValue() )
91 - {
83 + if ( radio.getValue() ) {
92 84 radio.setFocus( true );
93 85 return;
94 86 }
  @@ -106,8 +98,7 @@
106 98 * range
107 99 */
108 100 public void insertRadioButton( RadioButton radio, ColType value, int beforeIndex )
109 - throws IndexOutOfBoundsException
110 - {
101 + throws IndexOutOfBoundsException {
111 102 vpanel.insert( radio, beforeIndex );
112 103 radioMap.put( radio, value );
113 104 }
  @@ -117,21 +108,17 @@
117 108 *
118 109 * @param radio the radio button to remove
119 110 */
120 - public void removeRadioButton( RadioButton radio )
121 - {
111 + public void removeRadioButton( RadioButton radio ) {
122 112 vpanel.remove( radio );
123 113 radioMap.remove( radio );
124 114 }
125 115
126 116 @Override
127 - protected ColType getValue()
128 - {
117 + protected ColType getValue() {
129 118 Iterator<Widget> it = vpanel.iterator();
130 - while ( it.hasNext() )
131 - {
119 + while ( it.hasNext() ) {
132 120 RadioButton radio = (RadioButton) it.next();
133 - if ( radio.getValue() )
134 - {
121 + if ( radio.getValue() ) {
135 122 return radioMap.get( radio );
136 123 }
137 124 }
  @@ -139,16 +126,11 @@
139 126 }
140 127
141 128 @Override
142 - protected void setValue( ColType cellValue )
143 - {
144 - for ( Map.Entry<RadioButton, ColType> entry : radioMap.entrySet() )
145 - {
146 - if ( entry.getValue().equals( cellValue ) )
147 - {
129 + protected void setValue( ColType cellValue ) {
130 + for ( Map.Entry<RadioButton, ColType> entry : radioMap.entrySet() ) {
131 + if ( entry.getValue().equals( cellValue ) ) {
148 132 entry.getKey().setValue( true );
149 - }
150 - else
151 - {
133 + } else {
152 134 entry.getKey().setValue( false );
153 135 }
154 136 }