Jalview2XML.LoadJalviewAlign(choice);\r
}\r
}\r
- jalview.io.VamsasClient v_client=null;\r
+ jalview.gui.VamsasClient v_client=null;\r
public void vamsasLoad_actionPerformed(ActionEvent e)\r
{\r
if (v_client==null) {\r
\r
if (value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
- v_client = new jalview.io.VamsasClient(this,\r
+ v_client = new jalview.gui.VamsasClient(this,\r
chooser.getSelectedFile().getAbsolutePath()\r
);\r
this.vamsasLoad.setText("Session Update");\r
--- /dev/null
+/**
+ *
+ */
+package jalview.gui;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Vector;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+
+import jalview.bin.Cache;
+
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.test.simpleclient.ArchiveClient;
+
+/**
+ * @author jimp
+ *
+ */
+public class VamsasClient extends ArchiveClient {
+ Desktop us;
+ // Cache.preferences for vamsas client session arena
+ // preferences for check for default session at startup.
+ // user and organisation stuff.
+ public VamsasClient(Desktop jdesktop,
+ String sessionPath) {
+ super("Jalview User", "Dundee", // new org.vamsas.client.ClientHandle("jalview","2.7"),
+ sessionPath);
+ us=jdesktop;
+ }
+ public void initial_update() {
+ Cache.log.info("Jalview loading the Vamsas Session.");
+ // load in the vamsas archive for the first time
+
+ // VamsasArchive doc = new VamsasArchive();
+ }
+ public void get_update(VamsasArchive doc) {
+ Cache.log.info("Jalview updating from Vamsas Session.");
+ }
+ public void push_update() {
+ // collect all uncached alignments and put them into the vamsas dataset.
+ // store them.
+ Cache.log.info("Jalview updating the Vamsas Session.");
+ }
+ public void end_session() {
+ // stop any update/watcher thread.
+ Cache.log.info("Jalview disconnecting from the Vamsas Session.");
+ }
+ public void updateVamsasDocument(VamsasDocument doc) {
+ // wander through frames
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+
+ if (frames == null)
+ {
+ return;
+ }
+
+ try
+ {
+ Vector shortNames = new Vector();
+
+ //REVERSE ORDER
+ for (int i = frames.length - 1; i > -1; i--)
+ {
+ if (frames[i] instanceof AlignFrame)
+ {
+ AlignFrame af = (AlignFrame) frames[i];
+ // check if this frame has an associated alignment object ?
+ // update alignment and root from frame.
+
+
+ String shortName = af.getTitle();
+
+ if (shortName.indexOf(File.separatorChar) > -1)
+ {
+ shortName = shortName.substring(shortName.lastIndexOf(
+ File.separatorChar) + 1);
+ }
+
+ int count = 1;
+
+ while (shortNames.contains(shortName))
+ {
+ if (shortName.endsWith("_" + (count - 1)))
+ {
+ shortName = shortName.substring(0,
+ shortName.lastIndexOf("_"));
+ }
+
+ shortName = shortName.concat("_" + count);
+ count++;
+ }
+
+ shortNames.addElement(shortName);
+
+ if (!shortName.endsWith(".xml"))
+ {
+ shortName = shortName + ".xml";
+ }
+
+ }
+ }
+ }
+ catch (Exception e) {
+ Cache.log.error("Vamsas Document store exception",e);
+ }
+ }
+ protected class VamsasClientWatcher extends Thread implements Runnable {
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ VamsasClient client=null;
+ VamsasClientWatcher(VamsasClient client) {
+ this.client = client;
+ }
+ public void run() {
+ VamsasArchive docio = client.watch(0);
+ client.get_update(docio);
+ }
+
+ }
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
+++ /dev/null
-/**
- *
- */
-package jalview.io;
-
-import jalview.bin.Cache;
-import jalview.gui.Desktop;
-
-import org.vamsas.client.UserHandle;
-import org.vamsas.client.simpleclient.FileWatcher;
-import org.vamsas.client.simpleclient.VamsasArchive;
-import org.vamsas.client.simpleclient.VamsasFile;
-import org.vamsas.test.simpleclient.ArchiveClient;
-
-/**
- * @author jimp
- *
- */
-public class VamsasClient extends ArchiveClient {
- Desktop us;
- public VamsasClient(Desktop jdesktop,
- String sessionPath) {
- super("Jalview User", "Dundee", // new org.vamsas.client.ClientHandle("jalview","2.7"),
- sessionPath);
- us=jdesktop;
- }
- public void initial_update() {
- Cache.log.info("Jalview loading the Vamsas Session.");
- // load in the vamsas archive for the first time
-
- // VamsasArchive doc = new VamsasArchive();
- }
- public void get_update(VamsasArchive doc) {
- Cache.log.info("Jalview updating from Vamsas Session.");
- }
- public void push_update() {
- // collect all uncached alignments and put them into the vamsas dataset.
- // store them.
- Cache.log.info("Jalview updating the Vamsas Session.");
- }
- public void end_session() {
- // stop any update/watcher thread.
- Cache.log.info("Jalview disconnecting from the Vamsas Session.");
- }
- protected class VamsasClientWatcher extends Thread implements Runnable {
- /* (non-Javadoc)
- * @see java.lang.Thread#run()
- */
- VamsasClient client=null;
- VamsasClientWatcher(VamsasClient client) {
- this.client = client;
- }
- public void run() {
- VamsasArchive docio = client.watch(0);
- client.get_update(docio);
- }
-
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
-}
JMenuBar DesktopMenubar = new JMenuBar();\r
JMenu FileMenu = new JMenu();\r
JMenu HelpMenu = new JMenu();\r
+ protected JMenu VamsasMenu = new JMenu();\r
JMenuItem inputLocalFileMenuItem = new JMenuItem();\r
JMenuItem inputURLMenuItem = new JMenuItem();\r
JMenuItem inputTextboxMenuItem = new JMenuItem();\r
FileMenu.setMnemonic('F');\r
FileMenu.setText("File");\r
HelpMenu.setText("Help");\r
+ VamsasMenu.setText("Vamsas");\r
+ VamsasMenu.setMnemonic('V');\r
+ VamsasMenu.setToolTipText("Share data with other vamsas applications.");\r
inputLocalFileMenuItem.setMnemonic('L');\r
inputLocalFileMenuItem.setText("from File");\r
inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener()\r
}\r
}); DesktopMenubar.add(FileMenu);\r
DesktopMenubar.add(toolsMenu);\r
+ DesktopMenubar.add(VamsasMenu);\r
DesktopMenubar.add(HelpMenu);\r
DesktopMenubar.add(windowMenu);\r
FileMenu.addSeparator();\r
FileMenu.addSeparator();\r
FileMenu.add(saveState);\r
FileMenu.add(loadState);\r
- FileMenu.addSeparator();\r
- FileMenu.add(vamsasLoad);\r
- FileMenu.add(vamsasStop);\r
FileMenu.addSeparator();\r
FileMenu.add(quit);\r
HelpMenu.add(aboutMenuItem);\r
HelpMenu.add(documentationMenuItem);\r
+ VamsasMenu.add(vamsasLoad);\r
+ VamsasMenu.add(vamsasStop);\r
toolsMenu.add(preferences);\r
jMenu1.add(inputLocalFileMenuItem);\r
jMenu1.add(inputURLMenuItem);\r