summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/TabSheet.java
diff options
context:
space:
mode:
authortapio <tapio@vaadin.com>2013-06-17 14:41:18 +0300
committerVaadin Code Review <review@vaadin.com>2013-06-24 09:12:27 +0000
commitcdb8d682af602cc8731e7a63827b499c2da5144e (patch)
treeb7e12cf7b984360e6133815dacfea27a81182b17 /server/src/com/vaadin/ui/TabSheet.java
parentcc8bb2c509024076421abc37113cd7c6d8867571 (diff)
downloadvaadin-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/vaadin/ui/TabSheet.java')
-rw-r--r--server/src/com/vaadin/ui/TabSheet.java39
1 files changed, 37 insertions, 2 deletions
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;
+ }
}
/**