/** @see com.ixora.rms.ui.artefacts.ArtefactSelectorPanel#handleRemoveArtefact() */
 protected void handleRemoveArtefact() {
   try {
     JTable table = getJTableArtefacts();
     int[] sel = table.getSelectedRows();
     if (Utils.isEmptyArray(sel)) {
       return;
     }
     for (int idx : sel) {
       DashboardInfo gi = (DashboardInfo) table.getModel().getValueAt(idx, 1);
       DashboardMap map = fDashboardRepository.getDashboardMap(fContext);
       if (map == null) {
         logger.error("Couldn't find query gruop map for context: " + this.fContext);
         return;
       }
       // ask for confitmation
       if (!UIUtils.getBooleanOkCancelInput(
           this.fViewContainer.getAppFrame(),
           MessageRepository.get(Msg.TITLE_CONFIRM_REMOVE_DASHBOARD),
           MessageRepository.get(
               Msg.TEXT_CONFIRM_REMOVE_DASHBOARD, new String[] {gi.getTranslatedName()}))) {
         return;
       }
       // remove the dashboard only for the current fSUOVersion
       map.remove(gi.getDashboard().getName(), fSUOVersion);
       fDashboardRepository.setDashboardMap(fContext, map);
       fDashboardRepository.save();
       // update model
       fSessionData.getDashboardHelper().removeDashboard(fContext, gi.getDashboard().getName());
       // refresh table model
       refreshTableModel();
     }
   } catch (Exception ex) {
     UIExceptionMgr.userException(ex);
   }
 }
 /** @see com.ixora.common.ui.filter.FilterEditorDialog#handleCancel() */
 protected void handleCancel() {
   try {
     fFilter = null;
     dispose();
   } catch (Exception e) {
     UIExceptionMgr.userException(e);
   }
 }
 /** @see com.ixora.rms.ui.artefacts.ArtefactSelectorPanel#handleApplyChanges() */
 protected void handleApplyChanges() {
   try {
     applyChangesLocally();
   } catch (Exception e) {
     handleCancel();
     UIExceptionMgr.userException(e);
   }
 }
 private void handleSelectTimeIntervalOne() {
   try {
     if (fLogOne != null) {
       scanLogForTimestamps(fLogOne);
     }
   } catch (Exception e) {
     UIExceptionMgr.userException(e);
   }
 }
 /** Cancels changes. */
 protected void handleCancel() {
   try {
     fSessionData.getDashboardHelper().rollbackDashboards(this.fContext);
     getDashboardTableModel().fireTableDataChanged();
     this.fActionApply.setEnabled(false);
     this.fActionCancel.setEnabled(false);
   } catch (Exception e) {
     UIExceptionMgr.userException(e);
   }
 }
 /** @see com.ixora.rms.ui.artefacts.ArtefactSelectorPanel#handleAddArtefact() */
 protected void handleAddArtefact() {
   try {
     DashboardEditorDialog editor =
         new DashboardEditorDialog(
             fViewContainer, fTreeExplorer, fDashboardRepository, fEventHandlef);
     editor.setModal(true);
     editor.edit(fSessionData, fContext, fAllSUOVersions, null);
     UIUtils.centerDialogAndShow(fViewContainer.getAppFrame(), editor);
   } catch (Exception ex) {
     UIExceptionMgr.userException(ex);
   }
 }
  /** @see com.ixora.rms.ui.artefacts.ArtefactSelectorPanel#handlePlotArtefact() */
  protected void handlePlotArtefact() {
    try {
      final JTable table = getJTableArtefacts();
      final int[] sel = table.getSelectedRows();
      if (Utils.isEmptyArray(sel)) {
        return;
      }

      this.fViewContainer
          .getAppWorker()
          .runJobSynch(
              new UIWorkerJobDefault(
                  fViewContainer.getAppFrame(),
                  Cursor.WAIT_CURSOR,
                  MessageRepository.get(Msg.TEXT_PLOTTING_DASHBOARD)) {
                public void work() throws Exception {
                  for (int idx : sel) {
                    DashboardInfo di = (DashboardInfo) table.getModel().getValueAt(idx, 1);

                    Dashboard dtls = di.getDashboard();
                    if (dtls == null) {
                      logger.error("No dashboard");
                      return;
                    }

                    DataViewId[] members = dtls.getViews();
                    ResourceId[] counters = dtls.getCounters();
                    if (Utils.isEmptyArray(members) && Utils.isEmptyArray(counters)) {
                      // TODO localize
                      throw new RMSException(
                          "Dashboard " + di.getTranslatedName() + " has no data views.");
                    }

                    if (!di.getFlag(DataViewInfo.ENABLED) && di.isCommitted()) {
                      // enable it first
                      ((DashboardTableModel) fTableModelArtefacts).enableDashboard(idx);
                      applyChangesLocally();
                    }

                    callback.plot(new DashboardId(fContext, dtls.getName()));
                  }
                }

                public void finished(Throwable ex) {
                  ; // nothing, synched job
                }
              });
    } catch (Exception ex) {
      UIExceptionMgr.userException(ex);
    }
  }
 /** @param e */
 private void handleNoAggCheckBoxEvent(ItemEvent e) {
   try {
     if (fCheckBoxNoAgg.isSelected()) {
       fTextFieldAggStep.setEnabled(false);
       fTextFieldAggStep.setText("0");
     } else {
       fTextFieldAggStep.setEnabled(true);
       fTextFieldAggStep.setText(
           String.valueOf(
               ConfigurationMgr.getInt(
                   LogComponent.NAME, LogConfigurationConstants.LOG_AGGREGATION_PERIOD)));
     }
   } catch (Exception ex) {
     UIExceptionMgr.userException(ex);
   }
 }
 /** @see com.ixora.rms.ui.artefacts.ArtefactSelectorPanel#handleEditArtefact() */
 protected void handleEditArtefact() {
   try {
     JTable table = getJTableArtefacts();
     int sel = table.getSelectedRow();
     if (sel < 0) {
       return;
     }
     DashboardInfo cd = (DashboardInfo) table.getModel().getValueAt(sel, 1);
     DashboardEditorDialog editor =
         new DashboardEditorDialog(
             fViewContainer, fTreeExplorer, fDashboardRepository, fEventHandlef);
     editor.setModal(true);
     editor.edit(fSessionData, fContext, fAllSUOVersions, cd.getDashboard());
     UIUtils.centerDialogAndShow(fViewContainer.getAppFrame(), editor);
   } catch (Exception ex) {
     UIExceptionMgr.userException(ex);
   }
 }
  private void handleOk() {
    try {
      String aggStepString = fTextFieldAggStep.getText().trim();
      int aggStep = 0;
      try {
        aggStep = Integer.parseInt(aggStepString);
      } catch (NumberFormatException e) {
        throw new RMSException("The aggregation step must be an integer");
      }

      if (fCheckBoxNoAgg.isSelected()) {
        aggStep = 0;
      }
      fActionOk.setEnabled(false);
      final int faggStep = aggStep;
      if (fTimeIntervalOne == null) {
        runScanJob(
            fLogOne,
            new ScanEndCallback() {
              public void finishedScanning(Throwable err) {
                try {
                  if (err == null) {
                    fResult =
                        new DataLogCompareAndReplayConfiguration(
                            new DataLogCompareAndReplayConfiguration.LogRepositoryReplayConfig(
                                new LogRepositoryInfo(fRepositoryType, fLogOne), fTimeIntervalOne),
                            faggStep);
                    dispose();
                  }
                } catch (Exception e) {
                  UIExceptionMgr.userException(e);
                }
              }
            });
      }

    } catch (Exception e) {
      UIExceptionMgr.userException(e);
    }
  }
 /** @see com.ixora.common.ui.filter.FilterEditorDialog#handleOk() */
 protected void handleOk() {
   try {
     boolean regex = fCheckIsRegex.isSelected();
     String filterText = fTextFieldFilter.getText();
     if (filterText == null || filterText.trim().length() == 0) {
       UIUtils.showError(
           this,
           // TODO localize
           "Invalid Filter",
           "Filter will not be set.");
       return;
     }
     if (regex) {
       fFilter = createRegexFilter(filterText.trim(), fCheckIsNegative.isSelected());
     } else {
       fFilter = createStringFilter(filterText.trim(), fCheckIsNegative.isSelected());
     }
     dispose();
   } catch (Exception e) {
     UIExceptionMgr.userException(e);
   }
 }
  /** @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) */
  public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
    try {
      if (columnIndex != 0) {
        return;
      }
      this.fViewContainer
          .getAppWorker()
          .runJobSynch(
              new UIWorkerJobDefault(fViewContainer.getAppFrame(), Cursor.WAIT_CURSOR, "") {
                public void work() throws Exception {
                  setArtefactEnabled(rowIndex, ((Boolean) aValue).booleanValue());
                  // this will trigger a refresh on the entire row
                  fireTableRowsUpdated(rowIndex, rowIndex);
                }

                public void finished(Throwable ex) {}
              });
    } catch (Exception e) {
      // this will trigger a refresh on the entire row
      // before the exception is displayed
      fireTableRowsUpdated(rowIndex, rowIndex);
      UIExceptionMgr.userException(e);
    }
  }