01: /*
02: * Copyright (C) 2004 TiongHiang Lee
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * Email: thlee@onemindsoft.org
19: */
20:
21: package org.onemind.swingweb.image;
22:
23: import java.awt.Image;
24: import java.awt.image.ImageConsumer;
25: import java.awt.image.ImageProducer;
26: import java.util.ArrayList;
27: import java.util.List;
28:
29: /**
30: * A dummy image producer
31: * @author TiongHiang Lee (thlee@onemindsoft.org)
32: *
33: */
34: public class DummyImageProducer implements ImageProducer {
35:
36: /** the consumers **/
37: private List _consumers = new ArrayList();
38:
39: /** the image **/
40: private Image _image;
41:
42: /**
43: * Constructor
44: * @param image the image
45: */
46: public DummyImageProducer(Image image) {
47: _image = image;
48: }
49:
50: /**
51: * Return the image
52: * @return the image
53: */
54: public Image getImage() {
55: return _image;
56: }
57:
58: /**
59: * {@inheritDoc}
60: */
61: public void addConsumer(ImageConsumer ic) {
62: _consumers.add(ic);
63: }
64:
65: /**
66: * {@inheritDoc}
67: */
68: public void removeConsumer(ImageConsumer ic) {
69: _consumers.remove(ic);
70: }
71:
72: /**
73: * {@inheritDoc}
74: */
75: public void requestTopDownLeftRightResend(ImageConsumer ic) {
76: ic.imageComplete(ImageConsumer.TOPDOWNLEFTRIGHT);
77: }
78:
79: /**
80: * {@inheritDoc}
81: */
82: public void startProduction(ImageConsumer ic) {
83: ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
84: }
85:
86: /**
87: * {@inheritDoc}
88: */
89: public boolean isConsumer(ImageConsumer ic) {
90: return false;
91: }
92: }
|