*/
package jalview.bin;
+import jalview.api.AlignCalcWorkerI;
import jalview.api.AlignFrameI;
import jalview.api.AlignViewportI;
import jalview.api.JalviewApp;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
protected JSFunctionExec jsFunctionExec;
+ private boolean noCalculation, noMenuBar, noStatus;
+
+ private boolean noAnnotation;
+
+ public boolean getStartCalculations()
+ {
+ return !noCalculation;
+ }
+
+ public boolean getAllowMenuBar()
+ {
+ return !noMenuBar;
+ }
+
+ public boolean getShowStatus()
+ {
+ return !noStatus;
+ }
+
+ public boolean getShowAnnotation()
+ {
+ return !noAnnotation;
+ }
+
public static AlignFrame getCurrentAlignFrame()
{
return getInstance().currentAlignFrame;
*/
public static void main(String[] args)
{
- // setLogging(); // BH - for event debugging in JavaScript
+ // Platform.startJavaLogging();
getInstance().doMain(args);
}
- /**
- * Allow an outside entity to initiate the second half of argument parsing
- * (only).
- *
- * @param args
- * @return null is good
- */
- @Override
- public Object parseArguments(String[] args)
- {
-
- try
- {
- ArgsParser aparser = new ArgsParser(args);
- return parseArguments(aparser, false);
- } catch (Throwable t)
- {
- return t;
- }
- }
-
- private static void logClass(String name)
- {
- // BH - for event debugging in JavaScript
- ConsoleHandler consoleHandler = new ConsoleHandler();
- consoleHandler.setLevel(Level.ALL);
- Logger logger = Logger.getLogger(name);
- logger.setLevel(Level.ALL);
- logger.addHandler(consoleHandler);
- }
@SuppressWarnings("unused")
- private static void setLogging()
- {
-
- /**
- * @j2sIgnore
- *
- */
- {
- System.out.println("not in js");
- }
-
- // BH - for event debugging in JavaScript (Java mode only)
- if (!Platform.isJS())
- /**
- * Java only
- *
- * @j2sIgnore
- */
- {
- Logger.getLogger("").setLevel(Level.ALL);
- logClass("java.awt.EventDispatchThread");
- logClass("java.awt.EventQueue");
- logClass("java.awt.Component");
- logClass("java.awt.focus.Component");
- logClass("java.awt.focus.DefaultKeyboardFocusManager");
- }
-
- }
-
/**
* @param args
*/
{
boolean isJS = Platform.isJS();
- if (!isJS)
+ if (isJS)
+ {
+ Platform.setAppClass(this);
+ }
+ else
{
System.setSecurityManager(null);
}
parseArguments(aparser, true);
}
+ /**
+ * Allow an outside entity to initiate the second half of argument parsing
+ * (only).
+ *
+ * @param args
+ * @return null is good
+ */
+ @Override
+ public Object parseArguments(String[] args)
+ {
+
+ try
+ {
+ ArgsParser aparser = new ArgsParser(args);
+ return parseArguments(aparser, false);
+ } catch (Throwable t)
+ {
+ return t;
+ }
+ }
+
+ /**
+ *
+ * @param aparser
+ * @param isStartup
+ * @return
+ */
private Object parseArguments(ArgsParser aparser, boolean isStartup)
{
boolean isJS = Platform.isJS();
String fileFormat = (isJavaAppletTag
? aparser.getAppletValue("format", null)
: null);
-
FileFormatI format = null;
DataSourceType protocol = null;
}
}
+ String data;
+
if (file != null)
{
+
if (!headless)
{
desktop.setProgressBar(
// TODO ?
}
+ if (aparser.contains(ArgsParser.NOMENUBAR))
+ {
+ noMenuBar = true;
+ System.out.println("CMD [nomenu] executed successfully!");
+ }
+
+ if (aparser.contains(ArgsParser.NOSTATUS))
+ {
+ noStatus = true;
+ System.out.println("CMD [nostatus] executed successfully!");
+ }
+
+ if (aparser.contains(ArgsParser.NOANNOTATION)
+ || aparser.contains(ArgsParser.NOANNOTATION2))
+ {
+ noAnnotation = true;
+ System.out.println("CMD no-annotation executed successfully!");
+ }
+ if (aparser.contains(ArgsParser.NOCALCULATION))
+ {
+ noCalculation = true;
+ System.out.println("CMD [nocalculation] executed successfully!");
+ }
+
AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
protocol, format);
if (af == null)
// TODO: file2 How to implement file2 for the applet spit screen?
- String data = aparser.getValue(ArgsParser.COLOUR, true);
+ data = aparser.getValue(ArgsParser.COLOUR, true);
if (data != null)
{
data.replaceAll("%20", " ");
System.out.println(
"CMD [-annotations " + data + "] executed successfully!");
}
+
+ if (aparser.contains(ArgsParser.SHOWOVERVIEW))
+ {
+ af.overviewMenuItem_actionPerformed(null);
+ System.out.println("CMD [showoverview] executed successfully!");
+ }
+
// set or clear the sortbytree flag.
if (aparser.contains(ArgsParser.SORTBYTREE))
{
System.out.println("CMD [-sortbytree] executed successfully!");
}
}
-
+
boolean doUpdateAnnotation = false;
-
- if (aparser.contains(ArgsParser.NOANNOTATION)
- || aparser.contains(ArgsParser.NOANNOTATION2))
+ /**
+ * we do this earlier in JalviewJS because of a complication with
+ * SHOWOVERVIEW
+ *
+ * For now, just fixing this in JalviewJS.
+ *
+ *
+ * @j2sIgnore
+ *
+ */
{
- af.getViewport().setShowAnnotation(false);
- if (!af.getViewport().isShowAnnotation())
+ if (aparser.contains(ArgsParser.NOANNOTATION)
+ || aparser.contains(ArgsParser.NOANNOTATION2))
{
- doUpdateAnnotation = true;
- System.out.println("CMD no-annotation executed successfully!");
+ af.getViewport().setShowAnnotation(false);
+ if (!af.getViewport().isShowAnnotation())
+ {
+ doUpdateAnnotation = true;
+ System.out
+ .println("CMD no-annotation executed successfully!");
+ }
}
}
if (aparser.contains(ArgsParser.NOSORTBYTREE))
}
+ @Override
+ public void showOverview()
+ {
+ currentAlignFrame.overviewMenuItem_actionPerformed(null);
+ }
+
+ public void notifyWorker(AlignCalcWorkerI worker, String status)
+ {
+ // System.out.println("Jalview worker " + worker.getClass().getSimpleName()
+ // + " " + status);
+ }
+
}
+