summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Motornyi <elmot@vaadin.com>2017-10-23 14:34:20 +0300
committerPéter Török <31210544+torok-peter@users.noreply.github.com>2017-10-23 14:34:20 +0300
commita2497cf0155caeaf90c421b19c4d97ecfbe4fd87 (patch)
treee3921e7820fcccc4299e2212d0b563afed906a54
parent46d1a95f046739a8e158f4fcec4e06fbf3656a11 (diff)
downloadvaadin-framework-a2497cf0155caeaf90c421b19c4d97ecfbe4fd87.tar.gz
vaadin-framework-a2497cf0155caeaf90c421b19c4d97ecfbe4fd87.zip
Unlock panel caption div hacking (#10120)
* Unlock panel caption div hacking Fixes #10119 * Javadoc formatting fix
-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