@Override
 public void sequenceChanged(SequenceEvent sequenceEvent) {
   if (sequenceEvent.getSource() == SequenceEvent.SequenceEventSourceType.SEQUENCE_DATA) {
     cancelCompute = true;
     while (computing)
       try {
         Thread.sleep(1);
       } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     (new Thread(new computeRunnable())).start();
   }
   if (sequenceEvent.getSourceType() == SequenceEventSourceType.SEQUENCE_OVERLAY
       && sequenceEvent.getSource() == this
       && sequenceEvent.getType() == SequenceEventType.REMOVED)
     sequence.removeROI(displayRectangle);
 }
Esempio n. 2
0
  /** Collapse event */
  private boolean collapseWith(SequenceEvent e) {
    // same source type
    if (e.getSourceType() == sourceType) {
      switch (sourceType) {
        case SEQUENCE_META:
          if (StringUtil.equals((String) e.getSource(), (String) source)) return true;

        case SEQUENCE_COLORMAP:
        case SEQUENCE_COMPONENTBOUNDS:
          // join events in one global event
          if (e.getParam() != param) param = -1;
          return true;

        case SEQUENCE_DATA:
          // optimize different type event to a single CHANGED event (for DATA only)
          if (e.getType() != type) type = SequenceEventType.CHANGED;
          if (e.getSource() != source) source = null;
          return true;

        case SEQUENCE_PAINTER:
        case SEQUENCE_OVERLAY:
        case SEQUENCE_ROI:
          // same type ?
          if (e.getType() == type) {
            // join events in one global event
            if (e.getSource() != source) source = null;
            return true;
          }
          break;

        case SEQUENCE_TYPE:
          return true;
      }
    }

    return false;
  }