List of usage examples for com.google.gwt.user.client DOM getElementPropertyInt
@Deprecated public static int getElementPropertyInt(Element elem, String prop)
From source file:asquare.gwt.tk.client.ui.behavior.MouseEventImpl.java
License:Apache License
/** * @param source the widget which is receiving the mouse event * @param mouseEvent a <code>mousedown</code>, <code>mousemove</code> or <code>mouseup</code> event * @param type the DOM event type/*from w w w .j a va 2s . co m*/ * @param previewPhase <code>true</code> if the event was caught in event preview */ public MouseEventImpl(Widget source, Event mouseEvent, int type, boolean previewPhase) { super(source, mouseEvent, type, previewPhase); Element e = source.getElement(); m_clientX = DOM.eventGetClientX(mouseEvent); m_clientY = DOM.eventGetClientY(mouseEvent); m_absoluteX = Window.getScrollLeft() + m_clientX; m_absoluteY = Window.getScrollTop() + m_clientY; m_widgetLeft = DOM.getAbsoluteLeft(source.getElement()); m_widgetTop = DOM.getAbsoluteTop(source.getElement()); /* * Translate the coordinates into the source widget's coordinate space * see MouseListenerCollection.fireMouseEvent() */ m_widgetX = m_absoluteX - m_widgetLeft + DOM.getElementPropertyInt(e, "scrollLeft"); m_widgetY = m_absoluteY - m_widgetTop + DOM.getElementPropertyInt(e, "scrollTop"); }
From source file:asquare.gwt.tk.client.ui.ModalDialog.java
License:Apache License
/** * Get the actual width of the content panel. This does not work until the * dialog has been shown.//w w w.j av a 2 s .c o m * * @return the width in pixels */ public int getContentOffsetWidth() { return DOM.getElementPropertyInt(m_contentTd, "offsetWidth"); }
From source file:asquare.gwt.tk.client.ui.ModalDialog.java
License:Apache License
/** * Get the actual height of the content panel. This does not work until the * dialog has been shown.// w ww . j a va2 s . c om * * @return the height in pixels */ public int getContentOffsetHeight() { return DOM.getElementPropertyInt(m_contentTd, "offsetHeight"); }
From source file:asquare.gwt.tk.client.util.DomUtil.java
License:Apache License
/** * Gets an int attribute on the specified UIObject's element. * /*from w w w. jav a 2 s.co m*/ * @param uio a UIObject * @param name the attribute name, in "camelCase" * @return the value, or <code>0</code> if the attribute is not defined */ public static int getIntAttribute(UIObject uio, String name) { return DOM.getElementPropertyInt(uio.getElement(), name); }
From source file:asquare.gwt.tk.client.util.TableUtil.java
License:Apache License
public static int getTableCellPadding(Element table) { return DOM.getElementPropertyInt(table, "cellPadding"); }
From source file:asquare.gwt.tk.client.util.TableUtil.java
License:Apache License
public static int getTableCellSpacing(Element table) { return DOM.getElementPropertyInt(table, "cellSpacing"); }
From source file:cc.alcina.framework.gwt.client.widget.complex.ProgressBar.java
License:Apache License
/** * This method is called when the dimensions of the parent element change. * Subclasses should override this method as needed. * //from www.j ava 2s. c om * Move the text to the center of the progress bar. * * @param width * the new client width of the element * @param height * the new client height of the element */ public void onResize(int width, int height) { if (textVisible) { int textWidth = DOM.getElementPropertyInt(textElement, "offsetWidth"); int left = (width / 2) - (textWidth / 2); DOM.setStyleAttribute(textElement, "left", left + "px"); } }
From source file:cc.alcina.framework.gwt.client.widget.complex.ProgressBar.java
License:Apache License
/** * Redraw the progress bar when something changes the layout. */// ww w . j a v a 2 s . com public void redraw() { if (isAttached()) { int width = DOM.getElementPropertyInt(getElement(), "clientWidth"); int height = DOM.getElementPropertyInt(getElement(), "clientHeight"); onResize(width, height); } }
From source file:cc.alcina.framework.gwt.client.widget.complex.SliderBar.java
License:Apache License
/** * Draw the labels along the line. not dimension-sensitive yet *///from www .j a v a2 s . c o m private void drawLabels() { // Abort if not attached if (!isAttached()) { return; } // Draw the labels int lineMajorDimension = getLineMajorDimension(); if (numLabels > 0) { // Create the labels or make them visible for (int i = 0; i <= numLabels; i++) { Element label = null; if (i < labelElements.size()) { label = labelElements.get(i); } else { // Create the new label label = DOM.createDiv(); DOM.setStyleAttribute(label, "position", "absolute"); DOM.setStyleAttribute(label, "display", "none"); if (enabled) { DOM.setElementProperty(label, "className", "gwt-SliderBar-label"); } else { DOM.setElementProperty(label, "className", "gwt-SliderBar-label-disabled"); } DOM.appendChild(getElement(), label); labelElements.add(label); } // Set the label text double value = minValue + (getTotalRange() * i / numLabels); DOM.setStyleAttribute(label, "visibility", "hidden"); DOM.setStyleAttribute(label, "display", ""); DOM.setElementProperty(label, "innerHTML", formatLabel(value)); // Move to the left so the label width is not clipped by the // shell DOM.setStyleAttribute(label, "left", "0px"); // Position the label and make it visible int labelWidth = DOM.getElementPropertyInt(label, "offsetWidth"); int labelLeftOffset = linePreOffset + (lineMajorDimension * i / numLabels) - (labelWidth / 2); labelLeftOffset = Math.min(labelLeftOffset, linePreOffset + lineMajorDimension - labelWidth); labelLeftOffset = Math.max(labelLeftOffset, linePreOffset); DOM.setStyleAttribute(label, "left", labelLeftOffset + "px"); DOM.setStyleAttribute(label, "visibility", "visible"); } // Hide unused labels for (int i = (numLabels + 1); i < labelElements.size(); i++) { DOM.setStyleAttribute(labelElements.get(i), "display", "none"); } } else { // Hide all labels for (Element elem : labelElements) { DOM.setStyleAttribute(elem, "display", "none"); } } }
From source file:cc.alcina.framework.gwt.client.widget.complex.SliderBar.java
License:Apache License
/** * Draw the tick along the line.// w ww . j av a 2 s.c o m */ private void drawTicks() { // Abort if not attached if (!isAttached()) { return; } // Draw the ticks int lineMajorDimension = getLineMajorDimension(); if (numTicks > 0) { // Create the ticks or make them visible for (int i = 0; i <= numTicks; i++) { Element tick = null; if (i < tickElements.size()) { tick = tickElements.get(i); } else { // Create the new tick tick = DOM.createDiv(); DOM.setStyleAttribute(tick, "position", "absolute"); DOM.setStyleAttribute(tick, "display", "none"); DOM.appendChild(getElement(), tick); tickElements.add(tick); } if (enabled) { DOM.setElementProperty(tick, "className", "gwt-SliderBar-tick"); } else { DOM.setElementProperty(tick, "className", "gwt-SliderBar-tick gwt-SliderBar-tick-disabled"); } // Position the tick and make it visible DOM.setStyleAttribute(tick, "visibility", "hidden"); DOM.setStyleAttribute(tick, "display", ""); int tickWidth = DOM.getElementPropertyInt(tick, "offsetWidth"); int tickLeftOffset = linePreOffset + (lineMajorDimension * i / numTicks) - (tickWidth / 2); tickLeftOffset = Math.min(tickLeftOffset, linePreOffset + lineMajorDimension - tickWidth); DOM.setStyleAttribute(tick, "left", tickLeftOffset + "px"); DOM.setStyleAttribute(tick, "visibility", "visible"); } // Hide unused ticks for (int i = (numTicks + 1); i < tickElements.size(); i++) { DOM.setStyleAttribute(tickElements.get(i), "display", "none"); } } else { // Hide all ticks for (Element elem : tickElements) { DOM.setStyleAttribute(elem, "display", "none"); } } knobImage.getElement().removeFromParent(); DOM.appendChild(getElement(), knobImage.getElement()); }