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;
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;
}
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;
}
}
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,
widthGuess = 0;
}
- DOM.setStyleAttribute(element, "width", widthGuess + "px");
+ element.getStyle().setWidth(widthGuess, Unit.PX);
int captionOffsetWidth = DOM.getElementPropertyInt(element,
"offsetWidth");
// Cannot set negative width even if we would want to
w = 0;
}
- DOM.setStyleAttribute(element, "width", w + "px");
+ element.getStyle().setWidth(w, Unit.PX);
}
heightGuess = 0;
}
- DOM.setStyleAttribute(element, "height", heightGuess + "px");
+ element.getStyle().setHeight(heightGuess, Unit.PX);
int captionOffsetHeight = DOM.getElementPropertyInt(element,
"offsetHeight");
// Cannot set negative height even if we would want to
h = 0;
}
- DOM.setStyleAttribute(element, "height", h + "px");
+ element.getStyle().setHeight(h, Unit.PX);
}
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);
}
}
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;
}
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();
if (availableWidth > iconRequiredWidth) {
availableWidth -= iconRequiredWidth;
} else {
- DOM.setStyleAttribute(icon.getElement(), "width",
- availableWidth + "px");
+ icon.getElement().getStyle()
+ .setWidth(availableWidth, Unit.PX);
availableWidth = 0;
}
}
availableWidth -= captionWidth;
} else {
- DOM.setStyleAttribute(captionText, "width", availableWidth
- + "px");
+ captionText.getStyle().setWidth(availableWidth, Unit.PX);
availableWidth = 0;
}
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;
}
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
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;
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();
}
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);
}
}
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;
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);
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);
}
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);
}
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;
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);
}
}
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("");
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;
/**
}
// Set the color
- DOM.setStyleAttribute(colorIcon.getElement(), "background", color);
-
+ colorIcon.getElement().getStyle().setProperty("background", color);
}
}
public void refreshColor() {
if (color != null) {
// Set the color
- DOM.setStyleAttribute(area.getElement(), "background", color);
+ area.getElement().getStyle().setProperty("background", color);
}
}
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>();
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;
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();
}
}
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;
public VNotification() {
setStyleName(STYLENAME);
sinkEvents(Event.ONCLICK);
- DOM.setStyleAttribute(getElement(), "zIndex", "" + Z_INDEX_BASE);
+ getElement().getStyle().setZIndex(Z_INDEX_BASE);
}
/**
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:
}
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 + ")");
}
}
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;
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();
* 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);
}
}
}
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()) {
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;
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;
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;
/** 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);
}
}
}
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);
}
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),
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);
}
}
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);
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);
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;
}
}
}
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 {
/*
public TableFooter() {
- DOM.setStyleAttribute(hTableWrapper, "overflow", "hidden");
+ hTableWrapper.getStyle().setOverflow(Overflow.HIDDEN);
DOM.appendChild(table, headerTableBody);
DOM.appendChild(headerTableBody, tr);
* 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();
}
/**
*/
private void setContainerHeight() {
fixSpacers();
- DOM.setStyleAttribute(container, "height",
- measureRowHeightOffset(totalRows) + "px");
+ container.getStyle().setHeight(measureRowHeightOffset(totalRows),
+ Unit.PX);
}
private void fixSpacers() {
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;
}
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;
/**
* Representation of a single "tab" shown in the TabBar
- *
+ *
*/
public static class Tab extends SimplePanel implements HasFocusHandlers,
HasBlurHandlers, HasKeyDownHandlers {
/**
* Toggles the style names for the Tab
- *
+ *
* @param selected
* true if the Tab is selected
* @param first
/**
* Returns the index of the first visible tab
- *
+ *
* @return
*/
private int getFirstVisibleTab() {
/**
* Find the next visible tab. Returns -1 if none is found.
- *
+ *
* @param i
* @return
*/
/**
* Find the previous visible tab. Returns -1 if none is found.
- *
+ *
* @param i
* @return
*/
/**
* Load the content of a tab of the provided index.
- *
+ *
* @param index
* of the tab to load
*/
/**
* Returns the currently displayed widget in the tab panel.
- *
+ *
* @since 7.2
* @return currently displayed content widget
*/
/**
* Returns the client to server RPC proxy for the tabsheet.
- *
+ *
* @since 7.2
* @return RPC proxy
*/
/**
* 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
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);
/**
* Checks if the tab with the selected index has been scrolled out of the
* view (on the left side).
- *
+ *
* @param index
* @return
*/
/**
* Renders the widget content for a tab sheet.
- *
+ *
* @param newWidget
*/
public void renderContent(Widget newWidget) {
}
// 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();
}
}
*/
private void updateTabScroller() {
if (!isDynamicWidth()) {
- DOM.setStyleAttribute(tabs, "width", "100%");
+ tabs.getStyle().setWidth(100, Unit.PCT);
}
// Make sure scrollerIndex is valid
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",
: -1);
} else {
- DOM.setStyleAttribute(scroller, "display", "none");
+ scroller.getStyle().setDisplay(Display.NONE);
}
if (BrowserInfo.get().isSafari()) {
/**
* Makes tab bar visible.
- *
+ *
* @since 7.2
*/
public void showTabs() {
/**
* Makes tab bar invisible.
- *
+ *
* @since 7.2
*/
public void hideTabs() {
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;
private Element createContainerElement() {
Element el = DOM.createDiv();
- DOM.setStyleAttribute(el, "position", "absolute");
+ el.getStyle().setPosition(Position.ABSOLUTE);
hide(el);
touchScrollHandler.addElement(el);
return el;
}
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) {
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;
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;
/** 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);
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;
protected void setZIndex(int zIndex) {
super.setZIndex(zIndex);
if (vaadinModality) {
- DOM.setStyleAttribute(getModalityCurtain(), "zIndex", "" + zIndex);
+ getModalityCurtain().getStyle().setZIndex(zIndex);
}
}
this.closable = closable;
if (closable) {
- DOM.setStyleAttribute(closeBox, "display", "");
+ closeBox.getStyle().clearDisplay();
} else {
- DOM.setStyleAttribute(closeBox, "display", "none");
+ closeBox.getStyle().setDisplay(Display.NONE);
}
}
}
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(),
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;
}
}
showResizingCurtain();
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(resizeBox, "visibility", "hidden");
+ resizeBox.getStyle().setVisibility(Visibility.HIDDEN);
}
resizing = true;
startX = Util.getTouchOrMouseClientX(event);
case Event.ONLOSECAPTURE:
hideResizingCurtain();
if (BrowserInfo.get().isIE()) {
- DOM.setStyleAttribute(resizeBox, "visibility", "");
+ resizeBox.getStyle().clearVisibility();
}
resizing = false;
break;
*/
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;
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;
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);
}
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;
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) {
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;
// 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();
}