use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class CloneDashboard method run.
@Override
public void run(final IAction action) {
final long parentId = sourceObject.getParentIdList()[0];
final CreateObjectDialog dlg = new CreateObjectDialog(window.getShell(), Messages.get().CloneDashboard_Dashboard);
if (dlg.open() == Window.OK) {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CloneDashboard_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_DASHBOARD, dlg.getObjectName(), parentId);
final long newDashboardId = session.createObject(cd);
final NXCObjectModificationData md = new NXCObjectModificationData(newDashboardId);
md.setDashboardElements(sourceObject.getElements());
md.setColumnCount(sourceObject.getNumColumns());
md.setObjectFlags(sourceObject.getOptions());
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CloneDashboard_Error, dlg.getObjectName());
}
}.start();
}
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class MapBackground method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected boolean applyChanges(final boolean isApply) {
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
if (radioTypeNone.getSelection()) {
md.setMapBackground(NXCommon.EMPTY_GUID, new GeoLocation(false), 0, ColorConverter.rgbToInt(backgroundColor.getColorValue()));
} else if (radioTypeImage.getSelection()) {
md.setMapBackground(image.getImageGuid(), new GeoLocation(false), 0, ColorConverter.rgbToInt(backgroundColor.getColorValue()));
} else if (!disableGeolocationBackground && radioTypeGeoMap.getSelection()) {
GeoLocation location;
try {
location = GeoLocation.parseGeoLocation(latitude.getText(), longitude.getText());
} catch (GeoLocationFormatException e) {
MessageDialogHelper.openError(getShell(), Messages.get().MapBackground_Error, Messages.get().MapBackground_GeoLocFormatError);
return false;
}
md.setMapBackground(NetworkMap.GEOMAP_BACKGROUND, location, zoomSpinner.getSelection(), ColorConverter.rgbToInt(backgroundColor.getColorValue()));
}
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().MapBackground_JobTitle + object.getObjectName(), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().MapBackground_JobError + object.getObjectName();
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
MapBackground.this.setValid(true);
}
});
}
}
}.start();
return true;
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class MapObjectFilter method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
final String filter = filterSource.getText();
if (initialFilter.equals(filter) && (checkboxEnableFilter.getSelection() == initialEnable))
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setFilter(filter);
md.setObjectFlags(checkboxEnableFilter.getSelection() ? NetworkMap.MF_FILTER_OBJECTS : 0, NetworkMap.MF_FILTER_OBJECTS);
new ConsoleJob(Messages.get().MapObjectFilter_JobTitle, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
initialFilter = filter;
initialEnable = checkboxEnableFilter.getSelection();
MapObjectFilter.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().MapObjectFilter_JobError;
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class PredefinedMap method saveMap.
/**
* Save map on server
*/
private void saveMap() {
updateObjectPositions();
final NXCObjectModificationData md = new NXCObjectModificationData(rootObject.getObjectId());
md.setMapContent(mapPage.getElements(), mapPage.getLinks());
md.setMapLayout(automaticLayoutEnabled ? layoutAlgorithm : MapLayoutAlgorithm.MANUAL);
md.setConnectionRouting(routingAlgorithm);
md.setMapObjectDisplayMode(labelProvider.getObjectFigureType());
int flags = mapObject.getFlags();
if (labelProvider.isShowStatusIcons())
flags |= NetworkMap.MF_SHOW_STATUS_ICON;
else
flags &= ~NetworkMap.MF_SHOW_STATUS_ICON;
if (labelProvider.isShowStatusFrame())
flags |= NetworkMap.MF_SHOW_STATUS_FRAME;
else
flags &= ~NetworkMap.MF_SHOW_STATUS_FRAME;
if (labelProvider.isShowStatusBackground())
flags |= NetworkMap.MF_SHOW_STATUS_BKGND;
else
flags &= ~NetworkMap.MF_SHOW_STATUS_BKGND;
if (labelProvider.isShowLinkDirection())
flags |= NetworkMap.MF_SHOW_LINK_DIRECTION;
else
flags &= ~NetworkMap.MF_SHOW_LINK_DIRECTION;
md.setObjectFlags(flags);
new ConsoleJob(String.format(Messages.get().PredefinedMap_SaveJobTitle, rootObject.getObjectName()), this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(mapPage);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().PredefinedMap_SaveJobError;
}
}.start();
addDciToRequestList();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class MapOptions method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected boolean applyChanges(final boolean isApply) {
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
int flags = 0;
if ((checkIncludeEndNodes != null) && checkIncludeEndNodes.getSelection())
flags |= NetworkMap.MF_SHOW_END_NODES;
if (checkShowStatusIcon.getSelection())
flags |= NetworkMap.MF_SHOW_STATUS_ICON;
if (checkShowStatusFrame.getSelection())
flags |= NetworkMap.MF_SHOW_STATUS_FRAME;
if (checkShowStatusBkgnd.getSelection())
flags |= NetworkMap.MF_SHOW_STATUS_BKGND;
if (checkCalculateStatus.getSelection())
flags |= NetworkMap.MF_CALCULATE_STATUS;
if (checkShowLinkDirection.getSelection())
flags |= NetworkMap.MF_SHOW_LINK_DIRECTION;
md.setObjectFlags(flags, 0x5F);
md.setMapObjectDisplayMode(MapObjectDisplayMode.getByValue(objectDisplayMode.getSelectionIndex()));
md.setConnectionRouting(routingAlgorithm.getSelectionIndex() + 1);
if (radioColorCustom.getSelection()) {
md.setLinkColor(ColorConverter.rgbToInt(linkColor.getColorValue()));
} else {
md.setLinkColor(-1);
}
if (checkCustomRadius != null) {
if (checkCustomRadius.getSelection())
md.setDiscoveryRadius(topologyRadius.getSelection());
else
md.setDiscoveryRadius(-1);
}
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().MapOptions_JobTitle + object.getObjectName(), null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().MapOptions_JobError + object.getObjectName();
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
MapOptions.this.setValid(true);
}
});
}
}
}.start();
return true;
}
Aggregations