List of usage examples for com.google.gwt.user.client Element setPropertyInt
@Override public void setPropertyInt(String name, int value)
From source file:com.extjs.gxt.ui.client.widget.DatePick.java
License:Open Source License
private void createMonthPicker() { String ok = messages.getOkText() != null ? messages.getOkText() : myMessages.datePicker_okText(); String cancel = messages.getCancelText() != null ? messages.getCancelText() : myMessages.datePicker_cancelText(); StringBuffer buf = new StringBuffer(); buf.append("<table border=0 cellspacing=0>"); String[] monthNames = constants.shortMonths(); for (int i = 0; i < 6; i++) { buf.append("<tr><td class=x-date-mp-month><a href=#>" + monthNames[i] + "</a></td>"); buf.append("<td class='x-date-mp-month x-date-mp-sep'><a href=#>" + monthNames[i + 6] + "</a></td>"); if (i == 0) { buf.append(//from www .java 2s. c o m "<td class=x-date-mp-ybtn align=center><a class=x-date-mp-prev href=#></a></td><td class='x-date-mp-ybtn' align=center><a class='x-date-mp-next'></a></td></tr>"); } else { buf.append( "<td class='x-date-mp-year'><a href='#'></a></td><td class='x-date-mp-year'><a href='#'></a></td></tr>"); } } buf.append("<tr class=x-date-mp-btns><td colspan='4'><button type='button' class='x-date-mp-ok'>"); buf.append(ok); buf.append("</button><button type=button class=x-date-mp-cancel>"); buf.append(cancel); buf.append("</button></td></tr></table>"); monthPicker.update(buf.toString()); mpMonths = new CompositeElement(Util.toElementArray(monthPicker.select("td.x-date-mp-month"))); mpYears = new CompositeElement(Util.toElementArray(monthPicker.select("td.x-date-mp-year"))); mpMonths.each(new CompositeFunction() { public void doFunction(Element elem, CompositeElement ce, int index) { index += 1; if (index % 2 == 0) { elem.setPropertyInt("xmonth", (int) (5 + (Math.round(index * .5)))); } else { elem.setPropertyInt("xmonth", (int) (Math.round((index - 1) * .5))); } } }); }
From source file:com.extjs.gxt.ui.client.widget.DatePicker.java
License:sencha.com license
private void createMonthPicker() { StringBuffer buf = new StringBuffer(); buf.append("<table border=0 cellspacing=0>"); String[] monthNames = constants.shortMonths(); for (int i = 0; i < 6; i++) { buf.append("<tr><td class=x-date-mp-month><a href=#>"); buf.append(monthNames[i]);/* w w w . ja v a 2 s . co m*/ buf.append("</a></td>"); buf.append("<td class='x-date-mp-month x-date-mp-sep'><a href=#>"); buf.append(monthNames[i + 6]); buf.append("</a></td>"); if (i == 0) { buf.append( "<td class=x-date-mp-ybtn align=center><a class=x-date-mp-prev href=#></a></td><td class='x-date-mp-ybtn' align=center><a class='x-date-mp-next'></a></td></tr>"); } else { buf.append( "<td class='x-date-mp-year'><a href='#'></a></td><td class='x-date-mp-year'><a href='#'></a></td></tr>"); } } buf.append("<tr class=x-date-mp-btns><td colspan='4'><button type='button' class='x-date-mp-ok'>"); buf.append(messages.getOkText()); buf.append("</button><button type=button class=x-date-mp-cancel>"); buf.append(messages.getCancelText()); buf.append("</button></td></tr></table>"); monthPicker.update(SafeHtmlUtils.fromTrustedString(buf.toString())); mpMonths = new CompositeElement(Util.toElementArray(monthPicker.select("td.x-date-mp-month"))); mpYears = new CompositeElement(Util.toElementArray(monthPicker.select("td.x-date-mp-year"))); mpMonths.each(new CompositeFunction() { public void doFunction(Element elem, CompositeElement ce, int index) { index += 1; if (index % 2 == 0) { elem.setPropertyInt("xmonth", (int) (5 + (Math.round(index * .5)))); } else { elem.setPropertyInt("xmonth", (int) (Math.round((index - 1) * .5))); } } }); }
From source file:fr.loria.score.client.RtApi.java
License:Open Source License
public RtApi(JavaScriptObject jsConfig) { // and set the caret at pos 0 Config config = new DefaultConfig(jsConfig); // Get the text area element Element htmlTextAreaElement = DOM.getElementById(config.getParameter("textAreaId")); if (htmlTextAreaElement == null) { return;//from w w w. j ava2s. com } Element toReplace = DOM.getElementById(config.getParameter("toReplaceId")); if (toReplace == null) { toReplace = htmlTextAreaElement; } if (htmlTextAreaElement.getTagName().equalsIgnoreCase("textarea")) { int width = 500; int height = 210; TextArea tArea = TextArea.wrap(htmlTextAreaElement); height = tArea.getOffsetHeight(); width = tArea.getOffsetWidth(); Element canvasEl = DOM.createElement("canvas"); canvasEl.setId("editor"); canvasEl.setPropertyInt("width", width); canvasEl.setPropertyInt("height", height); com.google.gwt.dom.client.Element parentElem = toReplace.getParentElement(); parentElem.insertFirst(canvasEl); parentElem.removeChild(toReplace); injectJSFilesForRTEditor(parentElem); editor = Editor.getEditor(); editor.addHooksToEventListeners(new EditorApi()); clientJupiter.setCommunicationService(comService); clientJupiter.setDocument(new PlainDocument(tArea.getText())); clientJupiter.setEditingSessionId(config.getParameter(DOCUMENT_ID).hashCode()); clientJupiter.setCallback(new ClientCallback.PlainClientCallback(editor)); clientJupiter.connect(); } }
From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java
License:Open Source License
@Override public void setSelectionRange(Element element, int pos, int length) { if (!element.getPropertyBoolean(SELECTION_PRESERVED)) { element.setPropertyBoolean(SELECTION_PRESERVED, true); ensureSelectionIsPreserved(element); }/*from w ww. j a va 2 s.co m*/ if (isFocused(element)) { super.setSelectionRange(element, pos, length); } else { element.setPropertyInt(CURSOR_POS, pos); element.setPropertyInt(SELECTION_LENGTH, length); } }
From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java
License:Open Source License
/** * Saves the selection start and the selection length. * // w ww . j a v a 2s. com * @param element the element whose selection is saved */ private void saveSelection(Element element) { element.setPropertyInt(CURSOR_POS, getTextAreaCursorPos(element)); element.setPropertyInt(SELECTION_LENGTH, getSelectionLength(element)); }