Skip to content

Instantly share code, notes, and snippets.

@ederign
Created February 13, 2014 19:01
Embed
What would you like to do?
@Override
public void setPerspective( final PerspectiveDefinition perspective ) {
final PanelDefinition newRoot = perspective.getRoot();
//ederign o que falta aqui, saber como ele define o root, pq o estquema aqui embaixo tá dando null;
final WorkbenchPanelPresenter oldPresenter = mapPanelDefinitionToPresenter.remove( root );
final SimplePanel container;
if ( oldPresenter != null && oldPresenter.getPanelView().asWidget().getParent() != null ) {
container = (SimplePanel) oldPresenter.getPanelView().asWidget().getParent();
} else {
container = null;
}
factory.destroy( root );
this.root = newRoot;
this.perspective = perspective;
WorkbenchPanelPresenter newPresenter = getWorkbenchPanelPresenter( newRoot );
if ( newPresenter == null ) {
newPresenter = factory.newWorkbenchPanel( newRoot );
Widget parent = newPresenter.getPanelView().asWidget().getParent();
mapPanelDefinitionToPresenter.put( newRoot, newPresenter );
}
if ( container != null ) {
if ( oldPresenter != null ) {
oldPresenter.removePanel();
}
//colocar duas perspectivas
if(perspective.getName().contains( "Home" )){
//procurar aqui um modo de já pegar a activity
PerspectiveActivity defaultPerspectiveActivity = getDefaultPerspectiveActivity();
container.setWidget( defaultPerspectiveActivity.getRealPresenterWidget() );
}
else{
container.setWidget( newPresenter.getPanelView() );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment