summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/TabSheet.java
diff options
context:
space:
mode:
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;
+ }
}
/**