The great Interval revamp.
There is no more SafeInterval, instead Intervals can be constructed with a RunQueue to use for expiring. PresentsDObjectMgr implements RunQueue. Client has a getRunQueue() method to get the client side RunQueue. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3283 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,13 +21,14 @@
|
||||
|
||||
package com.threerings.micasa.client;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
import com.samskivert.util.RunQueue;
|
||||
import com.threerings.util.MessageManager;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
@@ -50,7 +51,7 @@ import com.threerings.micasa.util.MiCasaContext;
|
||||
* extended context implementation.
|
||||
*/
|
||||
public class MiCasaClient
|
||||
implements Client.Invoker
|
||||
implements RunQueue
|
||||
{
|
||||
/**
|
||||
* Initializes a new client and provides it with a frame in which to
|
||||
@@ -128,11 +129,17 @@ public class MiCasaClient
|
||||
_chatdir = new ChatDirector(_ctx, _msgmgr, null);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void invokeLater (Runnable run)
|
||||
// documentation inherited from interface RunQueue
|
||||
public void postRunnable (Runnable run)
|
||||
{
|
||||
// queue it on up on the swing thread
|
||||
SwingUtilities.invokeLater(run);
|
||||
// queue it on up on the awt thread
|
||||
EventQueue.invokeLater(run);
|
||||
}
|
||||
|
||||
// documentation inherited from interface RunQueue
|
||||
public boolean isDispatchThread ()
|
||||
{
|
||||
return EventQueue.isDispatchThread();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,15 +21,16 @@
|
||||
|
||||
package com.threerings.micasa.simulator.client;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
import com.samskivert.util.RunQueue;
|
||||
import com.threerings.util.MessageManager;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
@@ -48,7 +49,7 @@ import com.threerings.micasa.client.MiCasaFrame;
|
||||
import com.threerings.micasa.util.MiCasaContext;
|
||||
|
||||
public class SimpleClient
|
||||
implements Client.Invoker, SimulatorClient
|
||||
implements RunQueue, SimulatorClient
|
||||
{
|
||||
public SimpleClient (SimulatorFrame frame)
|
||||
throws IOException
|
||||
@@ -106,11 +107,17 @@ public class SimpleClient
|
||||
return _ctx;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void invokeLater (Runnable run)
|
||||
// documentation inherited from interface RunQueue
|
||||
public void postRunnable (Runnable run)
|
||||
{
|
||||
// queue it on up on the swing thread
|
||||
SwingUtilities.invokeLater(run);
|
||||
// queue it on up on the awt thread
|
||||
EventQueue.invokeLater(run);
|
||||
}
|
||||
|
||||
// documentation inherited from interface RunQueue
|
||||
public boolean isDispatchThread ()
|
||||
{
|
||||
return EventQueue.isDispatchThread();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimulatorApp.java,v 1.17 2004/08/27 02:12:52 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -26,7 +26,6 @@ import javax.swing.JFrame;
|
||||
import com.samskivert.swing.Controller;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.Interval;
|
||||
import com.samskivert.util.IntervalManager;
|
||||
import com.samskivert.util.ResultListener;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
@@ -167,11 +166,11 @@ public class SimulatorApp
|
||||
// wholly independent thread to wait for the server to be ready as
|
||||
// in normal circumstances they are entirely different processes;
|
||||
// so we just wait half a second which does the job
|
||||
IntervalManager.register(new Interval() {
|
||||
public void intervalExpired (int id, Object arg) {
|
||||
new Interval() {
|
||||
public void expired () {
|
||||
_client.getParlorContext().getClient().logon();
|
||||
}
|
||||
}, 500L, null, false);
|
||||
}.schedule(500L);
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
|
||||
Reference in New Issue
Block a user