use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ConditionData method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!isModified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setDciList(dciList);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().ConditionData_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
isModified = false;
}
@Override
protected String getErrorMessage() {
return Messages.get().ConditionData_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ConditionData.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class Dashboards method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!isModified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
Set<Long> idList = dashboards.keySet();
Long[] dlist = new Long[idList.size()];
int i = 0;
for (Long id : idList) dlist[i++] = id;
md.setDashboards(dlist);
new ConsoleJob(String.format(Messages.get().TrustedNodes_JobName, object.getObjectName()), 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() {
Dashboards.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().TrustedNodes_JobError;
}
}.schedule();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class AutoDeploy method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
int flags = object.getFlags();
if (checkboxEnableDeploy.getSelection())
flags |= AgentPolicy.PF_AUTO_DEPLOY;
else
flags &= ~AgentPolicy.PF_AUTO_DEPLOY;
if (checkboxEnableUninstall.getSelection())
flags |= AgentPolicy.PF_AUTO_UNINSTALL;
else
flags &= ~Container.CF_AUTO_UNBIND;
if ((flags == initialFlags) && initialAutoDeployFilter.equals(filterSource.getText()))
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setObjectFlags(flags);
md.setAutoBindFilter(filterSource.getText());
new ConsoleJob("Updating autodeploy configuration", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
initialFlags = md.getObjectFlags();
initialAutoDeployFilter = md.getAutoBindFilter();
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
AutoDeploy.this.setValid(true);
}
});
}
}
@Override
protected String getErrorMessage() {
return "Cannot update autodeploy configuration";
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class ClusterResources method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!isModified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setResourceList(resources);
new ConsoleJob(Messages.get().ClusterResources_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
isModified = false;
}
@Override
protected String getErrorMessage() {
return Messages.get().ClusterResources_JobError;
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ClusterResources.this.setValid(true);
}
});
}
}
}.start();
}
use of org.netxms.client.NXCObjectModificationData in project netxms by netxms.
the class StatusCalculation method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite dialogArea = new Composite(parent, SWT.NONE);
object = (AbstractObject) getElement().getAdapter(AbstractObject.class);
currentState = new NXCObjectModificationData(object.getObjectId());
currentState.setStatusCalculationMethod(object.getStatusCalculationMethod());
currentState.setStatusPropagationMethod(object.getStatusPropagationMethod());
currentState.setFixedPropagatedStatus(object.getFixedPropagatedStatus());
currentState.setStatusShift(object.getStatusShift());
currentState.setStatusTransformation(object.getStatusTransformation());
currentState.setStatusSingleThreshold(object.getStatusSingleThreshold());
currentState.setStatusThresholds(object.getStatusThresholds());
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
layout.makeColumnsEqualWidth = true;
dialogArea.setLayout(layout);
createLeftPanel(dialogArea);
createRightPanel(dialogArea);
changeCalculationMethod(object.getStatusCalculationMethod());
changePropagationMethod(object.getStatusPropagationMethod());
createCalcSelectionListener(radioCalcDefault, AbstractObject.CALCULATE_DEFAULT);
createCalcSelectionListener(radioCalcMostCritical, AbstractObject.CALCULATE_MOST_CRITICAL);
createCalcSelectionListener(radioCalcSingle, AbstractObject.CALCULATE_SINGLE_THRESHOLD);
createCalcSelectionListener(radioCalcMultiple, AbstractObject.CALCULATE_MULTIPLE_THRESHOLDS);
createPropSelectionListener(radioPropDefault, AbstractObject.PROPAGATE_DEFAULT);
createPropSelectionListener(radioPropUnchanged, AbstractObject.PROPAGATE_UNCHANGED);
createPropSelectionListener(radioPropFixed, AbstractObject.PROPAGATE_FIXED);
createPropSelectionListener(radioPropRelative, AbstractObject.PROPAGATE_RELATIVE);
createPropSelectionListener(radioPropTranslated, AbstractObject.PROPAGATE_TRANSLATED);
return dialogArea;
}
Aggregations