[Seaside] Updating non Smallfaces component.

Burella Juan M. juan.burella at gmail.com
Thu Aug 27 20:01:41 UTC 2009


Hi Tim,
 Let me see if I've understood what are you doing. You need to:

-Create (or modify?) a LBCGoogleMap when a ListBox changes
-Render or update the LBCGoogleMap when a Button is clicked.

You said LBCGoogleMap is not a WAComponent, what it is? If it's a
SFObject, then you can add to your SearcherInterface sending as
argument of #addSubpane: message, as already knows how to answer
#name (remember, it must answer #name properly, that is, not the #name
method in Object).

Then you can have:

>>initialize
....
  self addSubpane: self map
...


>>map
 ^LBCGoogleMap new
    name: 'mapDisplay';  " configure the mapDisplay's name"
    setCenter: model coordinates zoom: model zoom;
    addControl: GControl largeMapControl;
    setUIToDefault;
    yourself.

If when the list changes, you have to re-create the mapDisplay, in the
#regionSelectionChanged "callback" (the message sent when the list is
#changed) you should replace it as follows:

 oldMap := self paneNamed: 'mapDisplay'.
 self replacePane: oldMap with: self map

And to refresh properly the mapDisplay it should be rendered inside a
tag with id equals to its styleId, like this:

LBCGoogleMap >>renderContentOn: aRenderer

           aRenderer div
                    id: self styleId;
                with: [ "render your component" ]

and must answer #refreshOn: (please see #when:send:to:refresh: section
in http://wiki.squeak.org/squeak/6093). You can implement it this way:

refreshOn: aRenderer
      "Support for the events"

      self renderContentOn: aRenderer


You will need to preserve the same #styleId, to do this simply send
the message styleId: 'anyId' to the mapDisplay. Another way to solve
this is adding a SFPanel which contains the mapDisplay and refresh it
when the button is clicked.

Regards
Juan M.

On Thu, Aug 27, 2009 at 1:02 PM, Timothy James Ziebart <
timothy at churchmilitant.org> wrote:

> Hi All,
>
> I have an object SearchInterface, a subclass of WASmallFacesComposite.  On
> SearchInterface there are rendered a number of SFListBoxes and SFButtons.
>  Included are three listboxes that are cascaded and the control was created
> like this:
>
> createRegionListBox
>   |pane panes list|
>     list := self session findCodeByParent: 'region'.
>     panes := OrderedCollection
>       with: ( self paneNamed: 'nhoodList')
>       with: ( self paneNamed: 'cityList').
>         pane := SFListBox new.
>   pane
>       name: 'regionList';
>       items: list;
>       lines: 5;
>       printSelector: #asString;
>       owner: self;
>       when: #changed:
>           send: #regionSelectionChanged:
>           to: self
>           refresh: panes.
>   ^pane
>
> The listboxes work correctly.  What I need to do is have a GoogleMap
> rendered on SearchInterfaces as well.  The map will not be a WAComponent as
> I need to render it as new whenever the listbox contents change.  But not
> before an Update button is pressed.  Such as:
>
> createUpdateButton
>
>   | pane panes |
>     panes := OrderedCollection with: (*self paneNamed: 'mapDisplay')*.
>   pane := SFButton new.
>   pane
>       label: 'Update Map';
>       name: 'updateButton';
>       when: #clicked
>           send: #updateButtonPressed
>           to: self
>           refresh: panes.
>   ^pane
>
> The question is how do I create *mapDisplay*?  mapDisplay is rendered like
> this everytime the update button is pressed.
>
> map
>
>   ^LBCGoogleMap new
>       setCenter: model coordinates zoom: model zoom;
>       addControl: GControl largeMapControl;
>       setUIToDefault;
>       yourself.
>
> Can I place it on a SmallFace component that will render as I desire or do
> I replace it with non SmallFace components?  Thank you for any assistance.
>
> Tim
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090827/e70cc2f8/attachment.htm


More information about the seaside mailing list