+ /* public void vamsasLoad_actionPerformed(ActionEvent e)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
+ getProperty("LAST_DIRECTORY"));
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle("Load Vamsas file");
+ chooser.setToolTipText("Import");
+
+ int value = chooser.showOpenDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(null);
+ vs.load(
+ chooser.getSelectedFile().getAbsolutePath()
+ );
+ }
+
+ }*/
+
+
+ public void inputSequence_actionPerformed(ActionEvent e)
+ {
+ new SequenceFetcher(null);
+ }
+
+ JPanel progressPanel;
+
+ public void startLoading(final String fileName)
+ {
+ if (fileLoadingCount == 0)
+ {
+ progressPanel = new JPanel(new BorderLayout());
+ JProgressBar progressBar = new JProgressBar();
+ progressBar.setIndeterminate(true);
+
+ progressPanel.add(new JLabel("Loading File: " + fileName + " "),
+ BorderLayout.WEST);
+
+ progressPanel.add(progressBar, BorderLayout.CENTER);
+
+ instance.getContentPane().add(progressPanel, BorderLayout.SOUTH);
+ }
+ fileLoadingCount++;
+ validate();
+ }
+
+ public void stopLoading()
+ {
+ fileLoadingCount--;
+ if (fileLoadingCount < 1)
+ {
+ if(progressPanel!=null)
+ {
+ this.getContentPane().remove(progressPanel);
+ progressPanel = null;
+ }
+ fileLoadingCount = 0;
+ }
+ validate();
+ }
+
+ public static int getViewCount(String viewId)
+ {
+ int count = 0;
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ for (int t = 0; t < frames.length; t++)
+ {
+ if (frames[t] instanceof AlignFrame)
+ {
+ AlignFrame af = (AlignFrame) frames[t];
+ for(int a=0; a<af.alignPanels.size(); a++)
+ {
+ if(viewId.equals(
+ ((AlignmentPanel)af.alignPanels.elementAt(a)).av.getSequenceSetId() )
+ )
+ count ++;
+ }
+ }
+ }
+
+ return count;
+ }
+
+ public void explodeViews(AlignFrame af)
+ {
+ int size = af.alignPanels.size();
+ if(size<2)
+ return;
+ af.closeMenuItem_actionPerformed(null);
+
+ for(int i=0; i<size; i++)
+ {
+ AlignmentPanel ap = (AlignmentPanel)af.alignPanels.elementAt(i);
+ AlignFrame newaf = new AlignFrame(ap);
+ if(ap.av.explodedPosition!=null)
+ newaf.setBounds(ap.av.explodedPosition);
+
+ ap.av.gatherViewsHere = false;
+
+ PaintRefresher.Register(ap.seqPanel.seqCanvas, ap.av.getSequenceSetId());
+ PaintRefresher.Register(ap.idPanel.idCanvas, ap.av.getSequenceSetId());
+ PaintRefresher.Register(ap, ap.av.getSequenceSetId());
+
+
+ newaf.viewport = ap.av;
+ addInternalFrame(newaf, af.getTitle(),
+ AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ }
+
+ }
+
+ public void gatherViews(AlignFrame source)
+ {
+ source.viewport.gatherViewsHere = true;
+ source.viewport.explodedPosition = source.getBounds();
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ String viewId = source.viewport.sequenceSetID;
+
+ for (int t = 0; t < frames.length; t++)
+ {
+ if (frames[t] instanceof AlignFrame && frames[t] != source)
+ {
+ AlignFrame af = (AlignFrame) frames[t];
+ boolean gatherThis = false;
+ for (int a = 0; a < af.alignPanels.size(); a++)
+ {
+ AlignmentPanel ap = (AlignmentPanel) af.alignPanels.elementAt(a);
+ if (viewId.equals(ap.av.getSequenceSetId()))
+ {
+ gatherThis = true;
+ ap.av.gatherViewsHere = false;
+ ap.av.explodedPosition = af.getBounds();
+ source.addAlignmentPanel(ap);
+ }
+ }
+ if (gatherThis)
+ af.closeMenuItem_actionPerformed(null);
+ }
+ }
+
+ }
+
+ jalview.gui.VamsasClient v_client=null;
+ public void vamsasLoad_actionPerformed(ActionEvent e)
+ {
+ if (v_client==null) {
+ // Start a session.
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
+ getProperty("LAST_DIRECTORY"));
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle("Load Vamsas file");
+ chooser.setToolTipText("Import");
+
+ int value = chooser.showOpenDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ v_client = new jalview.gui.VamsasClient(this,
+ chooser.getSelectedFile());
+ this.vamsasLoad.setText("Session Update");
+ this.vamsasStop.setVisible(true);
+ v_client.initial_update();
+ v_client.startWatcher();
+ }
+ } else {
+ // store current data in session.
+ v_client.push_update();
+ }
+ }
+ public void vamsasStop_actionPerformed(ActionEvent e) {
+ if (v_client!=null) {
+ v_client.end_session();
+ v_client=null;
+ this.vamsasStop.setVisible(false);
+ this.vamsasLoad.setText("Start Vamsas Session...");
+ }
+ }
+ /**
+ * hide vamsas user gui bits when a vamsas document event is being handled.
+ * @param b true to hide gui, false to reveal gui
+ */
+ public void setVamsasUpdate(boolean b) {
+ jalview.bin.Cache.log.debug("Setting gui for Vamsas update "+(b ? "in progress" : "finished"));
+ vamsasLoad.setVisible(!b);
+ vamsasStop.setVisible(!b);
+
+ }