Go Back   SmartClient Forums > Smart GWT Technical Q&A
Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 30th Nov 2008, 21:18
sjivan sjivan is offline
Registered Developer
 
Join Date: May 2008
Posts: 1,319
Default Portal Preview

A couple of users have asked about portal support. Writing portals in SmartGWT / SmartClient is fairly simple as the Layouts have animation, and dynamic add / remove built-in. Here's an example of a SmartClient Portal

http://www.smartclient.com/smartgwt/...animation.html

API's for this will be added in the next release, and likely a nightly build over the next few weeks.

Sanjiv
Reply With Quote
  #2  
Old 1st Dec 2008, 01:00
zerozerosette zerozerosette is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default

Thanks Snajiv, that's a great example. But I have a further question: how can I keep this nice portal behavior while adding custom drag'n'drop features? For example, I need three columns with different size, and when a portlet is dropped on a bigger/smaller column, it must resize itself, adapting its width and height. Is adding a new DropHandler, and rewriting all the logic, the only way?
Something like this:
Code:
addDropHandler(new DropHandler() { public void onDrop(DropEvent event) { int newPosition = getDropPosition(); Canvas draggable = EventHandler.getDragTarget(); //Dropped on draggable's parent, reorder if (draggable.getParentElement() == PortalColumn.this) { reorderMember(PortalColumn.this.getMemberNumber(draggable), newPosition); return; } //Resize draggable.setHeight(size.getPixelSize()); draggable.setWidth(size.getPixelSize()); addMember(draggable, newPosition); reflowNow(); } });

Thank you for your answer...
Reply With Quote
  #3  
Old 1st Dec 2008, 17:33
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 14,135
Default

So long as you have not called setWidth() on the portlet with a fixed pixel value (which establishes that pixel value as one that SmartClient Layouts must respect), moving the portlet between different Layouts should result in auto-sizing behavior.
Reply With Quote
  #4  
Old 2nd Dec 2008, 05:29
zerozerosette zerozerosette is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default

Thanks for your answer... that would work, but in addition to resizing the portlets I need to change their contents, because a small portlet's content is different from a medium or a large one (a ListGrid put in a large portlet should show many fields, but when it is dropped on a smaller column it could hide most of the fields, or even be replaced with another widget). Any suggestion?

Thank you again...
Reply With Quote
  #5  
Old 2nd Dec 2008, 10:00
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 14,135
Default

Seem like you could add a method that notifies the portlet of the size of column it's being dropped into, allowing it to do whatever it wants, for example, hide fields if it contains a grid.
Reply With Quote
  #6  
Old 3rd Dec 2008, 04:36
zerozerosette zerozerosette is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default

It seems I finally got it. I added a resize/hiding fields/whatever method to my Portlet class' DragRepositionStopHandler. I hope this will prove to be the correct approach.

Another question:
When I move an empty portlet everything is fast, but when I add a listgrid to it (with addItem) there's a lag as i drop it on a column.
Is this related to http://forums.smartclient.com/showthread.php?t=833 ?

Thank you again!
Reply With Quote
  #7  
Old 3rd Dec 2008, 04:45
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 14,135
Default

Yes, that would be the cause of any lag, however, if it's a non-trivial lag it may indicate extra work is going on (eg maybe there are two clear/draw cycles or similar). You should be able to see this in the Developer Console by enabling log categories like "draws", "clears", and "redraws".
Reply With Quote
  #8  
Old 20th Jan 2009, 21:34
kccheng kccheng is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 51
Default

Quote:
Originally Posted by sjivan
A couple of users have asked about portal support. Writing portals in SmartGWT / SmartClient is fairly simple as the Layouts have animation, and dynamic add / remove built-in. Here's an example of a SmartClient Portal

http://www.smartclient.com/smartgwt/...animation.html

API's for this will be added in the next release, and likely a nightly build over the next few weeks.

Sanjiv

Where can I find the SmartGWT version of this sample ?
Thanks

Regards
KC
Reply With Quote
  #9  
Old 21st Jan 2009, 12:22
tomhj tomhj is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 68
Default

Has the GWT wrapper for the SmartClient portal component(s) been finished yet?
Reply With Quote
  #10  
Old 21st Jan 2009, 13:22
sjivan sjivan is offline
Registered Developer
 
Join Date: May 2008
Posts: 1,319
Default

Its on the TODO list but if you're in a hurry or would liek to lend a hand, you can try writing the SmartGWT equivalent of it yourself and post here if you run into any roadblocks. The code is fairy small.

View Source here :
http://www.smartclient.com/smartgwt/...animation.html

and the Portal code itself

portalComponents.js

Sanjiv
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


©2006 Isomorphic Software   ·   Terms of use