summaryrefslogtreecommitdiffstats
path: root/client/src/com
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-04-12 10:35:36 +0000
committerJohn Ahlroos <john@vaadin.com>2013-04-22 14:14:06 +0300
commit184114b0881a5323139e5cafd6bd7e5c04afd8e2 (patch)
tree80d686c8b4b4a67c24907eae025aa375674cdedc /client/src/com
parent747a88c642eb08992467ce88862fb93463d6ea20 (diff)
downloadvaadin-framework-184114b0881a5323139e5cafd6bd7e5c04afd8e2.tar.gz
vaadin-framework-184114b0881a5323139e5cafd6bd7e5c04afd8e2.zip
Fixed Accordion tab stylenames which never got applied on the tab widgets #11645 (merged from #10605 in 6.8 branch)
Change-Id: I6af93e3846ecedd31cb9afac6321316b122c9df5
Diffstat (limited to 'client/src/com')
-rw-r--r--client/src/com/vaadin/client/ui/VAccordion.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java
index 6c4bd06b6d..f87186fe37 100644
--- a/client/src/com/vaadin/client/ui/VAccordion.java
+++ b/client/src/com/vaadin/client/ui/VAccordion.java
@@ -34,6 +34,7 @@ import com.vaadin.client.Util;
import com.vaadin.client.VCaption;
import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler;
import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants;
+import com.vaadin.shared.ui.tabsheet.TabsheetConstants;
public class VAccordion extends VTabsheetBase {
@@ -76,6 +77,9 @@ public class VAccordion extends VTabsheetBase {
}
item.updateCaption(tabUidl);
+ item.updateTabStyleName(tabUidl
+ .getStringAttribute(TabsheetConstants.TAB_STYLE_NAME));
+
item.setVisible(!hidden);
if (selected) {
@@ -290,6 +294,7 @@ public class VAccordion extends VTabsheetBase {
private boolean open = false;
private Element content = DOM.createDiv();
private Element captionNode = DOM.createDiv();
+ private String styleName;
public StackItem(UIDL tabUidl) {
setElement(DOM.createDiv());
@@ -312,6 +317,7 @@ public class VAccordion extends VTabsheetBase {
captionNode.removeClassName(getStylePrimaryName() + "-caption");
setStylePrimaryName(primaryStyleName + "-item");
+ updateTabStyleName(getStylePrimaryName());
captionNode.addClassName(getStylePrimaryName() + "-caption");
content.addClassName(getStylePrimaryName() + "-content");
@@ -399,6 +405,32 @@ public class VAccordion extends VTabsheetBase {
uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ICON));
}
+ /**
+ * Updates a tabs stylename from the child UIDL
+ *
+ * @param uidl
+ * The child uidl of the tab
+ */
+ private void updateTabStyleName(String newStyleName) {
+ if (newStyleName != null && newStyleName.length() != 0) {
+ if (!newStyleName.equals(styleName)) {
+ // If we have a new style name
+ if (styleName != null && styleName.length() != 0) {
+ // Remove old style name if present
+ removeStyleDependentName(styleName);
+ }
+ // Set new style name
+ addStyleDependentName(newStyleName);
+ styleName = newStyleName;
+ }
+ } else if (styleName != null) {
+ // Remove the set stylename if no stylename is present in the
+ // uidl
+ removeStyleDependentName(styleName);
+ styleName = null;
+ }
+ }
+
public int getWidgetWidth() {
return DOM.getFirstChild(content).getOffsetWidth();
}