switch (event.type) {
case WPaloEvent.INIT:
case WPaloEvent.LOGIN:
if(event.data instanceof XUser) {
//System.out.println("instance of XUser");
XUser user = (XUser)event.data;
//check if we are admin:
if(user.isAdmin()) {
//create ui:
initUI(user);
}
} else if (event.data instanceof DisplayFlags) {
//System.out.println("instance of display flags");
DisplayFlags df = (DisplayFlags) event.data;
if (!df.isHideNavigator()) {
XUser user = df.getUser();
//check if we are admin:
if(user.isAdmin()) {
//create ui:
if(!df.isHideConnectionAccount()){
initUI(user);
}
}
}
}
break;
case WPaloEvent.EXPANDED_ACCOUNT_SECTION: //load tree data
TreeNode node = (TreeNode) event.data;
if (node != null) {
treeLoader.load(node);
}
break;
case WPaloEvent.SAVED_ACCOUNT_ITEM:
case WPaloEvent.SAVED_CONNECTION_ITEM:
if (treeStore == null) {
return;
}
TreeNode nd = (TreeNode) event.data;
if (nd != null) {
if(nd.getParent() != null)
treeStore.update(nd);
else {
int index = event.type == WPaloEvent.SAVED_ACCOUNT_ITEM ? 1 : 0;
treeStore.add(root.getChild(index), nd, false);
root.getChild(index).add(nd);
//shouldn't the store take care of this???
if(nd.getParent() == null)
nd.setParent(root.getChild(index));
}
}
if (event.type == WPaloEvent.SAVED_CONNECTION_ITEM) {
lastCreatedConnection = (XConnection) nd.getXObject();
final XUser admin = ((Workbench)Registry.get(Workbench.ID)).getUser();
final String adminUserId = admin.getId();
WPaloAdminServiceProvider.getInstance().hasAccount(admin.getSessionId(), lastCreatedConnection, new AsyncCallback<Boolean>(){
public void onFailure(Throwable arg0) {
}
public void onSuccess(Boolean result) {
if (!result) {