use of org.netxms.client.events.EventProcessingPolicyRule in project netxms by netxms.
the class EventProcessingPolicyEditor method copyRules.
/**
* Copy selected rules to internal clipboard
*/
private void copyRules() {
clipboard.clear();
actionPaste.setEnabled(true);
for (RuleEditor e : selection) clipboard.add(new EventProcessingPolicyRule(e.getRule()));
}
use of org.netxms.client.events.EventProcessingPolicyRule in project netxms by netxms.
the class EventProcessingPolicyEditor method initPolicyEditor.
/**
* Init policy editor
*/
private void initPolicyEditor() {
for (EventProcessingPolicyRule rule : policy.getRules()) {
if (isRuleVisible(rule)) {
RuleEditor editor = new RuleEditor(dataArea, rule, this);
ruleEditors.add(editor);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
editor.setLayoutData(gd);
}
}
dataArea.layout();
Rectangle r = scroller.getClientArea();
scroller.setMinSize(dataArea.computeSize(r.width, SWT.DEFAULT));
}
use of org.netxms.client.events.EventProcessingPolicyRule in project netxms by netxms.
the class EventProcessingPolicyEditor method insertRule.
/**
* Insert new rule at given position
*
* @param position
*/
private void insertRule(int position) {
EventProcessingPolicyRule rule = new EventProcessingPolicyRule();
rule.setRuleNumber(position + 1);
policy.insertRule(rule, position);
RuleEditor editor = new RuleEditor(dataArea, rule, this);
ruleEditors.add(position, editor);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
editor.setLayoutData(gd);
for (int i = position + 1; i < ruleEditors.size(); i++) ruleEditors.get(i).setRuleNumber(i + 1);
if (position < ruleEditors.size() - 1) {
RuleEditor anchor = null;
for (int i = position + 1; i < ruleEditors.size(); i++) if (!ruleEditors.get(i).isDisposed()) {
anchor = ruleEditors.get(i);
break;
}
if (anchor != null)
editor.moveAbove(anchor);
}
updateEditorAreaLayout();
setModified(true);
}
use of org.netxms.client.events.EventProcessingPolicyRule in project netxms by netxms.
the class RuleClipboard method paste.
/**
* Do paste - returns content (cloned as necessary) ready for pasting
*
* @return
*/
public Collection<EventProcessingPolicyRule> paste() {
List<EventProcessingPolicyRule> list = new ArrayList<EventProcessingPolicyRule>(content.size());
if (cloneOnPaste) {
for (EventProcessingPolicyRule r : content) list.add(new EventProcessingPolicyRule(r));
} else {
list.addAll(content);
}
// next paste of same content should be cloned
cloneOnPaste = true;
return list;
}
use of org.netxms.client.events.EventProcessingPolicyRule in project netxms by netxms.
the class ExportFileBuilder method doExport.
/**
* Do export operation and call completion handler when done
*
* @param completionHandler
*/
private void doExport(final ExportCompletionHandler completionHandler) {
final long[] eventList = new long[events.size()];
int i = 0;
for (EventObject o : events.values()) eventList[i++] = o.getCode();
final long[] templateList = new long[templates.size()];
i = 0;
for (Template t : templates.values()) templateList[i++] = t.getObjectId();
final long[] trapList = new long[traps.size()];
i = 0;
for (SnmpTrap t : traps.values()) trapList[i++] = t.getId();
final UUID[] ruleList = new UUID[rules.size()];
i = 0;
for (EventProcessingPolicyRule r : rules.values()) ruleList[i++] = r.getGuid();
final long[] scriptList = new long[scripts.size()];
i = 0;
for (Script s : scripts.values()) scriptList[i++] = s.getId();
final long[] toolList = new long[tools.size()];
i = 0;
for (ObjectTool t : tools.values()) toolList[i++] = t.getId();
final long[] summaryTableList = new long[summaryTables.size()];
i = 0;
for (DciSummaryTableDescriptor t : summaryTables.values()) summaryTableList[i++] = t.getId();
final long[] actionList = new long[actions.size()];
i = 0;
for (ServerAction a : actions.values()) actionList[i++] = a.getId();
final String descriptionText = description.getText();
new ConsoleJob(Messages.get().ExportFileBuilder_ExportJobName, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final String xml = session.exportConfiguration(descriptionText, eventList, trapList, templateList, ruleList, scriptList, toolList, summaryTableList, actionList);
runInUIThread(new Runnable() {
@Override
public void run() {
completionHandler.exportCompleted(xml);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ExportFileBuilder_ExportJobError;
}
}.start();
}
Aggregations