Hi Daniel,
>Thank you for your reply. Unfortunately, using the progress pane community
>code is not our solution, because we can't move our operational code into
>task classes.
In that case use ULCPollingTimer as I showed in my earlier mail.
See the snippet at the end of this mail.
>task classes. I still don't get it, why messages sent from server to client
>are not transfered, while doing some processing in a server operation. The
>following lines should fire a message "showSplashScreen" first to the
>client stub and than process the operation:
>
> ClientContext.sendMessage("showSplashScreen");
>
> try {
> System.out.println("Processing data");
> Thread.sleep(6000);
> } catch (InterruptedException e) {
> logger.error(e.getMessage(), e);
> } finally {
> ClientContext.sendMessage("hideSplashScreen");
> }
You are on the server side processing some event during which you are
sending a message to client to show splash, executing your long task,
followed by message to client to hide splash.
But the server does not block when sending a message to the client (as
explained in last mail). Hence when the server finishes processing of the
event, it sends message to start and hide splash as part of one response
and you see the splash only momentarily. So as part of the event processing
you should show splash and set up a polling timer. The polling timer will
fire as soon as the response reaches the client and it will send an event to
start your task. On completion of the task in polling timer action handler
you can send a message to hide the splash screen.
So basically, showing of splash and execution of long task are done in two
separate roundtrips.
I hope this helps.
Thanks and regards,
Janak
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of
>[EMAIL PROTECTED]
>Sent: Tuesday, February 20, 2007 2:16 PM
>To: [email protected]
>Cc: [EMAIL PROTECTED]
>Subject: RE: [ULC-developer] Question about using splash-screens
>
>
>Hello Janak.
>
>Thank you for your reply. Unfortunately, using the progress pane community
>code is not our solution, because we can't move our operational code into
>task classes. I still don't get it, why messages sent from server to client
>are not transfered, while doing some processing in a server operation. The
>following lines should fire a message "showSplashScreen" first to the
>client stub and than process the operation:
>
> ClientContext.sendMessage("showSplashScreen");
>
> try {
> System.out.println("Processing data");
> Thread.sleep(6000);
> } catch (InterruptedException e) {
> logger.error(e.getMessage(), e);
> } finally {
> ClientContext.sendMessage("hideSplashScreen");
> }
>
>Unexpected output is:
>
>> Processing data
>> showing SplashScreen
>> hiding SplashScreen
>
>We registered a MessageService with
>"ClientEnvironmentAdapter.setMessageService(splashHandler);" to receive and
>handle incoming messages. Hiding a Splash-Screen works fine, but for
>showing it, it doesnt come up at time. I understand that this is the
>behaviour of a request/response mechanismn - but what i don't understand
>is, why it aint possible to send message during processing - so breaking it
>up a little. Is there no other way except using the community code to show
>processing operations to the client? Could the messaging behaviour be
>implemented in future releases of ULC?
>
>Thanks and best regards,
>Daniel
>
>
>-----Original Message-----
>
>Hi Daniel,
>
>>We want our application to show litte loading splashscreens during
>>different undetermenistic operations (eg. saving, loading and heavy
>>validations). Unfortunately we have a problem creating and showing
>>ULCWindow components on server side before executing a task (eg. saving
>>data). The splash only shows up a millisecond when the task is already
>>completed.
>
>>Another way sending messages ("showSplash", "hideSplash", ...) to the
>>client doesnt work either, because a roundtrip is not fired after the
>>client confirmed to save the data. It doesn't show up even if we call
>>"splash.upload()" after we set it visible. In that way we wanted the
>client
>>to create a JWindow splashscreen.
>
>ULC executes the presentation logic on the server side.
>
>The server doesnot block, it only responds to the requests from the client.
>
>So showing the splash screen and starting you operation in the same server
>roundtrip will not help.
>
>>The third solution we thought to use, was the community snipped
>>ULCProgressPane. Unfortunately we have no idea how long the tasks take, so
>>we can't set the duration time. By the way, the sample client extension we
>>found, uses deprecated methods.
>
>Using the progress pane is the right approach.
>
>Which version of ULC are you using?
>
>The ULCProgressPane contribution on the community has been ported to ULC
>6.1.
>
>Moreover you can use ULCPollingTimer. Lets say you start you action by
>pressing a button:
>
>In the ActionListener for the button: Start PollingTimer and Show the
>splash
>window
>
>In the ActionListener of PollingTimer: Do your task and at the end Close
>the
>splash window.
>
>I hope this helps.
>
>Thanks and regards,
>
>Janak
----------------------------------------------
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCDialog;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCLabel;
import com.ulcjava.base.application.ULCPollingTimer;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.development.DevelopmentRunner;
public class ShowSplashSnippet extends AbstractApplication {
private ULCDialog splashWindow;
public void start() {
ULCFrame frame = new ULCFrame("ShowSplashSnippet");
splashWindow = new ULCDialog(frame, "Splash");
splashWindow.add(new ULCLabel("Task is Running..."));
splashWindow.setSize(100, 100);
splashWindow.setModal(true);
splashWindow.setDefaultCloseOperation(ULCDialog.DISPOSE_ON_CLOSE);
final ULCPollingTimer timer = new ULCPollingTimer(0, null);
timer.setRepeats(false);
timer.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
try {
Thread.sleep(Math.round(5000 * Math.random()));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
splashWindow.setVisible(false);
}
});
final ULCButton button = new ULCButton("Start");
button.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
splashWindow.setVisible(true);
timer.start();
}
});
frame.add(button);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(ShowSplashSnippet.class);
DevelopmentRunner.run();
}
}
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer