Search in sources :

Example 16 with ObjectIdMatchingData

use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.

the class TableValueConfig method remapObjects.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#remapObjects(java.util.Map)
	 */
@Override
public void remapObjects(Map<Long, ObjectIdMatchingData> remapData) {
    super.remapObjects(remapData);
    ObjectIdMatchingData md = remapData.get(objectId);
    if (md != null)
        objectId = md.dstId;
}
Also used : ObjectIdMatchingData(org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData)

Example 17 with ObjectIdMatchingData

use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.

the class ImportDashboard method readSourceObjects.

/**
 * Read source objects from XML document
 *
 * @param root
 * @return
 */
private Map<Long, ObjectIdMatchingData> readSourceObjects(Element root) {
    Map<Long, ObjectIdMatchingData> objects = new HashMap<Long, ObjectIdMatchingData>();
    // $NON-NLS-1$
    NodeList objectsRoot = root.getElementsByTagName("objectMap");
    for (int i = 0; i < objectsRoot.getLength(); i++) {
        if (objectsRoot.item(i).getNodeType() != Node.ELEMENT_NODE)
            continue;
        // $NON-NLS-1$
        NodeList elements = ((Element) objectsRoot.item(i)).getElementsByTagName("object");
        for (int j = 0; j < elements.getLength(); j++) {
            Element e = (Element) elements.item(j);
            // $NON-NLS-1$
            long id = getAttributeAsLong(e, "id", 0);
            // $NON-NLS-1$
            objects.put(id, new ObjectIdMatchingData(id, e.getTextContent(), (int) getAttributeAsLong(e, "class", 0)));
        }
    }
    return objects;
}
Also used : HashMap(java.util.HashMap) ObjectIdMatchingData(org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData) NodeList(org.w3c.dom.NodeList) DashboardElement(org.netxms.client.dashboards.DashboardElement) Element(org.w3c.dom.Element)

Example 18 with ObjectIdMatchingData

use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.

the class IdMatchingDialog method okPressed.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
	 */
@Override
protected void okPressed() {
    // check if all elements have a match
    boolean ok = true;
    for (ObjectIdMatchingData o : objects.values()) if (o.dstId == 0) {
        ok = false;
        break;
    }
    for (DciIdMatchingData d : dcis.values()) if ((d.dstNodeId == 0) || (d.dstDciId == 0)) {
        ok = false;
        break;
    }
    if (!ok) {
        if (!MessageDialogHelper.openQuestion(getShell(), Messages.get().IdMatchingDialog_MatchingErrors, Messages.get().IdMatchingDialog_ConfirmationText))
            return;
    }
    super.okPressed();
}
Also used : ObjectIdMatchingData(org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData) DciIdMatchingData(org.netxms.ui.eclipse.dashboard.dialogs.helpers.DciIdMatchingData)

Aggregations

ObjectIdMatchingData (org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData)18 DashboardElement (org.netxms.client.dashboards.DashboardElement)2 DciIdMatchingData (org.netxms.ui.eclipse.dashboard.dialogs.helpers.DciIdMatchingData)2 HashMap (java.util.HashMap)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 UIJob (org.eclipse.ui.progress.UIJob)1 DciValue (org.netxms.client.datacollection.DciValue)1 AbstractObject (org.netxms.client.objects.AbstractObject)1 IdMatchingDialog (org.netxms.ui.eclipse.dashboard.dialogs.IdMatchingDialog)1 Element (org.w3c.dom.Element)1 NodeList (org.w3c.dom.NodeList)1