TESTNG
/jalviewApplet.jar
/benchmarking/lib
-*.class
\ No newline at end of file
+*.class
+/site/
+/srcjar/
--- /dev/null
+j2s.compiler.status=enable
+j2s.class.replacements=org.apache.log4j.->jalview.javascript.log4j.;
+
/** Default file is ~/.jalview_properties */
static String propertiesFile;
- private static boolean propsAreReadOnly = false;
+ private static boolean propsAreReadOnly = /** @j2sNative true || */
+ false;
public static void initLogger()
{
// LOAD THE AUTHORS FROM THE authors.props file
try
{
- String authorDetails = "jar:"
+ String authorDetails = /** @j2sNative "xxx" || */
+ "jar:"
.concat(Cache.class.getProtectionDomain().getCodeSource()
.getLocation().toString().concat("!/authors.props"));
// VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW
try
{
- String buildDetails = "jar:".concat(Cache.class.getProtectionDomain()
+ String buildDetails = /** @j2sNative "xxx" || */
+ "jar:".concat(Cache.class.getProtectionDomain()
.getCodeSource().getLocation().toString()
.concat("!/.build_properties"));
--- /dev/null
+package jalview.javascript.log4j;
+
+import jalview.javascript.log4j.spi.LoggingEvent;
+
+public abstract class Appender
+{
+ public abstract void append(LoggingEvent loggingEvent);
+
+}
--- /dev/null
+package jalview.javascript.log4j;
+
+import jalview.javascript.log4j.spi.LoggingEvent;
+
+public class ConsoleAppender
+{
+
+ private String name;
+
+ private Layout layout;
+
+
+ public ConsoleAppender()
+ {
+ }
+
+ public ConsoleAppender(Layout layout, String name)
+ {
+ this.layout = layout;
+ this.name = name;
+ }
+
+ public void setLayout(Layout layout)
+ {
+ this.layout = layout;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void append(LoggingEvent event)
+ {
+
+ System.out
+ .println(event.getLevel() + ": " + event.getRenderedMessage());
+
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript.log4j;
+
+import jalview.javascript.log4j.spi.LoggingEvent;
+import jalview.javascript.log4j.spi.OptionHandler;
+
+import org.apache.log4j.PatternLayout;
+import org.apache.log4j.TTCCLayout;
+
+public abstract class Layout implements OptionHandler
+{
+
+ // Note that the line.separator property can be looked up even by
+ // applets.
+ public final static String LINE_SEP = System
+ .getProperty("line.separator");
+
+ public final static int LINE_SEP_LEN = LINE_SEP.length();
+
+ /**
+ * Implement this method to create your own layout format.
+ */
+ abstract public String format(LoggingEvent event);
+
+ /**
+ * Returns the content type output by this layout. The base class returns
+ * "text/plain".
+ */
+ public String getContentType()
+ {
+ return "text/plain";
+ }
+
+ /**
+ * Returns the header for the layout format. The base class returns
+ * <code>null</code>.
+ */
+ public String getHeader()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the footer for the layout format. The base class returns
+ * <code>null</code>.
+ */
+ public String getFooter()
+ {
+ return null;
+ }
+
+ /**
+ * If the layout handles the throwable object contained within
+ * {@link LoggingEvent}, then the layout should return <code>false</code>.
+ * Otherwise, if the layout ignores throwable object, then the layout should
+ * return <code>true</code>. If ignoresThrowable is true, the appender is
+ * responsible for rendering the throwable.
+ * <p>
+ * The {@link SimpleLayout}, {@link TTCCLayout}, {@link PatternLayout} all
+ * return <code>true</code>. The {@link org.apache.log4j.xml.XMLLayout}
+ * returns <code>false</code>.
+ *
+ * @since 0.8.4
+ */
+ abstract public boolean ignoresThrowable();
+
+}
--- /dev/null
+package jalview.javascript.log4j;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+/**
+ * Defines the minimum set of levels recognized by the system, that is
+ * <code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>, <code>WARN</code>,
+ * <code>INFO</code>, <code>DEBUG</code> and <code>ALL</code>.
+ *
+ * <p>
+ * The <code>Level</code> class may be subclassed to define a larger level set.
+ * </p>
+ *
+ * @author Ceki Gülcü
+ */
+public class Level extends Priority implements Serializable
+{
+
+ private static final String ALL_NAME = "ALL";
+
+ private static final String TRACE_NAME = "TRACE";
+
+ private static final String DEBUG_NAME = "DEBUG";
+
+ private static final String INFO_NAME = "INFO";
+
+ private static final String WARN_NAME = "WARN";
+
+ private static final String ERROR_NAME = "ERROR";
+
+ private static final String FATAL_NAME = "FATAL";
+
+ private static final String OFF_NAME = "OFF";
+
+ /**
+ * TRACE level integer value.
+ *
+ * @since 1.2.12
+ */
+ public static final int TRACE_INT = 5000;
+
+ /**
+ * The <code>OFF</code> has the highest possible rank and is intended to turn
+ * off logging.
+ */
+ final static public Level OFF = new Level(OFF_INT, OFF_NAME, 0);
+
+ /**
+ * The <code>FATAL</code> level designates very severe error events that will
+ * presumably lead the application to abort.
+ */
+ final static public Level FATAL = new Level(FATAL_INT, FATAL_NAME, 0);
+
+ /**
+ * The <code>ERROR</code> level designates error events that might still allow
+ * the application to continue running.
+ */
+ final static public Level ERROR = new Level(ERROR_INT, ERROR_NAME, 3);
+
+ /**
+ * The <code>WARN</code> level designates potentially harmful situations.
+ */
+ final static public Level WARN = new Level(WARN_INT, WARN_NAME, 4);
+
+ /**
+ * The <code>INFO</code> level designates informational messages that
+ * highlight the progress of the application at coarse-grained level.
+ */
+ final static public Level INFO = new Level(INFO_INT, INFO_NAME, 6);
+
+ /**
+ * The <code>DEBUG</code> Level designates fine-grained informational events
+ * that are most useful to debug an application.
+ */
+ final static public Level DEBUG = new Level(DEBUG_INT, DEBUG_NAME, 7);
+
+ /**
+ * The <code>TRACE</code> Level designates finer-grained informational events
+ * than the <code>DEBUG</code level.
+ *
+ * @since 1.2.12
+ */
+ public static final Level TRACE = new Level(TRACE_INT, TRACE_NAME, 7);
+
+ /**
+ * The <code>ALL</code> has the lowest possible rank and is intended to turn
+ * on all logging.
+ */
+ final static public Level ALL = new Level(ALL_INT, ALL_NAME, 7);
+
+ /**
+ * Serialization version id.
+ */
+ static final long serialVersionUID = 3491141966387921974L;
+
+ /**
+ * Instantiate a Level object.
+ */
+ protected Level(int level, String levelStr, int syslogEquivalent)
+ {
+ super(level, levelStr, syslogEquivalent);
+ }
+
+ /**
+ * Convert the string passed as argument to a level. If the conversion fails,
+ * then this method returns {@link #DEBUG}.
+ */
+ public static Level toLevel(String sArg)
+ {
+ return toLevel(sArg, Level.DEBUG);
+ }
+
+ /**
+ * Convert an integer passed as argument to a level. If the conversion fails,
+ * then this method returns {@link #DEBUG}.
+ */
+ public static Level toLevel(int val)
+ {
+ return toLevel(val, Level.DEBUG);
+ }
+
+ /**
+ * Convert an integer passed as argument to a level. If the conversion fails,
+ * then this method returns the specified default.
+ */
+ public static Level toLevel(int val, Level defaultLevel)
+ {
+ switch (val)
+ {
+ case ALL_INT:
+ return ALL;
+ case DEBUG_INT:
+ return Level.DEBUG;
+ case INFO_INT:
+ return Level.INFO;
+ case WARN_INT:
+ return Level.WARN;
+ case ERROR_INT:
+ return Level.ERROR;
+ case FATAL_INT:
+ return Level.FATAL;
+ case OFF_INT:
+ return OFF;
+ case TRACE_INT:
+ return Level.TRACE;
+ default:
+ return defaultLevel;
+ }
+ }
+
+ /**
+ * Convert the string passed as argument to a level. If the conversion fails,
+ * then this method returns the value of <code>defaultLevel</code>.
+ */
+ public static Level toLevel(String sArg, Level defaultLevel)
+ {
+ if (sArg == null)
+ {
+ return defaultLevel;
+ }
+ String s = sArg.toUpperCase();
+
+ if (s.equals(ALL_NAME))
+ {
+ return Level.ALL;
+ }
+ if (s.equals(DEBUG_NAME))
+ {
+ return Level.DEBUG;
+ }
+ if (s.equals(INFO_NAME))
+ {
+ return Level.INFO;
+ }
+ if (s.equals(WARN_NAME))
+ {
+ return Level.WARN;
+ }
+ if (s.equals(ERROR_NAME))
+ {
+ return Level.ERROR;
+ }
+ if (s.equals(FATAL_NAME))
+ {
+ return Level.FATAL;
+ }
+ if (s.equals(OFF_NAME))
+ {
+ return Level.OFF;
+ }
+ if (s.equals(TRACE_NAME))
+ {
+ return Level.TRACE;
+ }
+ //
+ // For Turkish i problem, see bug 40937
+ //
+ if (s.equals("\u0130NFO"))
+ {
+ return Level.INFO;
+ }
+ return defaultLevel;
+ }
+
+ /**
+ * Custom deserialization of Level.
+ *
+ * @param s
+ * serialization stream.
+ * @throws IOException
+ * if IO exception.
+ * @throws ClassNotFoundException
+ * if class not found.
+ */
+ private void readObject(final ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ level = s.readInt();
+ syslogEquivalent = s.readInt();
+ levelStr = s.readUTF();
+ if (levelStr == null)
+ {
+ levelStr = "";
+ }
+ }
+
+ /**
+ * Serialize level.
+ *
+ * @param s
+ * serialization stream.
+ * @throws IOException
+ * if exception during serialization.
+ */
+ private void writeObject(final ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ s.writeInt(level);
+ s.writeInt(syslogEquivalent);
+ s.writeUTF(levelStr);
+ }
+
+ /**
+ * Resolved deserialized level to one of the stock instances. May be overriden
+ * in classes derived from Level.
+ *
+ * @return resolved object.
+ * @throws ObjectStreamException
+ * if exception during resolution.
+ */
+ private Object readResolve() throws ObjectStreamException
+ {
+ //
+ // if the deserizalized object is exactly an instance of Level
+ //
+ if (getClass() == Level.class)
+ {
+ return toLevel(level);
+ }
+ //
+ // extension of Level can't substitute stock item
+ //
+ return this;
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript.log4j;
+
+import jalview.javascript.log4j.spi.LoggingEvent;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+public class Logger
+{
+
+ private static Map<String, Logger> registry;
+
+ private String name;
+
+ private Level level;
+
+ private boolean enabled = true;
+
+ private boolean isEnabled;
+
+ private Appender appender;
+
+ private Logger(String name)
+ {
+ this.name = name;
+ }
+
+ public static Logger getLogger(String name)
+ {
+ if (registry == null)
+ {
+ registry = new Hashtable<>();
+ getLogger("root");
+ }
+ Logger logger = registry.get(name);
+ if (logger == null)
+ {
+ registry.put(name, logger = new Logger(name));
+ logger.setLevel(Level.INFO);
+ }
+ return logger;
+ }
+
+ public static Logger getRootLogger()
+ {
+ return getLogger("root");
+ }
+
+ public void setLevel(Level l)
+ {
+ this.level = l;
+ }
+
+ public void addAppender(Appender appender)
+ {
+ this.appender = appender;
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return isEnabled;
+ }
+
+ public void debug(Object o)
+ {
+ debug(o, null);
+ }
+
+ public void debug(Object o, Throwable e)
+ {
+ switch (level.level)
+ {
+ case Priority.FATAL_INT:
+ case Priority.ERROR_INT:
+ case Priority.WARN_INT:
+ case Priority.INFO_INT:
+ case Priority.DEBUG_INT:
+ log(o, e);
+ break;
+ }
+ }
+
+ public void info(Object o)
+ {
+ info(o, null);
+ }
+
+ public void info(Object o, Throwable e)
+ {
+ switch (level.level)
+ {
+ case Priority.FATAL_INT:
+ case Priority.ERROR_INT:
+ case Priority.WARN_INT:
+ case Priority.INFO_INT:
+ log(o, e);
+ break;
+ }
+
+ }
+
+ public void warn(Object o)
+ {
+ warn(o, null);
+ }
+
+ public void warn(Object o, Throwable e)
+ {
+ switch (level.level)
+ {
+ case Priority.FATAL_INT:
+ case Priority.ERROR_INT:
+ case Priority.WARN_INT:
+ log(o, e);
+ break;
+ }
+
+ }
+
+ public void error(Object o)
+ {
+ error(o, null);
+ }
+
+ public void error(Object o, Throwable e)
+ {
+ switch (level.level)
+ {
+ case Priority.FATAL_INT:
+ case Priority.ERROR_INT:
+ log(o, e);
+ break;
+ }
+
+ }
+
+ private void log(Object s, Throwable e)
+ {
+ switch (level.level)
+ {
+ case Priority.ERROR_INT:
+ if (appender == null)
+ {
+ System.err.println(s);
+ return;
+ }
+ break;
+ case Priority.WARN_INT:
+ if (appender == null)
+ {
+ System.err.println(s);
+ return;
+ }
+ break;
+ case Priority.INFO_INT:
+ if (appender == null)
+ {
+ System.out.println(s);
+ return;
+ }
+ break;
+ case Priority.DEBUG_INT:
+ if (appender == null)
+ {
+ System.out.println(s);
+ return;
+ }
+ break;
+ }
+ e.printStackTrace();
+ appender.append(new LoggingEvent(this, s.toString(), level));
+ }
+
+}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Contributors: Kitching Simon <Simon.Kitching@orange.ch>
+
+package jalview.javascript.log4j;
+
+/**
+ <font color="#AA4444">Refrain from using this class directly, use
+ the {@link Level} class instead</font>.
+
+ @author Ceki Gülcü */
+public class Priority {
+
+ transient int level;
+ transient String levelStr;
+ transient int syslogEquivalent;
+
+ public final static int OFF_INT = Integer.MAX_VALUE;
+ public final static int FATAL_INT = 50000;
+ public final static int ERROR_INT = 40000;
+ public final static int WARN_INT = 30000;
+ public final static int INFO_INT = 20000;
+ public final static int DEBUG_INT = 10000;
+ //public final static int FINE_INT = DEBUG_INT;
+ public final static int ALL_INT = Integer.MIN_VALUE;
+
+ // too twisted for J2S -- Level class initializer initializes Priority, which
+ // creates a
+ // new Level before Priority is indicated to be a superclass of Level.
+ /**
+ * @deprecated Use {@link Level#FATAL} instead.
+ */
+ @Deprecated
+ final static public Priority FATAL = null;// new Level(FATAL_INT, "FATAL", 0);
+
+ /**
+ * @deprecated Use {@link Level#ERROR} instead.
+ */
+ @Deprecated
+ final static public Priority ERROR = null;// new Level(ERROR_INT, "ERROR", 3);
+
+ /**
+ * @deprecated Use {@link Level#WARN} instead.
+ */
+ @Deprecated
+ final static public Priority WARN = null;// new Level(WARN_INT, "WARN", 4);
+
+ /**
+ * @deprecated Use {@link Level#INFO} instead.
+ */
+ @Deprecated
+ final static public Priority INFO = null;// new Level(INFO_INT, "INFO", 6);
+
+ /**
+ * @deprecated Use {@link Level#DEBUG} instead.
+ */
+ @Deprecated
+ final static public Priority DEBUG = null;// new Level(DEBUG_INT, "DEBUG", 7);
+
+ /**
+ * Default constructor for deserialization.
+ */
+ protected Priority() {
+ level = DEBUG_INT;
+ levelStr = "DEBUG";
+ syslogEquivalent = 7;
+ }
+
+ /**
+ Instantiate a level object.
+ */
+ protected
+ Priority(int level, String levelStr, int syslogEquivalent) {
+ this.level = level;
+ this.levelStr = levelStr;
+ this.syslogEquivalent = syslogEquivalent;
+ }
+
+ /**
+ Two priorities are equal if their level fields are equal.
+ @since 1.2
+ */
+ @Override
+ public
+ boolean equals(Object o) {
+ if(o instanceof Priority) {
+ Priority r = (Priority) o;
+ return (this.level == r.level);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ Return the syslog equivalent of this priority as an integer.
+ */
+ public
+ final
+ int getSyslogEquivalent() {
+ return syslogEquivalent;
+ }
+
+
+
+ /**
+ Returns <code>true</code> if this level has a higher or equal
+ level than the level passed as argument, <code>false</code>
+ otherwise.
+
+ <p>You should think twice before overriding the default
+ implementation of <code>isGreaterOrEqual</code> method.
+
+ */
+ public
+ boolean isGreaterOrEqual(Priority r) {
+ return level >= r.level;
+ }
+
+ // /**
+ // Return all possible priorities as an array of Level objects in
+ // descending order.
+ //
+ // @deprecated This method will be removed with no replacement.
+ // */
+ // public
+ // static
+ // Priority[] getAllPossiblePriorities() {
+ // return new Priority[] {Priority.FATAL, Priority.ERROR, Level.WARN,
+ // Priority.INFO, Priority.DEBUG};
+ // }
+
+
+ /**
+ Returns the string representation of this priority.
+ */
+ @Override
+ final
+ public
+ String toString() {
+ return levelStr;
+ }
+
+ /**
+ Returns the integer representation of this level.
+ */
+ public
+ final
+ int toInt() {
+ return level;
+ }
+
+ // /**
+ // * @deprecated Please use the {@link Level#toLevel(String)} method instead.
+ // */
+ // public
+ // static
+ // Priority toPriority(String sArg) {
+ // return Level.toLevel(sArg);
+ // }
+
+ // /**
+ // * @deprecated Please use the {@link Level#toLevel(int)} method instead.
+ // */
+ // public
+ // static
+ // Priority toPriority(int val) {
+ // return toPriority(val, Priority.DEBUG);
+ // }
+
+ // /**
+ // * @deprecated Please use the {@link Level#toLevel(int, Level)} method
+ // instead.
+ // */
+ // public
+ // static
+ // Priority toPriority(int val, Priority defaultPriority) {
+ // return Level.toLevel(val, (Level) defaultPriority);
+ // }
+ //
+ // /**
+ // * @deprecated Please use the {@link Level#toLevel(String, Level)} method
+ // instead.
+ // */
+ // public
+ // static
+ // Priority toPriority(String sArg, Priority defaultPriority) {
+ // return Level.toLevel(sArg, (Level) defaultPriority);
+ // }
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript.log4j;
+
+import jalview.javascript.log4j.spi.LoggingEvent;
+
+public class SimpleLayout extends Layout
+{
+
+ StringBuffer sbuf = new StringBuffer(128);
+
+ @Override
+ public void activateOptions()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String format(LoggingEvent event)
+ {
+
+ sbuf.setLength(0);
+ sbuf.append(event.getLevel().toString());
+ sbuf.append(" - ");
+ sbuf.append(event.getRenderedMessage());
+ sbuf.append(LINE_SEP);
+ return sbuf.toString();
+ }
+ @Override
+ public boolean ignoresThrowable()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package jalview.javascript.log4j;
+
+public abstract class WriterAppender extends Appender
+{
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript.log4j.spi;
+
+import jalview.javascript.log4j.Logger;
+
+public class LoggingEvent
+{
+
+ private Object level;
+
+ private String msg;
+
+ private Logger logger;
+
+ public LoggingEvent(Logger logger, String level, Object message)
+ {
+ this.logger = logger;
+ this.level = level;
+ this.msg = message.toString();
+
+ }
+
+ public Object getLevel()
+ {
+ return level;
+ }
+
+ public String getRenderedMessage()
+ {
+ return msg;
+ }
+}
--- /dev/null
+package jalview.javascript.log4j.spi;
+
+public interface OptionHandler
+{
+
+ void activateOptions();
+
+}
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ResourceBundle.Control;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+//import java.util.logging.Level;
+//import java.util.logging.Logger;
+
+import org.apache.log4j.Logger;
/**
*
public class MessageManager
{
+ // BH 2018 switched to org.apache.llog4j.Logger
+
private static ResourceBundle rb;
private static Logger log = Logger
log.info("Getting messages for lang: " + loc);
Control control = Control.getControl(Control.FORMAT_PROPERTIES);
rb = ResourceBundle.getBundle("lang.Messages", loc, control);
- if (log.isLoggable(Level.FINEST))
- {
- // this might take a while, so we only do it if it will be shown
- log.finest("Language keys: " + rb.keySet());
- }
+ // if (log.isLoggable(Level.FINEST))
+ // {
+ // // this might take a while, so we only do it if it will be shown
+ // log.info("Language keys: " + rb.keySet()); // was FINEST
+ // }
} catch (Exception q)
{
- log.warning("Exception when initting Locale for i18n messages\n"
+ log.warn("Exception when initting Locale for i18n messages\n"
+ q.getMessage());
q.printStackTrace();
} catch (Error v)
{
- log.warning("Error when initting Locale for i18n messages\n"
+ log.warn("Error when initting Locale for i18n messages\n"
+ v.getMessage());
v.printStackTrace();
}
value = rb.getString(key);
} catch (Exception e)
{
- log.warning("I18N missing: " + loc + "\t" + key);
+ log.warn("I18N missing: " + loc + "\t" + key);
}
return value;
}
name = rb.getString(smkey);
} catch (Exception x)
{
- log.finest("I18N missing key with root " + keyroot + ": " + loc + "\t"
- + smkey);
+ log.info("I18N missing key with root " + keyroot + ": " + loc + "\t"
+ + smkey); // was FINEST
}
return name;
}
*/
public class Platform
{
+
private static Boolean isAMac = null, isWindows = null;
private static Boolean isHeadless = null;
/**
* sorry folks - Macs really are different
*
+ * BH: disabled for SwingJS -- will need to check key-press issues
+ *
* @return true if we do things in a special way.
*/
public static boolean isAMac()
{
if (isAMac == null)
{
- isAMac = System.getProperty("os.name").indexOf("Mac") > -1;
+ isAMac = /** @j2sNative false && */
+ System.getProperty("os.name").indexOf("Mac") > -1;
}
return isAMac.booleanValue();
{
if (isWindows == null)
{
- isWindows = System.getProperty("os.name").indexOf("Win") > -1;
+ isWindows = /** @j2sNative false && */
+ System.getProperty("os.name").indexOf("Win") > -1;
}
return isWindows.booleanValue();
}
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<title>SwingJS test _NAME_</title><meta charset="utf-8" />
+<script src="swingjs/swingjs2.js"></script>
+<script>
+if (!self.SwingJS)alert('swingjs2.js was not found. It needs to be in swingjs folder in the same directory as ' + document.location.href)
+Info = {
+ code: _CODE_,
+ main: _MAIN_,
+ width: 850,
+ height: 550,
+ readyFunction: null,
+ serverURL: 'https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php',
+ j2sPath: 'swingjs/j2s',
+ console:'sysoutdiv',
+ allowjavascript: true
+}
+</script>
+</head>
+<body>
+<script>
+SwingJS.getApplet('testApplet', Info)
+getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
+</script>
+<div style="position:absolute;left:900px;top:30px;width:600px;height:300px;">
+<div id="sysoutdiv" style="border:1px solid green;width:100%;height:95%;overflow:auto"></div>
+This is System.out. <a href="javascript:testApplet._clearConsole()">clear it</a> <br>Add ?j2snocore to URL to see full class list; ?j2sdebug to use uncompressed j2s/core files <br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
+</div>
+</body>
+</html>