summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-04-13 10:52:19 +0300
committerIlia Motornyi <elmot@vaadin.com>2017-04-13 09:52:19 +0200
commit22c39d36f81a6d37f729d67135487ef10cb8dc5a (patch)
treef4697f175a44753e59ae47be00c3f72cd3bf21c6 /client
parent71e4d797fe6a3629f9e489b06e2566e139577bfd (diff)
downloadvaadin-framework-22c39d36f81a6d37f729d67135487ef10cb8dc5a.tar.gz
vaadin-framework-22c39d36f81a6d37f729d67135487ef10cb8dc5a.zip
Correctly set ListSelect style names
Fixes #8901
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VListSelect.java29
1 files changed, 10 insertions, 19 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VListSelect.java b/client/src/main/java/com/vaadin/client/ui/VListSelect.java
index 9ce897de0e..b00a9513f1 100644
--- a/client/src/main/java/com/vaadin/client/ui/VListSelect.java
+++ b/client/src/main/java/com/vaadin/client/ui/VListSelect.java
@@ -30,6 +30,7 @@ import com.vaadin.client.FastStringSet;
import com.vaadin.client.Focusable;
import com.vaadin.client.connectors.AbstractMultiSelectConnector.MultiSelectWidget;
import com.vaadin.shared.Registration;
+import com.vaadin.shared.ui.listselect.ListSelectState;
import elemental.json.JsonObject;
@@ -57,6 +58,7 @@ public class VListSelect extends Composite
*/
public VListSelect() {
container = new FlowPanel();
+
initWidget(container);
select = new ListBox();
@@ -71,6 +73,13 @@ public class VListSelect extends Composite
container.add(select);
updateEnabledState();
+ setStylePrimaryName(ListSelectState.PRIMARY_STYLENAME);
+ }
+
+ @Override
+ public void setStylePrimaryName(String style) {
+ super.setStylePrimaryName(style);
+ select.setStyleName(style + "-select");
}
/**
@@ -105,24 +114,6 @@ public class VListSelect extends Composite
}
@Override
- public void setStyleName(String style) {
- super.setStyleName(style);
- updateStyleNames();
- }
-
- @Override
- public void setStylePrimaryName(String style) {
- super.setStylePrimaryName(style);
- updateStyleNames();
- }
-
- /** Update the style names for container & select. */
- protected void updateStyleNames() {
- container.setStyleName(getStylePrimaryName());
- select.setStyleName(getStylePrimaryName() + "-select");
- }
-
- @Override
public void setItems(List<JsonObject> items) {
selectedItemKeys = FastStringSet.create();
for (int i = 0; i < items.size(); i++) {
@@ -163,7 +154,7 @@ public class VListSelect extends Composite
return selectedItemKeys;
}
- private void selectionEvent(Object source){
+ private void selectionEvent(Object source) {
if (source == select) {
// selection can change by adding and at the same time removing
// previous keys, or by just adding (e.g. when modifier keys are