diff options
author | Mika Murtojarvi <mika@vaadin.com> | 2014-12-10 11:24:58 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-12-12 10:53:36 +0000 |
commit | e09ba97f64c19d5efcd2d99b7ebf9b7dfef144d7 (patch) | |
tree | 7cc1e42e9d46d1397e5199a33b4d7b6ba97a9b25 /server/src/com/vaadin/ui/Panel.java | |
parent | 7a73e9bd3bf469e4e16acfa0d7d2eb5a496de47a (diff) | |
download | vaadin-framework-e09ba97f64c19d5efcd2d99b7ebf9b7dfef144d7.tar.gz vaadin-framework-e09ba97f64c19d5efcd2d99b7ebf9b7dfef144d7.zip |
Declarative: add support for Panel (#7749).
Change-Id: I4e6414e2fd4941215a788f518862ce58f38f005f
Diffstat (limited to 'server/src/com/vaadin/ui/Panel.java')
-rw-r--r-- | server/src/com/vaadin/ui/Panel.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java index 9b1d8fd5fa..46ad801a6d 100644 --- a/server/src/com/vaadin/ui/Panel.java +++ b/server/src/com/vaadin/ui/Panel.java @@ -16,8 +16,11 @@ package com.vaadin.ui; +import java.util.Collection; import java.util.Map; +import org.jsoup.nodes.Element; + import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ActionManager; @@ -31,6 +34,8 @@ import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.panel.PanelServerRpc; import com.vaadin.shared.ui.panel.PanelState; import com.vaadin.ui.Component.Focusable; +import com.vaadin.ui.declarative.DesignAttributeHandler; +import com.vaadin.ui.declarative.DesignContext; /** * Panel - a simple single component container. @@ -339,4 +344,32 @@ public class Panel extends AbstractSingleComponentContainer implements return (PanelState) super.getState(markAsDirty); } + @Override + public void synchronizeFromDesign(Element design, + DesignContext designContext) { + super.synchronizeFromDesign(design, designContext); + // handle tabindex + Panel def = designContext.getDefaultInstance(this.getClass()); + int tabIndex = DesignAttributeHandler.readAttribute("tabindex", + design.attributes(), def.getTabIndex(), Integer.class); + setTabIndex(tabIndex); + } + + @Override + protected Collection<String> getCustomAttributes() { + Collection<String> attributes = super.getCustomAttributes(); + attributes.add("tabindex"); + attributes.add("tab-index"); + return attributes; + } + + @Override + public void synchronizeToDesign(Element design, DesignContext designContext) { + super.synchronizeToDesign(design, designContext); + // handle tabindex + Panel def = designContext.getDefaultInstance(this.getClass()); + DesignAttributeHandler.writeAttribute("tabindex", design.attributes(), + getTabIndex(), def.getTabIndex(), Integer.class); + } + } |