Search in sources :

Example 1 with EventProcessingPolicyRule

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()));
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) RuleEditor(org.netxms.ui.eclipse.epp.widgets.RuleEditor)

Example 2 with EventProcessingPolicyRule

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));
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) GridData(org.eclipse.swt.layout.GridData) Rectangle(org.eclipse.swt.graphics.Rectangle) RuleEditor(org.netxms.ui.eclipse.epp.widgets.RuleEditor)

Example 3 with EventProcessingPolicyRule

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);
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) GridData(org.eclipse.swt.layout.GridData) RuleEditor(org.netxms.ui.eclipse.epp.widgets.RuleEditor)

Example 4 with EventProcessingPolicyRule

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;
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) ArrayList(java.util.ArrayList)

Example 5 with EventProcessingPolicyRule

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();
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) Script(org.netxms.client.Script) SnmpTrap(org.netxms.client.snmp.SnmpTrap) EventObject(org.netxms.client.events.EventObject) DciSummaryTableDescriptor(org.netxms.client.datacollection.DciSummaryTableDescriptor) Template(org.netxms.client.objects.Template) EventTemplate(org.netxms.client.events.EventTemplate) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) UUID(java.util.UUID) ServerAction(org.netxms.client.ServerAction) ObjectTool(org.netxms.client.objecttools.ObjectTool)

Aggregations

EventProcessingPolicyRule (org.netxms.client.events.EventProcessingPolicyRule)10 RuleEditor (org.netxms.ui.eclipse.epp.widgets.RuleEditor)4 GridData (org.eclipse.swt.layout.GridData)3 NXCPMessage (org.netxms.base.NXCPMessage)2 EventObject (org.netxms.client.events.EventObject)2 EventProcessingPolicy (org.netxms.client.events.EventProcessingPolicy)2 AccessPoint (org.netxms.client.objects.AccessPoint)2 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 UUID (java.util.UUID)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Script (org.netxms.client.Script)1 ServerAction (org.netxms.client.ServerAction)1 DciSummaryTableDescriptor (org.netxms.client.datacollection.DciSummaryTableDescriptor)1 EventTemplate (org.netxms.client.events.EventTemplate)1 Template (org.netxms.client.objects.Template)1 ObjectTool (org.netxms.client.objecttools.ObjectTool)1 SnmpTrap (org.netxms.client.snmp.SnmpTrap)1