diff options
author | Henri Sara <hesara@vaadin.com> | 2016-08-25 10:35:31 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2016-08-25 13:38:48 +0300 |
commit | 71a2653431d2dc244492f67e09d679e65b319630 (patch) | |
tree | 43af95220c1ec773e24d41177d5956673c8434b5 /compatibility-shared/src | |
parent | d140deb4bf3bfc615f4e5fbdd45a36a1655c525e (diff) | |
download | vaadin-framework-71a2653431d2dc244492f67e09d679e65b319630.tar.gz vaadin-framework-71a2653431d2dc244492f67e09d679e65b319630.zip |
Move ComboBox shared classes to vaadin-compatibility-shared
Change-Id: Icdb0ddc011e8749f4c3f159d2ecd94e4c564d28f
Diffstat (limited to 'compatibility-shared/src')
4 files changed, 165 insertions, 0 deletions
diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxConstants.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxConstants.java new file mode 100644 index 0000000000..4e79ab35fb --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxConstants.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.combobox; + +import java.io.Serializable; + +@Deprecated +public class ComboBoxConstants implements Serializable { + @Deprecated + public static final String ATTR_INPUTPROMPT = "prompt"; + @Deprecated + public static final String ATTR_NO_TEXT_INPUT = "noInput"; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxServerRpc.java new file mode 100644 index 0000000000..f3dca9d6fb --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxServerRpc.java @@ -0,0 +1,53 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.combobox; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * Client to server RPC interface for ComboBox. + * + * @since + */ +public interface ComboBoxServerRpc extends ServerRpc { + /** + * Create a new item in the combo box. This method can only be used when the + * ComboBox is configured to allow the creation of new items by the user. + * + * @param itemValue + * user entered string value for the new item + */ + public void createNewItem(String itemValue); + + /** + * Set the current selection. + * + * @param item + * the id of a single item or null to deselect the current value + */ + public void setSelectedItem(String item); + + /** + * Request the server to send a page of the item list. + * + * @param filter + * filter string interpreted according to the current filtering + * mode + * @param page + * zero based page number + */ + public void requestPage(String filter, int page); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxState.java new file mode 100644 index 0000000000..bbab911309 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/ComboBoxState.java @@ -0,0 +1,65 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.combobox; + +import com.vaadin.shared.ui.select.AbstractSelectState; + +/** + * Shared state for the ComboBox component. + * + * @since 7.0 + */ +public class ComboBoxState extends AbstractSelectState { + { + primaryStyleName = "v-filterselect"; + } + + /** + * If text input is not allowed, the ComboBox behaves like a pretty + * NativeSelect - the user can not enter any text and clicking the text + * field opens the drop down with options. + * + * @since + */ + public boolean textInputAllowed = true; + + /** + * A textual prompt that is displayed when the select would otherwise be + * empty, to prompt the user for input. + * + * @since + */ + public String inputPrompt = null; + + /** + * Number of items to show per page or 0 to disable paging. + */ + public int pageLength = 10; + + /** + * Current filtering mode (look for match of the user typed string in the + * beginning of the item caption or anywhere in the item caption). + */ + public FilteringMode filteringMode = FilteringMode.STARTSWITH; + + /** + * Suggestion pop-up's width as a CSS string. By using relative units (e.g. + * "50%") it's possible to set the popup's width relative to the ComboBox + * itself. + */ + public String suggestionPopupWidth = null; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/FilteringMode.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/FilteringMode.java new file mode 100644 index 0000000000..382f509b80 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/combobox/FilteringMode.java @@ -0,0 +1,20 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.combobox; + +public enum FilteringMode { + OFF, STARTSWITH, CONTAINS; +} |