Skip to content

Commit

Permalink
Refreshed the Home page each time.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffyu committed May 16, 2012
1 parent a1a7f10 commit adff209
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
Expand Up @@ -92,13 +92,12 @@ public interface IndexProxy extends ProxyPlace<IndexPresenter> {}
public void onBind() {
super.onBind();
getView().setPresenter(this);
getPages();
}

@Override
public void onReveal() {
super.onReveal();

getPages();
}

}
Expand Up @@ -99,6 +99,8 @@ public void onClick(ClickEvent clickEvent) {

public void initializePages(List<PageModel> pageModels) {

mainContentPanel.clearAllTabs();

for (PageModel page : pageModels) {
int i = 0;
int columnNum = page.getColumns().intValue();
Expand All @@ -110,13 +112,6 @@ public void initializePages(List<PageModel> pageModels) {
mainContentPanel.addTab(page.getName(), portalLayout);
}

//Hard-coded for testing...
/* PortalLayout sndLayout = new PortalLayout(2);
PortletLayout helloWorld = new PortletLayout("HelloWorld", "Hello World Portlet");
sndLayout.addPortlet(0, helloWorld);
mainContentPanel.addTab("Finance", sndLayout);*/

mainContentPanel.initializeTab();
}

Expand Down
Expand Up @@ -22,7 +22,6 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;

import org.savara.gadget.web.client.util.UUID;

import java.util.HashMap;
Expand Down Expand Up @@ -66,7 +65,6 @@ public void addTab(String tabTitle, Widget widget){
theContent.getElement().setId(tabContentId);
theContent.add(widget);
tabsContent.add(theContent);

}

public void addTabAnchor(Anchor anchor) {
Expand Down Expand Up @@ -101,6 +99,8 @@ public void insertTab(String tabTitle, Widget widget) {
theContent.add(widget);
tabsContent.add(theContent);

tabNames.put(tabContentId, tabTitle);

addNewTab(id, tabContentId, tabTitle);
}

Expand All @@ -113,6 +113,13 @@ public void initializeTab() {
registerCloseEvent(id);
}

public void clearAllTabs(){
for(String contentId : tabNames.keySet()) {
removeTab(id, contentId);
}
destroyTab(id);
}

/**
* JSNI methods
*/
Expand All @@ -129,6 +136,16 @@ private static native void addNewTab(String id, String tabContentId, String tabT
theTabs.tabs("select","#"+tabContentId);
}-*/;

private static native void removeTab(String id, String tabContentId) /*-{
var theTabs = $wnd.$('#'+id).tabs();
theTabs.tabs("remove","#"+tabContentId);
}-*/;

private static native void destroyTab(String id) /*-{
var theTabs = $wnd.$('#'+id).tabs();
theTabs.tabs("destroy");
}-*/;

/**
* TODO: This is a hack, somehow couldn't attach the click event to removetBtn;
* */
Expand Down

0 comments on commit adff209

Please sign in to comment.