diff options
author | Felype Santiago Ferreira <felype@vaadin.com> | 2014-02-26 16:05:37 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-04-08 06:34:55 +0000 |
commit | f32e3535c6ef73bca33f274e9906f57aa178d22a (patch) | |
tree | ba2453a82f97a2c68f35d363ed2c553d84d5bae9 /shared | |
parent | ef8920661cc9d958c69cfedd0a74ce580a2a84ed (diff) | |
download | vaadin-framework-f32e3535c6ef73bca33f274e9906f57aa178d22a.tar.gz vaadin-framework-f32e3535c6ef73bca33f274e9906f57aa178d22a.zip |
Update Accordion and TabSheet to use Vaadin 7 style. (#13402).
This change also adds subpart support for TabSheet and
converts a test to TB3.
Change-Id: I23b6c81686ea6587470d8019e89a85149ec0b068
Diffstat (limited to 'shared')
5 files changed, 166 insertions, 1 deletions
diff --git a/shared/src/com/vaadin/shared/ui/accordion/AccordionState.java b/shared/src/com/vaadin/shared/ui/accordion/AccordionState.java new file mode 100644 index 0000000000..67b20fc040 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/accordion/AccordionState.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2013 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.shared.ui.accordion; + +import com.vaadin.shared.ui.tabsheet.TabsheetState; + +public class AccordionState extends TabsheetState { + + public static final String PRIMARY_STYLE_NAME = "v-accordion"; + + { + primaryStyleName = PRIMARY_STYLE_NAME; + } + +} diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabState.java new file mode 100644 index 0000000000..9620a61c9a --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabState.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2013 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.shared.ui.tabsheet; + +import java.io.Serializable; + +/** + * Shared state of a single tab in a Tabsheet or an Accordion. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class TabState implements Serializable { + + public String caption = ""; + public boolean enabled = true; + public boolean visible = true; + public boolean closable = false; + public String description = null; + public String styleName; + public String key; + public String componentError; + public String id; + public String iconAltText; + +}
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetClientRpc.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetClientRpc.java new file mode 100644 index 0000000000..780e0f1ac5 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetClientRpc.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2013 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.shared.ui.tabsheet; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * Server to client RPC methods for the TabSheet. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public interface TabsheetClientRpc extends ClientRpc { + + /** + * Forces the client to switch to the tab that is selected by the server. + * + * This is required e.g. for reverting tab selection change on the server + * side (shared state does not change). + */ + public void revertToSharedStateSelection(); +} diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetServerRpc.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetServerRpc.java new file mode 100644 index 0000000000..996525151c --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetServerRpc.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2013 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.shared.ui.tabsheet; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * Client to server RPC methods for the TabSheet. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public interface TabsheetServerRpc extends ServerRpc { + + /** + * Tell server that a tab has been selected by the user. + * + * @param key + * internal key of the tab + */ + void setSelected(String key); + + /** + * Tell server that a tab has been closed by the user. + * + * @param key + * internal key of the tab + */ + void closeTab(String key); + +} diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java index dbb91b8b3d..77e9e15400 100644 --- a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java @@ -15,10 +15,29 @@ */ package com.vaadin.shared.ui.tabsheet; +import java.util.ArrayList; + import com.vaadin.shared.AbstractComponentState; public class TabsheetState extends AbstractComponentState { + public static final String PRIMARY_STYLE_NAME = "v-tabsheet"; + { - primaryStyleName = "v-tabsheet"; + primaryStyleName = PRIMARY_STYLE_NAME; } + + /** + * Index of the component when switching focus - not related to Tabsheet + * tabs. + */ + public int tabIndex; + + public ArrayList<TabState> tabs = new ArrayList<TabState>(); + + /** true to show the tab bar, false to only show the contained component */ + public boolean tabsVisible = true; + + /** the key of the currently selected tab */ + public String selected; + } |