use of cz.metacentrum.perun.webgui.json.GetEntityById in project perun by CESNET.
the class FindUsersByIdsNotInRpc method retrieveData.
/**
* Retrieves data from RPC
*/
public void retrieveData() {
String[] ids = searchString.split(",");
if (ids.length == 0) {
return;
}
idsCount = ids.length;
onLoadingStart();
for (String id : ids) {
// trims the whitespace
id = id.trim();
try {
int idint = Integer.parseInt(id);
GetEntityById req = new GetEntityById(PerunEntity.USER, idint, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
idsFound++;
// add to result
int i = result.size();
result.set(i, new JSONObject(jso));
isFinished();
}
public void onError(PerunError err) {
idsFound++;
isFinished();
}
});
req.retrieveData();
} catch (Exception e) {
}
}
}
use of cz.metacentrum.perun.webgui.json.GetEntityById in project perun by CESNET.
the class PerunWebSession method setActiveVoId.
/**
* Sets currently active VO (refresh links in menu)
* when only ID is provided.
*
* @param voId ID of VO which user is editing now
*/
public void setActiveVoId(final int voId) {
new GetEntityById(PerunEntity.VIRTUAL_ORGANIZATION, voId, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
VirtualOrganization vo = jso.cast();
setActiveVo(vo);
}
}).retrieveData();
}
use of cz.metacentrum.perun.webgui.json.GetEntityById in project perun by CESNET.
the class PerunWebSession method setActiveGroupId.
/**
* Sets currently active Group (refresh links in menu)
* when only ID is provided.
*
* @param groupId ID of groupwhich user is editing now
*/
public void setActiveGroupId(int groupId) {
new GetEntityById(PerunEntity.GROUP, groupId, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
Group group = jso.cast();
setActiveGroup(group);
}
}).retrieveData();
}
use of cz.metacentrum.perun.webgui.json.GetEntityById in project perun by CESNET.
the class PerunWebSession method setActiveSecurityTeamId.
/**
* Sets currently active SecurityTeam (refresh links in menu)
* when only ID is provided.
*
* @param securityTeamId ID of SecTeam which user is editing now
*/
public void setActiveSecurityTeamId(int securityTeamId) {
new GetEntityById(PerunEntity.SECURITY_TEAM, securityTeamId, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
SecurityTeam f = jso.cast();
setActiveSecurityTeam(f);
}
}).retrieveData();
}
use of cz.metacentrum.perun.webgui.json.GetEntityById in project perun by CESNET.
the class ResourceDetailTabItem method draw.
public Widget draw() {
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(resource.getName()));
// main widget panel
final VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
AbsolutePanel dp = new AbsolutePanel();
// dp.setStyleName("decoration");
final FlexTable menu = new FlexTable();
menu.setCellSpacing(5);
// MAIN INFO PANEL
// resource info
menu.setWidget(0, 0, new Image(LargeIcons.INSTANCE.serverGroupIcon()));
Label resourceName = new Label();
resourceName.setText(Utils.getStrippedStringWithEllipsis(resource.getName(), 40));
resourceName.setStyleName("now-managing");
resourceName.setTitle(resource.getName());
menu.setWidget(0, 1, resourceName);
menu.setHTML(0, 2, " ");
menu.getFlexCellFormatter().setWidth(0, 2, "25px");
int column = 3;
final JsonCallbackEvents events = new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
new GetEntityById(PerunEntity.RICH_RESOURCE, resourceId, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
resource = jso.cast();
open();
draw();
}
}).retrieveData();
}
};
CustomButton change = new CustomButton("", ButtonTranslation.INSTANCE.editResourceDetails(), SmallIcons.INSTANCE.applicationFormEditIcon());
if (!session.isVoAdmin(resource.getVoId()) && !session.isFacilityAdmin(resource.getFacilityId()))
change.setEnabled(false);
change.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// prepare confirm content
Resource r = resource.cast();
session.getTabManager().addTabToCurrentTab(new EditResourceDetailsTabItem(r, events));
}
});
menu.setWidget(0, column, change);
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
if (JsonUtils.isExtendedInfoVisible()) {
menu.setHTML(0, column, "<strong>ID:</strong><br/><span class=\"inputFormInlineComment\">" + resource.getId() + "</span>");
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
}
if (facilityId > 0) {
// facility admin view
menu.setHTML(0, column, "<strong>VO:</strong><br/><span class=\"inputFormInlineComment\">" + resource.getVoId() + " / " + SafeHtmlUtils.fromString(resource.getVo().getShortName()).asString() + "</span>");
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
}
menu.setHTML(0, column, "<strong>Description:</strong><br/><span class=\"inputFormInlineComment\">" + SafeHtmlUtils.fromString((resource.getDescription() != null) ? resource.getDescription() : "").asString() + " </span>");
if (session.isFacilityAdmin(resource.getFacilityId())) {
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
Anchor a = new Anchor("View facility details >>");
a.setStyleName("pointer");
a.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
session.getTabManager().addTab(new FacilityDetailTabItem(resource.getFacility()));
}
});
menu.setWidget(0, column, a);
}
dp.add(menu);
vp.add(dp);
vp.setCellHeight(dp, "30px");
// TAB PANEL WITH INNER TABS
tabPanel.clear();
Resource r = resource.cast();
tabPanel.add(new ResourceAssignedGroupsTabItem(r), "Assigned groups");
tabPanel.add(new ResourceAssignedServicesTabItem(r), "Assigned services");
tabPanel.add(new ResourceSettingsTabItem(r, null), "Service settings");
tabPanel.add(new ResourceGroupSettingsTabItem(r), "Group settings");
tabPanel.add(new ResourceMemberSettingsTabItem(resource), "Member settings");
if (session.isVoAdmin(r.getVoId()) || session.isVoObserver(r.getVoId())) {
tabPanel.add(new ResourceTagsTabItem(r), "Tags");
}
// Resize must be called after page fully displays
Scheduler.get().scheduleDeferred(new Command() {
@Override
public void execute() {
tabPanel.finishAdding();
}
});
vp.add(tabPanel);
this.contentWidget.setWidget(vp);
return getWidget();
}
Aggregations