List of usage examples for com.google.gwt.user.client.ui LayoutPanel setWidgetVisible
public void setWidgetVisible(Widget child, boolean visible)
From source file:org.rstudio.studio.client.workbench.views.vcs.frame.VCSPopup.java
License:Open Source License
public static Controller show(final LayoutPanel swapContainer, final ReviewPresenter rpres, final HistoryPresenter hpres, boolean showHistory) { final Widget review = rpres.asWidget(); review.setSize("100%", "100%"); final Widget history = hpres.asWidget(); history.setSize("100%", "100%"); swapContainer.setSize("100%", "100%"); swapContainer.add(review);/* www . j av a 2 s . co m*/ swapContainer.setWidgetLeftRight(review, 0, Unit.PX, 0, Unit.PX); swapContainer.setWidgetTopBottom(review, 0, Unit.PX, 0, Unit.PX); swapContainer.add(history); swapContainer.setWidgetLeftRight(history, 0, Unit.PX, 0, Unit.PX); swapContainer.setWidgetTopBottom(history, 0, Unit.PX, 0, Unit.PX); if (showHistory) { swapContainer.setWidgetVisible(review, false); hpres.onShow(); } else { swapContainer.setWidgetVisible(history, false); rpres.onShow(); } // create a controller used to implement switch view and to return final Controller controller = new Controller() { @Override public void switchToHistory(FileSystemItem fileFilter) { if (fileFilter != null) hpres.setFileFilter(fileFilter); hpres.onShow(); swapContainer.setWidgetVisible(history, true); swapContainer.setWidgetVisible(review, false); } @Override public void switchToReview(ArrayList<StatusAndPath> selected) { if (selected != null) rpres.setSelectedPaths(selected); rpres.onShow(); swapContainer.setWidgetVisible(review, true); swapContainer.setWidgetVisible(history, false); } }; rpres.addSwitchViewHandler(new SwitchViewEvent.Handler() { @Override public void onSwitchView(SwitchViewEvent event) { controller.switchToHistory(null); } }); hpres.addSwitchViewHandler(new SwitchViewEvent.Handler() { @Override public void onSwitchView(SwitchViewEvent event) { controller.switchToReview(null); } }); return controller; }