summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-05-16 11:31:14 +0300
committerArtur Signell <artur@vaadin.com>2014-05-22 09:43:53 +0000
commita11909909c895032ca5f8b271dfb0fa29efa2a6f (patch)
tree85f393834d42c694d0e9bf94ecaa97423604668a /client
parentaac352ab8ba7b7d9e4ace96939e424b2c4e02530 (diff)
downloadvaadin-framework-a11909909c895032ca5f8b271dfb0fa29efa2a6f.tar.gz
vaadin-framework-a11909909c895032ca5f8b271dfb0fa29efa2a6f.zip
Replace use of deprecated DOM.setStyleAttribute method (#13781)
This change is only a brain dead replacement of one specific method. In some cases, there were some oddities in the surrounding code as well, but these were left unresolved on purpose. It should also be noted that DOM.setStyleAttribute just delegates to element.getStyle().setProperty(), so any null references would have caused problems already in the existing code. Change-Id: I340122ac0767af9928076376f76e5bd2c5e19f9f
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/Util.java25
-rw-r--r--client/src/com/vaadin/client/VCaption.java16
-rw-r--r--client/src/com/vaadin/client/VTooltip.java5
-rw-r--r--client/src/com/vaadin/client/ui/VAbstractSplitPanel.java71
-rw-r--r--client/src/com/vaadin/client/ui/VAccordion.java23
-rw-r--r--client/src/com/vaadin/client/ui/VColorPicker.java4
-rw-r--r--client/src/com/vaadin/client/ui/VColorPickerArea.java2
-rw-r--r--client/src/com/vaadin/client/ui/VFilterSelect.java4
-rw-r--r--client/src/com/vaadin/client/ui/VFormLayout.java5
-rw-r--r--client/src/com/vaadin/client/ui/VNotification.java54
-rw-r--r--client/src/com/vaadin/client/ui/VOverlay.java15
-rw-r--r--client/src/com/vaadin/client/ui/VRichTextArea.java11
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java50
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheet.java43
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheetPanel.java17
-rw-r--r--client/src/com/vaadin/client/ui/VTwinColSelect.java4
-rw-r--r--client/src/com/vaadin/client/ui/VWindow.java28
-rw-r--r--client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java9
-rw-r--r--client/src/com/vaadin/client/ui/link/LinkConnector.java5
-rw-r--r--client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java8
20 files changed, 208 insertions, 191 deletions
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index 7eeaad2d68..e031b37422 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -33,6 +33,7 @@ import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Touch;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
@@ -212,10 +213,10 @@ public class Util {
if (widthGuess < 1) {
widthGuess = 1;
}
- DOM.setStyleAttribute(element, "width", widthGuess + "px");
+ element.getStyle().setWidth(widthGuess, Unit.PX);
int padding = element.getOffsetWidth() - widthGuess;
- DOM.setStyleAttribute(element, "width", originalWidth);
+ element.getStyle().setProperty("width", originalWidth);
return padding;
}
@@ -228,10 +229,10 @@ public class Util {
if (widthGuess < 1) {
widthGuess = 1;
}
- DOM.setStyleAttribute(element, "height", widthGuess + "px");
+ element.getStyle().setHeight(widthGuess, Unit.PX);
int padding = element.getOffsetHeight() - widthGuess;
- DOM.setStyleAttribute(element, "height", originalHeight);
+ element.getStyle().setProperty("height", originalHeight);
return padding;
}
@@ -323,11 +324,11 @@ public class Util {
}
private static void setWidth(Widget widget, String width) {
- DOM.setStyleAttribute(widget.getElement(), "width", width);
+ widget.getElement().getStyle().setProperty("width", width);
}
private static void setHeight(Widget widget, String height) {
- DOM.setStyleAttribute(widget.getElement(), "height", height);
+ widget.getElement().getStyle().setProperty("height", height);
}
public static int setWidthExcludingPaddingAndBorder(Widget widget,
@@ -356,7 +357,7 @@ public class Util {
widthGuess = 0;
}
- DOM.setStyleAttribute(element, "width", widthGuess + "px");
+ element.getStyle().setWidth(widthGuess, Unit.PX);
int captionOffsetWidth = DOM.getElementPropertyInt(element,
"offsetWidth");
@@ -372,7 +373,7 @@ public class Util {
// Cannot set negative width even if we would want to
w = 0;
}
- DOM.setStyleAttribute(element, "width", w + "px");
+ element.getStyle().setWidth(w, Unit.PX);
}
@@ -389,7 +390,7 @@ public class Util {
heightGuess = 0;
}
- DOM.setStyleAttribute(element, "height", heightGuess + "px");
+ element.getStyle().setHeight(heightGuess, Unit.PX);
int captionOffsetHeight = DOM.getElementPropertyInt(element,
"offsetHeight");
@@ -405,7 +406,7 @@ public class Util {
// Cannot set negative height even if we would want to
h = 0;
}
- DOM.setStyleAttribute(element, "height", h + "px");
+ element.getStyle().setHeight(h, Unit.PX);
}
@@ -424,9 +425,9 @@ public class Util {
public static void setFloat(Element element, String value) {
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(element, "styleFloat", value);
+ element.getStyle().setProperty("styleFloat", value);
} else {
- DOM.setStyleAttribute(element, "cssFloat", value);
+ element.getStyle().setProperty("cssFloat", value);
}
}
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index b0d6a3a8a9..becc89ce1d 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -18,6 +18,7 @@ package com.vaadin.client;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
@@ -585,19 +586,19 @@ public class VCaption extends HTML {
}
public void setAlignment(String alignment) {
- DOM.setStyleAttribute(getElement(), "textAlign", alignment);
+ getElement().getStyle().setProperty("textAlign", alignment);
}
public void setMaxWidth(int maxWidth) {
this.maxWidth = maxWidth;
- DOM.setStyleAttribute(getElement(), "width", maxWidth + "px");
+ getElement().getStyle().setWidth(maxWidth, Unit.PX);
if (icon != null) {
- DOM.setStyleAttribute(icon.getElement(), "width", "");
+ icon.getElement().getStyle().clearWidth();
}
if (captionText != null) {
- DOM.setStyleAttribute(captionText, "width", "");
+ captionText.getStyle().clearWidth();
}
int requiredWidth = getRequiredWidth();
@@ -628,8 +629,8 @@ public class VCaption extends HTML {
if (availableWidth > iconRequiredWidth) {
availableWidth -= iconRequiredWidth;
} else {
- DOM.setStyleAttribute(icon.getElement(), "width",
- availableWidth + "px");
+ icon.getElement().getStyle()
+ .setWidth(availableWidth, Unit.PX);
availableWidth = 0;
}
}
@@ -639,8 +640,7 @@ public class VCaption extends HTML {
availableWidth -= captionWidth;
} else {
- DOM.setStyleAttribute(captionText, "width", availableWidth
- + "px");
+ captionText.getStyle().setWidth(availableWidth, Unit.PX);
availableWidth = 0;
}
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 54e42a118d..4384b51393 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -19,6 +19,7 @@ import com.google.gwt.aria.client.LiveValue;
import com.google.gwt.aria.client.RelevantValue;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -120,11 +121,11 @@ public class VTooltip extends VWindowOverlay {
}
if (info.getTitle() != null && !"".equals(info.getTitle())) {
DOM.setInnerHTML(description, info.getTitle());
- DOM.setStyleAttribute(description, "display", "");
+ description.getStyle().clearDisplay();
hasContent = true;
} else {
DOM.setInnerHTML(description, "");
- DOM.setStyleAttribute(description, "display", "none");
+ description.getStyle().setDisplay(Display.NONE);
}
if (hasContent) {
// Issue #8454: With IE7 the tooltips size is calculated based on
diff --git a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
index 80a6405d6c..269db23366 100644
--- a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
+++ b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
@@ -22,6 +22,8 @@ import java.util.List;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.TouchCancelEvent;
import com.google.gwt.event.dom.client.TouchCancelHandler;
import com.google.gwt.event.dom.client.TouchEndEvent;
@@ -181,16 +183,16 @@ public class VAbstractSplitPanel extends ComplexPanel {
protected void constructDom() {
DOM.appendChild(splitter, DOM.createDiv()); // for styling
DOM.appendChild(getElement(), wrapper);
- DOM.setStyleAttribute(wrapper, "position", "relative");
- DOM.setStyleAttribute(wrapper, "width", "100%");
- DOM.setStyleAttribute(wrapper, "height", "100%");
+ wrapper.getStyle().setPosition(Position.RELATIVE);
+ wrapper.getStyle().setWidth(100, Unit.PCT);
+ wrapper.getStyle().setHeight(100, Unit.PCT);
DOM.appendChild(wrapper, firstContainer);
DOM.appendChild(wrapper, splitter);
DOM.appendChild(wrapper, secondContainer);
- DOM.setStyleAttribute(splitter, "position", "absolute");
- DOM.setStyleAttribute(secondContainer, "position", "absolute");
+ splitter.getStyle().setPosition(Position.ABSOLUTE);
+ secondContainer.getStyle().setPosition(Position.ABSOLUTE);
setStylenames();
}
@@ -198,16 +200,16 @@ public class VAbstractSplitPanel extends ComplexPanel {
private void setOrientation(Orientation orientation) {
this.orientation = orientation;
if (orientation == Orientation.HORIZONTAL) {
- DOM.setStyleAttribute(splitter, "height", "100%");
- DOM.setStyleAttribute(splitter, "top", "0");
- DOM.setStyleAttribute(firstContainer, "height", "100%");
- DOM.setStyleAttribute(secondContainer, "top", "0");
- DOM.setStyleAttribute(secondContainer, "height", "100%");
+ splitter.getStyle().setHeight(100, Unit.PCT);
+ splitter.getStyle().setTop(0, Unit.PX);
+ firstContainer.getStyle().setHeight(100, Unit.PCT);
+ secondContainer.getStyle().setTop(0, Unit.PX);
+ secondContainer.getStyle().setHeight(100, Unit.PCT);
} else {
- DOM.setStyleAttribute(splitter, "width", "100%");
- DOM.setStyleAttribute(splitter, "left", "0");
- DOM.setStyleAttribute(firstContainer, "width", "100%");
- DOM.setStyleAttribute(secondContainer, "width", "100%");
+ splitter.getStyle().setWidth(100, Unit.PCT);
+ splitter.getStyle().setLeft(0, Unit.PX);
+ firstContainer.getStyle().setWidth(100, Unit.PCT);
+ secondContainer.getStyle().setWidth(100, Unit.PCT);
}
}
@@ -237,11 +239,11 @@ public class VAbstractSplitPanel extends ComplexPanel {
public void setPositionReversed(boolean reversed) {
if (positionReversed != reversed) {
if (orientation == Orientation.HORIZONTAL) {
- DOM.setStyleAttribute(splitter, "right", "");
- DOM.setStyleAttribute(splitter, "left", "");
+ splitter.getStyle().clearRight();
+ splitter.getStyle().clearLeft();
} else if (orientation == Orientation.VERTICAL) {
- DOM.setStyleAttribute(splitter, "top", "");
- DOM.setStyleAttribute(splitter, "bottom", "");
+ splitter.getStyle().clearTop();
+ splitter.getStyle().clearBottom();
}
positionReversed = reversed;
@@ -411,15 +413,14 @@ public class VAbstractSplitPanel extends ComplexPanel {
return;
}
- DOM.setStyleAttribute(firstContainer, "width", pixelPosition + "px");
+ firstContainer.getStyle().setWidth(pixelPosition, Unit.PX);
int secondContainerWidth = (wholeSize - pixelPosition - getSplitterSize());
if (secondContainerWidth < 0) {
secondContainerWidth = 0;
}
- DOM.setStyleAttribute(secondContainer, "width",
- secondContainerWidth + "px");
- DOM.setStyleAttribute(secondContainer, "left",
- (pixelPosition + getSplitterSize()) + "px");
+ secondContainer.getStyle().setWidth(secondContainerWidth, Unit.PX);
+ secondContainer.getStyle().setLeft(
+ pixelPosition + getSplitterSize(), Unit.PX);
LayoutManager layoutManager = LayoutManager.get(client);
ConnectorMap connectorMap = ConnectorMap.get(client);
@@ -460,16 +461,15 @@ public class VAbstractSplitPanel extends ComplexPanel {
return;
}
- DOM.setStyleAttribute(firstContainer, "height", pixelPosition
- + "px");
+ firstContainer.getStyle().setHeight(pixelPosition, Unit.PX);
int secondContainerHeight = (wholeSize - pixelPosition - getSplitterSize());
if (secondContainerHeight < 0) {
secondContainerHeight = 0;
}
- DOM.setStyleAttribute(secondContainer, "height",
- secondContainerHeight + "px");
- DOM.setStyleAttribute(secondContainer, "top",
- (pixelPosition + getSplitterSize()) + "px");
+ secondContainer.getStyle()
+ .setHeight(secondContainerHeight, Unit.PX);
+ secondContainer.getStyle().setTop(
+ pixelPosition + getSplitterSize(), Unit.PX);
layoutManager = LayoutManager.get(client);
connectorMap = ConnectorMap.get(client);
@@ -716,13 +716,12 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
if (draggingCurtain == null) {
draggingCurtain = DOM.createDiv();
- DOM.setStyleAttribute(draggingCurtain, "position", "absolute");
- DOM.setStyleAttribute(draggingCurtain, "top", "0px");
- DOM.setStyleAttribute(draggingCurtain, "left", "0px");
- DOM.setStyleAttribute(draggingCurtain, "width", "100%");
- DOM.setStyleAttribute(draggingCurtain, "height", "100%");
- DOM.setStyleAttribute(draggingCurtain, "zIndex", ""
- + VOverlay.Z_INDEX);
+ draggingCurtain.getStyle().setPosition(Position.ABSOLUTE);
+ draggingCurtain.getStyle().setTop(0, Unit.PX);
+ draggingCurtain.getStyle().setLeft(0, Unit.PX);
+ draggingCurtain.getStyle().setWidth(100, Unit.PCT);
+ draggingCurtain.getStyle().setHeight(100, Unit.PCT);
+ draggingCurtain.getStyle().setZIndex(VOverlay.Z_INDEX);
DOM.appendChild(wrapper, draggingCurtain);
}
diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java
index 1789fa1717..3e89958a98 100644
--- a/client/src/com/vaadin/client/ui/VAccordion.java
+++ b/client/src/com/vaadin/client/ui/VAccordion.java
@@ -20,6 +20,8 @@ import java.util.Iterator;
import java.util.Set;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
@@ -160,12 +162,11 @@ public class VAccordion extends VTabsheetBase {
public void setHeight(int height) {
if (height == -1) {
super.setHeight("");
- DOM.setStyleAttribute(content, "height", "0px");
+ content.getStyle().setHeight(0, Unit.PX);
} else {
super.setHeight((height + getCaptionHeight()) + "px");
- DOM.setStyleAttribute(content, "height", height + "px");
- DOM.setStyleAttribute(content, "top", getCaptionHeight() + "px");
-
+ content.getStyle().setHeight(height, Unit.PX);
+ content.getStyle().setTop(getCaptionHeight(), Unit.PX);
}
}
@@ -286,20 +287,20 @@ public class VAccordion extends VTabsheetBase {
public void open() {
open = true;
- DOM.setStyleAttribute(content, "top", getCaptionHeight() + "px");
- DOM.setStyleAttribute(content, "left", "0px");
- DOM.setStyleAttribute(content, "visibility", "");
+ content.getStyle().setTop(getCaptionHeight(), Unit.PX);
+ content.getStyle().setLeft(0, Unit.PX);
+ content.getStyle().clearVisibility();
addStyleDependentName("open");
}
public void hide() {
- DOM.setStyleAttribute(content, "visibility", "hidden");
+ content.getStyle().setVisibility(Visibility.HIDDEN);
}
public void close() {
- DOM.setStyleAttribute(content, "visibility", "hidden");
- DOM.setStyleAttribute(content, "top", "-100000px");
- DOM.setStyleAttribute(content, "left", "-100000px");
+ content.getStyle().setVisibility(Visibility.HIDDEN);
+ content.getStyle().setTop(-100000, Unit.PX);
+ content.getStyle().setLeft(-100000, Unit.PX);
removeStyleDependentName("open");
setHeight(-1);
setWidth("");
diff --git a/client/src/com/vaadin/client/ui/VColorPicker.java b/client/src/com/vaadin/client/ui/VColorPicker.java
index da98bb46a6..b55c125418 100644
--- a/client/src/com/vaadin/client/ui/VColorPicker.java
+++ b/client/src/com/vaadin/client/ui/VColorPicker.java
@@ -17,7 +17,6 @@ package com.vaadin.client.ui;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HTML;
/**
@@ -80,8 +79,7 @@ public class VColorPicker extends VButton implements ClickHandler {
}
// Set the color
- DOM.setStyleAttribute(colorIcon.getElement(), "background", color);
-
+ colorIcon.getElement().getStyle().setProperty("background", color);
}
}
diff --git a/client/src/com/vaadin/client/ui/VColorPickerArea.java b/client/src/com/vaadin/client/ui/VColorPickerArea.java
index f5ff2c28b2..e581cf3448 100644
--- a/client/src/com/vaadin/client/ui/VColorPickerArea.java
+++ b/client/src/com/vaadin/client/ui/VColorPickerArea.java
@@ -166,7 +166,7 @@ public class VColorPickerArea extends Widget implements ClickHandler, HasHTML,
public void refreshColor() {
if (color != null) {
// Set the color
- DOM.setStyleAttribute(area.getElement(), "background", color);
+ area.getElement().getStyle().setProperty("background", color);
}
}
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index b945b4eb00..5fed1b4e42 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -1463,8 +1463,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
int iconHeight = Util.getRequiredHeight(selectedItemIcon);
int marginTop = (availableHeight - iconHeight) / 2;
- DOM.setStyleAttribute(selectedItemIcon.getElement(), "marginTop",
- marginTop + "px");
+ selectedItemIcon.getElement().getStyle()
+ .setMarginTop(marginTop, Unit.PX);
}
private static Set<Integer> navigationKeyCodes = new HashSet<Integer>();
diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java
index 7fd07a2093..64a7c5e579 100644
--- a/client/src/com/vaadin/client/ui/VFormLayout.java
+++ b/client/src/com/vaadin/client/ui/VFormLayout.java
@@ -22,6 +22,7 @@ import java.util.List;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
@@ -331,10 +332,10 @@ public class VFormLayout extends SimplePanel {
if (BrowserInfo.get().isIE()) {
if (isEmpty) {
setHeight("0px");
- DOM.setStyleAttribute(getElement(), "overflow", "hidden");
+ getElement().getStyle().setOverflow(Overflow.HIDDEN);
} else {
setHeight("");
- DOM.setStyleAttribute(getElement(), "overflow", "");
+ getElement().getStyle().clearOverflow();
}
}
diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java
index 7097b428d0..93dc26f8be 100644
--- a/client/src/com/vaadin/client/ui/VNotification.java
+++ b/client/src/com/vaadin/client/ui/VNotification.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
@@ -90,7 +91,7 @@ public class VNotification extends VOverlay {
public VNotification() {
setStyleName(STYLENAME);
sinkEvents(Event.ONCLICK);
- DOM.setStyleAttribute(getElement(), "zIndex", "" + Z_INDEX_BASE);
+ getElement().getStyle().setZIndex(Z_INDEX_BASE);
}
/**
@@ -303,49 +304,52 @@ public class VNotification extends VOverlay {
public void setPosition(com.vaadin.shared.Position position) {
final Element el = getElement();
- DOM.setStyleAttribute(el, "top", "");
- DOM.setStyleAttribute(el, "left", "");
- DOM.setStyleAttribute(el, "bottom", "");
- DOM.setStyleAttribute(el, "right", "");
+ el.getStyle().clearTop();
+ el.getStyle().clearLeft();
+ el.getStyle().clearBottom();
+ el.getStyle().clearRight();
switch (position) {
case TOP_LEFT:
- DOM.setStyleAttribute(el, "top", "0px");
- DOM.setStyleAttribute(el, "left", "0px");
+ el.getStyle().setTop(0, Unit.PX);
+ el.getStyle().setLeft(0, Unit.PX);
break;
case TOP_RIGHT:
- DOM.setStyleAttribute(el, "top", "0px");
- DOM.setStyleAttribute(el, "right", "0px");
+ el.getStyle().setTop(0, Unit.PX);
+ el.getStyle().setRight(0, Unit.PX);
break;
case MIDDLE_LEFT:
center();
- DOM.setStyleAttribute(el, "left", "0px");
+ el.getStyle().setLeft(0, Unit.PX);
break;
case MIDDLE_RIGHT:
center();
- DOM.setStyleAttribute(el, "left", "");
- DOM.setStyleAttribute(el, "right", "0px");
+ el.getStyle().clearLeft();
+ el.getStyle().setRight(0, Unit.PX);
break;
case BOTTOM_RIGHT:
- DOM.setStyleAttribute(el, "position", "absolute");
- DOM.setStyleAttribute(el, "bottom", "0px");
- DOM.setStyleAttribute(el, "right", "0px");
+ // Avoiding strings would be ugly since another Position is imported
+ // TODO this is most likely redundant
+ el.getStyle().setProperty("position", "absolute");
+
+ el.getStyle().setBottom(0, Unit.PX);
+ el.getStyle().setRight(0, Unit.PX);
break;
case BOTTOM_LEFT:
- DOM.setStyleAttribute(el, "bottom", "0px");
- DOM.setStyleAttribute(el, "left", "0px");
+ el.getStyle().setBottom(0, Unit.PX);
+ el.getStyle().setLeft(0, Unit.PX);
break;
case TOP_CENTER:
center();
- DOM.setStyleAttribute(el, "top", "0px");
+ el.getStyle().setTop(0, Unit.PX);
break;
case BOTTOM_CENTER:
center();
- DOM.setStyleAttribute(el, "top", "");
- DOM.setStyleAttribute(el, "bottom", "0px");
+ el.getStyle().clearTop();
+ el.getStyle().setBottom(0, Unit.PX);
break;
case ASSISTIVE:
- DOM.setStyleAttribute(el, "top", "-2000px");
- DOM.setStyleAttribute(el, "left", "-2000px");
+ el.getStyle().setTop(-2000, Unit.PX);
+ el.getStyle().setLeft(-2000, Unit.PX);
break;
default:
case MIDDLE_CENTER:
@@ -369,10 +373,10 @@ public class VNotification extends VOverlay {
}
private void setOpacity(Element el, int opacity) {
- DOM.setStyleAttribute(el, "opacity", "" + (opacity / 100.0));
+ el.getStyle().setOpacity(opacity / 100.0);
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(el, "filter", "Alpha(opacity=" + opacity
- + ")");
+ el.getStyle().setProperty("filter",
+ "Alpha(opacity=" + opacity + ")");
}
}
diff --git a/client/src/com/vaadin/client/ui/VOverlay.java b/client/src/com/vaadin/client/ui/VOverlay.java
index 4d26bd5e43..0e9dcbe4cb 100644
--- a/client/src/com/vaadin/client/ui/VOverlay.java
+++ b/client/src/com/vaadin/client/ui/VOverlay.java
@@ -23,6 +23,7 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.IFrameElement;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.BorderStyle;
+import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.CloseEvent;
@@ -216,7 +217,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
shadow = DOM.createDiv();
shadow.setClassName(CLASSNAME_SHADOW);
shadow.setInnerHTML(SHADOW_HTML);
- DOM.setStyleAttribute(shadow, "position", "absolute");
+ shadow.getStyle().setPosition(Position.ABSOLUTE);
addCloseHandler(this);
} else {
removeShadowIfPresent();
@@ -263,9 +264,9 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
* The new z-index
*/
protected void setZIndex(int zIndex) {
- DOM.setStyleAttribute(getElement(), "zIndex", "" + zIndex);
+ getElement().getStyle().setZIndex(zIndex);
if (isShadowEnabled()) {
- DOM.setStyleAttribute(shadow, "zIndex", "" + zIndex);
+ shadow.getStyle().setZIndex(zIndex);
}
}
@@ -513,8 +514,12 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
}
updatePositionAndSize(shadow, positionAndSize);
- DOM.setStyleAttribute(shadow, "zIndex", zIndex);
- DOM.setStyleAttribute(shadow, "display", progress < 0.9 ? "none" : "");
+ shadow.getStyle().setProperty("zIndex", zIndex);
+ if (progress < 0.9) {
+ shadow.getStyle().setDisplay(Display.NONE);
+ } else {
+ shadow.getStyle().clearDisplay();
+ }
// Opera fix, part 2 (ticket #2704)
if (BrowserInfo.get().isOpera()) {
diff --git a/client/src/com/vaadin/client/ui/VRichTextArea.java b/client/src/com/vaadin/client/ui/VRichTextArea.java
index 1fb88060fe..52e3782f32 100644
--- a/client/src/com/vaadin/client/ui/VRichTextArea.java
+++ b/client/src/com/vaadin/client/ui/VRichTextArea.java
@@ -22,6 +22,9 @@ import java.util.Map.Entry;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
@@ -216,11 +219,11 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler,
private void detectExtraSizes() {
Element clone = Util.cloneNode(getElement(), false);
DOM.setElementAttribute(clone, "id", "");
- DOM.setStyleAttribute(clone, "visibility", "hidden");
- DOM.setStyleAttribute(clone, "position", "absolute");
+ clone.getStyle().setVisibility(Visibility.HIDDEN);
+ clone.getStyle().setPosition(Position.ABSOLUTE);
// due FF3 bug set size to 10px and later subtract it from extra pixels
- DOM.setStyleAttribute(clone, "width", "10px");
- DOM.setStyleAttribute(clone, "height", "10px");
+ clone.getStyle().setWidth(10, Unit.PX);
+ clone.getStyle().setHeight(10, Unit.PX);
DOM.appendChild(DOM.getParent(getElement()), clone);
extraHorizontalPixels = DOM.getElementPropertyInt(clone, "offsetWidth") - 10;
extraVerticalPixels = DOM.getElementPropertyInt(clone, "offsetHeight") - 10;
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index 6717a1a521..d6eec66561 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -38,6 +38,7 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.TextAlign;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.dom.client.TableCellElement;
@@ -2304,7 +2305,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
/** For internal use only. May be removed or replaced in the future. */
public void hideScrollPositionAnnotation() {
if (scrollPositionElement != null) {
- DOM.setStyleAttribute(scrollPositionElement, "display", "none");
+ scrollPositionElement.getStyle().setDisplay(Display.NONE);
}
}
@@ -2661,11 +2662,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
if (width == -1) {
// go to default mode, clip content if necessary
- DOM.setStyleAttribute(captionContainer, "overflow", "");
+ captionContainer.getStyle().clearOverflow();
}
width = w;
if (w == -1) {
- DOM.setStyleAttribute(captionContainer, "width", "");
+ captionContainer.getStyle().clearWidth();
setWidth("");
} else {
tHead.resizeCaptionContainer(this);
@@ -2836,7 +2837,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
floatingCopyOfHeaderCell.setClassName(sb.toString().trim());
// otherwise might wrap or be cut if narrow column
- DOM.setStyleAttribute(floatingCopyOfHeaderCell, "width", "auto");
+ floatingCopyOfHeaderCell.getStyle().setProperty("width", "auto");
updateFloatingCopysPosition(DOM.getAbsoluteLeft(td),
DOM.getAbsoluteTop(td));
DOM.appendChild(VOverlay.getOverlayContainer(client),
@@ -2846,10 +2847,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private void updateFloatingCopysPosition(int x, int y) {
x -= DOM.getElementPropertyInt(floatingCopyOfHeaderCell,
"offsetWidth") / 2;
- DOM.setStyleAttribute(floatingCopyOfHeaderCell, "left", x + "px");
+ floatingCopyOfHeaderCell.getStyle().setLeft(x, Unit.PX);
if (y > 0) {
- DOM.setStyleAttribute(floatingCopyOfHeaderCell, "top", (y + 7)
- + "px");
+ floatingCopyOfHeaderCell.getStyle().setTop(y + 7, Unit.PX);
}
}
@@ -3236,8 +3236,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
table.setPropertyInt("cellSpacing", 0);
}
- DOM.setStyleAttribute(hTableWrapper, "overflow", "hidden");
- DOM.setStyleAttribute(columnSelector, "display", "none");
+ hTableWrapper.getStyle().setOverflow(Overflow.HIDDEN);
+ columnSelector.getStyle().setDisplay(Display.NONE);
DOM.appendChild(table, headerTableBody);
DOM.appendChild(headerTableBody, tr);
@@ -3792,7 +3792,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
setText(headerText);
// ensure no clipping initially (problem on column additions)
- DOM.setStyleAttribute(captionContainer, "overflow", "visible");
+ captionContainer.getStyle().setOverflow(Overflow.VISIBLE);
DOM.sinkEvents(captionContainer, Event.MOUSEEVENTS);
@@ -3836,15 +3836,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (align != c) {
switch (c) {
case ALIGN_CENTER:
- DOM.setStyleAttribute(captionContainer, "textAlign",
- "center");
+ captionContainer.getStyle().setTextAlign(TextAlign.CENTER);
break;
case ALIGN_RIGHT:
- DOM.setStyleAttribute(captionContainer, "textAlign",
- "right");
+ captionContainer.getStyle().setTextAlign(TextAlign.RIGHT);
break;
default:
- DOM.setStyleAttribute(captionContainer, "textAlign", "left");
+ captionContainer.getStyle().setTextAlign(TextAlign.LEFT);
break;
}
}
@@ -3882,11 +3880,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
if (width == -1) {
// go to default mode, clip content if necessary
- DOM.setStyleAttribute(captionContainer, "overflow", "");
+ captionContainer.getStyle().clearOverflow();
}
width = w;
if (w == -1) {
- DOM.setStyleAttribute(captionContainer, "width", "");
+ captionContainer.getStyle().clearWidth();
setWidth("");
} else {
/*
@@ -4145,7 +4143,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
public TableFooter() {
- DOM.setStyleAttribute(hTableWrapper, "overflow", "hidden");
+ hTableWrapper.getStyle().setOverflow(Overflow.HIDDEN);
DOM.appendChild(table, headerTableBody);
DOM.appendChild(headerTableBody, tr);
@@ -4370,15 +4368,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* Disable browser measurement of the table width
*/
public void disableBrowserIntelligence() {
- DOM.setStyleAttribute(hTableContainer, "width", WRAPPER_WIDTH
- + "px");
+ hTableContainer.getStyle().setWidth(WRAPPER_WIDTH, Unit.PX);
}
/**
* Enable browser measurement of the table width
*/
public void enableBrowserIntelligence() {
- DOM.setStyleAttribute(hTableContainer, "width", "");
+ hTableContainer.getStyle().clearWidth();
}
/**
@@ -4881,8 +4878,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
*/
private void setContainerHeight() {
fixSpacers();
- DOM.setStyleAttribute(container, "height",
- measureRowHeightOffset(totalRows) + "px");
+ container.getStyle().setHeight(measureRowHeightOffset(totalRows),
+ Unit.PX);
}
private void fixSpacers() {
@@ -6821,14 +6818,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private int getContentAreaBorderHeight() {
if (contentAreaBorderHeight < 0) {
- DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
- "hidden");
+ scrollBodyPanel.getElement().getStyle()
+ .setOverflow(Overflow.HIDDEN);
int oh = scrollBodyPanel.getOffsetHeight();
int ch = scrollBodyPanel.getElement()
.getPropertyInt("clientHeight");
contentAreaBorderHeight = oh - ch;
- DOM.setStyleAttribute(scrollBodyPanel.getElement(), "overflow",
- "auto");
+ scrollBodyPanel.getElement().getStyle().setOverflow(Overflow.AUTO);
}
return contentAreaBorderHeight;
}
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java
index d2d61207ea..3f2d90b721 100644
--- a/client/src/com/vaadin/client/ui/VTabsheet.java
+++ b/client/src/com/vaadin/client/ui/VTabsheet.java
@@ -27,6 +27,9 @@ import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.dom.client.TableCellElement;
import com.google.gwt.dom.client.TableElement;
@@ -92,7 +95,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Representation of a single "tab" shown in the TabBar
- *
+ *
*/
public static class Tab extends SimplePanel implements HasFocusHandlers,
HasBlurHandlers, HasKeyDownHandlers {
@@ -194,7 +197,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Toggles the style names for the Tab
- *
+ *
* @param selected
* true if the Tab is selected
* @param first
@@ -577,7 +580,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Returns the index of the first visible tab
- *
+ *
* @return
*/
private int getFirstVisibleTab() {
@@ -586,7 +589,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Find the next visible tab. Returns -1 if none is found.
- *
+ *
* @param i
* @return
*/
@@ -605,7 +608,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Find the previous visible tab. Returns -1 if none is found.
- *
+ *
* @param i
* @return
*/
@@ -717,7 +720,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Load the content of a tab of the provided index.
- *
+ *
* @param index
* of the tab to load
*/
@@ -743,7 +746,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Returns the currently displayed widget in the tab panel.
- *
+ *
* @since 7.2
* @return currently displayed content widget
*/
@@ -753,7 +756,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Returns the client to server RPC proxy for the tabsheet.
- *
+ *
* @since 7.2
* @return RPC proxy
*/
@@ -763,10 +766,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* For internal use only.
- *
+ *
* Avoid using this method directly and use appropriate superclass methods
* where applicable.
- *
+ *
* @deprecated since 7.2 - use more specific methods instead (getRpcProxy(),
* getConnectorForWidget(Widget) etc.)
* @return ApplicationConnection
@@ -800,7 +803,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
addHandler(this, BlurEvent.getType());
// Tab scrolling
- DOM.setStyleAttribute(getElement(), "overflow", "hidden");
+ getElement().getStyle().setOverflow(Overflow.HIDDEN);
tabs = DOM.createDiv();
DOM.setElementProperty(tabs, "className", TABS_CLASSNAME);
Roles.getTablistRole().set(tabs);
@@ -881,7 +884,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Checks if the tab with the selected index has been scrolled out of the
* view (on the left side).
- *
+ *
* @param index
* @return
*/
@@ -1013,7 +1016,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Renders the widget content for a tab sheet.
- *
+ *
* @param newWidget
*/
public void renderContent(Widget newWidget) {
@@ -1061,9 +1064,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
// Set proper values for content element
- DOM.setStyleAttribute(contentNode, "height", contentHeight + "px");
+ contentNode.getStyle().setHeight(contentHeight, Unit.PX);
} else {
- DOM.setStyleAttribute(contentNode, "height", "");
+ contentNode.getStyle().clearHeight();
}
}
@@ -1113,7 +1116,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
*/
private void updateTabScroller() {
if (!isDynamicWidth()) {
- DOM.setStyleAttribute(tabs, "width", "100%");
+ tabs.getStyle().setWidth(100, Unit.PCT);
}
// Make sure scrollerIndex is valid
@@ -1127,7 +1130,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
boolean scrolled = isScrolledTabs();
boolean clipped = isClippedTabs();
if (tb.getTabCount() > 0 && tb.isVisible() && (scrolled || clipped)) {
- DOM.setStyleAttribute(scroller, "display", "");
+ scroller.getStyle().clearDisplay();
DOM.setElementProperty(scrollerPrev, "className",
SCROLLER_CLASSNAME + (scrolled ? "Prev" : "Prev-disabled"));
DOM.setElementProperty(scrollerNext, "className",
@@ -1140,7 +1143,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
: -1);
} else {
- DOM.setStyleAttribute(scroller, "display", "none");
+ scroller.getStyle().setDisplay(Display.NONE);
}
if (BrowserInfo.get().isSafari()) {
@@ -1383,7 +1386,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Makes tab bar visible.
- *
+ *
* @since 7.2
*/
public void showTabs() {
@@ -1394,7 +1397,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
/**
* Makes tab bar invisible.
- *
+ *
* @since 7.2
*/
public void hideTabs() {
diff --git a/client/src/com/vaadin/client/ui/VTabsheetPanel.java b/client/src/com/vaadin/client/ui/VTabsheetPanel.java
index b2d751332e..240f493907 100644
--- a/client/src/com/vaadin/client/ui/VTabsheetPanel.java
+++ b/client/src/com/vaadin/client/ui/VTabsheetPanel.java
@@ -17,6 +17,9 @@
package com.vaadin.client.ui;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -60,7 +63,7 @@ public class VTabsheetPanel extends ComplexPanel {
private Element createContainerElement() {
Element el = DOM.createDiv();
- DOM.setStyleAttribute(el, "position", "absolute");
+ el.getStyle().setPosition(Position.ABSOLUTE);
hide(el);
touchScrollHandler.addElement(el);
return el;
@@ -136,15 +139,15 @@ public class VTabsheetPanel extends ComplexPanel {
}
private void hide(Element e) {
- DOM.setStyleAttribute(e, "visibility", "hidden");
- DOM.setStyleAttribute(e, "top", "-100000px");
- DOM.setStyleAttribute(e, "left", "-100000px");
+ e.getStyle().setVisibility(Visibility.HIDDEN);
+ e.getStyle().setTop(-100000, Unit.PX);
+ e.getStyle().setLeft(-100000, Unit.PX);
}
private void unHide(Element e) {
- DOM.setStyleAttribute(e, "top", "0px");
- DOM.setStyleAttribute(e, "left", "0px");
- DOM.setStyleAttribute(e, "visibility", "");
+ e.getStyle().setTop(0, Unit.PX);
+ e.getStyle().setLeft(0, Unit.PX);
+ e.getStyle().clearVisibility();
}
public void fixVisibleTabSize(int width, int height, int minWidth) {
diff --git a/client/src/com/vaadin/client/ui/VTwinColSelect.java b/client/src/com/vaadin/client/ui/VTwinColSelect.java
index 08018e4d64..3987460989 100644
--- a/client/src/com/vaadin/client/ui/VTwinColSelect.java
+++ b/client/src/com/vaadin/client/ui/VTwinColSelect.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.Set;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
@@ -32,7 +33,6 @@ import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ListBox;
@@ -393,7 +393,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
/** For internal use only. May be removed or replaced in the future. */
public void setInternalWidths() {
- DOM.setStyleAttribute(getElement(), "position", "relative");
+ getElement().getStyle().setPosition(Position.RELATIVE);
int bordersAndPaddings = Util.measureHorizontalPaddingAndBorder(
buttons.getElement(), 0);
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index 0f759caa2e..9b1f7a6f3c 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -31,8 +31,10 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.FocusEvent;
@@ -328,7 +330,7 @@ public class VWindow extends VWindowOverlay implements
protected void setZIndex(int zIndex) {
super.setZIndex(zIndex);
if (vaadinModality) {
- DOM.setStyleAttribute(getModalityCurtain(), "zIndex", "" + zIndex);
+ getModalityCurtain().getStyle().setZIndex(zIndex);
}
}
@@ -622,9 +624,9 @@ public class VWindow extends VWindowOverlay implements
this.closable = closable;
if (closable) {
- DOM.setStyleAttribute(closeBox, "display", "");
+ closeBox.getStyle().clearDisplay();
} else {
- DOM.setStyleAttribute(closeBox, "display", "none");
+ closeBox.getStyle().setDisplay(Display.NONE);
}
}
@@ -725,8 +727,8 @@ public class VWindow extends VWindowOverlay implements
}
private void showModalityCurtain() {
- DOM.setStyleAttribute(getModalityCurtain(), "zIndex",
- "" + (windowOrder.indexOf(this) + Z_INDEX));
+ getModalityCurtain().getStyle().setZIndex(
+ windowOrder.indexOf(this) + Z_INDEX);
if (isShowing()) {
getOverlayContainer().insertBefore(getModalityCurtain(),
@@ -801,12 +803,12 @@ public class VWindow extends VWindowOverlay implements
private Element createCurtain() {
Element curtain = DOM.createDiv();
- DOM.setStyleAttribute(curtain, "position", "absolute");
- DOM.setStyleAttribute(curtain, "top", "0px");
- DOM.setStyleAttribute(curtain, "left", "0px");
- DOM.setStyleAttribute(curtain, "width", "100%");
- DOM.setStyleAttribute(curtain, "height", "100%");
- DOM.setStyleAttribute(curtain, "zIndex", "" + VOverlay.Z_INDEX);
+ curtain.getStyle().setPosition(Position.ABSOLUTE);
+ curtain.getStyle().setTop(0, Unit.PX);
+ curtain.getStyle().setLeft(0, Unit.PX);
+ curtain.getStyle().setWidth(100, Unit.PCT);
+ curtain.getStyle().setHeight(100, Unit.PCT);
+ curtain.getStyle().setZIndex(VOverlay.Z_INDEX);
return curtain;
}
@@ -1041,7 +1043,7 @@ public class VWindow extends VWindowOverlay implements
}
showResizingCurtain();
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(resizeBox, "visibility", "hidden");
+ resizeBox.getStyle().setVisibility(Visibility.HIDDEN);
}
resizing = true;
startX = Util.getTouchOrMouseClientX(event);
@@ -1059,7 +1061,7 @@ public class VWindow extends VWindowOverlay implements
case Event.ONLOSECAPTURE:
hideResizingCurtain();
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(resizeBox, "visibility", "");
+ resizeBox.getStyle().clearVisibility();
}
resizing = false;
break;
diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
index 7c5ce9f673..a72049aa90 100644
--- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.client.ui.checkbox;
+import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -30,7 +31,6 @@ import com.vaadin.client.VTooltip;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.Icon;
-import com.vaadin.client.ui.ImageIcon;
import com.vaadin.client.ui.VCheckBox;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
@@ -82,12 +82,11 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
DOM.sinkEvents(getWidget().errorIndicatorElement,
VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
} else {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement,
- "display", "");
+ getWidget().errorIndicatorElement.getStyle().clearDisplay();
}
} else if (getWidget().errorIndicatorElement != null) {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
- "none");
+ getWidget().errorIndicatorElement.getStyle().setDisplay(
+ Display.NONE);
getWidget().setAriaInvalid(false);
}
diff --git a/client/src/com/vaadin/client/ui/link/LinkConnector.java b/client/src/com/vaadin/client/ui/link/LinkConnector.java
index cc952525a9..42c42cf06e 100644
--- a/client/src/com/vaadin/client/ui/link/LinkConnector.java
+++ b/client/src/com/vaadin/client/ui/link/LinkConnector.java
@@ -16,6 +16,7 @@
package com.vaadin.client.ui.link;
+import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.user.client.DOM;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
@@ -83,8 +84,8 @@ public class LinkConnector extends AbstractComponentConnector {
DOM.insertChild(getWidget().getElement(),
getWidget().errorIndicatorElement, 0);
} else if (getWidget().errorIndicatorElement != null) {
- DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
- "none");
+ getWidget().errorIndicatorElement.getStyle().setDisplay(
+ Display.NONE);
}
if (getWidget().icon != null) {
diff --git a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java
index 4296ab54a7..8c6afd1c4f 100644
--- a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java
+++ b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java
@@ -16,7 +16,7 @@
package com.vaadin.client.ui.tabsheet;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.DOM;
+import com.google.gwt.dom.client.Style.Overflow;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorHierarchyChangeEvent;
import com.vaadin.client.TooltipInfo;
@@ -77,11 +77,11 @@ public class TabsheetConnector extends TabsheetBaseConnector implements
// tabs; push or not
if (!isUndefinedWidth()) {
- DOM.setStyleAttribute(getWidget().tabs, "overflow", "hidden");
+ getWidget().tabs.getStyle().setOverflow(Overflow.HIDDEN);
} else {
getWidget().showAllTabs();
- DOM.setStyleAttribute(getWidget().tabs, "width", "");
- DOM.setStyleAttribute(getWidget().tabs, "overflow", "visible");
+ getWidget().tabs.getStyle().clearWidth();
+ getWidget().tabs.getStyle().setOverflow(Overflow.VISIBLE);
getWidget().updateDynamicWidth();
}