tb.addItem(new ToolbarTextItem(constants.CurrentlyConfiguredUsers()));
tb.addItem(new ToolbarSeparator());
layout.add(grid);
ToolbarButton reload = new ToolbarButton(constants.Reload1());
reload.addListener(new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
refresh();
}
});
tb.addButton(reload);
grid.addGridRowListener(new GridRowListenerAdapter() {
@Override
public void onRowDblClick(GridPanel grid, int rowIndex,
EventObject e) {
String userName = grid.getSelectionModel().getSelected().getAsString("userName"); //NON-NLS
showEditor(userName);
}
});
ToolbarButton create = new ToolbarButton(constants.CreateNewUserMapping());
create.addListener(new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
final FormStylePopup form = new FormStylePopup("images/snapshot.png", //NON-NLS
constants.EnterNewUserName());
final TextBox userName = new TextBox();
form.addAttribute(constants.NewUserName(), userName);
com.google.gwt.user.client.ui.Button create = new com.google.gwt.user.client.ui.Button(constants.OK());
form.addAttribute("", create);
create.addClickListener(new ClickListener() {
public void onClick(Widget w) {
if (userName.getText() != null && userName.getText().length() !=0) {
RepositoryServiceFactory.getService().createUser(userName.getText(), new GenericCallback() {
public void onSuccess(Object a) {
refresh();
showEditor(userName.getText());
}
public void onFailure(Throwable t) {
super.onFailure(t);
}
});
form.hide();
}
}
});
form.show();
}
});
tb.addButton(create);
ToolbarButton delete = new ToolbarButton(constants.DeleteSelectedUser());
delete.addListener(new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
final String userName = grid.getSelectionModel().getSelected().getAsString("userName"); //NON-NLS
if (userName != null && Window.confirm(Format.format(constants.AreYouSureYouWantToDeleteUser0(), userName))) {
RepositoryServiceFactory.getService().deleteUser(userName, new GenericCallback() {
public void onSuccess(Object a) {