svn changeset:9124/svn branch:6.2tags/6.7.0.beta1
@@ -1,5 +1,6 @@ | |||
.v-datefield { | |||
white-space: nowrap; | |||
float: left; /* Force minimum width */ | |||
} | |||
.v-datefield-textfield { | |||
vertical-align: top; |
@@ -55,11 +55,11 @@ | |||
font-style: italic; | |||
} | |||
.v-filterselect-button { | |||
float: right; | |||
cursor: pointer; | |||
float: right; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-button { | |||
display: none; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #fff; |
@@ -454,6 +454,7 @@ div.v-app-loading { | |||
.v-datefield { | |||
white-space: nowrap; | |||
float: left; /* Force minimum width */ | |||
} | |||
.v-datefield-textfield { | |||
vertical-align: top; | |||
@@ -886,11 +887,11 @@ div.v-progressindicator-indeterminate-disabled { | |||
font-style: italic; | |||
} | |||
.v-filterselect-button { | |||
float: right; | |||
cursor: pointer; | |||
float: right; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-button { | |||
display: none; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #fff; |
@@ -454,6 +454,7 @@ div.v-app-loading { | |||
.v-datefield { | |||
white-space: nowrap; | |||
float: left; /* Force minimum width */ | |||
} | |||
.v-datefield-textfield { | |||
vertical-align: top; | |||
@@ -886,11 +887,11 @@ div.v-progressindicator-indeterminate-disabled { | |||
font-style: italic; | |||
} | |||
.v-filterselect-button { | |||
float: right; | |||
cursor: pointer; | |||
float: right; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-button { | |||
display: none; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #fff; |
@@ -53,11 +53,8 @@ | |||
} | |||
.v-disabled .v-filterselect-button:hover, | |||
.v-readonly .v-filterselect-button:hover { | |||
background-position: top left; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-input { | |||
background: transparent; | |||
color: black; | |||
background-position: top left; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #f6f7f7; |
@@ -454,6 +454,7 @@ div.v-app-loading { | |||
.v-datefield { | |||
white-space: nowrap; | |||
float: left; /* Force minimum width */ | |||
} | |||
.v-datefield-textfield { | |||
vertical-align: top; | |||
@@ -886,11 +887,11 @@ div.v-progressindicator-indeterminate-disabled { | |||
font-style: italic; | |||
} | |||
.v-filterselect-button { | |||
float: right; | |||
cursor: pointer; | |||
float: right; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-button { | |||
display: none; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #fff; | |||
@@ -2413,10 +2414,7 @@ div.v-tree-node-leaf { | |||
.v-disabled .v-filterselect-button:hover, | |||
.v-readonly .v-filterselect-button:hover { | |||
background-position: top left; | |||
} | |||
.v-filterselect.v-readonly .v-filterselect-input { | |||
background: transparent; | |||
color: black; | |||
cursor: default; | |||
} | |||
.v-filterselect-suggestpopup { | |||
background: #f6f7f7; |
@@ -594,6 +594,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
private boolean nullSelectionAllowed; | |||
private boolean nullSelectItem; | |||
private boolean enabled; | |||
private boolean readonly; | |||
// shown in unfocused empty field, disappears on focus (e.g "Search here") | |||
private static final String CLASSNAME_PROMPT = "prompt"; | |||
@@ -683,16 +684,11 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
paintableId = uidl.getId(); | |||
this.client = client; | |||
boolean readonly = uidl.hasAttribute("readonly"); | |||
boolean disabled = uidl.hasAttribute("disabled"); | |||
readonly = uidl.hasAttribute("readonly"); | |||
enabled = !uidl.hasAttribute("disabled"); | |||
if (disabled || readonly) { | |||
tb.setEnabled(false); | |||
enabled = false; | |||
} else { | |||
tb.setEnabled(true); | |||
enabled = true; | |||
} | |||
tb.setEnabled(enabled); | |||
tb.setReadOnly(readonly); | |||
if (client.updateComponent(this, uidl, true)) { | |||
return; | |||
@@ -887,7 +883,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
} | |||
public void onKeyDown(KeyDownEvent event) { | |||
if (enabled) { | |||
if (enabled && !readonly) { | |||
if (suggestionPopup.isAttached()) { | |||
popupKeyDown(event); | |||
} else { | |||
@@ -956,7 +952,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
} | |||
public void onKeyUp(KeyUpEvent event) { | |||
if (enabled) { | |||
if (enabled && !readonly) { | |||
switch (event.getNativeKeyCode()) { | |||
case KeyCodes.KEY_ENTER: | |||
case KeyCodes.KEY_TAB: | |||
@@ -996,7 +992,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
* Listener for popupopener | |||
*/ | |||
public void onClick(ClickEvent event) { | |||
if (enabled) { | |||
if (enabled && !readonly) { | |||
// ask suggestionPopup if it was just closed, we are using GWT | |||
// Popup's auto close feature | |||
if (!suggestionPopup.isJustClosed()) { |
@@ -2,47 +2,34 @@ package com.vaadin.tests.components.combobox; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.ComboBox; | |||
import com.vaadin.ui.VerticalLayout; | |||
public class ComboBoxValueInput extends TestBase { | |||
@Override | |||
protected void setup() { | |||
ComboBox cb = new ComboBox("A combobox without input prompt"); | |||
cb.setImmediate(true); | |||
cb.addItem("Value 1"); | |||
cb.addItem("Value 2"); | |||
cb.addItem("Value 3"); | |||
((VerticalLayout) getLayout()).setSpacing(true); | |||
ComboBox cb = getComboBox("A combobox", false); | |||
addComponent(cb); | |||
cb = new ComboBox("A combobox with input prompt"); | |||
cb = getComboBox("A combobox with input prompt", false); | |||
cb.setInputPrompt("Please select"); | |||
cb.setImmediate(true); | |||
cb.addItem("Value 1"); | |||
cb.addItem("Value 2"); | |||
cb.addItem("Value 3"); | |||
addComponent(cb); | |||
cb = getComboBox("A combobox with null item", true); | |||
addComponent(cb); | |||
cb = new ComboBox("A combobox with null item"); | |||
cb = getComboBox("A combobox with null item and input prompt", true); | |||
cb.setInputPrompt("Please select"); | |||
cb.setImmediate(true); | |||
cb.addItem("Null item"); | |||
cb.addItem("Value 1"); | |||
cb.addItem("Value 2"); | |||
cb.addItem("Value 3"); | |||
cb.setNullSelectionItemId("Null item"); | |||
addComponent(cb); | |||
cb = new ComboBox("A combobox with null item and input prompt"); | |||
cb.setImmediate(true); | |||
cb.addItem("Null item"); | |||
cb.addItem("Value 1"); | |||
cb.addItem("Value 2"); | |||
cb.addItem("Value 3"); | |||
cb.setNullSelectionItemId("Null item"); | |||
cb = getComboBox("A disabled combobox", true); | |||
cb.setEnabled(false); | |||
addComponent(cb); | |||
cb = getComboBox("A read-only combobox", true); | |||
cb.setReadOnly(true); | |||
addComponent(cb); | |||
} | |||
@@ -56,4 +43,18 @@ public class ComboBoxValueInput extends TestBase { | |||
return 3268; | |||
} | |||
private ComboBox getComboBox(String caption, boolean addNullItem) { | |||
ComboBox cb = new ComboBox(caption); | |||
cb.setImmediate(true); | |||
if (addNullItem) { | |||
cb.addItem("Null item"); | |||
cb.setNullSelectionItemId("Null item"); | |||
} | |||
cb.addItem("Value 1"); | |||
cb.addItem("Value 2"); | |||
cb.addItem("Value 3"); | |||
return cb; | |||
} | |||
} |