Skip to content

Commit

Permalink
- BZ-986819 and BZ-986825 fixes in kie-drools-wb and kie-wb
Browse files Browse the repository at this point in the history
  • Loading branch information
salaboy committed Jul 23, 2013
1 parent 21f8592 commit 0218746
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 18 deletions.
Expand Up @@ -46,6 +46,8 @@
import org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBarPresenter;
import org.uberfire.mvp.Command;
import org.uberfire.mvp.impl.DefaultPlaceRequest;
import org.uberfire.security.Identity;
import org.uberfire.security.Role;
import org.uberfire.workbench.model.menu.MenuFactory;
import org.uberfire.workbench.model.menu.MenuItem;
import org.uberfire.workbench.model.menu.MenuPosition;
Expand Down Expand Up @@ -73,6 +75,9 @@ public class KieDroolsWorkbenchEntryPoint {

@Inject
private ActivityManager activityManager;

@Inject
private Identity identity;

@AfterInitialization
public void startApp() {
Expand Down Expand Up @@ -112,14 +117,6 @@ public void execute() {
.newTopLevelMenu( constants.deployment() )
.withItems( getDeploymentMenuItems() )
.endMenu()
.newTopLevelMenu( constants.logout() )
.respondsWith( new Command() {
@Override
public void execute() {
redirect( GWT.getModuleBaseURL() + "uf_logout" );
}
} )
.endMenu()
.newTopLevelMenu( constants.find() )
.position( MenuPosition.RIGHT )
.respondsWith( new Command() {
Expand All @@ -129,10 +126,31 @@ public void execute() {
}
} )
.endMenu()
.newTopLevelMenu( constants.User() +": "+ identity.getName() )
.position( MenuPosition.RIGHT )
.withItems( getRoles() )
.endMenu()
.build();

menubar.addMenus( menus );
}

private List<? extends MenuItem> getRoles() {
final List<MenuItem> result = new ArrayList<MenuItem>( identity.getRoles().size() );
for ( final Role role : identity.getRoles() ) {
if(!role.getName().equals("IS_REMEMBER_ME")){
result.add( MenuFactory.newSimpleItem( constants.Role() +": " + role.getName() ).endMenu().build().getItems().get( 0 ) );
}
}
result.add(MenuFactory.newSimpleItem(constants.LogOut()).respondsWith(new Command() {
@Override
public void execute() {
redirect(GWT.getModuleBaseURL() + "uf_logout");
}
}).endMenu().build().getItems().get(0));

return result;
}

private List<MenuItem> getAuthoringMenuItems() {
final List<MenuItem> result = new ArrayList<MenuItem>( 1 );
Expand Down
Expand Up @@ -86,4 +86,10 @@ public interface AppConstants

String homeDeployCaption();

String Role();

String User();

String LogOut();

}
Expand Up @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
Expand Up @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
Expand Up @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
Expand Up @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
Expand Up @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
@@ -1,4 +1,4 @@
home=Home
\u00ef\u00bb\u00bfhome=Home
authoring=Authoring
project_authoring=Projects
administration=Administration
Expand All @@ -24,3 +24,6 @@ homeAuthor=Author
homeAuthorCaption=Formalize your Business Knowledge
homeDeploy=Deploy
homeDeployCaption=Learn how to configure your environment
Role=Role
User=User
LogOut=Log Out
Expand Up @@ -133,12 +133,7 @@ public void execute() {
.newTopLevelMenu(constants.Deploy()).withItems(getDeploymentViews()).endMenu()
.newTopLevelMenu(constants.Process_Management()).withItems(getProcessMGMTViews()).endMenu()
.newTopLevelMenu(constants.Tasks()).withItems(getTasksViews()).endMenu().newTopLevelMenu(constants.Dashboards())
.withItems(getDashboardViews()).endMenu().newTopLevelMenu(constants.LogOut()).respondsWith(new Command() {
@Override
public void execute() {
redirect(GWT.getModuleBaseURL() + "uf_logout");
}
}).endMenu()
.withItems(getDashboardViews()).endMenu()
.newTopLevelMenu(constants.find())
.position( MenuPosition.RIGHT )
.respondsWith( new Command() {
Expand All @@ -148,7 +143,7 @@ public void execute() {
}
} )
.endMenu()
.newTopLevelMenu( identity.getName() )
.newTopLevelMenu( constants.User() +": "+ identity.getName() )
.position( MenuPosition.RIGHT )
.withItems( getRoles() )
.endMenu()
Expand All @@ -160,8 +155,16 @@ public void execute() {
private List<? extends MenuItem> getRoles() {
final List<MenuItem> result = new ArrayList<MenuItem>( identity.getRoles().size() );
for ( final Role role : identity.getRoles() ) {
result.add( MenuFactory.newSimpleItem( role.getName() ).endMenu().build().getItems().get( 0 ) );
if(!role.getName().equals("IS_REMEMBER_ME")){
result.add( MenuFactory.newSimpleItem( constants.Role() +": " + role.getName() ).endMenu().build().getItems().get( 0 ) );
}
}
result.add(MenuFactory.newSimpleItem(constants.LogOut()).respondsWith(new Command() {
@Override
public void execute() {
redirect(GWT.getModuleBaseURL() + "uf_logout");
}
}).endMenu().build().getItems().get(0));

return result;
}
Expand Down
Expand Up @@ -116,4 +116,8 @@ public interface AppConstants

String homeImproveCaption();

String User();

String Role();

}
Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=User
Role=Role
Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=Usuario
Role=Rol
Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=User
Role=Role
Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=User
Role=Role
Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=User
Role=Role
@@ -1,4 +1,4 @@
Tasks_List=Tasks List
\u00ef\u00bb\u00bfTasks_List=Tasks List
Process_Dashboard=Process & Task Dashboard
Business_Dashboard=Business Dashboards
Project_Authoring=Project Authoring
Expand Down Expand Up @@ -39,3 +39,5 @@ homeWork=Work
homeWorkCaption=Reduce the paper work
homeImprove=Improve
homeImproveCaption=Your Business Performance
User=User
Role=Role

0 comments on commit 0218746

Please sign in to comment.