Example #1
0
  /**
   * Set the selected sequence
   *
   * @param sequence the new selected sequence
   */
  public void setSequence(final AcceleratorSeq sequence) {
    _sequence = sequence;

    // clear the probe since a new one will need to be made for the new sequence
    _baseProbe = null;

    loadBPMs();
    loadCorrectors();
    useSetpoints(sequence);

    BEAM_EXCURSION_ORBIT_ADAPTOR.setSequence(sequence);
    BEAM_EXCURSION_ORBIT_ADAPTOR.setBPMAgents(_bpmAgents);

    synchronized (_orbitSources) {
      for (final OrbitSource orbitSource : _orbitSources) {
        orbitSource.setSequence(sequence, _bpmAgents);
      }
    }

    _modificationStore.postModification(this);
    EVENT_PROXY.sequenceChanged(this, sequence);
  }
Example #2
0
  /** Load the bpms from the selected sequence and construct the BPM agents. */
  public void loadBPMs() {
    if (_sequence == null) {
      AVAILABLE_BPM_AGENTS.clear();
      _bpmAgents = new ArrayList<BpmAgent>();
      BEAM_EXCURSION_ORBIT_ADAPTOR.setBPMAgents(_bpmAgents);
    } else {
      final List<BPM> allBPMs = _sequence.getAllNodesOfType(BPM.s_strType);
      final List<BPM> bpms = AcceleratorSeq.filterNodesByStatus(allBPMs, true);
      final Iterator<BPM> bpmIter = bpms.iterator();
      final List<BpmAgent> bpmAgents = new ArrayList<BpmAgent>(bpms.size());
      while (bpmIter.hasNext()) {
        final BPM bpm = bpmIter.next();
        if (bpm.getValid()) {
          bpmAgents.add(new BpmAgent(bpm));
        }
      }
      Collections.sort(bpmAgents, new BPMComparator(_sequence));
      BEAM_EXCURSION_ORBIT_ADAPTOR.setBPMAgents(bpmAgents);

      AVAILABLE_BPM_AGENTS.clear();
      AVAILABLE_BPM_AGENTS.addAll(bpmAgents);
      refreshEnabledBPMs(false);
    }
  }