From: gmungoc Date: Fri, 10 Jul 2015 05:12:47 +0000 (+0100) Subject: JAL-1807 explicit imports (jalview.bin) X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4eec97fe80f83bc1e0ee44da3981a8c014e1ac5d;p=jalview.git JAL-1807 explicit imports (jalview.bin) --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 10aba00..4ed6e1a 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -20,6 +20,12 @@ */ package jalview.bin; +import jalview.gui.UserDefinedColours; +import jalview.io.PIRFile; +import jalview.jbgui.GDesktop; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; +import jalview.util.Format; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.dbsources.das.datamodel.DasSourceRegistry; @@ -253,7 +259,7 @@ public class Cache // log output Logger laxis = Logger.getLogger("org.apache.axis"); Logger lcastor = Logger.getLogger("org.exolab.castor"); - jalview.bin.Cache.log = Logger.getLogger("jalview.bin.Jalview"); + Cache.log = Logger.getLogger("jalview.bin.Jalview"); laxis.setLevel(Level.toLevel(Cache.getDefault("logs.Axis.Level", Level.INFO.toString()))); @@ -265,13 +271,13 @@ public class Cache // lcastor = Logger.getLogger("org.exolab.castor.xml.Marshaller"); // lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level", // Level.INFO.toString()))); - jalview.bin.Cache.log.setLevel(Level.toLevel(Cache.getDefault( + Cache.log.setLevel(Level.toLevel(Cache.getDefault( "logs.Jalview.level", Level.INFO.toString()))); // laxis.addAppender(ap); // lcastor.addAppender(ap); - // jalview.bin.Cache.log.addAppender(ap); + // Cache.log.addAppender(ap); // Tell the user that debug is enabled - jalview.bin.Cache.log.debug("Jalview Debugging Output Follows."); + Cache.log.debug("Jalview Debugging Output Follows."); } catch (Exception ex) { System.err.println("Problems initializing the log4j system\n"); @@ -470,9 +476,9 @@ public class Cache setProperty("VERSION", codeVersion); // LOAD USERDEFINED COLOURS - jalview.gui.UserDefinedColours + UserDefinedColours .initUserColourSchemes(getProperty("USER_DEFINED_COLOURS")); - jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER", + PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER", false); } @@ -608,10 +614,10 @@ public class Cache { try { - if (jalview.jbgui.GDesktop.class.getClassLoader().loadClass( + if (GDesktop.class.getClassLoader().loadClass( "uk.ac.vamsas.client.VorbaId") != null) { - jalview.bin.Cache.log + Cache.log .debug("Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)"); vamsasJarsArePresent = 1; Logger lvclient = Logger.getLogger("uk.ac.vamsas"); @@ -625,7 +631,7 @@ public class Cache } catch (Exception e) { vamsasJarsArePresent = 0; - jalview.bin.Cache.log.debug("Vamsas Classes are not present"); + Cache.log.debug("Vamsas Classes are not present"); } } return (vamsasJarsArePresent > 0); @@ -650,7 +656,7 @@ public class Cache if (Cache.class.getClassLoader().loadClass( "groovy.lang.GroovyObject") != null) { - jalview.bin.Cache.log + Cache.log .debug("Found Groovy (groovy.lang.GroovyObject can be loaded)"); groovyJarsArePresent = 1; Logger lgclient = Logger.getLogger("groovy"); @@ -664,11 +670,11 @@ public class Cache } catch (Error e) { groovyJarsArePresent = 0; - jalview.bin.Cache.log.debug("Groovy Classes are not present", e); + Cache.log.debug("Groovy Classes are not present", e); } catch (Exception e) { groovyJarsArePresent = 0; - jalview.bin.Cache.log.debug("Groovy Classes are not present"); + Cache.log.debug("Groovy Classes are not present"); } } return (groovyJarsArePresent > 0); @@ -723,9 +729,9 @@ public class Cache new Object[] { "Jalview Desktop", - (vrs = jalview.bin.Cache.getProperty("VERSION") + (vrs = Cache.getProperty("VERSION") + "_" - + jalview.bin.Cache.getDefault("BUILD_DATE", + + Cache.getDefault("BUILD_DATE", "unknown")), "UA-9060947-1" }); jgoogleanalyticstracker.getMethod("trackAsynchronously", new Class[] @@ -811,13 +817,12 @@ public class Cache { return defcolour; } - Color col = jalview.schemes.ColourSchemeProperty - .getAWTColorFromName(colprop); + Color col = ColourSchemeProperty.getAWTColorFromName(colprop); if (col == null) { try { - col = new jalview.schemes.UserColourScheme(colprop).findColour('A'); + col = new UserColourScheme(colprop).findColour('A'); } catch (Exception ex) { log.warn("Couldn't parse '" + colprop + "' as a colour for " @@ -836,7 +841,7 @@ public class Cache */ public static void setColourProperty(String property, Color colour) { - setProperty(property, jalview.util.Format.getHexString(colour)); + setProperty(property, Format.getHexString(colour)); } public static final DateFormat date_format = SimpleDateFormat diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index f6d0099..8669a96 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -22,8 +22,17 @@ package jalview.bin; import jalview.gui.AlignFrame; import jalview.gui.Desktop; +import jalview.gui.PromptUserConfig; +import jalview.io.AppletFormatAdapter; import jalview.io.BioJsHTMLOutput; +import jalview.io.FileLoader; +import jalview.io.FormatAdapter; import jalview.io.HtmlSvgOutput; +import jalview.io.IdentifyFile; +import jalview.io.NewickFile; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -231,7 +240,7 @@ public class Jalview } String file = null, protocol = null, format = null, data = null; - jalview.io.FileLoader fileLoader = new jalview.io.FileLoader(!headless); + FileLoader fileLoader = new FileLoader(!headless); Vector getFeatures = null; // vector of das source nicknames to fetch // features from // loading is done. @@ -262,13 +271,13 @@ public class Jalview { try { - String viprotocol = jalview.io.AppletFormatAdapter + String viprotocol = AppletFormatAdapter .checkProtocol(vamsasImport); - if (viprotocol == jalview.io.FormatAdapter.FILE) + if (viprotocol == FormatAdapter.FILE) { inSession = desktop.vamsasImport(new File(vamsasImport)); } - else if (viprotocol == jalview.io.FormatAdapter.URL) + else if (viprotocol == FormatAdapter.URL) { inSession = desktop.vamsasImport(new URL(vamsasImport)); } @@ -354,9 +363,9 @@ public class Jalview } } - protocol = jalview.io.AppletFormatAdapter.checkProtocol(file); + protocol = AppletFormatAdapter.checkProtocol(file); - format = new jalview.io.IdentifyFile().Identify(file, protocol); + format = new IdentifyFile().Identify(file, protocol); AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format); @@ -372,12 +381,12 @@ public class Jalview { data.replaceAll("%20", " "); - jalview.schemes.ColourSchemeI cs = jalview.schemes.ColourSchemeProperty + ColourSchemeI cs = ColourSchemeProperty .getColour(af.getViewport().getAlignment(), data); if (cs == null) { - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme( + UserColourScheme ucs = new UserColourScheme( "white"); ucs.parseAppletParameter(data); cs = ucs; @@ -392,14 +401,14 @@ public class Jalview if (data != null) { af.parseFeaturesFile(data, - jalview.io.AppletFormatAdapter.checkProtocol(data)); + AppletFormatAdapter.checkProtocol(data)); System.out.println("Added " + data); } data = aparser.getValue("features", true); if (data != null) { af.parseFeaturesFile(data, - jalview.io.AppletFormatAdapter.checkProtocol(data)); + AppletFormatAdapter.checkProtocol(data)); System.out.println("Added " + data); } @@ -425,11 +434,11 @@ public class Jalview data = aparser.getValue("tree", true); if (data != null) { - jalview.io.NewickFile fin = null; + NewickFile fin = null; try { - fin = new jalview.io.NewickFile(data, - jalview.io.AppletFormatAdapter.checkProtocol(data)); + fin = new NewickFile(data, + AppletFormatAdapter.checkProtocol(data)); if (fin != null) { af.getViewport().setCurrentTree( @@ -470,7 +479,7 @@ public class Jalview { // Execute the groovy script after we've done all the rendering stuff // and before any images or figures are generated. - if (jalview.bin.Cache.groovyJarsPresent()) + if (Cache.groovyJarsPresent()) { System.out.println("Executing script " + groovyscript); executeGroovyScript(groovyscript, new Object[] @@ -553,11 +562,11 @@ public class Jalview // //////////////////// if (!headless && file == null && vamsasImport == null - && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) + && Cache.getDefault("SHOW_STARTUP_FILE", true)) { - file = jalview.bin.Cache.getDefault( + file = Cache.getDefault( "STARTUP_FILE", - jalview.bin.Cache.getDefault("www.jalview.org", + Cache.getDefault("www.jalview.org", "http://www.jalview.org") + "/examples/exampleFile_2_7.jar"); if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar")) @@ -565,7 +574,7 @@ public class Jalview // hardwire upgrade of the startup file file.replace("_2_3.jar", "_2_7.jar"); // and remove the stale setting - jalview.bin.Cache.removeProperty("STARTUP_FILE"); + Cache.removeProperty("STARTUP_FILE"); } protocol = "File"; @@ -581,7 +590,7 @@ public class Jalview } else { - format = new jalview.io.IdentifyFile().Identify(file, protocol); + format = new IdentifyFile().Identify(file, protocol); } startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol, @@ -603,7 +612,7 @@ public class Jalview // Once all other stuff is done, execute any groovy scripts (in order) if (groovyscript != null) { - if (jalview.bin.Cache.groovyJarsPresent()) + if (Cache.groovyJarsPresent()) { System.out.println("Executing script " + groovyscript); executeGroovyScript(groovyscript, new Object[] @@ -673,7 +682,7 @@ public class Jalview /** * start a User Config prompt asking if we can log usage statistics. */ - jalview.gui.PromptUserConfig prompter = new jalview.gui.PromptUserConfig( + PromptUserConfig prompter = new PromptUserConfig( desktop.desktop, "USAGESTATS", "Jalview Usage Statistics", diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index ae5c63f..5d1f0b0 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -20,6 +20,7 @@ */ package jalview.bin; +import jalview.analysis.SequenceIdMatcher; import jalview.api.StructureSelectionManagerProvider; import jalview.appletgui.AlignFrame; import jalview.appletgui.AlignViewport; @@ -44,6 +45,11 @@ import jalview.io.NewickFile; import jalview.javascript.JSFunctionExec; import jalview.javascript.JalviewLiteJsApi; import jalview.javascript.JsCallBack; +import jalview.javascript.JsSelectionSender; +import jalview.javascript.MouseOverListener; +import jalview.javascript.MouseOverStructureListener; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; import jalview.structure.SelectionListener; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; @@ -178,7 +184,7 @@ public class JalviewLite extends Applet implements final String position, final String alignedPosition) { // TODO: could try to highlight in all alignments if alf==null - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + SequenceIdMatcher matcher = new SequenceIdMatcher( alf.viewport.getAlignment().getSequencesArray()); final SequenceI sq = matcher.findIdMatch(sequenceId); if (sq != null) @@ -284,7 +290,7 @@ public class JalviewLite extends Applet implements final SequenceGroup sel = new SequenceGroup(); final ColumnSelection csel = new ColumnSelection(); AlignmentI al = alf.viewport.getAlignment(); - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + SequenceIdMatcher matcher = new SequenceIdMatcher( alf.viewport.getAlignment().getSequencesArray()); int start = 0, end = al.getWidth(), alw = al.getWidth(); boolean seqsfound = true; @@ -598,7 +604,7 @@ public class JalviewLite extends Applet implements SequenceI[] sqs = null; if (ids != null && ids.length > 0) { - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + SequenceIdMatcher matcher = new SequenceIdMatcher( alf.viewport.getAlignment().getSequencesArray()); int s = 0; sqs = new SequenceI[ids.length]; @@ -876,7 +882,7 @@ public class JalviewLite extends Applet implements setMouseoverListener(currentAlignFrame, listener); } - private Vector javascriptListeners = new Vector(); + private Vector javascriptListeners = new Vector(); /* * (non-Javadoc) @@ -897,7 +903,7 @@ public class JalviewLite extends Applet implements return; } } - jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener( + MouseOverListener mol = new MouseOverListener( this, af, listener); javascriptListeners.addElement(mol); StructureSelectionManager.getStructureSelectionManager(this) @@ -941,8 +947,7 @@ public class JalviewLite extends Applet implements return; } } - jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender( - this, af, listener); + JsSelectionSender mol = new JsSelectionSender(this, af, listener); javascriptListeners.addElement(mol); StructureSelectionManager.getStructureSelectionManager(this) .addSelectionListener(mol); @@ -974,7 +979,7 @@ public class JalviewLite extends Applet implements return; } } - jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener( + MouseOverStructureListener mol = new MouseOverStructureListener( this, listener, separatorListToArray(modelSet)); javascriptListeners.addElement(mol); StructureSelectionManager.getStructureSelectionManager(this) @@ -1071,8 +1076,7 @@ public class JalviewLite extends Applet implements { while (javascriptListeners.size() > 0) { - jalview.javascript.JSFunctionExec mol = javascriptListeners - .elementAt(0); + JSFunctionExec mol = javascriptListeners.elementAt(0); javascriptListeners.removeElement(mol); if (mol instanceof SelectionListener) { @@ -1098,7 +1102,7 @@ public class JalviewLite extends Applet implements StructureSelectionManager.release(this); } - private jalview.javascript.JSFunctionExec jsFunctionExec; + private JSFunctionExec jsFunctionExec; /* * (non-Javadoc) @@ -1996,8 +2000,8 @@ public class JalviewLite extends Applet implements // alignPdbStructures is true) Vector pdbs = new Vector(); // create a lazy matcher if we're asked to - jalview.analysis.SequenceIdMatcher matcher = (applet - .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher( + SequenceIdMatcher matcher = (applet.getDefaultParameter( + "relaxedidmatch", false)) ? new SequenceIdMatcher( alignFrame.getAlignViewport().getAlignment() .getSequencesArray()) : null; @@ -2853,13 +2857,12 @@ public class JalviewLite extends Applet implements { return defcolour; } - Color col = jalview.schemes.ColourSchemeProperty - .getAWTColorFromName(colprop); + Color col = ColourSchemeProperty.getAWTColorFromName(colprop); if (col == null) { try { - col = new jalview.schemes.UserColourScheme(colprop).findColour('A'); + col = new UserColourScheme(colprop).findColour('A'); } catch (Exception ex) { System.err.println("Couldn't parse '" + colprop diff --git a/src/jalview/bin/JalviewLiteURLRetrieve.java b/src/jalview/bin/JalviewLiteURLRetrieve.java index 6be1016..f84cd07 100644 --- a/src/jalview/bin/JalviewLiteURLRetrieve.java +++ b/src/jalview/bin/JalviewLiteURLRetrieve.java @@ -23,6 +23,7 @@ package jalview.bin; import jalview.datamodel.AlignmentI; import jalview.io.AppletFormatAdapter; import jalview.io.FileParse; +import jalview.io.IdentifyFile; import java.applet.Applet; import java.io.InputStream; @@ -113,7 +114,7 @@ public class JalviewLiteURLRetrieve extends Applet String format = getParameter("format"); if (format == null || format.length() == 0) { - format = new jalview.io.IdentifyFile().Identify(file, protocol); + format = new IdentifyFile().Identify(file, protocol); System.out.println("Format is " + format); } else