+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
-\r
/**\r
- * Element of the VamsasFileWatcherThread event generator chain.\r
- * Keep a reference to this element before adding it to the chain \r
- * in order to control the generation of events with halt and enable.\r
+ * Element of the VamsasFileWatcherThread event generator chain. Keep a\r
+ * reference to this element before adding it to the chain in order to control\r
+ * the generation of events with halt and enable.\r
* \r
* doWatch will do nothing if the element is not enabled.\r
* \r
*/\r
public class SessionFileWatcherElement extends WatcherElement {\r
- SessionFile watched=null;\r
+ SessionFile watched = null;\r
+\r
/**\r
* create a new, enabled watch element\r
- * @param watcher file being watched\r
- * @param handler handler to call on state change\r
+ * \r
+ * @param watcher\r
+ * file being watched\r
+ * @param handler\r
+ * handler to call on state change\r
*/\r
public SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler) {\r
this(watcher, handler, true);\r
}\r
+\r
protected void initWatch() {\r
- if (watched==null)\r
+ if (watched == null)\r
return;\r
- if (watcher==null || !watcher.getSubject().equals(watched.sessionFile)) \r
- watcher=new FileWatcher(watched.sessionFile);\r
+ if (watcher == null || !watcher.getSubject().equals(watched.sessionFile))\r
+ watcher = new FileWatcher(watched.sessionFile);\r
else\r
watcher.setState();\r
}\r
+\r
protected void endWatch() {\r
// leaves watcher in state its in.\r
}\r
+\r
/**\r
* new watcher with flag to initially skip watching this sessionfile\r
+ * \r
* @param watcher\r
* @param handler\r
* @param enableWatching\r
*/\r
- public SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler, boolean enableWatching) {\r
+ public SessionFileWatcherElement(SessionFile watcher,\r
+ WatcherCallBack handler, boolean enableWatching) {\r
super(handler);\r
this.watched = watcher;\r
if (enableWatching)\r
else\r
haltWatch();\r
}\r
+\r
/**\r
* @return the watched\r
*/\r
public SessionFile getWatched() {\r
return watched;\r
}\r
+\r
protected String getSubject() {\r
return watched.sessionFile.toString();\r
}\r