private void createGroup(final String groupname) { final StatusRecord sr = StatusHandler.createMessage( StatusHandler.getCreateGroupBusy(groupname), StatusRecord.STATUS_BUSY); RusselApi.createGroup( groupname, new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { sr.setMessage(StatusHandler.getCreateGroupError(groupname)); sr.setState(StatusRecord.STATUS_ERROR); StatusHandler.alterMessage(sr); } @Override public void onSuccess(ESBPacket esbPacket) { makeOption(groupname, "groupSelect"); fillGroupDetails(groupname); DOM.getElementById("groupSelect").setPropertyString("value", groupname); sr.setMessage(StatusHandler.getCreateGroupDone(groupname)); sr.setState(StatusRecord.STATUS_DONE); StatusHandler.alterMessage(sr); PageAssembler.closePopup("createGroupModal"); } }); }
private void deleteGroup(final String groupname) { final StatusRecord sr = StatusHandler.createMessage( StatusHandler.getDeleteGroupBusy(groupname), StatusRecord.STATUS_BUSY); RusselApi.removeGroup( groupname, new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { sr.setMessage(StatusHandler.getDeleteGroupError(groupname)); sr.setState(StatusRecord.STATUS_ERROR); StatusHandler.alterMessage(sr); } @Override public void onSuccess(ESBPacket esbPacket) { Element e = DOM.getElementById("groupSelect"); Element a = null; for (int i = 0; i < e.getChildCount(); i++) { Node n = e.getChild(i); if (n instanceof Element) { if (((Element) n).getPropertyString("value").equals(groupname)) a = (Element) n; } } if (a != null) { a.removeFromParent(); DOM.getElementById("memberUserSelect").removeAllChildren(); DOM.getElementById("memberGroupSelect").removeAllChildren(); DOM.getElementById("userList").removeAllChildren(); DOM.getElementById("groupList").removeAllChildren(); } sr.setMessage(StatusHandler.getDeleteGroupDone(groupname)); sr.setState(StatusRecord.STATUS_DONE); StatusHandler.alterMessage(sr); } }); }