List of usage examples for com.google.gwt.user.client DOM setElementPropertyInt
@Deprecated public static void setElementPropertyInt(Element elem, String prop, int value)
From source file:asquare.gwt.tk.client.util.DomUtil.java
License:Apache License
/** * Sets an int attribute on the specified UIObject's element. * /*from w w w . j ava 2 s . c o m*/ * @param uio a UIObject * @param name the attribute name, in "camelCase" * @param value an int value */ public static void setIntAttribute(UIObject uio, String name, int value) { DOM.setElementPropertyInt(uio.getElement(), name, value); }
From source file:asquare.gwt.tk.client.util.TableUtil.java
License:Apache License
public static void setTableCellPadding(Element table, int px) { DOM.setElementPropertyInt(table, "cellPadding", px); }
From source file:asquare.gwt.tk.client.util.TableUtil.java
License:Apache License
public static void setTableCellSpacing(Element table, int px) { DOM.setElementPropertyInt(table, "cellSpacing", px); }
From source file:cc.alcina.framework.gwt.client.widget.dialog.DecoratorPanel.java
License:Apache License
/** * Creates a new panel using the specified style names to apply to each row. * Each row will contain three cells (Left, Center, and Right). The Center * cell in the containerIndex row will contain the {@link Widget}. * /*from ww w.j a va2 s .c o m*/ * @param rowStyles * an array of style names to apply to each row * @param containerIndex * the index of the container row */ DecoratorPanel(String[] rowStyles, int containerIndex) { super(DOM.createTable()); // Add a tbody Element table = getElement(); tbody = DOM.createTBody(); DOM.appendChild(table, tbody); DOM.setElementPropertyInt(table, "cellSpacing", 0); DOM.setElementPropertyInt(table, "cellPadding", 0); // Add each row for (int i = 0; i < rowStyles.length; i++) { Element row = createTR(rowStyles[i]); DOM.appendChild(tbody, row); if (i == containerIndex) { containerElem = DOM.getFirstChild(DOM.getChild(row, 1)); } } // Set the overall style name setStyleName(DEFAULT_STYLENAME); }
From source file:cc.alcina.framework.gwt.client.widget.DivStackPanel.java
License:Apache License
/** * Inserts a widget before the specified index. * //from w w w .ja v a 2 s .c o m * @param w * the widget to be inserted * @param beforeIndex * the index before which it will be inserted * @throws IndexOutOfBoundsException * if <code>beforeIndex</code> is out of range */ public void insert(Widget w, int beforeIndex) { Element tdh = createHeaderElem(); Element tdb = DOM.createDiv(); // DOM indices are 2x logical indices; 2 dom elements per stack item beforeIndex = adjustIndex(w, beforeIndex); int effectiveIndex = beforeIndex * 2; // this ordering puts the body below the header DOM.insertChild(getElement(), tdb, effectiveIndex); DOM.insertChild(getElement(), tdh, effectiveIndex); // header styling setStyleName(tdh, DEFAULT_ITEM_STYLENAME, true); DOM.setElementPropertyInt(tdh, "__owner", hashCode()); DOM.setElementProperty(tdh, "height", "1px"); // body styling setStyleName(tdb, DEFAULT_STYLENAME + "Content", true); DOM.setElementProperty(tdb, "height", "100%"); DOM.setElementProperty(tdb, "vAlign", "top"); // Now that the DOM is connected, call insert (this ensures that // onLoad() is // not fired until the child widget is attached to the DOM). super.insert(w, tdb, beforeIndex, false); // Update indices of all elements to the right. updateIndicesFrom(beforeIndex); // Correct visible stack for new location. if (visibleStack == -1) { showStack(0); } else { setStackVisible(beforeIndex, false); if (visibleStack >= beforeIndex) { ++visibleStack; } // Reshow the stack to apply style names setStackVisible(visibleStack, true); } }
From source file:cc.alcina.framework.gwt.client.widget.DivStackPanel.java
License:Apache License
private void updateIndicesFrom(int beforeIndex) { for (int i = beforeIndex, c = getWidgetCount(); i < c; ++i) { Element childTR = DOM.getChild(body, i * 2); Element childTD = childTR; DOM.setElementPropertyInt(childTD, "__index", i); // Update the special style on the first element if (beforeIndex == 0) { setStyleName(childTD, DEFAULT_ITEM_STYLENAME + "-first", true); } else {/*from w w w .jav a2 s . com*/ setStyleName(childTD, DEFAULT_ITEM_STYLENAME + "-first", false); } } }
From source file:ccc.client.gwt.widgets.FCKEditor.java
License:LGPL
private void switchToEditor(final String cssHeight) { _toggleButton.setText(_uiConstants.loading()); _htmlArea.hide();// ww w .j a v a 2 s. c om initJSNI(FCKEditor.this); //Create the hidden input box _inputBox.setId(_elementID); _inputBox.setVisible(false); _inputBox.setValue(_html == null || _html.equals("") ? " " : _html); //Create the configuration input box _configBox.setId(_elementID + "___Config"); _configBox.setVisible(false); _configBox.setValue(""); //Create the IFRAME _editorFrame.setUrl(getFckBaseUrl() + "editor/fckeditor.html?InstanceName=" + _elementID + "&Toolbar=ccc"); _editorFrame.setHeight(cssHeight); DOM.setElementProperty(_editorFrame.getElement(), "height", cssHeight); DOM.setElementProperty(_editorFrame.getElement(), "scrolling", "no"); DOM.setElementProperty(_editorFrame.getElement(), "id", _elementID + "___Frame"); DOM.setElementPropertyInt(_editorFrame.getElement(), "frameBorder", 0); // Build the panel remove(_toggleButton); add(_configBox); add(_inputBox); add(_editorFrame); add(_toggleButton); fckResize(getWidth()); layout(); }
From source file:com.extjs.gxt.ui.client.widget.impl.PngImageImpl.java
License:sencha.com license
public Element createElement(String url, int width, int height) { Element result = DOM.createImg(); DOM.setElementProperty(result, "src", url); DOM.setElementPropertyInt(result, "width", width); DOM.setElementPropertyInt(result, "height", height); return result; }
From source file:com.extjs.gxt.ui.client.widget.table.TableView.java
License:Open Source License
protected void render() { scrollBarWidth = XDOM.getScrollBarWidth(); Element div = DOM.createDiv(); div.setInnerHTML(bodyHTML.toString()); scrollEl = new El(El.fly(div).getSubChild(2)); dataEl = scrollEl.firstChild();// ww w.j ava2s .com DOM.appendChild(table.getElement(), DOM.getFirstChild(div)); if (table.getVerticalLines()) { table.addStyleName("my-tbl-vlines"); } if (!GXT.isIE) { DOM.setElementPropertyInt(table.getElement(), "tabIndex", 0); } DOM.sinkEvents(scrollEl.dom, Event.ONSCROLL); if (!GXT.isGecko) { table.disableTextSelection(true); } table.el().addEventsSunk(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS | Event.KEYEVENTS); }
From source file:com.google.gerrit.client.ui.ComplexDisclosurePanel.java
License:Apache License
public ComplexDisclosurePanel(final String text, final boolean isOpen) { // Ick. GWT's DisclosurePanel won't let us subclass it, or do any // other modification of its header. We're stuck with injecting // into the DOM directly. //// ww w. ja va2 s .c o m main = new DisclosurePanel(text); main.setOpen(isOpen); final Element headerParent; { final Element table = main.getElement(); final Element tbody = DOM.getFirstChild(table); final Element tr1 = DOM.getChild(tbody, 0); final Element tr2 = DOM.getChild(tbody, 1); DOM.setElementProperty(DOM.getChild(tr1, 0), "width", "20px"); DOM.setElementPropertyInt(DOM.getChild(tr2, 0), "colSpan", 2); headerParent = tr1; } header = new ComplexPanel() { { setElement(DOM.createTD()); DOM.setInnerHTML(getElement(), " "); addStyleName(Gerrit.RESOURCES.css().complexHeader()); } @Override public void add(Widget w) { add(w, getElement()); } }; initWidget(new ComplexPanel() { { final DisclosurePanel main = ComplexDisclosurePanel.this.main; setElement(main.getElement()); getChildren().add(main); adopt(main); add(ComplexDisclosurePanel.this.header, headerParent); } }); }