use of cz.metacentrum.perun.webgui.client.resources.TableSorter in project perun by CESNET.
the class StatisticsTabItem method draw.
public Widget draw() {
// PAGE CONTENTS
ScrollPanel scroll = new ScrollPanel();
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName("perun-table");
vp.setSpacing(5);
scroll.setWidget(vp);
scroll.setStyleName("perun-tableScrollPanel");
session.getUiElements().resizePerunTable(scroll, 350, this);
final DisclosurePanel vosStatistics = new DisclosurePanel();
vosStatistics.setWidth("100%");
// vosStatistics.setOpen(true);
FlexTable vosHeader = new FlexTable();
vosHeader.setWidget(0, 0, new Image(LargeIcons.INSTANCE.buildingIcon()));
vosHeader.setWidget(0, 1, new HTML("<h3>Virtual Organizations</h3>"));
vosHeader.setTitle("Click to show/hide VOs statistics");
vosStatistics.setHeader(vosHeader);
vp.add(vosStatistics);
// the general statistics table
final FlexTable statisticsTable = new FlexTable();
statisticsTable.addStyleName("statisticsTable");
// the VOs table
final FlexTable vosTable = new FlexTable();
vosTable.addStyleName("statisticsTable");
vosTable.setWidget(0, 0, new HTML("<strong>" + "VO name" + "</strong>"));
vosTable.setWidget(0, 1, new HTML("<strong>" + "Members" + "</strong>"));
vosTable.setWidget(0, 2, new HTML("<strong>" + "Valid members" + "</strong>"));
vosTable.setWidget(0, 3, new HTML("<strong>" + "Invalid members" + "</strong>"));
vosTable.setWidget(0, 4, new HTML("<strong>" + "Expired members" + "</strong>"));
vosTable.setWidget(0, 5, new HTML("<strong>" + "Disabled members" + "</strong>"));
vosTable.setWidget(0, 6, new HTML("<strong>" + "Groups" + "</strong>"));
vosTable.setWidget(0, 7, new HTML("<strong>" + "Resources" + "</strong>"));
// vos events - adds the VOs to the table and calls how many members the VO has
JsonCallbackEvents vosEvents = new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
// conversion
ArrayList<VirtualOrganization> vos = JsonUtils.jsoAsList(jso);
vos = new TableSorter<VirtualOrganization>().sortByName(vos);
// iterating VOs
for (int i = 0; i < vos.size(); i++) {
VirtualOrganization vo = vos.get(i);
// call the request for number of members
GetMembersCount countMembers = new GetMembersCount(vo.getId(), null);
countMembers.retrieveData();
GetMembersCount countValidMembers = new GetMembersCount(vo.getId(), PerunStatus.VALID);
countValidMembers.retrieveData();
GetMembersCount countInvalidMembers = new GetMembersCount(vo.getId(), PerunStatus.INVALID);
countInvalidMembers.retrieveData();
GetMembersCount countExpiredMembers = new GetMembersCount(vo.getId(), PerunStatus.EXPIRED);
countExpiredMembers.retrieveData();
GetMembersCount countDisabledMembers = new GetMembersCount(vo.getId(), PerunStatus.DISABLED);
countDisabledMembers.retrieveData();
// call the request for number of resources
GetResourcesCount countResources = new GetResourcesCount(vo.getId());
countResources.retrieveData();
GetGroupsCount countGroups = new GetGroupsCount(vo.getId());
countGroups.retrieveData();
// adds the VO to the table
vosTable.setText(i + 1, 0, vo.getName());
vosTable.setWidget(i + 1, 1, countMembers.getMembersCountHyperlink());
vosTable.setWidget(i + 1, 2, countValidMembers.getMembersCountHyperlink());
vosTable.setWidget(i + 1, 3, countInvalidMembers.getMembersCountHyperlink());
vosTable.setWidget(i + 1, 4, countExpiredMembers.getMembersCountHyperlink());
vosTable.setWidget(i + 1, 5, countDisabledMembers.getMembersCountHyperlink());
vosTable.setWidget(i + 1, 6, countGroups.getGroupsCountHyperlink());
vosTable.setWidget(i + 1, 7, countResources.getResourcesCountHyperlink());
}
}
};
// requests
final GetVos vos = new GetVos(vosEvents);
vosHeader.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (vosStatistics.getContent() == null) {
// retrieve data
vosStatistics.setContent(vosTable);
vos.retrieveData();
}
}
});
this.contentWidget.setWidget(scroll);
return getWidget();
}
use of cz.metacentrum.perun.webgui.client.resources.TableSorter in project perun by CESNET.
the class AddFacilityDestinationTabItem method draw.
public Widget draw() {
titleWidget.setText("Add destination");
final VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
FlexTable layout = new FlexTable();
layout.setStyleName("inputFormFlexTable");
FlexTable.FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
layout.setWidth("350px");
final ExtendedSuggestBox destination = new ExtendedSuggestBox();
final ListBox type = new ListBox();
type.addItem("HOST", "host");
type.addItem("USER@HOST", "user@host");
type.addItem("USER@HOST:PORT", "user@host:port");
type.addItem("USER@HOST-WINDOWS", "user@host-windows");
type.addItem("HOST-WINDOWS-PROXY", "host-windows-proxy");
type.addItem("URL", "url");
type.addItem("MAIL", "email");
type.addItem("SIGNED MAIL", "semail");
type.addItem("SERVICE SPECIFIC", "service-specific");
final ListBox propTypeSelect = new ListBox();
propTypeSelect.addItem("PARALLEL");
propTypeSelect.addItem("DUMMY");
// propTypeSelect.addItem("SERIAL"); TODO - will we ever use it ?
final HTML propTypeHelp = new HTML("PARALLEL - Data for all destinations of one service are pushed in parallel.");
final ListBoxWithObjects<Service> services = new ListBoxWithObjects<Service>();
final CheckBox useHosts = new CheckBox(WidgetTranslation.INSTANCE.useFacilityHostnames(), false);
useHosts.setTitle(WidgetTranslation.INSTANCE.useFacilityHostnamesTitle());
final CheckBox onlyAssignedServices = new CheckBox("Show only services on facility", false);
onlyAssignedServices.setTitle("Click to show all possible services");
onlyAssignedServices.setValue(true);
final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addDestination());
// fill oracle with hosts of facility
GetHosts getHosts = new GetHosts(facilityId, new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
ArrayList<Host> ho = JsonUtils.jsoAsList(jso);
for (Host h : ho) {
hosts.addAll(ho);
destination.getSuggestOracle().add(h.getName());
}
}
});
getHosts.retrieveData();
JsonCallbackEvents fillAssignedServices = new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
services.removeAllOption();
services.clear();
ArrayList<Service> ses = JsonUtils.jsoAsList(jso);
if (ses != null && !ses.isEmpty()) {
ses = new TableSorter<Service>().sortByName(ses);
services.addAllItems(ses);
services.addAllOption();
services.setSelectedIndex(0);
} else {
services.addItem("No service available");
}
addButton.setEnabled(true);
type.setEnabled(true);
}
@Override
public void onError(PerunError error) {
services.removeAllOption();
services.clear();
services.addItem("Error while loading");
addButton.setEnabled(true);
type.setEnabled(true);
}
@Override
public void onLoadingStart() {
services.removeAllOption();
services.clear();
services.addItem("Loading...");
addButton.setEnabled(false);
type.setEnabled(false);
}
};
final GetFacilityAssignedServices getAssignedServices = new GetFacilityAssignedServices(facility.getId(), fillAssignedServices);
getAssignedServices.retrieveData();
final GetServices getAllServices = new GetServices(fillAssignedServices);
onlyAssignedServices.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
if (onlyAssignedServices.getValue() == false) {
onlyAssignedServices.setTitle("Click to show only services on facility");
getAllServices.retrieveData();
} else {
onlyAssignedServices.setTitle("Click to show all possible services");
getAssignedServices.retrieveData();
}
}
});
final Label destinationLabel = new Label();
destinationLabel.getElement().setInnerHTML("<strong>Host:</strong>");
final ExtendedSuggestBox.SuggestBoxValidator validator = new ExtendedSuggestBox.SuggestBoxValidator() {
@Override
public boolean validateSuggestBox() {
if (destination.getSuggestBox().getText().trim().isEmpty() && useHosts.getValue() == false) {
destination.setError("Destination value can't be empty.");
return false;
}
// check as email
if (type.getSelectedIndex() > 5 && type.getSelectedIndex() < 8) {
if (!JsonUtils.isValidEmail(destination.getSuggestBox().getText().trim())) {
destination.setError("Not valid email address.");
return false;
} else {
destination.setOk();
return true;
}
}
destination.setOk();
return true;
}
};
destination.setValidator(validator);
type.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
// if hosts - checkbox visible
if (type.getSelectedIndex() == 0) {
useHosts.setVisible(true);
} else {
useHosts.setVisible(false);
useHosts.setValue(false);
destination.getSuggestBox().setEnabled(true);
}
if (type.getSelectedIndex() < 5) {
destination.getSuggestOracle().clear();
for (Host h : hosts) {
destination.getSuggestOracle().add(h.getName());
}
} else {
destination.getSuggestOracle().clear();
}
// set label
if (type.getSelectedIndex() == 0) {
destinationLabel.getElement().setInnerHTML("<strong>Host:</strong>");
} else if (type.getSelectedIndex() == 1) {
destinationLabel.getElement().setInnerHTML("<strong>User@host:</strong>");
} else if (type.getSelectedIndex() == 2) {
destinationLabel.getElement().setInnerHTML("<strong>User@host:port:</strong>");
} else if (type.getSelectedIndex() == 3) {
destinationLabel.getElement().setInnerHTML("<strong>User@host-windows:</strong>");
} else if (type.getSelectedIndex() == 4) {
destinationLabel.getElement().setInnerHTML("<strong>Host-Windows-Proxy:</strong>");
} else if (type.getSelectedIndex() == 5) {
destinationLabel.getElement().setInnerHTML("<strong>URL:</strong>");
} else if (type.getSelectedIndex() == 6) {
destinationLabel.getElement().setInnerHTML("<strong>Mail:</strong>");
} else if (type.getSelectedIndex() == 7) {
destinationLabel.getElement().setInnerHTML("<strong>Signed mail:</strong>");
} else if (type.getSelectedIndex() == 8) {
destinationLabel.getElement().setInnerHTML("<strong>Service specific:</strong>");
}
// run validation
validator.validateSuggestBox();
}
});
useHosts.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (useHosts.getValue() == true) {
destination.getSuggestBox().setEnabled(false);
destination.setOk();
// use only PARALLEL since API doesn't read it
propTypeSelect.setSelectedIndex(0);
propTypeHelp.setHTML("PARALLEL - Data for all destinations and one service are pushed in parallel.");
} else {
destination.getSuggestBox().setEnabled(true);
}
}
});
propTypeSelect.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
if (propTypeSelect.getSelectedIndex() == 0) {
propTypeHelp.setHTML("PARALLEL - Data for all destinations and one service are pushed in parallel.");
} else {
propTypeHelp.setHTML("DUMMY - Service provisioning data is generated by Perun, but not pushed to destination. Destinations can pull data by themselves.");
// allow to set custom value - can't use facility hosts
useHosts.setValue(false);
destination.getSuggestBox().setEnabled(true);
}
}
});
cellFormatter.setColSpan(0, 0, 2);
HTML text = new HTML("Please add destinations for service configuration delivery. New service configuration can be performed directly on facility (dest. type HOST) or sent to URL or by an email.");
text.setStyleName("inputFormInlineComment");
layout.setWidget(0, 0, text);
layout.setHTML(1, 0, "Service:");
layout.setWidget(1, 1, services);
layout.setWidget(2, 1, onlyAssignedServices);
layout.setHTML(3, 0, "Type:");
layout.setWidget(3, 1, type);
layout.setWidget(4, 0, destinationLabel);
layout.setWidget(4, 1, destination);
layout.setWidget(5, 1, useHosts);
layout.setHTML(6, 0, "Propagation:");
layout.setWidget(6, 1, propTypeSelect);
for (int i = 1; i < layout.getRowCount(); i++) {
cellFormatter.addStyleName(i, 0, "itemName");
}
propTypeHelp.setStyleName("inputFormInlineComment");
layout.setWidget(7, 0, propTypeHelp);
cellFormatter.setColSpan(7, 0, 2);
final TabItem tab = this;
TabMenu menu = new TabMenu();
menu.addWidget(addButton);
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (services.isEmpty()) {
// no services available
addButton.setEnabled(false);
}
if (validator.validateSuggestBox()) {
if (services.getSelectedIndex() == 0) {
// selected all
if (useHosts.getValue() == true) {
// auto by hosts
AddDestinationsByHostsOnFacility request = new AddDestinationsByHostsOnFacility(facility, JsonCallbackEvents.closeTabDisableButtonEvents(addButton, tab, true));
request.addDestinationByHosts(services.getAllObjects());
} else {
// default
AddDestination request = new AddDestination(facility, JsonCallbackEvents.closeTabDisableButtonEvents(addButton, tab, true));
request.addDestination(destination.getSuggestBox().getText().trim(), type.getValue(type.getSelectedIndex()), services.getAllObjects(), propTypeSelect.getSelectedValue());
}
} else {
// selected one
if (useHosts.getValue() == true) {
// auto by hosts
AddDestinationsByHostsOnFacility request = new AddDestinationsByHostsOnFacility(facility, JsonCallbackEvents.closeTabDisableButtonEvents(addButton, tab, true));
request.addDestinationByHosts(services.getSelectedObject());
} else {
// default
AddDestination request = new AddDestination(facility, JsonCallbackEvents.closeTabDisableButtonEvents(addButton, tab, true));
request.addDestination(destination.getSuggestBox().getText().trim(), type.getValue(type.getSelectedIndex()), services.getSelectedObject(), propTypeSelect.getSelectedValue());
}
}
}
}
});
menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
session.getTabManager().closeTab(tab, isRefreshParentOnClose());
}
}));
vp.add(layout);
vp.add(menu);
vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
this.contentWidget.setWidget(vp);
return getWidget();
}
use of cz.metacentrum.perun.webgui.client.resources.TableSorter in project perun by CESNET.
the class CopyMailsTabItem method draw.
public Widget draw() {
final FlexTable content = new FlexTable();
content.setStyleName("inputFormFlexTable");
// boxes
final ListBoxWithObjects<VirtualOrganization> vosBox = new ListBoxWithObjects<VirtualOrganization>();
final ListBoxWithObjects<Group> groupsBox = new ListBoxWithObjects<Group>();
final CustomButton save;
final TabItem tab = this;
VerticalPanel vp = new VerticalPanel();
TabMenu menu = new TabMenu();
titleWidget.setText("Copy form items from VO / group");
save = TabMenu.getPredefinedButton(ButtonType.OK, ButtonTranslation.INSTANCE.copyFromVo());
// get them
final GetVos vos = new GetVos(new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
vosBox.clear();
ArrayList<VirtualOrganization> vos = JsonUtils.jsoAsList(jso);
vos = new TableSorter<VirtualOrganization>().sortByName(vos);
vosBox.addAllItems(vos);
// get them
GetAllGroups getGroups = new GetAllGroups(voId, new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
groupsBox.clear();
ArrayList<Group> groups = JsonUtils.jsoAsList(jso);
groups = new TableSorter<Group>().sortByName(groups);
groupsBox.addNotSelectedOption();
groupsBox.addAllItems(groups);
save.setEnabled(true);
}
@Override
public void onError(PerunError error) {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Loading...");
save.setEnabled(false);
}
});
getGroups.retrieveData();
}
@Override
public void onError(PerunError error) {
vosBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
vosBox.addItem("Loading...");
save.setEnabled(false);
}
});
vos.retrieveData();
vosBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (vosBox.getSelectedObject() != null) {
// get them
GetAllGroups getGroups = new GetAllGroups(vosBox.getSelectedObject().getId(), new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
groupsBox.clear();
ArrayList<Group> groups = JsonUtils.jsoAsList(jso);
groups = new TableSorter<Group>().sortByName(groups);
groupsBox.addNotSelectedOption();
groupsBox.addAllItems(groups);
save.setEnabled(true);
}
@Override
public void onError(PerunError error) {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Loading...");
save.setEnabled(false);
}
});
getGroups.retrieveData();
}
}
});
content.setHTML(0, 0, "Source VO:");
content.getFlexCellFormatter().setStyleName(0, 0, "itemName");
content.setWidget(0, 1, vosBox);
content.setHTML(1, 0, "Source group:");
content.getFlexCellFormatter().setStyleName(1, 0, "itemName");
content.setWidget(1, 1, groupsBox);
save.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
CopyMails request = null;
if (groupsBox.getSelectedIndex() != 0 && voId != 0 && groupId == 0) {
// from group to VO
request = new CopyMails(PerunEntity.GROUP, groupsBox.getSelectedObject().getId(), PerunEntity.VIRTUAL_ORGANIZATION, voId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() != 0 && voId != 0 && groupId != 0) {
// from group to group
request = new CopyMails(PerunEntity.GROUP, groupsBox.getSelectedObject().getId(), PerunEntity.GROUP, groupId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() == 0 && voId != 0 && groupId == 0) {
// from VO to VO
request = new CopyMails(PerunEntity.VIRTUAL_ORGANIZATION, vosBox.getSelectedObject().getId(), PerunEntity.VIRTUAL_ORGANIZATION, voId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() == 0 && voId != 0 && groupId != 0) {
// from VO to group
request = new CopyMails(PerunEntity.VIRTUAL_ORGANIZATION, vosBox.getSelectedObject().getId(), PerunEntity.GROUP, groupId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
}
request.copyMails();
}
});
content.setHTML(2, 0, "All mail definitions will be added to yours.");
content.getFlexCellFormatter().setStyleName(2, 0, "inputFormInlineComment");
content.getFlexCellFormatter().setColSpan(2, 0, 2);
menu.addWidget(save);
menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
session.getTabManager().closeTab(tab, isRefreshParentOnClose());
}
}));
vp.add(content);
vp.add(menu);
vp.setCellHeight(menu, "30px");
vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
this.contentWidget.setWidget(vp);
return getWidget();
}
use of cz.metacentrum.perun.webgui.client.resources.TableSorter in project perun by CESNET.
the class CopyFormTabItem method draw.
public Widget draw() {
final FlexTable content = new FlexTable();
content.setStyleName("inputFormFlexTable");
// boxes
final ListBoxWithObjects<VirtualOrganization> vosBox = new ListBoxWithObjects<VirtualOrganization>();
final ListBoxWithObjects<Group> groupsBox = new ListBoxWithObjects<Group>();
final CustomButton save;
final TabItem tab = this;
VerticalPanel vp = new VerticalPanel();
TabMenu menu = new TabMenu();
titleWidget.setText("Copy form items from VO / group");
save = TabMenu.getPredefinedButton(ButtonType.OK, ButtonTranslation.INSTANCE.copyFromVo());
// get them
final GetVos vos = new GetVos(new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
vosBox.clear();
ArrayList<VirtualOrganization> vos = JsonUtils.jsoAsList(jso);
vos = new TableSorter<VirtualOrganization>().sortByName(vos);
vosBox.addAllItems(vos);
// get them
int backupVoId = voId;
if (vos.size() > 0) {
backupVoId = vos.get(0).getId();
}
GetAllGroups getGroups = new GetAllGroups(backupVoId, new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
groupsBox.clear();
ArrayList<Group> groups = JsonUtils.jsoAsList(jso);
groups = new TableSorter<Group>().sortByName(groups);
groupsBox.addNotSelectedOption();
groupsBox.addAllItems(groups);
save.setEnabled(true);
}
@Override
public void onError(PerunError error) {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Loading...");
save.setEnabled(false);
}
});
getGroups.retrieveData();
}
@Override
public void onError(PerunError error) {
vosBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
vosBox.addItem("Loading...");
save.setEnabled(false);
}
});
vos.retrieveData();
vosBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (vosBox.getSelectedObject() != null) {
// get them
GetAllGroups getGroups = new GetAllGroups(vosBox.getSelectedObject().getId(), new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
groupsBox.clear();
ArrayList<Group> groups = JsonUtils.jsoAsList(jso);
groups = new TableSorter<Group>().sortByName(groups);
groupsBox.addNotSelectedOption();
groupsBox.addAllItems(groups);
save.setEnabled(true);
}
@Override
public void onError(PerunError error) {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Error while loading");
save.setEnabled(false);
}
@Override
public void onLoadingStart() {
groupsBox.removeNotSelectedOption();
groupsBox.clear();
groupsBox.addItem("Loading...");
save.setEnabled(false);
}
});
getGroups.retrieveData();
}
}
});
content.setHTML(0, 0, "Source VO:");
content.getFlexCellFormatter().setStyleName(0, 0, "itemName");
content.setWidget(0, 1, vosBox);
content.setHTML(1, 0, "Source group:");
content.getFlexCellFormatter().setStyleName(1, 0, "itemName");
content.setWidget(1, 1, groupsBox);
save.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
CopyForm request = null;
if (groupsBox.getSelectedIndex() != 0 && voId != 0 && groupId == 0) {
// from group to VO
request = new CopyForm(PerunEntity.GROUP, groupsBox.getSelectedObject().getId(), PerunEntity.VIRTUAL_ORGANIZATION, voId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() != 0 && voId != 0 && groupId != 0) {
// from group to group
request = new CopyForm(PerunEntity.GROUP, groupsBox.getSelectedObject().getId(), PerunEntity.GROUP, groupId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() == 0 && voId != 0 && groupId == 0) {
// from VO to VO
request = new CopyForm(PerunEntity.VIRTUAL_ORGANIZATION, vosBox.getSelectedObject().getId(), PerunEntity.VIRTUAL_ORGANIZATION, voId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
} else if (groupsBox.getSelectedIndex() == 0 && voId != 0 && groupId != 0) {
// from VO to group
request = new CopyForm(PerunEntity.VIRTUAL_ORGANIZATION, vosBox.getSelectedObject().getId(), PerunEntity.GROUP, groupId, JsonCallbackEvents.closeTabDisableButtonEvents(save, tab, true));
}
request.copyForm();
}
});
content.setHTML(2, 0, "All form items will be added to yours.");
content.getFlexCellFormatter().setStyleName(2, 0, "inputFormInlineComment");
content.getFlexCellFormatter().setColSpan(2, 0, 2);
menu.addWidget(save);
menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
session.getTabManager().closeTab(tab, isRefreshParentOnClose());
}
}));
vp.add(content);
vp.add(menu);
vp.setCellHeight(menu, "30px");
vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
this.contentWidget.setWidget(vp);
return getWidget();
}
Aggregations