Hi Scott,

Further to my mail below, there is a slight correction.

> >The other option I've seen but haven't yet tried is to use
> ApplicationContext.addRoundTripListener, which 
> >is a static method, and would not seem to be appropriate for a single
> instance. (would it?)

I suggested a solution for this in the enclosed snippet. That will work
but you will have to remove the RoundTripListener in the roundTripWillEnd
method after it has set the divider location.Otherwise you will be setting
the divider location after every roundtrip!

Thanks and regards,

Janak

-----------------------------------------
Janak Mulani

email: [EMAIL PROTECTED]
url: http://www.canoo.com

Beyond AJAX - Java Rich Internet Applications 

http://www.canoo.com/ulc
-----------------------------------------  

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Janak Mulani
> Sent: Monday, September 29, 2008 3:56 PM
> To: [email protected]
> Subject: RE: [ULC-developer] Proper technique for invoking 
> ULCSplitPane.setDividerLocation
> 
> Hi Scott,
> 
> This is a Swing issue. See the links below.
> 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4188905
> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4188905> 
> 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4101306
> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4101306> 
> 
> The setting of divider location is being overridden while laying out
> splitpanes.
> 
> You can use a polling timer to set the divider location after 
> the split
> panes are visible. Please see the link below:
> 
> http://lists.canoo.com/mailman/private/ulc-developer/2004/001207.html
> 
> Start the polling timer with 0 delay as soon as you have 
> added the split
> pane so the roundtrip will can immediately.
> 
> >I've also tried this, without success:
> >     add(mySplitPaneExtension);
> >     UlcUtilities.invokeLater(new Runnable() {
> >           public void run() {
> >                 mySplitPaneExtension.setDividerLocation(loc);
> >
> >           }
> >
> >     });
> 
> This makes sure that the request is sent after all cleint 
> side requests
> have been processed. This should work if the request order is 
> proper. See
> the snippet below. To test uncomment the code for invokeLater.
> 
> 
> > ClientContext.setEventDeliveryMode(ULCProxy proxy,  String
> eventCategory, int mode);
> 
> This is to set that a given event of a category 
> UlcEventCategories for the
> proxy will be fired in Synch, Asynch or deferred mode. I 
> don't think this
> is relevant to your problem.
> 
> >The other option I've seen but haven't yet tried is to use
> ApplicationContext.addRoundTripListener, which 
> >is a static method, and would not seem to be appropriate for a single
> instance. (would it?)
> 
> This should work too. You can set the divider loaction at the end of
> roundtrip. This will add the request after even the 
> invokeLater requests.
> See the snippet below and uncomment the rountriplistener 
> related code to
> test.
> 
> BTW, there is no guaranteed reply time for requests on dev list. We
> recommend purchasing Premium Support for guaranteed response time.
> 
> Thanks and regards,
> 
> Janak
> 
> -----------------------------------------
> Janak Mulani
> 
> email: [EMAIL PROTECTED]
> url: http://www.canoo.com <http://www.canoo.com/> 
> 
> Beyond AJAX - Java Rich Internet Applications
> 
> http://www.canoo.com/ulc
> ----------------------------------------- 
> 
>  
> 
> 
> ________________________________
> 
>       From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Scott Woodson
>       Sent: Wednesday, September 24, 2008 4:45 AM
>       To: [EMAIL PROTECTED]
>       Subject: [ULC-developer] Proper technique for invoking
> ULCSplitPane.setDividerLocation
>       
>       
> 
>       In standard swing, a split pane divider location cannot be set
> until the pane contents are "realized".
> 
>       What is the proper technique to do this in the ULC environment?
> 
>        
> 
>       I have a widget extension that contains a JSplitPane as the main
> root of its content.
> 
>       Invoking the "setDividerLocation" method on this extension
> immediately after adding it to the ULC widget hierarchy has no affect,
> because with the asynchronous nature of ULC client/server 
> communications,
> the client widget has not been fully realized when it receives the
> "setDividerLocation" command.
> 
>        
> 
>       Stepping through this code using the debugger alleviates the
> problem.
> 
>       I can also simulate this action programmatically (this is my
> current code!):
> 
>        
> 
>       add(mySplitPaneExtension);
> 
>                         
> 
>       final ULCPollingTimer delay = new ULCPollingTimer(100, new
> IActionListener() {
> 
>       public void actionPerformed(ActionEvent event) {
> 
>                   mySplitPaneExtension.setDividerLocation(loc);
> 
>             }
> 
>       });
> 
>       delay.setRepeats(false);
> 
>       delay.start();
> 
> 
>       This of course is highly dependent on network latency.
> 
>       I've also tried this, without success:
> 
>       add(mySplitPaneExtension);
> 
>       UlcUtilities.invokeLater(new Runnable() {
> 
>             public void run() {
> 
>                   mySplitPaneExtension.setDividerLocation(loc);
> 
>             }
> 
>       });
> 
>        
>       Browsing ULC documentation shows two other potential solutions.
>       
>        ClientContext.setEventDeliveryMode(ULCProxy proxy, 
> 
>       String eventCategory, int mode);
> 
>       Unfortunately I couldn't try this, because the "eventCategory"
> argument doesn't seem to be documented anywhere (a "google" 
> search only
> shows this being assigned the value
> "UlcEventCategories.VALUE_CHANGED_EVENT_CATEGORY", where
> "UlcEventCategories" seems to be an obsolete class.
> 
> 
>       Note: there's another place I might need to use this method, if
> someone would be so kind as to point to the documentation.
> 
>        
>       The other option I've seen but haven't yet tried is to use
> ApplicationContext.addRoundTripListener, which is a static method, and
> would not seem to be appropriate for a single instance. (would it?)
> 
>       Many thanks.
> 
>       ---------------------------------------
> 
> 
> import com.ulcjava.base.application.AbstractApplication;
> import com.ulcjava.base.application.ULCBoxPane;
> import com.ulcjava.base.application.ULCFrame;
> import com.ulcjava.base.application.ULCLabel;
> import com.ulcjava.base.application.ULCSplitPane;
> import com.ulcjava.base.application.event.IRoundTripListener;
> import com.ulcjava.base.application.event.RoundTripEvent;
> import com.ulcjava.base.development.DevelopmentRunner;
> import com.ulcjava.base.server.ULCSession;
> 
> public class ULCSplitPaneTest extends AbstractApplication {
> 
>     public void start() {
> 
>         ULCFrame frame = new ULCFrame("ULCSplitPaneTest");
> 
> 
>         frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
> 
>         ULCBoxPane content = new ULCBoxPane(true);
> 
>         final ULCSplitPane innerSplit = new ULCSplitPane();
>         final ULCSplitPane outerSplit = new ULCSplitPane();
> 
> 
>  
> innerSplit.setOrientation(com.ulcjava.base.application.ULCSpli
> tPane.VERTIC
> AL_SPLIT);
>         innerSplit.setDividerSize(2);
>         innerSplit.setDividerLocation(0.7);
>         innerSplit.setLeftComponent(new ULCLabel("Inner Left"));
>         innerSplit.setRightComponent(new ULCLabel("Inner Right"));
> 
>  
> outerSplit.setOrientation(com.ulcjava.base.application.ULCSpli
> tPane.VERTIC
> AL_SPLIT);
>         outerSplit.setDividerSize(2);
>         outerSplit.setDividerLocation(0.6);
>         outerSplit.setLeftComponent(innerSplit);
>         outerSplit.setRightComponent(new ULCLabel("Outer Right"));
> 
>         content.set(0, 0, 1, 1,
> com.ulcjava.base.shared.IDefaults.BOX_EXPAND_EXPAND, outerSplit);
>         frame.add(content);
>         frame.setSize(300, 300);
>         // UlcUtilities.invokeLater(new Runnable() {
>         // public void run() {
>         // innerSplit.setDividerLocation(0.7);
>         // }});
>         //
> 
>  
> ULCSession.getCurrentSessionRegistry().getCurrentSession().add
> RoundTripLis
> tener(new IRoundTripListener() {
> 
>             public void roundTripDidStart(RoundTripEvent event) {
> 
>             }
> 
>             public void roundTripWillEnd(RoundTripEvent event) {
>                 // innerSplit.setDividerLocation(0.7);
>             }
> 
>         });
> 
>         frame.setVisible(true);
> 
>     }
> 
>     public static void main(String[] args) {
> 
> 
>         DevelopmentRunner.setApplicationClass(ULCSplitPaneTest.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

Reply via email to