moced down delayed operation too

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@70597 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-02-28 14:32:10 +00:00
parent bf578453be
commit b449b9c045
2 changed files with 57 additions and 35 deletions

35
pom.xml
View File

@ -174,41 +174,6 @@
</execution>
</executions>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- TODO: Update version to 2.5.0 once gwt-maven-plugin 2.5.0 final
is released (post-GWT 2.5.0) -->
<version>2.4.0</version>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
</dependency>
</dependencies>
<!-- JS is only needed in the package phase, this speeds up testing -->
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,57 @@
/****************************************************************************
* This software is part of the gCube Project.
* Site: http://www.gcube-system.org/
****************************************************************************
* The gCube/gCore software is licensed as Free Open Source software
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
* The software and documentation is provided by its authors/distributors
* "as is" and no expressed or
* implied warranty is given for its use, quality or fitness for a
* particular case.
****************************************************************************
* Filename: DelayedOperation.java
****************************************************************************
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
***************************************************************************/
package org.gcube.resourcemanagement.support.shared.util;
import com.google.gwt.user.client.Timer;
/**
* Performs a delayed action on client side.
* Usage:
* <pre>
* new DelayedOperation() {
* // @Override
* public void doJob() {
* // Here the code...
* }
* }.start(5000); // the operation will start after 5 secs.
* </pre>
* @author Daniele Strollo (ISTI-CNR)
*/
public abstract class DelayedOperation {
public final void start(final int delayMills) {
Timer t = new Timer() {
@Override
public void run() {
doJob();
}
};
t.schedule(delayMills);
}
public final void loop(final int delayMills) {
Timer t = new Timer() {
@Override
public void run() {
doJob();
this.schedule(delayMills);
}
};
t.schedule(delayMills);
}
public abstract void doJob();
}