diff options
author | Anna Miroshnik <anna.miroshnik@arcadia.spb.ru> | 2014-09-09 14:17:06 +0400 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-12 16:52:17 +0300 |
commit | 219cd81c6d097b34419dadc68e307f48575b5cbb (patch) | |
tree | 52cc69ae166480d9822ff269572829a516ba5c68 /client | |
parent | 1eebd89464f4a6ff20672dee0c6f0807d5926f5c (diff) | |
download | vaadin-framework-219cd81c6d097b34419dadc68e307f48575b5cbb.tar.gz vaadin-framework-219cd81c6d097b34419dadc68e307f48575b5cbb.zip |
Fix slider inside table is not accessible.(#13681)
some fixes after review.
HiddenSliderHandle extends AbstractTestUI instead of UI now.
Change-Id: I83578014ae83219941da745e8373614854c937d7
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VSlider.java | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/client/src/com/vaadin/client/ui/VSlider.java b/client/src/com/vaadin/client/ui/VSlider.java index 86e5ef129d..3cebb63183 100644 --- a/client/src/com/vaadin/client/ui/VSlider.java +++ b/client/src/com/vaadin/client/ui/VSlider.java @@ -192,37 +192,44 @@ public class VSlider extends SimpleFocusablePanel implements Field, // clear unnecessary opposite style attribute base.getStyle().clearProperty(oppositeStyleAttribute); - if (!getElement().hasParentElement()) { - return; - } - - final Element p = getElement().getParentElement(); - if (p.getPropertyInt(domProperty) > 50) { - if (isVertical()) { - setHeight(); + /* + * To resolve defect #13681 we should not return from method buildBase() + * if slider has no parentElement, because such operations as + * buildHandle() and setValues(), which are needed for Slider, are + * called at the end of method buildBase(). And these methods will not + * be called if there is no parentElement. So, instead of returning from + * method buildBase() if there is no parentElement "if condition" is + * applied to call code for parentElement only in case it exists. + */ + if (getElement().hasParentElement()) { + final Element p = getElement().getParentElement(); + if (p.getPropertyInt(domProperty) > MIN_SIZE) { + if (isVertical()) { + setHeight(); + } else { + base.getStyle().clearProperty(styleAttribute); + } } else { - base.getStyle().clearProperty(styleAttribute); - } - } else { - // Set minimum size and adjust after all components have - // (supposedly) been drawn completely. - base.getStyle().setPropertyPx(styleAttribute, MIN_SIZE); - Scheduler.get().scheduleDeferred(new Command() { - - @Override - public void execute() { - final Element p = getElement().getParentElement(); - if (p.getPropertyInt(domProperty) > (MIN_SIZE + 5)) { - if (isVertical()) { - setHeight(); - } else { - base.getStyle().clearProperty(styleAttribute); + // Set minimum size and adjust after all components have + // (supposedly) been drawn completely. + base.getStyle().setPropertyPx(styleAttribute, MIN_SIZE); + Scheduler.get().scheduleDeferred(new Command() { + + @Override + public void execute() { + final Element p = getElement().getParentElement(); + if (p.getPropertyInt(domProperty) > (MIN_SIZE + 5)) { + if (isVertical()) { + setHeight(); + } else { + base.getStyle().clearProperty(styleAttribute); + } + // Ensure correct position + setValue(value, false); } - // Ensure correct position - setValue(value, false); } - } - }); + }); + } } if (!isVertical()) { |