From: hansonr Date: Wed, 20 Jun 2018 09:59:05 +0000 (+0100) Subject: Bob first commit JAL-3032 X-Git-Tag: Release_2_11_4_0~45^2~18^2~684 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=507f8f9e119ce89ba04aea3b3d814cbe58f3d686;p=jalview.git Bob first commit JAL-3032 - jalview/bin/cache.java propsAreReadable true for JS authordetails, builddetails "xxx" for JS for now - org.apache.log4j -> jalview.javascript.log4j (minimal) - jalview/util/MessageManager switch to org.apache.log4j JavaScript Status: jalview.io.FileFormatException: Failed to read data from source: CANNOT ACCESS DATA AT URL 'http://www.jalview.org/examples/uniref50.fa' ((intermediate value).toBIS$O is not a function --- 507f8f9e119ce89ba04aea3b3d814cbe58f3d686 diff --cc .gitignore index 2a55560,2a55560..012a802 --- a/.gitignore +++ b/.gitignore @@@ -12,4 -12,4 +12,6 @@@ TESTNG /jalviewApplet.jar /benchmarking/lib --*.class ++*.class ++/site/ ++/srcjar/ diff --cc .j2s index 0000000,0000000..10e5647 new file mode 100644 --- /dev/null +++ b/.j2s @@@ -1,0 -1,0 +1,3 @@@ ++j2s.compiler.status=enable ++j2s.class.replacements=org.apache.log4j.->jalview.javascript.log4j.; ++ diff --cc SwingJS-site.zip index 0000000,0000000..4d17c4c new file mode 100644 Binary files differ diff --cc src/jalview/bin/Cache.java index dcd6546,dcd6546..d374682 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@@ -288,7 -288,7 +288,8 @@@ public class Cach /** Default file is ~/.jalview_properties */ static String propertiesFile; -- private static boolean propsAreReadOnly = false; ++ private static boolean propsAreReadOnly = /** @j2sNative true || */ ++ false; public static void initLogger() { @@@ -399,7 -399,7 +400,8 @@@ // 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")); @@@ -421,7 -421,7 +423,8 @@@ // 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")); diff --cc src/jalview/javascript/log4j/Appender.java index 0000000,0000000..1b2b676 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/Appender.java @@@ -1,0 -1,0 +1,9 @@@ ++package jalview.javascript.log4j; ++ ++import jalview.javascript.log4j.spi.LoggingEvent; ++ ++public abstract class Appender ++{ ++ public abstract void append(LoggingEvent loggingEvent); ++ ++} diff --cc src/jalview/javascript/log4j/ConsoleAppender.java index 0000000,0000000..f1aca45 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/ConsoleAppender.java @@@ -1,0 -1,0 +1,41 @@@ ++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()); ++ ++ } ++ ++} diff --cc src/jalview/javascript/log4j/Layout.java index 0000000,0000000..ea79e1b new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/Layout.java @@@ -1,0 -1,0 +1,86 @@@ ++/* ++ * 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 . ++ * 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 ++ * null. ++ */ ++ public String getHeader() ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the footer for the layout format. The base class returns ++ * null. ++ */ ++ public String getFooter() ++ { ++ return null; ++ } ++ ++ /** ++ * If the layout handles the throwable object contained within ++ * {@link LoggingEvent}, then the layout should return false. ++ * Otherwise, if the layout ignores throwable object, then the layout should ++ * return true. If ignoresThrowable is true, the appender is ++ * responsible for rendering the throwable. ++ *

++ * The {@link SimpleLayout}, {@link TTCCLayout}, {@link PatternLayout} all ++ * return true. The {@link org.apache.log4j.xml.XMLLayout} ++ * returns false. ++ * ++ * @since 0.8.4 ++ */ ++ abstract public boolean ignoresThrowable(); ++ ++} diff --cc src/jalview/javascript/log4j/Level.java index 0000000,0000000..5691a47 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/Level.java @@@ -1,0 -1,0 +1,271 @@@ ++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 ++ * OFF, FATAL, ERROR, WARN, ++ * INFO, DEBUG and ALL. ++ * ++ *

++ * The Level class may be subclassed to define a larger level set. ++ *

++ * ++ * @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 OFF 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 FATAL 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 ERROR 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 WARN level designates potentially harmful situations. ++ */ ++ final static public Level WARN = new Level(WARN_INT, WARN_NAME, 4); ++ ++ /** ++ * The INFO 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 DEBUG 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 TRACE Level designates finer-grained informational events ++ * than the DEBUGALL 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 defaultLevel. ++ */ ++ 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; ++ } ++ ++} diff --cc src/jalview/javascript/log4j/Logger.java index 0000000,0000000..bb7eb34 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/Logger.java @@@ -1,0 -1,0 +1,194 @@@ ++/* ++ * 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 . ++ * 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 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)); ++ } ++ ++} diff --cc src/jalview/javascript/log4j/Priority.java index 0000000,0000000..2ace1eb new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/Priority.java @@@ -1,0 -1,0 +1,204 @@@ ++/* ++ * 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 ++ ++package jalview.javascript.log4j; ++ ++/** ++ Refrain from using this class directly, use ++ the {@link Level} class instead. ++ ++ @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 true if this level has a higher or equal ++ level than the level passed as argument, false ++ otherwise. ++ ++

You should think twice before overriding the default ++ implementation of isGreaterOrEqual 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); ++ // } ++} diff --cc src/jalview/javascript/log4j/SimpleLayout.java index 0000000,0000000..9e5cbba new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/SimpleLayout.java @@@ -1,0 -1,0 +1,55 @@@ ++/* ++ * 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 . ++ * 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; ++ } ++ ++} diff --cc src/jalview/javascript/log4j/WriterAppender.java index 0000000,0000000..1a015f2 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/WriterAppender.java @@@ -1,0 -1,0 +1,23 @@@ ++/* ++ * 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 ++{ ++ ++} diff --cc src/jalview/javascript/log4j/spi/LoggingEvent.java index 0000000,0000000..669ae52 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/spi/LoggingEvent.java @@@ -1,0 -1,0 +1,51 @@@ ++/* ++ * 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 . ++ * 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; ++ } ++} diff --cc src/jalview/javascript/log4j/spi/OptionHandler.java index 0000000,0000000..9cd0f01 new file mode 100644 --- /dev/null +++ b/src/jalview/javascript/log4j/spi/OptionHandler.java @@@ -1,0 -1,0 +1,8 @@@ ++package jalview.javascript.log4j.spi; ++ ++public interface OptionHandler ++{ ++ ++ void activateOptions(); ++ ++} diff --cc src/jalview/util/MessageManager.java index 71fc47a,66d8f9f..1cfe0c6 --- a/src/jalview/util/MessageManager.java +++ b/src/jalview/util/MessageManager.java @@@ -23,10 -23,9 +23,11 @@@ package jalview.util import java.text.MessageFormat; 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; /** * @@@ -56,15 -53,16 +57,16 @@@ public class MessageManage // Locale.setDefault(loc); /* Getting messages for GV */ log.info("Getting messages for lang: " + loc); - rb = ResourceBundle.getBundle("lang.Messages", 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) diff --cc src/jalview/util/Platform.java index 2c74609,2c74609..6a5f133 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@@ -30,6 -30,6 +30,7 @@@ import java.awt.event.MouseEvent */ public class Platform { ++ private static Boolean isAMac = null, isWindows = null; private static Boolean isHeadless = null; @@@ -37,13 -37,13 +38,16 @@@ /** * 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(); @@@ -59,7 -59,7 +63,8 @@@ { if (isWindows == null) { -- isWindows = System.getProperty("os.name").indexOf("Win") > -1; ++ isWindows = /** @j2sNative false && */ ++ System.getProperty("os.name").indexOf("Win") > -1; } return isWindows.booleanValue(); } diff --cc template.html index 0000000,0000000..5005060 new file mode 100644 --- /dev/null +++ b/template.html @@@ -1,0 -1,0 +1,31 @@@ ++ ++ ++ ++SwingJS test _NAME_ ++ ++ ++ ++ ++ ++

++
++This is System.out. clear it
Add ?j2snocore to URL to see full class list; ?j2sdebug to use uncompressed j2s/core files
get _j2sClassList.txt ++
++ ++