Ejemplo n.º 1
0
 /**
  * Constructs an {@code AlertsViewer} to display alerts for a single alert type.
  *
  * @param alert the alerts
  * @param context the context
  * @param help the help context
  */
 public AlertsViewer(Alert alert, Context context, HelpContext help) {
   this(Arrays.asList(alert), context, help);
   if (alert.getAlert() != null) {
     setTitle(DescriptorHelper.getDisplayName(alert.getAlert()));
   } else {
     setTitle(alert.getAlertType().getName());
   }
 }
Ejemplo n.º 2
0
 /**
  * Shows an alert.
  *
  * @param alert the alert to show. May be {@code null}
  */
 private void show(Alert alert) {
   if (alert != null) {
     if (viewer != null) {
       column.remove(viewer);
     }
     if (alert.getAlert() != null) {
       DefaultLayoutContext layout = new DefaultLayoutContext(context, getHelpContext());
       viewer = new IMObjectViewer(alert.getAlert(), layout).getComponent();
     } else {
       viewer = LabelFactory.create("alert.nodetail", "bold");
       ColumnLayoutData layout = new ColumnLayoutData();
       layout.setAlignment(Alignment.ALIGN_CENTER);
       viewer.setLayoutData(layout);
     }
     column.add(viewer);
   }
 }
Ejemplo n.º 3
0
 /**
  * Returns the value found at the given coordinate within the table.
  *
  * @param object the object
  * @param column the column
  * @param row the row
  * @return the value at the given coordinate.
  */
 protected Object getValue(Alert object, TableColumn column, int row) {
   int index = column.getModelIndex();
   Object result = null;
   switch (index) {
     case PRIORITY:
       result = getPriority(object);
       break;
     case ALERT:
       result = getAlertType(object);
       break;
     case REASON:
       Act act = object.getAlert();
       if (act != null) {
         ActBean bean = new ActBean(act);
         result = bean.getString("reason");
       }
       break;
     default:
       throw new IllegalArgumentException("Illegal column=" + index);
   }
   return result;
 }