if (oldInfos.isEmpty()) {
return;
}
final String cn = getBrowser().getCluster().getName();
guiData.startProgressIndicator(cn, "paste");
final ClusterBrowser otherBrowser = (ClusterBrowser) oldInfos.get(0).getBrowser();
getBrowser().getClusterViewPanel().setDisabledDuringLoad(true);
otherBrowser.getClusterViewPanel().setDisabledDuringLoad(true);
for (Info oldI : oldInfos) {
CloneInfo oci = null;
if (oldI instanceof CloneInfo) {
oci = (CloneInfo) oldI;
oldI = oci.getContainedService();
}
final CloneInfo oldCi = oci;
if (oldI instanceof ServiceInfo) {
final ServiceInfo oldSi = (ServiceInfo) oldI;
final ServiceInfo newSi =
addServicePanel(oldSi.getResourceAgent(),
null, /* pos */
true,
null, /* clone id */
null,
Application.RunMode.LIVE);
application.invokeLater(new Runnable() {
@Override
public void run() {
if (!(newSi instanceof CloneInfo)) {
oldSi.getInfoPanel();
newSi.getInfoPanel();
oldSi.waitForInfoPanel();
newSi.waitForInfoPanel();
}
if (oldCi != null) {
final Value v = newSi.getTypeRadioGroup().getValue();
if (oldCi.getService().isMaster()) {
if (!ServiceInfo.MASTER_SLAVE_TYPE_STRING.equals(v)) {
newSi.getTypeRadioGroup().setValue(ServiceInfo.MASTER_SLAVE_TYPE_STRING);
}
} else {
if (!ServiceInfo.CLONE_TYPE_STRING.equals(v)) {
newSi.getTypeRadioGroup().setValue(ServiceInfo.CLONE_TYPE_STRING);
}
}
}
copyPasteFields(oldSi, newSi);
}
});
/* clone parameters */
final CloneInfo newCi = newSi.getCloneInfo();
if (newCi != null) {
for (final String param : oldCi.getParametersFromXML()) {
if (ServiceInfo.GUI_ID.equals(param) || ServiceInfo.PCMK_ID.equals(param)) {
if (getBrowser().isCrmId(oldCi.getService().getCrmId())) {
continue;
}
}
application.invokeLater(new Runnable() {
@Override
public void run() {
copyPasteField(oldCi.getWidget(param, null), newCi.getWidget(param, null));
}
});
}
}
if (oldI instanceof GroupInfo) {
final GroupInfo oldGi = (GroupInfo) oldI;
final GroupInfo newGi = (GroupInfo) newSi;
application.invokeInEdt(new Runnable() {
@Override
public void run() {
for (final Info info : treeMenuController.nodesToInfos(oldGi.getNode().children())) {
final ServiceInfo oldChild = (ServiceInfo) info;
oldChild.getInfoPanel();
final ServiceInfo newChild =
newGi.addGroupServicePanel(oldChild.getResourceAgent(), false);
newChild.getInfoPanel();
copyPasteFields(oldChild, newChild);
}
treeMenuController.reloadNode(newGi.getNode(), false);
}
});
}
}
}
guiData.stopProgressIndicator(cn, "paste");
otherBrowser.getClusterViewPanel().setDisabledDuringLoad(false);
getBrowser().getClusterViewPanel().setDisabledDuringLoad(false);
}