Skip to content

Commit 56c8ebc

Browse files
committed
Resolve #500
1 parent 09c88b0 commit 56c8ebc

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

gwt-material/src/main/java/gwt/material/design/client/ui/html/Option.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public int getIndex() {
6565
return OptionElement.as(this.getElement()).getIndex();
6666
}
6767

68-
;
69-
7068
/**
7169
* Option label for use in hierarchical menus.
7270
*
@@ -130,8 +128,6 @@ public boolean isSelected() {
130128
return OptionElement.as(this.getElement()).isSelected();
131129
}
132130

133-
;
134-
135131
/**
136132
* Represents the value of the HTML selected attribute. The value of this
137133
* attribute does not change if the state of the corresponding form control,
@@ -145,8 +141,6 @@ public void setDefaultSelected(boolean selected) {
145141
OptionElement.as(this.getElement()).setDefaultSelected(selected);
146142
}
147143

148-
;
149-
150144
/**
151145
* The control is unavailable in this context.
152146
*
@@ -158,8 +152,6 @@ public void setDisabled(boolean disabled) {
158152
OptionElement.as(this.getElement()).setDisabled(disabled);
159153
}
160154

161-
;
162-
163155
/**
164156
* Option label for use in hierarchical menus.
165157
*
@@ -199,4 +191,9 @@ public void setValue(String value) {
199191
OptionElement.as(this.getElement()).setValue(value);
200192
}
201193

194+
@Override
195+
public void setEnabled(boolean enabled) {
196+
super.setEnabled(enabled);
197+
setDisabled(!enabled);
198+
}
202199
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2016 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.client.ui.base.helper;
21+
22+
import gwt.material.design.client.base.helper.ColorHelper;
23+
import gwt.material.design.client.base.helper.EnumHelper;
24+
import gwt.material.design.client.base.helper.StyleHelper;
25+
import gwt.material.design.client.constants.Color;
26+
import junit.framework.TestCase;
27+
28+
/**
29+
* Test case for {@link EnumHelper}.
30+
*/
31+
public class EnumHelperTest extends TestCase {
32+
33+
public EnumHelperTest() {
34+
checkFromStyleName();
35+
}
36+
37+
private void checkFromStyleName() {
38+
assertEquals(Color.PINK,
39+
EnumHelper.fromStyleName("pink", Color.class, Color.DEFAULT));
40+
41+
assertEquals(Color.PINK,
42+
EnumHelper.fromStyleName("pink lighten-1", Color.class, Color.DEFAULT));
43+
44+
assertEquals(Color.PINK_LIGHTEN_1,
45+
EnumHelper.fromStyleName("pink lighten-1", Color.class, Color.DEFAULT, true));
46+
}
47+
}

0 commit comments

Comments
 (0)