001package edu.wisc.ssec.mcidasv.collaboration; 002 003import ucar.unidata.collab.Sharable; 004import ucar.unidata.idv.IntegratedDataViewer; 005import ucar.unidata.idv.ViewManager; 006import ucar.unidata.idv.collab.CollabManager; 007import ucar.unidata.idv.collab.CollabMsgType; 008 009import edu.wisc.ssec.mcidasv.McIDASV; 010import org.slf4j.Logger; 011import org.slf4j.LoggerFactory; 012 013public class CollaborationManager extends CollabManager { 014 015 private static final Logger logger = LoggerFactory.getLogger(CollaborationManager.class); 016 017 private ViewManager recordingFrom; 018 019 public CollaborationManager(IntegratedDataViewer idv) { 020 super(idv); 021 } 022 023// public void startRecording(ViewManager vm) { 024// recordingFrom = vm; 025// } 026// 027// public void stopRecording(ViewManager vm) { 028// recordingFrom = null; 029// } 030// 031// @Override public void write(CollabMsgType type, String message) { 032// super.write(type, message); 033// } 034// 035// @Override protected String makeMsg(CollabMsgType type, String body) { 036// logger.trace("type: {}, body: {}", type, body); 037// return super.makeMsg(type, body); 038// } 039 040 @Override protected Sharable findSharable(String id) { 041 Sharable sharable = super.findSharable(id); 042 if (sharable == null) { 043 if (id.startsWith("view_")) { 044 if (recordingFrom == null) { 045 sharable = ((McIDASV) getIdv()).getVMManager().getLastActiveViewManager(); 046 } else { 047 return recordingFrom; 048 } 049 } 050 } 051 return sharable; 052 } 053 054 055}