gzz.client
Class AbstractUpdateManager

gzz.client.AbstractUpdateManager gzz.util.Background gzz.util.PriorityQueue ../../../Gzz_Background.gen.html#bggeneral bggeneral_small gzz.mem.MemoryPartitioner gzz.mem.MemoryConsumer gzz.client.AbstractUpdateManager ../../../Gzz_Memory.gen.html#memorytexAPI memorytexAPI_small
java.lang.Object
  |
  +--gzz.client.AbstractUpdateManager
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GLUpdateManager, JUpdateManager

public abstract class AbstractUpdateManager
extends java.lang.Object
implements java.lang.Runnable

A single global instance to manage the updating of windows. The windows are set in a priority order so that even if the user is moving fast, he will get an immediate response through the less important windows not being updated at each step.

Currently, GZigZag is single-threaded very strongly, so you can't allow anything to happen while the UpdateManager is working.


Nested Class Summary
static interface AbstractUpdateManager.FractCalculator
          An animation main curve calculator.
static class AbstractUpdateManager.LinearCalculator
           
static class AbstractUpdateManager.SimpleCalculator
           
static interface AbstractUpdateManager.Window
          A window animation is performed in.
 
Field Summary
static boolean dbg
           
static int defaultAnimationTime
           
static AbstractUpdateManager.FractCalculator fractCalc
           
protected static AbstractUpdateManager instance
           
static float jumpFract
           
protected  java.util.ArrayList ordering
          The order of windows, from the most important to the least.
static java.lang.String rcsid
           
 
Constructor Summary
protected AbstractUpdateManager(java.lang.Runnable r)
           
 
Method Summary
static void addWindow(AbstractUpdateManager.Window w)
           
protected  void callGenerateEnd(AbstractUpdateManager.Window w, int millis, float lod)
          Call the method of Window.
static void chg()
          Called by a space to inform that some cells have been changed and all windows should be updated.
static void chgAfter(int millis)
          We want to update the screen, but not start immediately in order to do some more background processing.
protected  void chgImpl()
           
protected  boolean doIdle()
          Do the background tasks that need to be done in the main thread.
static void doWhenIdle(java.lang.Runnable r, float priority)
          Run a given task in the main thread at some point in the future.
static void freeze()
          Disable all updating of windows.
static int getAnimationTime()
           
protected  int getAnimationTimeImpl()
           
protected abstract  boolean handleEvents(boolean waitForEvent)
          For subclasses to override: process incoming events.
protected  void interruptEventloop()
           
static void prioritize(AbstractUpdateManager.Window w)
          Set the window that has the privilege of animating the next update.
protected  void prioritizeImpl(AbstractUpdateManager.Window w)
           
static void rmWindow(AbstractUpdateManager.Window w)
           
 void run()
           
static void setAnimationTime(int millis)
           
protected  void setAnimationTimeImpl(int millis)
           
protected static void setInstance(AbstractUpdateManager in)
           
static void setNoAnimation()
           
static void thaw()
          Enable again the updating of windows.
static boolean tickIdle()
          Play the idle tasks one step; return true if something was done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rcsid

public static final java.lang.String rcsid
See Also:
Constant Field Values

dbg

public static boolean dbg

instance

protected static AbstractUpdateManager instance

ordering

protected java.util.ArrayList ordering
The order of windows, from the most important to the least.


jumpFract

public static final float jumpFract
See Also:
Constant Field Values

defaultAnimationTime

public static int defaultAnimationTime

fractCalc

public static AbstractUpdateManager.FractCalculator fractCalc
Constructor Detail

AbstractUpdateManager

protected AbstractUpdateManager(java.lang.Runnable r)
Method Detail

setInstance

protected static void setInstance(AbstractUpdateManager in)

callGenerateEnd

protected void callGenerateEnd(AbstractUpdateManager.Window w,
                               int millis,
                               float lod)
Call the method of Window. OpenGL needs to wrap this to put it in context.


addWindow

public static void addWindow(AbstractUpdateManager.Window w)

rmWindow

public static void rmWindow(AbstractUpdateManager.Window w)

prioritize

public static void prioritize(AbstractUpdateManager.Window w)
Set the window that has the privilege of animating the next update. May not be set to null; use setNoAnimation for that.


prioritizeImpl

protected void prioritizeImpl(AbstractUpdateManager.Window w)

setNoAnimation

public static void setNoAnimation()

setAnimationTime

public static void setAnimationTime(int millis)

setAnimationTimeImpl

protected void setAnimationTimeImpl(int millis)

getAnimationTime

public static int getAnimationTime()

getAnimationTimeImpl

protected int getAnimationTimeImpl()

chgAfter

public static void chgAfter(int millis)
We want to update the screen, but not start immediately in order to do some more background processing. For example, when MipzipLoader is working, we want to update the screen when new information has been loaded, but not right away.


chg

public static void chg()
Called by a space to inform that some cells have been changed and all windows should be updated.


chgImpl

protected void chgImpl()

freeze

public static void freeze()
Disable all updating of windows.


thaw

public static void thaw()
Enable again the updating of windows. Unlike freeze(), the effect should be instantaneous.


handleEvents

protected abstract boolean handleEvents(boolean waitForEvent)
For subclasses to override: process incoming events. In order to provide a responsive implementation, this method should only wait for 1000ms at most.

Parameters:
waitForEvent - Hang until an event comes.
Returns:
true, if any events were received.

doWhenIdle

public static void doWhenIdle(java.lang.Runnable r,
                              float priority)
Run a given task in the main thread at some point in the future.

See Also:
Background.addTask(java.lang.Runnable, float)

interruptEventloop

protected void interruptEventloop()

doIdle

protected boolean doIdle()
Do the background tasks that need to be done in the main thread. Implementations overriding this method should also delegate!

Returns:
true if something was done.

tickIdle

public static boolean tickIdle()
Play the idle tasks one step; return true if something was done. Used mainly from tests.


run

public void run()
Specified by:
run in interface java.lang.Runnable