private void updateTextStyle (int percent) { // Set the style depending on the size of the bar if (percent < 50) { DOM.setElementProperty(textElement, "className", textClassName + " " + textFirstHalfClassName); } else { DOM.setElementProperty(textElement, "className", textClassName + " " + textSecondHalfClassName); } } }
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; }
private void updateTextStyle (int percent) { // Set the style depending on the size of the bar if (percent < 50) { DOM.setElementProperty(textElement, "className", textClassName + " " + textFirstHalfClassName); } else { DOM.setElementProperty(textElement, "className", textClassName + " " + textSecondHalfClassName); } } }
public void setBarStyleName (String barClassName) { DOM.setElementProperty(barElement, "className", barClassName); }
public void setBarStyleName (String barClassName) { DOM.setElementProperty(barElement, "className", barClassName); }
/** Set the current progress. * * @param curProgress the current progress */ public void setProgress (double curProgress) { this.curProgress = Math.max(minProgress, Math.min(maxProgress, curProgress)); // Calculate percent complete int percent = (int)(100 * getPercent()); DOM.setStyleAttribute(barElement, "width", percent + "%"); DOM.setElementProperty(textElement, "innerHTML", generateText(curProgress)); updateTextStyle(percent); // Realign the text redraw(); }
/** Set the current progress. * * @param curProgress the current progress */ public void setProgress (double curProgress) { this.curProgress = Math.max(minProgress, Math.min(maxProgress, curProgress)); // Calculate percent complete int percent = (int)(100 * getPercent()); DOM.setStyleAttribute(barElement, "width", percent + "%"); DOM.setElementProperty(textElement, "innerHTML", generateText(curProgress)); updateTextStyle(percent); // Realign the text redraw(); }
private void updateTextStyle (int percent) { // Set the style depending on the size of the bar if (percent < 50) { DOM.setElementProperty(textElement, "className", textClassName + " " + textFirstHalfClassName); } else { DOM.setElementProperty(textElement, "className", textClassName + " " + textSecondHalfClassName); } } }
/** * Sets the width of the table's border. This border is displayed around all * cells in the table. * * @param width the width of the border, in pixels */ public void setBorderWidth(int width) { DOM.setElementProperty(tableElem, "border", "" + width); }
/** * Sets the width of the specified column. * * @param column the column of the cell whose width is to be set * @param width the cell's new width, in percentage or pixel units * @throws IndexOutOfBoundsException */ public void setWidth(int column, String width) { DOM.setElementProperty(ensureColumn(column), "width", width); }
@Override public void setAccessKey(char key) { DOM.setElementProperty(getElement(), "accessKey", Character.toString(key)); }
@Override public void setTargetHistoryToken(final String targetHistoryToken) { assert targetHistoryToken != null : "New history item cannot be null!"; this.targetHistoryToken = targetHistoryToken; String href = (targetHistoryToken.startsWith("/")) ? targetHistoryToken : "/" + targetHistoryToken; DOM.setElementProperty(getElement(), "href", CodeServerParameterHelper.append(href)); }
/** * Highlight this widget. */ private void highlight() { String styleName = getStylePrimaryName(); DOM.setElementProperty(getElement(), "className", styleName + " " //$NON-NLS-1$ //$NON-NLS-2$ + styleName + "-focused"); //$NON-NLS-1$ }
/** * Unhighlight this widget. */ private void unhighlight() { DOM.setElementProperty(getElement(), "className", getStylePrimaryName()); } }
@Override public void setValue(String text) { DOM.setElementProperty(getTextBox().getElement(), "value", text); } }
/** * Highlight this widget. */ private void highlight() { String styleName = getStylePrimaryName(); DOM.setElementProperty(getElement(), "className", styleName + " " + styleName + "-focused"); }
/** * Unhighlight this widget. */ private void unhighlight() { DOM.setElementProperty(getElement(), "className", getStylePrimaryName()); //$NON-NLS-1$ }
@Override public void setTargetHistoryToken(final String targetHistoryToken) { assert targetHistoryToken != null : "New history item cannot be null!"; this.targetHistoryToken = targetHistoryToken; String href = (targetHistoryToken.startsWith("/")) ? targetHistoryToken : "/" + targetHistoryToken; DOM.setElementProperty((Element) getElement().getChild(0), "href", CodeServerParameterHelper.append(href)); }
@PatchMethod static void setText(ValueBoxBase<?> valueBoxBase, String text) { DOM.setElementProperty(valueBoxBase.getElement(), "value", text != null ? text : ""); AutoDirectionHandler autoDirHandler = GwtReflectionUtils.getPrivateFieldValue(valueBoxBase, "autoDirHandler"); autoDirHandler.refreshDirection(); int cursorPos = text != null ? text.length() : 0; valueBoxBase.setCursorPos(cursorPos); }
@PatchMethod static void setText(ValueBoxBase<?> valueBoxBase, String text) { DOM.setElementProperty(valueBoxBase.getElement(), "value", text != null ? text : ""); AutoDirectionHandler autoDirHandler = GwtReflectionUtils.getPrivateFieldValue(valueBoxBase, "autoDirHandler"); autoDirHandler.refreshDirection(); int cursorPos = text != null ? text.length() : 0; valueBoxBase.setCursorPos(cursorPos); }