view src/econnect/wp3_3/client/widgets/timeplot/StiTimeplot.java @ 28:6ec1ab4f897a

Added .toString() to force String output, otherwise this can lead to Type Exceptions (e.g. when an int is returned).
author Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
date Wed, 28 Nov 2012 16:56:38 +0100
parents cf06b77a8bbd
children
line wrap: on
line source

package econnect.wp3_3.client.widgets.timeplot;

import com.google.gwt.core.client.JavaScriptObject;

import econnect.wp3_3.client.core.StiCore;

/**
 * Implementation of the wrapper for the STITimeplot class of the STI JavaScript source
*/
public class StiTimeplot extends JavaScriptObject {
	
	protected StiTimeplot(){
	}
	
    /**
     * Initializes a STITimeplot element
     *
     * @param core the core of the STI
     * @param window the window div id for the container for the timeplot element
     * @param container the container div id for the timeplot element
     * @return a STITimeplot object
    */
	public static native StiTimeplot createStiTimeplot(StiCore core, String window, String container) /*-{
		return new $wnd.STITimeplot(core, window, container);
	}-*/;
	
	/**
	 * activates the play function of the timeplot element
	*/
	public final native void play() /*-{
		this.play();
	}-*/;

	/**
	 * stops the play function of the timeplot element
	*/
	public final native void pause() /*-{
		this.stop();
	}-*/;

	/**
	 * Getter for the play status
	 * 
	 * @return the play status; true if it plays, false if not
	*/
	public final native boolean paused() /*-{
		return this.paused;
	}-*/;

	/**
	 * Getter for the number of zoom levels; depends on the number of timeslices
	 * 
	 * @return the number of zoom levels
	*/
	public final native int getNumZoomLevels() /*-{
		return this.getZoomLevels();
	}-*/;
	
	/**
	 * Changes zoom of the timeplot
	 * 
	 * @param delta is 1 if zoom-in and -1 if zoom-out
	*/
	public final native void zoom(int delta) /*-{
		this.zoom(delta,null);
	}-*/;
	
	/**
	 * get actual min time
	*/
	public final native String minTime() /*-{
		return this.eds.minDate.getTime().toString();
	}-*/;

	/**
	 * get actual max time
	*/
	public final native String maxTime() /*-{
		return this.eds.maxDate.getTime().toString();
	}-*/;

	public final native String minSelTime() /*-{
		if( this.leftFlagTime != null ){
			return this.leftFlagTime.getTime().toString();
		}
		return null;
	}-*/;

	public final native String maxSelTime() /*-{
		if( this.rightFlagTime != null ){
			return this.rightFlagTime.getTime().toString();
		}
		return null;
	}-*/;

	public final native void selectTimerange(String minSelTime, String maxSelTime) /*-{
		this.selectTimerange(minSelTime,maxSelTime);
	}-*/;

}