Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » GMap custom widget
GMap custom widget [message #643766] Wed, 08 December 2010 08:40 Go to next message
Yury Mising name is currently offline Yury Mising nameFriend
Messages: 95
Registered: May 2010
Location: Russia
Member
Hi, All!

I'm developing my own custom widget and get some problem. I'd tried to reproduce this problem on your GMap widget from your CVS and it had been reproduced!
I've added the GMap on the dialog:
  public int createUI() {
    Display display = PlatformUI.createDisplay();
    Shell shell = new Shell(display);
    shell.setLayout( new FillLayout() );
 
    GMap map = new GMap( shell, SWT.NONE );
    map.setAddress( "Stephanienstra├če 20, Karlsruhe" );

    shell.setSize(300, 300);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
    return 0;
  }

And everything seems to work fine, but I'm interesting in the following: set the breakpoint to this method into GMapLCA.java and try to resize the dialog
  public void readData( final Widget widget ) {
    GMap map = ( GMap )widget;
    String location = WidgetLCAUtil.readPropertyValue( map, PARAM_CENTER );
    map.setCenterLocation( location );
  }

WidgetLCAUtil.readPropertyValue( map, PARAM_CENTER ) returns NULL after resizing and our widget will have null value for it's location parameter. It is because there are no PARAM_CENTER in the current request. And i don't have an answer for a question - why?
Could you get any explanation?

Best regards,
Yury.
Re: GMap custom widget [message #643789 is a reply to message #643766] Wed, 08 December 2010 09:45 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi Yury!

> WidgetLCAUtil.readPropertyValue( map, PARAM_CENTER ) returns NULL after
> resizing and our widget will have null value for it's location
> parameter. It is because there are no PARAM_CENTER in the current
> request. And i don't have an answer for a question - why?

It seems you found a bug. The code should actually be:

public void readData( final Widget widget ) {
GMap map = ( GMap )widget;
String location = WidgetLCAUtil.readPropertyValue( map, PARAM_CENTER );
if( location != null ) {
map.setCenterLocation( location );
}
}

When readPropertyValue returns null, it indicated that the value hasnt
changed, therfore no changes will be made to the widget.

Hope that helps.

Gretings,
Tim
Re: GMap custom widget [message #643807 is a reply to message #643789] Wed, 08 December 2010 11:13 Go to previous messageGo to next message
Yury Mising name is currently offline Yury Mising nameFriend
Messages: 95
Registered: May 2010
Location: Russia
Member
Hi, Tim!

Actually I've already made this fixes that you propose Smile But just interesting about correctness of this fixes, maybe anyone propose another way to fix them. Anyway, thank you for help!

Best regards,
Yury.
Re: GMap custom widget [message #644180 is a reply to message #643807] Thu, 09 December 2010 18:22 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Yury,
all widgets LCA are visited on every request. In xxxLCA#readData() you
check if a specific for the widget parameter (property) exists in the
request and process it if exist. That's why the null check after you get
a property is absolutely obligatory. The request contains only "changed"
properties.
HTH,
Ivan

On 08.12.2010 1:13 PM, Yury wrote:
> Hi, Tim!
>
> Actually I've already made this fixes that you propose :) But just
> interesting about correctness of this fixes, maybe anyone propose
> another way to fix them. Anyway, thank you for help!
>
> Best regards,
> Yury.
Re: GMap custom widget [message #644230 is a reply to message #644180] Fri, 10 December 2010 04:46 Go to previous message
Yury Mising name is currently offline Yury Mising nameFriend
Messages: 95
Registered: May 2010
Location: Russia
Member
Hi, Ivan!

Thank you for explanation!

Best regards,
Yury.
Previous Topic:RAP deployed in embedded tomcat - work folder sige increases huge
Next Topic:interactiondesign API in single sourcing?
Goto Forum:
  


Current Time: Thu Oct 21 19:35:06 GMT 2021

Powered by FUDForum. Page generated in 0.01483 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top