01: /*
02: * $Id: Watchable.java,v 1.2 2007/12/20 18:17:41 rbair Exp $
03: *
04: * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
05: * Santa Clara, California 95054, U.S.A. All rights reserved.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20: */
21:
22: package com.sun.pdfview;
23:
24: /**
25: * An interface for rendering or parsing, which can be stopped and started.
26: */
27: public interface Watchable {
28: /** the possible statuses */
29: public static final int UNKNOWN = 0;
30: public static final int NOT_STARTED = 1;
31: public static final int PAUSED = 2;
32: public static final int NEEDS_DATA = 3;
33: public static final int RUNNING = 4;
34: public static final int STOPPED = 5;
35: public static final int COMPLETED = 6;
36: public static final int ERROR = 7;
37:
38: /**
39: * Get the status of this watchable
40: *
41: * @return one of the well-known statuses
42: */
43: public int getStatus();
44:
45: /**
46: * Stop this watchable. Stop will cause all processing to cease,
47: * and the watchable to be destroyed.
48: */
49: public void stop();
50:
51: /**
52: * Start this watchable and run until it is finished or stopped.
53: * Note the watchable may be stopped if go() with a
54: * different time is called during execution.
55: */
56: public void go();
57:
58: /**
59: * Start this watchable and run for the given number of steps or until
60: * finished or stopped.
61: *
62: * @param steps the number of steps to run for
63: */
64: public void go(int steps);
65:
66: /**
67: * Start this watchable and run for the given amount of time, or until
68: * finished or stopped.
69: *
70: * @param millis the number of milliseconds to run for
71: */
72: public void go(long millis);
73: }
|