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.registry.*;
26: import org.swingml.server.*;
27:
28: public class SubmittingThread extends Thread {
29:
30: public boolean repaint = false;
31: public Container submittingContainer = null;
32: public String submittingURL = null;
33: public Container targetingContainer = null;
34:
35: public SubmittingThread(String aSubmittingURL,
36: Container aSubmittingContainer,
37: Container aTargetingContainer, boolean aRepaint) {
38: this .repaint = aRepaint;
39: this .submittingURL = aSubmittingURL;
40: this .targetingContainer = aTargetingContainer;
41: this .submittingContainer = aSubmittingContainer;
42: }
43:
44: public void run() {
45: SwingMLServerResponse response = HttpSubmitController.submit(
46: submittingURL, submittingContainer, null, true);
47: SwingMLRenderer renderer = SwingMLRenderer.getRenderer();
48: if (response != null) {
49: renderer.render(response.getSwingMLSpec(),
50: targetingContainer);
51: if (response.hasErrors()) {
52: SwingMLModel model = (SwingMLModel) SwingMLModelToContainerRegistry
53: .getModel(submittingContainer);
54: model.handle(response.getErrors());
55: // renderer.render(response.getErrorSpec(), targetingContainer);
56: }
57: } else {
58: renderer.render(HttpSubmitController
59: .getConnectionErrorSpec(), targetingContainer);
60: }
61: }
62: }
|