01: /*
02: * SwingML Copyright (C) 2002 SwingML Team
03: *
04: * This library is free software; you can redistribute it and/or modify it under
05: * the terms of the GNU Lesser General Public License as published by the Free
06: * Software Foundation; either version 2 of the License, or (at your option) any
07: * later version.
08: *
09: * This library is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12: * details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with this library; if not, write to the Free Software Foundation, Inc.,
16: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: * Authors: Ezequiel Cuellar <ecuellar@crosslogic.com>
19: *
20: */
21: package org.swingml;
22:
23: import java.awt.*;
24:
25: import org.swingml.event.*;
26: import org.swingml.registry.*;
27: import org.swingml.server.*;
28:
29: public class RenderingThread extends Thread {
30:
31: public Container parent = null;
32: public String submittingURL = null;
33:
34: public RenderingThread(String aSubmittingURL, Container aParent) {
35: this .submittingURL = aSubmittingURL;
36: this .parent = aParent;
37: }
38:
39: public void run() {
40: SwingMLRenderer theRenderer = SwingMLRenderer.getRenderer();
41: ExternalEventManager.flush(theRenderer);
42: SwingMLServerResponse response = HttpSubmitController.getSpec(
43: submittingURL, parent);
44: SwingMLRenderer renderer = SwingMLRenderer.getRenderer();
45: if (response != null) {
46: renderer.render(response.getSwingMLSpec(), parent);
47: if (response.hasErrors()) {
48: SwingMLModel model = (SwingMLModel) SwingMLModelToContainerRegistry
49: .getModel(parent);
50: model.handle(response.getErrors());
51: }
52: } else {
53: renderer.render(HttpSubmitController
54: .getConnectionErrorSpec(), parent);
55: }
56: }
57: }
|