I have a page layout that contains a static header / footer, and 2 dynamic portions (an action bar, and a scrollable content area).
-- I want my resulting page to resemble:
---HEADER--- (static)
---action-bar--- (dynamic, updated by whatever is in Content)
---content--- (dynamic, scrollable)
---FOOTER--- (static)
I have setup my main page layout like this:
AppTemplateView.java:
...
ActionBar actionBar = new ActionBar();
...
DockLayoutPanel masterLayout = new DockLayoutPanel(Unit.PX);
masterLayout.addNorth(buildHeaderPanel(), 53);
masterLayout.addNorth(actionBar, 48);
masterLayout.addSouth(buildFooterPanel(), 32);
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.add(appPanel);
masterLayout.add(scrollPanel);
initWidget(masterLayout);
...
public void setActionBar(ActionBar newActionBar) {
this.actionBar = newActionBar; // What do I actually need to do here???
}
I'm using native GWT no extensions. My app uses Activities and Places. Initially the screen renders fine, but when I navigate to a different view, the content area updates correctly, but the action-bar doesn't change. I'd like to update the action-bar from within each view dynamically. For example:
TestView.java:
public TestView(AppTemplateView template) {
ActionBar actionBar = new ActionBar();
// build up the custom action bar for this view. Add it to the template
template.setActionBar(actionBar);
// and build up the actual content for this view.
VerticalPanel container = new VerticalPanel();
container.add(new Label("Content goes here..."));
initWidget(container);
}
What's the right way to replace the actionBar content in the template from within one of my views? I've tried having actionBar in the template be a SimplePanel, and from my setActionBar() method calling actionBar.clear(); actionBar.add(newActionBar); but it still didn't update in the browser.
Another way I thought was to call from within setActionBar(ActionBar newActionBar):
Element el = masterLayout.getWidgetContainerElement(actionBar);
el.removeAllChildren();
el.appendChild(newActionBar);
this.actionBar = newActionBar;
But I'm not sure if that's even a valid approach.
Any suggestions?
Nick
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment