summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java
index 25434e2701..80b9e16d5b 100644
--- a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java
@@ -95,10 +95,9 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector
getWidget().bottomDecoration
.setClassName(VPanel.CLASSNAME + "-deco");
getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption");
- boolean hasCaption = false;
- if (getState().caption != null && !getState().caption.isEmpty()) {
+ boolean hasCaption = hasCaption();
+ if (hasCaption) {
getWidget().setCaption(getState().caption);
- hasCaption = true;
} else {
getWidget().setCaption("");
getWidget().captionNode
@@ -174,6 +173,15 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector
getWidget().contentNode.setTabIndex(getState().tabIndex);
}
+ /**
+ * Detects if caption div should be visible.
+ *
+ * @return {@code true} if caption div should be shown
+ */
+ protected boolean hasCaption() {
+ return getState().caption != null && !getState().caption.isEmpty();
+ }
+
@Override
public void updateCaption(ComponentConnector component) {
// NOP: layouts caption, errors etc not rendered in Panel