/*
* SwingML Copyright (C) 2002 SwingML Team
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Ezequiel Cuellar <ecuellar@crosslogic.com>
*
*/
package org.swingml;
import java.awt.*;
import org.swingml.event.*;
import org.swingml.registry.*;
import org.swingml.server.*;
public class RenderingThread extends Thread {
public Container parent = null;
public String submittingURL = null;
public RenderingThread (String aSubmittingURL, Container aParent) {
this.submittingURL = aSubmittingURL;
this.parent = aParent;
}
public void run () {
SwingMLRenderer theRenderer = SwingMLRenderer.getRenderer();
ExternalEventManager.flush(theRenderer);
SwingMLServerResponse response = HttpSubmitController.getSpec(submittingURL, parent);
SwingMLRenderer renderer = SwingMLRenderer.getRenderer();
if (response != null) {
renderer.render(response.getSwingMLSpec(), parent);
if (response.hasErrors()) {
SwingMLModel model = (SwingMLModel) SwingMLModelToContainerRegistry.getModel(parent);
model.handle(response.getErrors());
}
} else {
renderer.render(HttpSubmitController.getConnectionErrorSpec(), parent);
}
}
}
|