in client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java [75:123]
void handleSave(ClickEvent e) {
hc.showTopLoading("Saving...");
if (state == LabelListActivity.Displayable.CASCADE_TYPE_RENAME) {
RenameFolderRequest req = rf.renameFolderRequest();
RenameFolderAction action = req.create(RenameFolderAction.class);
final ImapFolder f = req.create(ImapFolder.class);
f.setFullName(folder.getFullName());
action.setFolder(f);
if (ROOT_PATH.equals(parent.getValue(parent.getSelectedIndex()))) {
action.setNewName(name.getText());
} else {
action.setNewName(parent.getValue(parent.getSelectedIndex()) + "/" + name.getText());
}
req.rename(action).fire(new Receiver<GenericResult>() {
@Override
public void onSuccess(GenericResult response) {
hc.hideTopLoading();
eventBus.fireEvent(new RefreshLabelListEvent());
hc.showNotice("The label \"" + f.getFullName() + "\" has been renamed to " + name.getText(), 10000);
}
@Override
public void onFailure(ServerFailure error) {
hc.hideTopLoading();
hc.showNotice(error.getMessage(), 10000);
}
});
} else if (state == LabelListActivity.Displayable.CASCADE_TYPE_ADD) {
CreateFolderRequest req = rf.createFolderRequest();
CreateFolderAction action = req.create(CreateFolderAction.class);
final ImapFolder f = req.create(ImapFolder.class);
f.setFullName(path + "/" + name.getText());
action.setFolder(f);
req.create(action).fire(new Receiver<GenericResult>() {
@Override
public void onSuccess(GenericResult response) {
hc.hideTopLoading();
eventBus.fireEvent(new RefreshLabelListEvent());
hc.showNotice("The label \"" + f.getFullName() + "\" was created.", 10000);
}
@Override
public void onFailure(ServerFailure error) {
hc.hideTopLoading();
hc.showNotice(error.getMessage(), 10000);
}
});
}
}