-----Original Message-----
From: Zanetti, Giorgio [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 02, 2006 6:42 PM
To: Janak Mulani
Subject: RE: [ULC-developer] FW: How to change client cursor
Thanks for your quick response,
We have looked to the snippet code you have sent me... the problem is,
we
want to have the "custom hourglass" behaviour *every time* the client is
waiting for a server's response. For example, every time the user selects a
menu item that triggers an action on the server, every time a server-side
validation is invoked, etc... and not only for specific operations attached
to a button.
To give you a better idea, a client-side roundtrip listener would be a
perfect solution for us.
This is why we tried to work on the event queue. If we were able to add our
own logic to ULC FilteringEventQueue, we could achieve what we need: we
could simply change the cursor as soon as an interaction event is received
(mouse click, etc.).
Let us know,
Giorgio
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Janak Mulani
Sent: mercoledì 2 agosto 2006 1.09
To: [EMAIL PROTECTED] Com
Subject: [ULC-developer] FW: How to change client cursor
Hi Giorgio,
RoundTripListener is a bit of a misnomer. It is fired only when a round trip
starts and ends on the server. It does not take into account the roundtrip
start/end on the client.
Setting cursor in the RounTripListener methods does not help because the
message will reach the client only after the roundtrip has ended.
ULC follows a request-response architecture and all the requests are
initiated from the client. So the server cannot "push" a request to the
client unless the client has already started a roundtrip.
For synchronous requests, ULC blocks user inputs to the ULC client and
installs the wait cursor till the response to the request returns to the
client.
Moreover, installing your own EventQueue is not advisable in ULC because ULC
installs its own EventQueue which is special.
So, basically what you are trying to do is sort of simulate a ULCProgressBar
i.e. you want a special cursor to indicate that your long action is in
progress and at the end of the action you want to reset the cursor back to
the default.
I have created a small snippet (at the end of this mail) that achieves what
you desire. In the snippet, the long task is excuted in ULCPollingTimer.
Note that the onus of disabling other widgets and windows is on the
programmer.
I would also like you to read about ULCProgressBar and
http://ulc-community.canoo.com/snipsnap/space/Contributions/Extensions/Progr
ess+Pane
I hope this helps.
Thanks and regards,
Janak
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Zanetti, Giorgio
Sent: Monday, July 31, 2006 3:23 PM
To: [EMAIL PROTECTED]
Subject: How to change client cursor
Hello all,
I'm trying to modify the style of the cursor when my client application is
waiting for long running server elaborations.
The intent is to replace the hourglass with a custom cursor any time it
appears.
I've added a RoundTripListener to my ApplicationContext and modified the
client and server half objects to handle my new setCursor methods.
When I run my application, I've noticed that:
-the round trip listener is invoked as soon as the server application is
busy (for debug purpose I print a sample message when the listener is
invoked);
-the setCursor client methods of the half objects are invoked;
-the client cursor remains an hourglass and change only at the end of the
transaction (seams that the setCursor message is the last message sent from
server to client);
A solution may be to send, from roundTripDidStart/roundTripDidEnd methods of
the listener RoundTripListener, asynchronous messages to the client
component. But I don't know why?
I'm new to ULC and I'm trying many solutions without results.
Can you help me in solving this problem?
Best regards
Giorgio Z.
---------------------------------
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCPollingTimer;
import com.ulcjava.base.application.UlcUtilities;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.development.DevelopmentRunner;
public class HourGlassCursorSnippet extends AbstractApplication {
public void start() {
final ULCButton button = new ULCButton("Long Action");
final ULCFrame frame = new ULCFrame("HourGlassCursorSnippet");
ULCBoxPane centerPane = new ULCBoxPane(true);
centerPane.add(ULCBoxPane.BOX_EXPAND_EXPAND, button);
button.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("Action Started");
button.setEnabled(false);
final ULCPollingTimer timer = new ULCPollingTimer(500,
null);
timer.setRepeats(false);
timer.addActionListener(new IActionListener() {
char fCurrentChar = 'A';
public void actionPerformed(ActionEvent event) {
if (fCurrentChar <= 'Z') {
// simulate a task
UlcUtilities.getRootPane(button).setCursor(com.u
lcjava.base.application.util.Cursor.CROSSHAIR_CURSOR);
try {
Thread.sleep(Math.round(1000*Math.random()))
;
} catch (InterruptedException e) {
}
fCurrentChar++;
timer.restart();
} else {
button.setEnabled(true);
UlcUtilities.getRootPane(button).setCursor(com.u
lcjava.base.application.util.Cursor.DEFAULT_CURSOR);
System.out.println("Action Ended");
}
}
});
timer.start();
}
});
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.setContentPane(centerPane);
frame.setSize(200,200);
frame.setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(HourGlassCursorSnippet.class)
;
DevelopmentRunner.main(args);
}
}
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer