import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
-import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-public class VProgressIndicator extends Widget implements VPaintableWidget {
+public class VProgressIndicator extends Widget {
- private static final String CLASSNAME = "v-progressindicator";
+ public static final String CLASSNAME = "v-progressindicator";
Element wrapper = DOM.createDiv();
Element indicator = DOM.createDiv();
- private ApplicationConnection client;
- private final Poller poller;
- private boolean indeterminate = false;
+ protected ApplicationConnection client;
+ protected final Poller poller;
+ protected boolean indeterminate = false;
private boolean pollerSuspendedDueDetach;
- private int interval;
+ protected int interval;
public VProgressIndicator() {
setElement(DOM.createDiv());
poller = new Poller();
}
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- this.client = client;
- if (!uidl.getBooleanAttribute("cached")) {
- poller.cancel();
- }
- if (client.updateComponent(this, uidl, true)) {
- return;
- }
-
- indeterminate = uidl.getBooleanAttribute("indeterminate");
-
- if (indeterminate) {
- String basename = CLASSNAME + "-indeterminate";
- VProgressIndicator.setStyleName(getElement(), basename, true);
- VProgressIndicator.setStyleName(getElement(), basename
- + "-disabled", uidl.getBooleanAttribute("disabled"));
- } else {
- try {
- final float f = Float.parseFloat(uidl
- .getStringAttribute("state"));
- final int size = Math.round(100 * f);
- DOM.setStyleAttribute(indicator, "width", size + "%");
- } catch (final Exception e) {
- }
- }
-
- if (!uidl.getBooleanAttribute("disabled")) {
- interval = uidl.getIntAttribute("pollinginterval");
- poller.scheduleRepeating(interval);
- }
- }
-
@Override
protected void onAttach() {
super.onAttach();
}
}
-
- public Widget getWidgetForPaintable() {
- return this;
- }
-
}
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.UIDL;
+
+public class VProgressIndicatorPaintable extends VAbstractPaintableWidget {
+
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+
+ // Ensure correct implementation,
+ // but don't let container manage caption etc.
+ if (client.updateComponent(this, uidl, false)) {
+ return;
+ }
+
+ // Save details
+ getWidgetForPaintable().client = client;
+
+ getWidgetForPaintable().indeterminate = uidl
+ .getBooleanAttribute("indeterminate");
+
+ if (getWidgetForPaintable().indeterminate) {
+ String basename = VProgressIndicator.CLASSNAME + "-indeterminate";
+ getWidgetForPaintable().addStyleName(basename);
+ if (uidl.getBooleanAttribute("disabled")) {
+ getWidgetForPaintable().addStyleName(basename + "-disabled");
+ } else {
+ getWidgetForPaintable().removeStyleName(basename + "-disabled");
+ }
+ } else {
+ try {
+ final float f = Float.parseFloat(uidl
+ .getStringAttribute("state"));
+ final int size = Math.round(100 * f);
+ DOM.setStyleAttribute(getWidgetForPaintable().indicator,
+ "width", size + "%");
+ } catch (final Exception e) {
+ }
+ }
+
+ if (!uidl.getBooleanAttribute("disabled")) {
+ getWidgetForPaintable().interval = uidl
+ .getIntAttribute("pollinginterval");
+ getWidgetForPaintable().poller
+ .scheduleRepeating(getWidgetForPaintable().interval);
+ }
+ }
+
+ @Override
+ protected Widget createWidget() {
+ return GWT.create(VProgressIndicator.class);
+ }
+
+ @Override
+ public VProgressIndicator getWidgetForPaintable() {
+ return (VProgressIndicator) super.getWidgetForPaintable();
+ }
+}
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.ui.VProgressIndicator;
+import com.vaadin.terminal.gwt.client.ui.VProgressIndicatorPaintable;
/**
* <code>ProgressIndicator</code> is component that shows user state of a
* @since 4
*/
@SuppressWarnings("serial")
-@ClientWidget(VProgressIndicator.class)
+@ClientWidget(VProgressIndicatorPaintable.class)
public class ProgressIndicator extends AbstractField<Number> implements
Property.Viewer, Property.ValueChangeListener {