/** Sets whether the text is visible over the bar. * * @param textVisible True to show text, false to hide it */ public void setTextVisible (boolean textVisible) { this.textVisible = textVisible; if (this.textVisible) { DOM.setStyleAttribute(textElement, "display", ""); redraw(); } else { DOM.setStyleAttribute(textElement, "display", "none"); } }
/** Sets whether the text is visible over the bar. * * @param textVisible True to show text, false to hide it */ public void setTextVisible (boolean textVisible) { this.textVisible = textVisible; if (this.textVisible) { DOM.setStyleAttribute(textElement, "display", ""); redraw(); } else { DOM.setStyleAttribute(textElement, "display", "none"); } }
/** This method is called when the dimensions of the parent element change. Subclasses should override this method as needed. * * 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"); } }
/** This method is called when the dimensions of the parent element change. Subclasses should override this method as needed. * * 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"); } }
/** 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(); }
/** This method is called immediately after a widget becomes attached to the browser's document. */ @Override protected void onLoad () { // Reset the position attribute of the parent element DOM.setStyleAttribute(getElement(), "position", "relative"); ResizableWidgetCollection.get().add(this); redraw(); }
/** This method is called immediately after a widget becomes attached to the browser's document. */ @Override protected void onLoad () { // Reset the position attribute of the parent element DOM.setStyleAttribute(getElement(), "position", "relative"); ResizableWidgetCollection.get().add(this); redraw(); }
/** Create a progress bar within the given range starting at the specified progress amount. * * @param minProgress the minimum progress * @param maxProgress the maximum progress * @param curProgress the current progress * @param textFormatter the text formatter */ public ProgressBar (double minProgress, double maxProgress, double curProgress, TextFormatter textFormatter) { this.minProgress = minProgress; this.maxProgress = maxProgress; this.curProgress = curProgress; setTextFormatter(textFormatter); // Create the outer shell setElement(DOM.createDiv()); DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-ProgressBar-shell"); // Create the bar element barElement = DOM.createDiv(); DOM.appendChild(getElement(), barElement); DOM.setStyleAttribute(barElement, "height", "100%"); setBarStyleName("gwt-ProgressBar-bar"); // Create the text element textElement = DOM.createDiv(); DOM.appendChild(getElement(), textElement); DOM.setStyleAttribute(textElement, "position", "absolute"); DOM.setStyleAttribute(textElement, "top", "0px"); // Set the current progress setProgress(curProgress); }
/** Create a progress bar within the given range starting at the specified progress amount. * * @param minProgress the minimum progress * @param maxProgress the maximum progress * @param curProgress the current progress * @param textFormatter the text formatter */ public ProgressBar (double minProgress, double maxProgress, double curProgress, TextFormatter textFormatter) { this.minProgress = minProgress; this.maxProgress = maxProgress; this.curProgress = curProgress; setTextFormatter(textFormatter); // Create the outer shell setElement(DOM.createDiv()); DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-ProgressBar-shell"); // Create the bar element barElement = DOM.createDiv(); DOM.appendChild(getElement(), barElement); DOM.setStyleAttribute(barElement, "height", "100%"); setBarStyleName("gwt-ProgressBar-bar"); // Create the text element textElement = DOM.createDiv(); DOM.appendChild(getElement(), textElement); DOM.setStyleAttribute(textElement, "position", "absolute"); DOM.setStyleAttribute(textElement, "top", "0px"); // Set the current progress setProgress(curProgress); }
/** * {@inheritDoc} */ public void setTransform(Element element, String transform) { DOM.setStyleAttribute(element, "WebkitTransform", transform); }
/** * Sets the Modal's width. * * @param width Modal's new width, in px */ public void setWidth(int width) { DOM.setStyleAttribute(this.getElement(), "width", width + "px"); DOM.setStyleAttribute(this.getElement(), "marginLeft", (-width / 2) + "px"); }
/** * Sets the Modal's body maxHeight. * * @param maxHeight the Modal's body new maxHeight, in CSS units (e.g. "10px", "1em") */ public void setMaxHeigth(String maxHeight) { DOM.setStyleAttribute(body.getElement(), "maxHeight", maxHeight); }
/** * Sets the Modal's body height. * @param height the Modal's body height, in px */ public void setBodyHeigth( int height ) { DOM.setStyleAttribute( body.getElement(), "height", height + "px" ); }
/** * Constructor. */ public MouseResizeWorkerOpera() { cursorUpdateDiv = DOM.createDiv(); DOM.setStyleAttribute(cursorUpdateDiv, "position", "absolute"); }
public void setOpacity(double opacity) { this.opacity = opacity; DOM.setStyleAttribute(widget.getElement(), "filter", "alpha(opacity=" + (opacity * 100) + ")"); DOM.setStyleAttribute(widget.getElement(), "opacity", Double.toString(opacity)); }
@Override protected void onComplete() { if (!opening) { curPanel.content.setVisible(false); } DOM.setStyleAttribute(curPanel.content.getElement(), "height", "auto"); DOM.setStyleAttribute(curPanel.content.getElement(), "overflow", "visible"); curPanel = null; }
public void setScrollable(boolean scrollable) { if (!scrollable) { setStyleAttribute(scrollPanel.getElement(), "overflow", "hidden"); scrollPanel.setHeight("20px"); table.setHeight("20px"); } else { setStyleAttribute(scrollPanel.getElement(), "overflow", "scroll"); } }
public void init(Panel container, FileUploadWithMouseEvents input) { super.init(container, input); DOM.setStyleAttribute(input.getElement(), "position", "absolute"); } }
/** {@inheritDoc} */ @Override public void setFooterWidget(int column, Widget widget) { getFooterTable().setFooterWidget(column, widget); Element tr = DOM.getChild(getTFootElement(), 0); Element td = DOM.getChild(tr, column); if (isResizable()) { DOM.setStyleAttribute(td, "overflow", "hidden"); DOM.setStyleAttribute(td, "whiteSpace", "nowrap"); } }