public Object getValueAt(int row, int column) { synchronized (allocations) { Allocation[] ary = getAllocationArray(); if (row >= ary.length) return null; Allocation a = ary[row]; AllocationResult ar = a.getEstimatedResult(); switch (column) { case 0: // The task id return a.getTask().getUID(); case 1: // The failed status return ar.isSuccess() ? "Succeeded" : "Failed"; case 2: // The confidence rating return confidenceFormat.format(ar.getConfidenceRating()); } return "???"; } }
private void checkAllocations(Enumeration en) { while (en.hasMoreElements()) { Allocation alloc = (Allocation) en.nextElement(); AllocationResult ar = alloc.getEstimatedResult(); if (ar != null) { if (!allocations.contains(alloc)) { allocations.add(alloc); tableModel.fireTableDataChanged(); } else { tableModel.fireTableDataChanged(); } if (ar.isSuccess()) { removeAlert(alloc); } else { createAlert(alloc); } } else { removeAllocation(alloc); } } }
/** Creates and publishes alert for failed allocations * */ public void createAlert(Allocation alloc) { if (allocationAlerts.containsKey(alloc)) return; NewAlert alert = theLDMF.newAlert(); NewAlertParameter[] params = new NewAlertParameter[1]; params[0] = theLDMF.newAlertParameter(); params[0].setParameter(alloc); params[0].setDescription("Failed Allocation"); alert.setAlertText("Allocation Failed for :" + alloc.toString()); alert.setAlertParameters(params); publishAdd(alert); allocationAlerts.put(alloc, alert); }
public int compare(Object l, Object r) { Allocation la = (Allocation) l; Allocation ra = (Allocation) r; return la.getTask().getUID().compareTo(ra.getTask().getUID()); }