diff options
author | tapio <tapio@vaadin.com> | 2013-06-17 14:41:18 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-24 09:12:27 +0000 |
commit | cdb8d682af602cc8731e7a63827b499c2da5144e (patch) | |
tree | b7e12cf7b984360e6133815dacfea27a81182b17 /server/src/com | |
parent | cc8bb2c509024076421abc37113cd7c6d8867571 (diff) | |
download | vaadin-framework-cdb8d682af602cc8731e7a63827b499c2da5144e.tar.gz vaadin-framework-cdb8d682af602cc8731e7a63827b499c2da5144e.zip |
Add support for setId to TabSheet.Tab (#12064)
Change-Id: Ia88b9d03a26b9670ab4026f8083a0b932dafa1c0
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/ui/Component.java | 6 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/TabSheet.java | 39 |
2 files changed, 40 insertions, 5 deletions
diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 485327bb54..c385805675 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -651,7 +651,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public Locale getLocale(); /** - * Adds an unique id for component that get's transferred to terminal for + * Adds an unique id for component that is used in the client-side for * testing purposes. Keeping identifiers unique is the responsibility of the * programmer. * @@ -661,7 +661,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public void setId(String id); /** - * Get's currently set debug identifier + * Gets currently set debug identifier * * @return current id, null if not set */ @@ -669,7 +669,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { /** * <p> - * Gets the component's description, used in tooltips and can be displayed + * Gets the components description, used in tooltips and can be displayed * directly in certain other components such as forms. The description can * be used to briefly describe the state of the component to the user. The * description string may contain certain XML tags: diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java index 36022adb74..2c85b279cd 100644 --- a/server/src/com/vaadin/ui/TabSheet.java +++ b/server/src/com/vaadin/ui/TabSheet.java @@ -431,7 +431,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, icon); } final String caption = tab.getCaption(); - if (caption != null && caption.length() > 0) { + if (caption != null && !caption.isEmpty()) { target.addAttribute( TabsheetBaseConstants.ATTRIBUTE_TAB_CAPTION, caption); } @@ -449,10 +449,15 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, } final String styleName = tab.getStyleName(); - if (styleName != null && styleName.length() != 0) { + if (styleName != null && !styleName.isEmpty()) { target.addAttribute(TabsheetConstants.TAB_STYLE_NAME, styleName); } + final String id = tab.getId(); + if (id != null && !id.isEmpty()) { + target.addAttribute("id", id); + } + target.addAttribute("key", keyMapper.key(component)); if (component.equals(selected)) { target.addAttribute("selected", true); @@ -1015,6 +1020,23 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * @see #setStyleName(String) */ public String getStyleName(); + + /** + * Adds an unique id for component that is used in the client-side for + * testing purposes. Keeping identifiers unique is the responsibility of + * the programmer. + * + * @param id + * An alphanumeric id + */ + public void setId(String id); + + /** + * Gets currently set debug identifier + * + * @return current id, null if not set + */ + public String getId(); } /** @@ -1030,6 +1052,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, private String description = null; private ErrorMessage componentError = null; private String styleName; + private String id; public TabSheetTabImpl(String caption, Resource icon) { if (caption == null) { @@ -1150,6 +1173,18 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, public String getStyleName() { return styleName; } + + @Override + public void setId(String id) { + this.id = id; + markAsDirty(); + + } + + @Override + public String getId() { + return id; + } } /** |