From: gmungoc Date: Fri, 10 Jul 2015 05:14:47 +0000 (+0100) Subject: JAL-1807 explicit imports (jalview.gui) X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=aa91e8c4561c2dd0f18760e18fb0052979733bf8;p=jalview.git JAL-1807 explicit imports (jalview.gui) --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 68d7397..e656b0f 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -46,6 +46,7 @@ import jalview.commands.RemoveGapColCommand; import jalview.commands.RemoveGapsCommand; import jalview.commands.SlideSequencesCommand; import jalview.commands.TrimRegionCommand; +import jalview.controller.AlignViewController; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -63,11 +64,13 @@ import jalview.datamodel.SequenceI; import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.io.AlignmentProperties; import jalview.io.AnnotationFile; +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.JPredFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.io.JnetAnnotationMaker; @@ -84,6 +87,7 @@ import jalview.schemes.HydrophobicColourScheme; import jalview.schemes.NucleotideColourScheme; import jalview.schemes.PIDColourScheme; import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.RNAHelicesColour; import jalview.schemes.RNAHelicesColourChooser; import jalview.schemes.ResidueProperties; import jalview.schemes.StrandColourScheme; @@ -94,10 +98,14 @@ import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.viewmodel.AlignmentViewport; +import jalview.ws.DBRefFetcher; +import jalview.ws.WSMenuEntryProviderI; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.rest.RestClient; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -146,6 +154,8 @@ import javax.swing.JRadioButtonMenuItem; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; +import ext.vamsas.ServiceHandle; + /** * DOCUMENT ME! * @@ -341,7 +351,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, progressBar = new ProgressBar(this.statusPanel, this.statusBar); } - avc = new jalview.controller.AlignViewController(this, viewport, + avc = new AlignViewController(this, viewport, alignPanel); if (viewport.getAlignmentConservationAnnotation() == null) { @@ -353,7 +363,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // modifyPID.setEnabled(false); } - String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", + String sortby = Cache.getDefault("SORT_ALIGNMENT", "No sort"); if (sortby.equals("Id")) @@ -381,7 +391,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, wrapMenuItem_actionPerformed(null); } - if (jalview.bin.Cache.getDefault("SHOW_OVERVIEW", false)) + if (Cache.getDefault("SHOW_OVERVIEW", false)) { this.overviewMenuItem_actionPerformed(null); } @@ -705,8 +715,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel) { ap.alignFrame = this; - avc = new jalview.controller.AlignViewController(this, viewport, - alignPanel); + avc = new AlignViewController(this, viewport, alignPanel); alignPanels.add(ap); @@ -828,7 +837,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, purinePyrimidineColour.setEnabled(nucleotide); showComplementMenuItem.setText(MessageManager .getString(nucleotide ? "label.protein" : "label.nucleotide")); - setColourSelected(jalview.bin.Cache.getDefault( + setColourSelected(Cache.getDefault( nucleotide ? Preferences.DEFAULT_COLOUR_NUC : Preferences.DEFAULT_COLOUR_PROT, "None")); } @@ -894,7 +903,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, listenToViewSelections.setSelected(av.followSelection); rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure()); rnahelicesColour - .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); + .setSelected(av.getGlobalColourScheme() instanceof RNAHelicesColour); setShowProductsEnabled(); updateEditMenuBar(); } @@ -940,7 +949,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public String getVersion() { - return jalview.bin.Cache.getProperty("VERSION"); + return Cache.getProperty("VERSION"); } public FeatureRenderer getFeatureRenderer() @@ -1043,7 +1052,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void save_actionPerformed(ActionEvent e) { if (fileName == null - || (currentFileFormat == null || !jalview.io.FormatAdapter + || (currentFileFormat == null || !FormatAdapter .isValidIOFormat(currentFileFormat, true)) || fileName.startsWith("http")) { @@ -1065,9 +1074,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void saveAs_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), - jalview.io.AppletFormatAdapter.WRITABLE_EXTENSIONS, - jalview.io.AppletFormatAdapter.WRITABLE_FNAMES, + Cache.getProperty("LAST_DIRECTORY"), + AppletFormatAdapter.WRITABLE_EXTENSIONS, + AppletFormatAdapter.WRITABLE_FNAMES, currentFileFormat, false); chooser.setFileView(new JalviewFileView()); @@ -1099,10 +1108,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, fileName = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", + Cache.setProperty("DEFAULT_FILE_FORMAT", currentFileFormat); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName); + Cache.setProperty("LAST_DIRECTORY", fileName); if (currentFileFormat.indexOf(" ") > -1) { currentFileFormat = currentFileFormat.substring(0, @@ -1135,7 +1144,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - if (!jalview.io.AppletFormatAdapter.isValidFormat(format, true)) + if (!AppletFormatAdapter.isValidFormat(format, true)) { warningMessage("Cannot save file " + fileName + " using format " + format, "Alignment output format not supported"); @@ -1201,7 +1210,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, private void warningMessage(String warning, String title) { - if (new jalview.util.Platform().isHeadless()) + if (Platform.isHeadless()) { System.err.println("Warning: " + title + "\nWarning: " + warning); @@ -1441,7 +1450,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // Pick the tree file JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager .getString("label.load_jalview_annotations")); @@ -1453,7 +1462,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + Cache.setProperty("LAST_DIRECTORY", choice); loadJalviewDataFile(choice, null, null, null); } @@ -1883,7 +1892,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, try { - jalview.gui.Desktop.internalCopy = true; + Desktop.internalCopy = true; // Its really worth setting the clipboard contents // to empty before setting the large StringSelection!! Toolkit.getDefaultToolkit().getSystemClipboard() @@ -3706,9 +3715,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, iSize--; } } - if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null) + if (UserDefinedColours.getUserColourSchemes() != null) { - java.util.Enumeration userColours = jalview.gui.UserDefinedColours + Enumeration userColours = UserDefinedColours .getUserColourSchemes().keys(); while (userColours.hasMoreElements()) @@ -3727,7 +3736,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, radioItem.removeActionListener(radioItem.getActionListeners()[0]); int option = JOptionPane.showInternalConfirmDialog( - jalview.gui.Desktop.desktop, + Desktop.desktop, MessageManager .getString("label.remove_from_default_list"), MessageManager @@ -3735,8 +3744,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { - jalview.gui.UserDefinedColours - .removeColourFromDefaults(radioItem.getText()); + UserDefinedColours.removeColourFromDefaults(radioItem + .getText()); colourMenu.remove(radioItem); } else @@ -4303,7 +4312,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * be submitted for multiple alignment. * */ - public jalview.datamodel.AlignmentView gatherSequencesForAlignment() + public AlignmentView gatherSequencesForAlignment() { // Now, check we have enough sequences AlignmentView msa = null; @@ -4387,7 +4396,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // Pick the tree file JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager .getString("label.select_newick_like_tree_file")); @@ -4398,11 +4407,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); - jalview.io.NewickFile fin = null; + Cache.setProperty("LAST_DIRECTORY", choice); + NewickFile fin = null; try { - fin = new jalview.io.NewickFile(choice, "File"); + fin = new NewickFile(choice, "File"); viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree()); } catch (Exception ex) { @@ -4575,10 +4584,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // Add any secondary structure prediction services for (int i = 0, j = secstrpr.size(); i < j; i++) { - final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr - .get(i); - jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer - .getServiceClient(sh); + final ServiceHandle sh = (ServiceHandle) secstrpr.get(i); + WSMenuEntryProviderI impl = Discoverer.getServiceClient(sh); int p = secstrmenu.getItemCount(); impl.attachWSMenuEntry(secstrmenu, me); int q = secstrmenu.getItemCount(); @@ -4705,8 +4712,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // SHmmr test client - still being implemented. // DEBUG - alignmentView - for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient - .getRestClients()) + for (RestClient client : RestClient.getRestClients()) { client.attachWSMenuEntry( JvSwingUtils.findOrCreateMenu(webService, client.getAction()), @@ -4716,7 +4722,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /* * public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser - * chooser = new JalviewFileChooser(jalview.bin.Cache. + * chooser = new JalviewFileChooser(Cache. * getProperty("LAST_DIRECTORY")); * * chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Export @@ -4796,7 +4802,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, showProducts.setEnabled(showp); } catch (Exception e) { - jalview.bin.Cache.log + Cache.log .warn("canTranslate threw an exception - please report to help@jalview.org", e); return false; @@ -4911,14 +4917,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } catch (Exception e) { - jalview.bin.Cache.log.error( + Cache.log.error( "Exception when finding crossreferences", e); } catch (OutOfMemoryError e) { new OOMWarning("whilst fetching crossreferences", e); } catch (Error e) { - jalview.bin.Cache.log.error("Error when finding crossreferences", + Cache.log.error("Error when finding crossreferences", e); } AlignFrame.this.setProgressBar(MessageManager.formatMessage( @@ -4939,11 +4945,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // old way try { - return (jalview.analysis.Dna.canTranslate(selection, + return (Dna.canTranslate(selection, viewport.getViewAsVisibleContigs(true))); } catch (Exception e) { - jalview.bin.Cache.log + Cache.log .warn("canTranslate threw an exception - please report to help@jalview.org", e); return false; @@ -4965,7 +4971,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, al = dna.translateCdna(); } catch (Exception ex) { - jalview.bin.Cache.log.error( + Cache.log.error( "Exception during translation. Please report this !", ex); final String msg = MessageManager .getString("label.error_when_translating_sequences_submit_bug_report"); @@ -5029,7 +5035,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public boolean parseFeaturesFile(String file, String type) { return avc.parseFeaturesFile(file, type, - jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false)); + Cache.getDefault("RELAXEDSEQIDMATCHING", false)); } @@ -5136,12 +5142,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, String file = files.get(i).toString(); String pdbfn = ""; String protocol = FormatAdapter.checkProtocol(file); - if (protocol == jalview.io.FormatAdapter.FILE) + if (protocol == FormatAdapter.FILE) { File fl = new File(file); pdbfn = fl.getName(); } - else if (protocol == jalview.io.FormatAdapter.URL) + else if (protocol == FormatAdapter.URL) { URL url = new URL(file); pdbfn = url.getFile(); @@ -5280,7 +5286,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (protocol == null) { - protocol = jalview.io.FormatAdapter.checkProtocol(file); + protocol = FormatAdapter.checkProtocol(file); } // if the file isn't identified, or not positively identified as some // other filetype (PFAM is default unidentified alignment file type) then @@ -5346,8 +5352,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (format.equalsIgnoreCase("JnetFile")) { - jalview.io.JPredFile predictions = new jalview.io.JPredFile( - file, protocol); + JPredFile predictions = new JPredFile(file, protocol); new JnetAnnotationMaker(); JnetAnnotationMaker.add_annotation(predictions, viewport.getAlignment(), 0, false); @@ -5364,9 +5369,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * if (format.equalsIgnoreCase("PDB")) { * * String pdbfn = ""; // try to match up filename with sequence id - * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl = + * try { if (protocol == FormatAdapter.FILE) { File fl = * new File(file); pdbfn = fl.getName(); } else if (protocol == - * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn = + * FormatAdapter.URL) { URL url = new URL(file); pdbfn = * url.getFile(); } } catch (Exception e) { } ; if (assocSeq == * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) { @@ -5491,8 +5496,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void extractScores_actionPerformed(ActionEvent e) { - ParseProperties pp = new jalview.analysis.ParseProperties( - viewport.getAlignment()); + ParseProperties pp = new ParseProperties(viewport.getAlignment()); // TODO: verify regex and introduce GUI dialog for version 2.5 // if (pp.getScoresFromDescription("col", "score column ", // "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)", @@ -5602,7 +5606,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - new jalview.ws.DBRefFetcher(alignPanel.av + new DBRefFetcher(alignPanel.av .getSequenceSelection(), alignPanel.alignFrame) .fetchDBRefs(false); } @@ -5620,7 +5624,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { final jalview.ws.SequenceFetcher sf = SequenceFetcher .getSequenceFetcherSingleton(me); - javax.swing.SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(new Runnable() { @Override public void run() @@ -5672,7 +5676,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - new jalview.ws.DBRefFetcher(alignPanel.av + new DBRefFetcher(alignPanel.av .getSequenceSelection(), alignPanel.alignFrame, dassource) .fetchDBRefs(false); @@ -5705,7 +5709,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - new jalview.ws.DBRefFetcher(alignPanel.av + new DBRefFetcher(alignPanel.av .getSequenceSelection(), alignPanel.alignFrame, dassource) .fetchDBRefs(false); @@ -5748,7 +5752,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - new jalview.ws.DBRefFetcher(alignPanel.av + new DBRefFetcher(alignPanel.av .getSequenceSelection(), alignPanel.alignFrame, dassrc) .fetchDBRefs(false); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index c18c989..062fa82 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -573,7 +573,7 @@ public class AlignViewport extends AlignmentViewport implements */ public void sendSelection() { - jalview.structure.StructureSelectionManager + StructureSelectionManager .getStructureSelectionManager(Desktop.instance).sendSelection( new SequenceGroup(getSelectionGroup()), new ColumnSelection(getColumnSelection()), this); @@ -900,7 +900,7 @@ public class AlignViewport extends AlignmentViewport implements try { - newAlignFrame.setMaximum(jalview.bin.Cache.getDefault( + newAlignFrame.setMaximum(Cache.getDefault( "SHOW_FULLSCREEN", false)); } catch (java.beans.PropertyVetoException ex) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ad7e75c..4c66214 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -29,10 +29,12 @@ import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.io.HTMLOutput; import jalview.jbgui.GAlignmentPanel; import jalview.math.AlignmentDimension; import jalview.schemes.ResidueProperties; import jalview.structure.StructureSelectionManager; +import jalview.util.ImageMaker; import jalview.util.MessageManager; import jalview.util.Platform; @@ -1237,7 +1239,7 @@ public class AlignmentPanel extends GAlignmentPanel implements return idwidth.intValue() + 4; } - void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file) + void makeAlignmentImage(ImageMaker.TYPE type, File file) { long progress = System.currentTimeMillis(); headless = (System.getProperty("java.awt.headless") != null && System @@ -1253,14 +1255,14 @@ public class AlignmentPanel extends GAlignmentPanel implements AlignmentDimension aDimension = getAlignmentDimension(); try { - jalview.util.ImageMaker im; + ImageMaker im; final String imageAction, imageTitle; - if (type == jalview.util.ImageMaker.TYPE.PNG) + if (type == ImageMaker.TYPE.PNG) { imageAction = "Create PNG image from alignment"; imageTitle = null; } - else if (type == jalview.util.ImageMaker.TYPE.EPS) + else if (type == ImageMaker.TYPE.EPS) { imageAction = "Create EPS file from alignment"; imageTitle = alignFrame.getTitle(); @@ -1271,7 +1273,7 @@ public class AlignmentPanel extends GAlignmentPanel implements imageTitle = alignFrame.getTitle(); } - im = new jalview.util.ImageMaker(this, type, imageAction, + im = new ImageMaker(this, type, imageAction, aDimension.getWidth(), aDimension.getHeight(), file, imageTitle); if (av.getWrapAlignment()) @@ -1357,7 +1359,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public void makeEPS(File epsFile) { - makeAlignmentImage(jalview.util.ImageMaker.TYPE.EPS, epsFile); + makeAlignmentImage(ImageMaker.TYPE.EPS, epsFile); } /** @@ -1365,12 +1367,12 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public void makePNG(File pngFile) { - makeAlignmentImage(jalview.util.ImageMaker.TYPE.PNG, pngFile); + makeAlignmentImage(ImageMaker.TYPE.PNG, pngFile); } public void makeSVG(File svgFile) { - makeAlignmentImage(jalview.util.ImageMaker.TYPE.SVG, svgFile); + makeAlignmentImage(ImageMaker.TYPE.SVG, svgFile); } public void makePNGImageMap(File imgMapFile, String imageName) { @@ -1390,7 +1392,7 @@ public class AlignmentPanel extends GAlignmentPanel implements .getAlignment().getWidth(), g, gSize, f, fSize, sy; StringBuffer text = new StringBuffer(); PrintWriter out = new PrintWriter(new FileWriter(imgMapFile)); - out.println(jalview.io.HTMLOutput.getImageMapHTML()); + out.println(HTMLOutput.getImageMapHTML()); out.println("" + ""); @@ -1566,7 +1568,7 @@ public class AlignmentPanel extends GAlignmentPanel implements PaintRefresher.RemoveComponent(this); if (av != null) { - jalview.structure.StructureSelectionManager ssm = av + StructureSelectionManager ssm = av .getStructureSelectionManager(); ssm.removeStructureViewerListener(getSeqPanel(), null); ssm.removeSelectionListener(getSeqPanel()); diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index c8dd889..37205a7 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -21,6 +21,7 @@ package jalview.gui; import jalview.bin.Cache; +import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceGroup; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; @@ -449,7 +450,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter && getCurrentAnnotation().threshold == null) { getCurrentAnnotation() - .setThreshold(new jalview.datamodel.GraphLine( + .setThreshold( + new GraphLine( (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, "Threshold", Color.black)); } diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index e87be35..62a6f96 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -23,6 +23,7 @@ package jalview.gui; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.ColumnSelection; +import jalview.datamodel.GraphLine; import jalview.schemes.AnnotationColourGradient; import jalview.util.MessageManager; import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; @@ -387,7 +388,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { getCurrentAnnotation() .setThreshold( - new jalview.datamodel.GraphLine( + new GraphLine( (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, "Threshold", Color.black)); } diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 9b25388..b67a2f7 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.io.AnnotationFile; import jalview.io.FeaturesFile; @@ -117,7 +118,7 @@ public class AnnotationExporter extends JPanel public void toFile_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(features ? MessageManager.getString("label.save_features_to_file") diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index fad9dcd..13f2723 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -20,6 +20,18 @@ */ package jalview.gui; +import jalview.analysis.AlignSeq; +import jalview.analysis.AlignmentUtils; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.FormatAdapter; +import jalview.util.Comparison; +import jalview.util.MessageManager; + import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -50,16 +62,6 @@ import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; -import jalview.analysis.AlignmentUtils; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.Annotation; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.FormatAdapter; -import jalview.util.MessageManager; - /** * DOCUMENT ME! * @@ -862,8 +864,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (dseqs[0] == null) { dseqs[0] = new Sequence(sq); - dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, sq.getSequenceAsString())); + dseqs[0].setSequence(AlignSeq.extractGaps( + Comparison.GapChars, sq.getSequenceAsString())); sq.setDatasetSequence(dseqs[0]); } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 97752f2..3b405d8 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -27,6 +27,7 @@ import jalview.datamodel.SequenceI; import jalview.renderer.AnnotationRenderer; import jalview.renderer.AwtRenderPanelI; import jalview.util.MessageManager; +import jalview.util.Platform; import java.awt.AlphaComposite; import java.awt.Color; @@ -139,7 +140,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, public AnnotationPanel(AlignmentPanel ap) { - MAC = jalview.util.Platform.isAMac(); + MAC = Platform.isAMac(); ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java index 21c91d8..6551228 100644 --- a/src/jalview/gui/AnnotationRowFilter.java +++ b/src/jalview/gui/AnnotationRowFilter.java @@ -32,7 +32,7 @@ public abstract class AnnotationRowFilter extends JPanel protected boolean enableSeqAss = false; - private jalview.datamodel.AlignmentAnnotation currentAnnotation; + private AlignmentAnnotation currentAnnotation; protected boolean adjusting = false; @@ -365,13 +365,13 @@ public abstract class AnnotationRowFilter extends JPanel } - public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation() + public AlignmentAnnotation getCurrentAnnotation() { return currentAnnotation; } public void setCurrentAnnotation( - jalview.datamodel.AlignmentAnnotation currentAnnotation) + AlignmentAnnotation currentAnnotation) { this.currentAnnotation = currentAnnotation; } diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index a16ea68..900d3be 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -40,8 +40,11 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.structures.models.AAStructureBindingModel; +import jalview.util.BrowserLauncher; +import jalview.util.ImageMaker; import jalview.util.MessageManager; import jalview.util.Platform; +import jalview.ws.dbsources.Pdb; import java.awt.BorderLayout; import java.awt.Color; @@ -147,7 +150,7 @@ public class AppJmol extends StructureViewerBase this.setBounds(bounds); initMenus(); setViewId(viewid); - // jalview.gui.Desktop.addInternalFrame(this, "Loading File", + // Desktop.addInternalFrame(this, "Loading File", // bounds.width,bounds.height); this.addInternalFrameListener(new InternalFrameAdapter() @@ -477,7 +480,7 @@ public class AppJmol extends StructureViewerBase // TODO: consider waiting until the structure/view is fully loaded before // displaying this.getContentPane().add(renderPanel, java.awt.BorderLayout.CENTER); - jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(), + Desktop.addInternalFrame(this, jmb.getViewerTitle(), getBounds().width, getBounds().height); if (scriptWindow == null) { @@ -595,7 +598,7 @@ public class AppJmol extends StructureViewerBase String[] curfiles = jmb.getPdbFile(); // files currently in viewer // TODO: replace with reference fetching/transfer code (validate PDBentry // as a DBRef?) - jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb(); + Pdb pdbclient = new Pdb(); for (int pi = 0; pi < jmb.getPdbCount(); pi++) { String file = jmb.getPdbEntry(pi).getFile(); @@ -765,7 +768,7 @@ public class AppJmol extends StructureViewerBase public void pdbFile_actionPerformed(ActionEvent actionEvent) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file")); @@ -815,7 +818,7 @@ public class AppJmol extends StructureViewerBase @Override public void viewMapping_actionPerformed(ActionEvent actionEvent) { - jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer(); + CutAndPasteTransfer cap = new CutAndPasteTransfer(); try { cap.appendText(jmb.printMappings()); @@ -827,7 +830,7 @@ public class AppJmol extends StructureViewerBase cap.dispose(); return; } - jalview.gui.Desktop.addInternalFrame(cap, + Desktop.addInternalFrame(cap, MessageManager.getString("label.pdb_sequence_mapping"), 550, 600); } @@ -835,40 +838,38 @@ public class AppJmol extends StructureViewerBase @Override public void eps_actionPerformed(ActionEvent e) { - makePDBImage(jalview.util.ImageMaker.TYPE.EPS); + makePDBImage(ImageMaker.TYPE.EPS); } @Override public void png_actionPerformed(ActionEvent e) { - makePDBImage(jalview.util.ImageMaker.TYPE.PNG); + makePDBImage(ImageMaker.TYPE.PNG); } - void makePDBImage(jalview.util.ImageMaker.TYPE type) + void makePDBImage(ImageMaker.TYPE type) { int width = getWidth(); int height = getHeight(); - jalview.util.ImageMaker im; + ImageMaker im; - if (type == jalview.util.ImageMaker.TYPE.PNG) + if (type == ImageMaker.TYPE.PNG) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.PNG, + im = new ImageMaker(this, ImageMaker.TYPE.PNG, "Make PNG image from view", width, height, null, null); } - else if (type == jalview.util.ImageMaker.TYPE.EPS) + else if (type == ImageMaker.TYPE.EPS) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.EPS, + im = new ImageMaker(this, ImageMaker.TYPE.EPS, "Make EPS file from view", width, height, null, this.getTitle()); } else { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA", + im = new ImageMaker(this, ImageMaker.TYPE.SVG, + "Make SVG file from PCA", width, height, null, this.getTitle()); } @@ -1007,7 +1008,7 @@ public class AppJmol extends StructureViewerBase { try { - jalview.util.BrowserLauncher + BrowserLauncher .openURL("http://jmol.sourceforge.net/docs/JmolUserGuide/"); } catch (Exception ex) { diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 99bcff4..c6836d3 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -252,7 +252,7 @@ public class AppVarna extends JInternalFrame implements SelectionListener, getContentPane().add(split, BorderLayout.CENTER); varnaPanel.addSelectionListener(this); - jalview.gui.Desktop.addInternalFrame(this, "", getBounds().width, + Desktop.addInternalFrame(this, "", getBounds().width, getBounds().height); this.pack(); showPanel(true); diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index a3e695a..8b4c281 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -252,9 +252,9 @@ public class BlogReader extends JPanel _channelModel = new ChannelListModel(); // Construct our jalview news channel Channel chan = new Channel(); - chan.setURL(jalview.bin.Cache.getDefault( + chan.setURL(Cache.getDefault( "JALVIEW_NEWS_RSS", - jalview.bin.Cache.getDefault("www.jalview.org", + Cache.getDefault("www.jalview.org", "http://www.jalview.org") + "/feeds/desktop/rss")); loadLastM(); _channelModel.addChannel(chan); @@ -419,10 +419,10 @@ public class BlogReader extends JPanel } if (lastDate != null) { - jalview.bin.Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", + Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", lastDate); - jalview.bin.Cache.log.debug("Saved last read date as " - + jalview.bin.Cache.date_format.format(lastDate)); + Cache.log.debug("Saved last read date as " + + Cache.date_format.format(lastDate)); } } @@ -743,8 +743,8 @@ public class BlogReader extends JPanel { // this tests the detection of new news based on the last read date stored // in jalview properties - jalview.bin.Cache.loadProperties(null); - jalview.bin.Cache.initLogger(); + Cache.loadProperties(null); + Cache.initLogger(); // test will advance read date each time Calendar today = Calendar.getInstance(), lastread = Calendar .getInstance(); @@ -755,7 +755,7 @@ public class BlogReader extends JPanel lastread.getTime()); BlogReader me = new BlogReader(); System.out.println("Set last date to " - + jalview.bin.Cache.date_format.format(lastread.getTime())); + + Cache.date_format.format(lastread.getTime())); if (me.isNewsNew()) { Cache.log.debug("There is news to read."); diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index f644e95..b81de3d 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -20,6 +20,32 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.ext.rbvi.chimera.JalviewChimeraBinding; +import jalview.gui.StructureViewer.ViewerType; +import jalview.io.AppletFormatAdapter; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.ZappoColourScheme; +import jalview.structures.models.AAStructureBindingModel; +import jalview.util.BrowserLauncher; +import jalview.util.MessageManager; +import jalview.util.Platform; +import jalview.ws.dbsources.Pdb; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -50,31 +76,6 @@ import javax.swing.event.InternalFrameEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import jalview.bin.Cache; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.ext.rbvi.chimera.JalviewChimeraBinding; -import jalview.gui.StructureViewer.ViewerType; -import jalview.io.AppletFormatAdapter; -import jalview.io.JalviewFileChooser; -import jalview.io.JalviewFileView; -import jalview.schemes.BuriedColourScheme; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.HelixColourScheme; -import jalview.schemes.HydrophobicColourScheme; -import jalview.schemes.PurinePyrimidineColourScheme; -import jalview.schemes.StrandColourScheme; -import jalview.schemes.TaylorColourScheme; -import jalview.schemes.TurnColourScheme; -import jalview.schemes.ZappoColourScheme; -import jalview.structures.models.AAStructureBindingModel; -import jalview.util.MessageManager; -import jalview.util.Platform; -import jalview.ws.dbsources.Pdb; - /** * GUI elements for handling an external chimera display * @@ -601,7 +602,7 @@ public class ChimeraViewFrame extends StructureViewerBase void initChimera() { jmb.setFinishedInit(false); - jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle("Chimera", true), + Desktop.addInternalFrame(this, jmb.getViewerTitle("Chimera", true), getBounds().width, getBounds().height); if (!jmb.launchChimera()) @@ -995,7 +996,7 @@ public class ChimeraViewFrame extends StructureViewerBase public void pdbFile_actionPerformed(ActionEvent actionEvent) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file")); @@ -1044,7 +1045,7 @@ public class ChimeraViewFrame extends StructureViewerBase @Override public void viewMapping_actionPerformed(ActionEvent actionEvent) { - jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer(); + CutAndPasteTransfer cap = new CutAndPasteTransfer(); try { cap.appendText(jmb.printMappings()); @@ -1056,7 +1057,7 @@ public class ChimeraViewFrame extends StructureViewerBase cap.dispose(); return; } - jalview.gui.Desktop.addInternalFrame(cap, + Desktop.addInternalFrame(cap, MessageManager.getString("label.pdb_sequence_mapping"), 550, 600); } @@ -1206,7 +1207,7 @@ public class ChimeraViewFrame extends StructureViewerBase { try { - jalview.util.BrowserLauncher + BrowserLauncher .openURL("https://www.cgl.ucsf.edu/chimera/docs/UsersGuide"); } catch (Exception ex) { diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index ea5c75e..545460d 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -20,20 +20,29 @@ */ package jalview.gui; -import java.awt.*; -import java.awt.datatransfer.*; -import java.awt.event.*; +import jalview.bin.Cache; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.jbgui.GCutAndPasteHtmlTransfer; +import jalview.util.MessageManager; +import jalview.viewmodel.AlignmentViewport; + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; import java.io.StringWriter; -import javax.swing.*; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkEvent.EventType; - -import jalview.io.*; -import jalview.jbgui.*; -import jalview.util.MessageManager; -import jalview.viewmodel.AlignmentViewport; +import javax.swing.event.HyperlinkListener; /** * Cut'n'paste files into the desktop See JAL-1105 @@ -138,7 +147,7 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer public void save_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setAcceptAllFileFilterUsed(false); chooser.setFileView(new JalviewFileView()); diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 979d1aa..2fc44a5 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -24,6 +24,7 @@ import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.ComplexAlignFile; import jalview.api.FeaturesDisplayedI; +import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; @@ -123,7 +124,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer public void save_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setAcceptAllFileFilterUsed(false); chooser.setFileView(new JalviewFileView()); @@ -269,7 +270,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer try { - af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", + af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN", false)); } catch (Exception ex) { diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index fab4cb3..f781473 100644 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -20,6 +20,13 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.jbgui.GDasSourceBrowser; +import jalview.util.MessageManager; +import jalview.util.TableSorter; +import jalview.ws.dbsources.das.api.DasSourceRegistryI; +import jalview.ws.dbsources.das.api.jalviewSourceI; + import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; @@ -46,12 +53,6 @@ import org.biodas.jdas.schema.sources.COORDINATES; import org.biodas.jdas.schema.sources.PROP; import org.biodas.jdas.schema.sources.VERSION; -import jalview.jbgui.GDasSourceBrowser; -import jalview.util.MessageManager; -import jalview.util.TableSorter; -import jalview.ws.dbsources.das.api.DasSourceRegistryI; -import jalview.ws.dbsources.das.api.jalviewSourceI; - public class DasSourceBrowser extends GDasSourceBrowser implements Runnable, ListSelectionListener { @@ -63,7 +64,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements { fs = featureSettings; // TODO DasSourceRegistryProvider API - sourceRegistry = jalview.bin.Cache.getDasSourceRegistry(); + sourceRegistry = Cache.getDasSourceRegistry(); String registry = sourceRegistry.getDasRegistryURL(); registryURL.setText(registry); @@ -360,7 +361,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements public void refresh_actionPerformed(ActionEvent e) { - saveProperties(jalview.bin.Cache.applicationProperties); + saveProperties(Cache.applicationProperties); Thread worker = new Thread(this); worker.start(); @@ -683,7 +684,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements void setSelectedFromProperties() { - String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", + String active = Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot"); StringTokenizer st = new StringTokenizer(active, "\t"); selectedSources = new Vector(); @@ -707,11 +708,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements { if (registryURL.getText() == null || registryURL.getText().length() < 1) { - properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL); + properties.remove(Cache.DAS_REGISTRY_URL); } else { - properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, + properties.setProperty(Cache.DAS_REGISTRY_URL, registryURL.getText()); } @@ -724,11 +725,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements } } - properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE, + properties.setProperty(Cache.DAS_ACTIVE_SOURCE, sb.toString()); String sourceprop = sourceRegistry.getLocalSourceString(); - properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop); + properties.setProperty(Cache.DAS_LOCAL_SOURCE, sourceprop); } class DASTableModel extends AbstractTableModel diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 6a95363..2228725 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -22,15 +22,19 @@ package jalview.gui; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.StructureSelectionManagerProvider; import jalview.bin.Cache; +import jalview.io.AppletFormatAdapter; import jalview.io.FileLoader; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.jbgui.GDesktop; import jalview.jbgui.GSplitFrame; import jalview.jbgui.GStructureViewer; import jalview.structure.StructureSelectionManager; +import jalview.util.BrowserLauncher; import jalview.util.ImageMaker; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; @@ -107,9 +111,10 @@ import javax.swing.event.MenuListener; * @author $author$ * @version $Revision: 1.155 $ */ -public class Desktop extends jalview.jbgui.GDesktop implements - DropTargetListener, ClipboardOwner, IProgressIndicator, - jalview.api.StructureSelectionManagerProvider +public class Desktop extends GDesktop implements + DropTargetListener, + ClipboardOwner, IProgressIndicator, + StructureSelectionManagerProvider { private JalviewChangeSupport changeSupport = new JalviewChangeSupport(); @@ -300,11 +305,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements doVamsasClientCheck(); doGroovyCheck(); doConfigureStructurePrefs(); - setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION")); + setTitle("Jalview " + Cache.getProperty("VERSION")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE", + boolean selmemusage = Cache.getDefault("SHOW_MEMUSAGE", false); - boolean showjconsole = jalview.bin.Cache.getDefault( + boolean showjconsole = Cache.getDefault( "SHOW_JAVA_CONSOLE", false); desktop = new MyDesktopPane(selmemusage); showMemusage.setSelected(selmemusage); @@ -336,11 +341,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements jconsole = new Console(this, showjconsole); // add essential build information jconsole.setHeader("Jalview Version: " - + jalview.bin.Cache.getProperty("VERSION") + "\n" + + Cache.getProperty("VERSION") + "\n" + "Jalview Installation: " - + jalview.bin.Cache.getDefault("INSTALLATION", "unknown") + + Cache.getDefault("INSTALLATION", "unknown") + "\n" + "Build Date: " - + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n" + + Cache.getDefault("BUILD_DATE", "unknown") + "\n" + "Java version: " + System.getProperty("java.version") + "\n" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " @@ -408,10 +413,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements { Cache.log.debug("Filechooser init thread started."); JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), - jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS, - jalview.io.AppletFormatAdapter.READABLE_FNAMES, - jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT")); + Cache.getProperty("LAST_DIRECTORY"), + AppletFormatAdapter.READABLE_EXTENSIONS, + AppletFormatAdapter.READABLE_FNAMES, + Cache.getProperty("DEFAULT_FILE_FORMAT")); Cache.log.debug("Filechooser init thread finished."); } }).start(); @@ -436,13 +441,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements // configure services StructureSelectionManager ssm = StructureSelectionManager .getStructureSelectionManager(this); - if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true)) + if (Cache.getDefault(Preferences.ADD_SS_ANN, true)) { - ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault( + ssm.setAddTempFacAnnot(Cache.getDefault( Preferences.ADD_TEMPFACT_ANN, true)); - ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault( + ssm.setProcessSecondaryStructure(Cache.getDefault( Preferences.STRUCT_FROM_PDB, true)); - ssm.setSecStructServices(jalview.bin.Cache.getDefault( + ssm.setSecStructServices(Cache.getDefault( Preferences.USE_RNAVIEW, true)); } else @@ -513,26 +518,26 @@ public class Desktop extends jalview.jbgui.GDesktop implements { // TODO: lock aspect ratio for scaling desktop Bug #0058199 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - String x = jalview.bin.Cache.getProperty(windowName + "SCREEN_X"); - String y = jalview.bin.Cache.getProperty(windowName + "SCREEN_Y"); - String width = jalview.bin.Cache.getProperty(windowName + String x = Cache.getProperty(windowName + "SCREEN_X"); + String y = Cache.getProperty(windowName + "SCREEN_Y"); + String width = Cache.getProperty(windowName + "SCREEN_WIDTH"); - String height = jalview.bin.Cache.getProperty(windowName + String height = Cache.getProperty(windowName + "SCREEN_HEIGHT"); if ((x != null) && (y != null) && (width != null) && (height != null)) { int ix = Integer.parseInt(x), iy = Integer.parseInt(y), iw = Integer .parseInt(width), ih = Integer.parseInt(height); - if (jalview.bin.Cache.getProperty("SCREENGEOMETRY_WIDTH") != null) + if (Cache.getProperty("SCREENGEOMETRY_WIDTH") != null) { // attempt #1 - try to cope with change in screen geometry - this // version doesn't preserve original jv aspect ratio. // take ratio of current screen size vs original screen size. double sw = ((1f * screenSize.width) / (1f * Integer - .parseInt(jalview.bin.Cache + .parseInt(Cache .getProperty("SCREENGEOMETRY_WIDTH")))); double sh = ((1f * screenSize.height) / (1f * Integer - .parseInt(jalview.bin.Cache + .parseInt(Cache .getProperty("SCREENGEOMETRY_HEIGHT")))); // rescale the bounds depending upon the current screen geometry. ix = (int) (ix * sw); @@ -541,17 +546,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements ih = (int) (ih * sh); while (ix >= screenSize.width) { - jalview.bin.Cache.log + Cache.log .debug("Window geometry location recall error: shifting horizontal to within screenbounds."); ix -= screenSize.width; } while (iy >= screenSize.height) { - jalview.bin.Cache.log + Cache.log .debug("Window geometry location recall error: shifting vertical to within screenbounds."); iy -= screenSize.height; } - jalview.bin.Cache.log.debug("Got last known dimensions for " + Cache.log.debug("Got last known dimensions for " + windowName + ": x:" + ix + " y:" + iy + " width:" + iw + " height:" + ih); } @@ -563,7 +568,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements private void doVamsasClientCheck() { - if (jalview.bin.Cache.vamsasJarsPresent()) + if (Cache.vamsasJarsPresent()) { setupVamsasDisconnectedGui(); VamsasMenu.setVisible(true); @@ -991,10 +996,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), - jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS, - jalview.io.AppletFormatAdapter.READABLE_FNAMES, - jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT")); + Cache.getProperty("LAST_DIRECTORY"), + AppletFormatAdapter.READABLE_EXTENSIONS, + AppletFormatAdapter.READABLE_FNAMES, + Cache.getProperty("DEFAULT_FILE_FORMAT")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager @@ -1006,7 +1011,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser + Cache.setProperty("LAST_DIRECTORY", chooser .getSelectedFile().getParent()); String format = null; @@ -1060,7 +1065,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements history.setEditable(true); history.addItem("http://www."); - String historyItems = jalview.bin.Cache.getProperty("RECENT_URL"); + String historyItems = Cache.getProperty("RECENT_URL"); StringTokenizer st; @@ -1146,9 +1151,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void quit() { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - jalview.bin.Cache + Cache .setProperty("SCREENGEOMETRY_WIDTH", screen.width + ""); - jalview.bin.Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height + Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height + ""); storeLastKnownDimensions("", new Rectangle(getBounds().x, getBounds().y, getWidth(), getHeight())); @@ -1173,14 +1178,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements private void storeLastKnownDimensions(String string, Rectangle jc) { - jalview.bin.Cache.log.debug("Storing last known dimensions for " + Cache.log.debug("Storing last known dimensions for " + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width + " height:" + jc.height); - jalview.bin.Cache.setProperty(string + "SCREEN_X", jc.x + ""); - jalview.bin.Cache.setProperty(string + "SCREEN_Y", jc.y + ""); - jalview.bin.Cache.setProperty(string + "SCREEN_WIDTH", jc.width + ""); - jalview.bin.Cache.setProperty(string + "SCREEN_HEIGHT", jc.height + ""); + Cache.setProperty(string + "SCREEN_X", jc.x + ""); + Cache.setProperty(string + "SCREEN_Y", jc.y + ""); + Cache.setProperty(string + "SCREEN_WIDTH", jc.width + ""); + Cache.setProperty(string + "SCREEN_HEIGHT", jc.height + ""); } /** @@ -1211,9 +1216,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (shortv) { message.append("

Version: " - + jalview.bin.Cache.getProperty("VERSION") + "

"); + + Cache.getProperty("VERSION") + ""); message.append("Last Updated: " - + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + + Cache.getDefault("BUILD_DATE", "unknown") + ""); } @@ -1221,21 +1226,21 @@ public class Desktop extends jalview.jbgui.GDesktop implements { message.append("Version " - + jalview.bin.Cache.getProperty("VERSION") + + Cache.getProperty("VERSION") + "; last updated: " - + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")); + + Cache.getDefault("BUILD_DATE", "unknown")); } - if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals( + if (Cache.getDefault("LATEST_VERSION", "Checking").equals( "Checking")) { message.append("
...Checking latest version...
"); } - else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking") - .equals(jalview.bin.Cache.getProperty("VERSION"))) + else if (!Cache.getDefault("LATEST_VERSION", "Checking") + .equals(Cache.getProperty("VERSION"))) { boolean red = false; - if (jalview.bin.Cache.getProperty("VERSION").toLowerCase() + if (Cache.getProperty("VERSION").toLowerCase() .indexOf("automated build") == -1) { red = true; @@ -1245,10 +1250,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements } message.append("
!! Version " - + jalview.bin.Cache.getDefault("LATEST_VERSION", + + Cache.getDefault("LATEST_VERSION", "..Checking..") + " is available for download from " - + jalview.bin.Cache.getDefault("www.jalview.org", + + Cache.getDefault("www.jalview.org", "http://www.jalview.org") + " !!"); if (red) { @@ -1256,7 +1261,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } message.append("
Authors: " - + jalview.bin.Cache + + Cache .getDefault("AUTHORFNAMES", "The Jalview Authors (See AUTHORS file for current list)") + "

Development managed by The Barton Group, University of Dundee, Scotland, UK.
" @@ -1329,9 +1334,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements protected void garbageCollect_actionPerformed(ActionEvent e) { // We simply collect the garbage - jalview.bin.Cache.log.debug("Collecting garbage..."); + Cache.log.debug("Collecting garbage..."); System.gc(); - jalview.bin.Cache.log.debug("Finished garbage collection."); + Cache.log.debug("Finished garbage collection."); } /* @@ -1471,7 +1476,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void saveState_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "jvp" }, new String[] { "Jalview Project" }, "Jalview Project"); @@ -1494,7 +1499,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements setProgressBar(MessageManager.formatMessage( "label.saving_jalview_project", new Object[] { choice.getName() }), choice.hashCode()); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", + Cache.setProperty("LAST_DIRECTORY", choice.getParent()); // TODO catch and handle errors for savestate // TODO prevent user from messing with the Desktop whilst we're saving @@ -1542,7 +1547,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void loadState_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "jvp", "jar" }, new String[] { "Jalview Project", "Jalview Project (old)" }, "Jalview Project"); @@ -1556,7 +1561,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements final File selectedFile = chooser.getSelectedFile(); setProjectFile(selectedFile); final String choice = selectedFile.getAbsolutePath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", + Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent()); new Thread(new Runnable() { @@ -1839,7 +1844,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } - jalview.gui.VamsasApplication v_client = null; + VamsasApplication v_client = null; public void vamsasImport_actionPerformed(ActionEvent e) { @@ -1847,7 +1852,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { // Load and try to start a session. JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager @@ -1877,13 +1882,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements } else { - jalview.bin.Cache.log + Cache.log .error("Implementation error - load session from a running session is not supported."); } } /** - * import file into a new vamsas session (uses jalview.gui.VamsasApplication) + * import file into a new vamsas session (uses VamsasApplication) * * @param file * @return true if import was a success and a session was started. @@ -1894,7 +1899,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (v_client != null) { - jalview.bin.Cache.log + Cache.log .error("Implementation error - load session from a running session is not supported."); return false; } @@ -1914,11 +1919,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements } bis.close(); fos.close(); - v_client = new jalview.gui.VamsasApplication(this, file, + v_client = new VamsasApplication(this, file, url.toExternalForm()); } catch (Exception ex) { - jalview.bin.Cache.log.error( + Cache.log.error( "Failed to create new vamsas session from contents of URL " + url, ex); return false; @@ -1929,7 +1934,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } /** - * import file into a new vamsas session (uses jalview.gui.VamsasApplication) + * import file into a new vamsas session (uses VamsasApplication) * * @param file * @return true if import was a success and a session was started. @@ -1939,7 +1944,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (v_client != null) { - jalview.bin.Cache.log + Cache.log .error("Implementation error - load session from a running session is not supported."); return false; } @@ -1949,13 +1954,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements { file.getName() }), file.hashCode()); try { - v_client = new jalview.gui.VamsasApplication(this, file, null); + v_client = new VamsasApplication(this, file, null); } catch (Exception ex) { setProgressBar(MessageManager.formatMessage( "status.importing_vamsas_session_from", new Object[] { file.getName() }), file.hashCode()); - jalview.bin.Cache.log.error( + Cache.log.error( "New vamsas session from existing session file failed:", ex); return false; } @@ -1993,7 +1998,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements // Start a session. // we just start a default session for moment. /* - * JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. + * JalviewFileChooser chooser = new JalviewFileChooser(Cache. * getProperty("LAST_DIRECTORY")); * * chooser.setFileView(new JalviewFileView()); @@ -2003,7 +2008,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements * int value = chooser.showOpenDialog(this); * * if (value == JalviewFileChooser.APPROVE_OPTION) { v_client = new - * jalview.gui.VamsasApplication(this, chooser.getSelectedFile()); + * VamsasApplication(this, chooser.getSelectedFile()); */ v_client = new VamsasApplication(this); setupVamsasConnectedGui(); @@ -2054,13 +2059,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements sess = VamsasApplication.getSessionList(); } catch (Exception e) { - jalview.bin.Cache.log.warn( + Cache.log.warn( "Problem getting current sessions list.", e); sess = null; } if (sess != null) { - jalview.bin.Cache.log.debug("Got current sessions list: " + Cache.log.debug("Got current sessions list: " + sess.length + " entries."); VamsasStMenu.removeAll(); for (int i = 0; i < sess.length; i++) @@ -2102,7 +2107,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } else { - jalview.bin.Cache.log.debug("No current vamsas sessions."); + Cache.log.debug("No current vamsas sessions."); VamsasStMenu.removeAll(); VamsasStMenu.setVisible(false); } @@ -2119,7 +2124,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (v_client != null) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "vdj" }, // TODO: VAMSAS DOCUMENT EXTENSION is VDJ new String[] { "Vamsas Document" }, "Vamsas Document"); @@ -2136,7 +2141,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements JPanel progpanel = addProgressPanel(MessageManager.formatMessage( "label.saving_vamsas_doc", new Object[] { choice.getName() })); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent()); + Cache.setProperty("LAST_DIRECTORY", choice.getParent()); String warnmsg = null; String warnttl = null; try @@ -2146,14 +2151,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements { warnttl = "Serious Problem saving Vamsas Document"; warnmsg = ex.toString(); - jalview.bin.Cache.log.error("Error Whilst saving document to " + Cache.log.error("Error Whilst saving document to " + choice, ex); } catch (Exception ex) { warnttl = "Problem saving Vamsas Document."; warnmsg = ex.toString(); - jalview.bin.Cache.log.warn("Exception Whilst saving document to " + Cache.log.warn("Exception Whilst saving document to " + choice, ex); } @@ -2178,7 +2183,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ public void setVamsasUpdate(boolean b) { - jalview.bin.Cache.log.debug("Setting gui for Vamsas update " + Cache.log.debug("Setting gui for Vamsas update " + (b ? "in progress" : "finished")); if (vamUpdate != null) @@ -2322,7 +2327,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void doGroovyCheck() { - if (jalview.bin.Cache.groovyJarsPresent()) + if (Cache.groovyJarsPresent()) { groovyShell = new JMenuItem(); groovyShell.setText(MessageManager.getString("label.groovy_console")); @@ -2420,7 +2425,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void groovyShell_actionPerformed(ActionEvent e) { // use reflection to avoid creating compilation dependency. - if (!jalview.bin.Cache.groovyJarsPresent()) + if (!Cache.groovyJarsPresent()) { throw new Error( MessageManager @@ -2441,7 +2446,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements run.invoke(gc); } catch (Exception ex) { - jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex); + Cache.log.error("Groovy Shell Creation failed.", ex); JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.getString("label.couldnt_create_groovy_shell"), @@ -2762,7 +2767,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements "status.opening_params", new Object[] { url }), this.hashCode()); } - jalview.util.BrowserLauncher.openURL(url); + BrowserLauncher.openURL(url); } catch (Exception ex) { JOptionPane.showInternalMessageDialog(Desktop.desktop, @@ -2890,7 +2895,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { invalidate(); File of; - ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS, + ImageMaker im = new ImageMaker(this, ImageMaker.TYPE.EPS, "View of Desktop", getWidth(), getHeight(), of = new File( "Jalview_snapshot" + System.currentTimeMillis() + ".eps"), "View of desktop"); diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java index b5c3762..518cd4a 100644 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -20,11 +20,22 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.util.MessageManager; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; public class EPSOptions extends JPanel { @@ -131,11 +142,11 @@ public class EPSOptions extends JPanel if (!askAgain.isSelected()) { - jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING"); + Cache.applicationProperties.remove("EPS_RENDERING"); } else { - jalview.bin.Cache.setProperty("EPS_RENDERING", value); + Cache.setProperty("EPS_RENDERING", value); } dialog.setVisible(false); diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 7f76760..d204f11 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -20,19 +20,32 @@ */ package jalview.gui; -import java.util.*; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.event.*; - -import jalview.datamodel.*; -import jalview.schemes.*; +import jalview.datamodel.GraphLine; +import jalview.schemes.AnnotationColourGradient; +import jalview.schemes.GraduatedColor; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Hashtable; + +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JColorChooser; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSlider; +import javax.swing.JTextField; +import javax.swing.border.LineBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; public class FeatureColourChooser extends JalviewDialog { @@ -92,7 +105,7 @@ public class FeatureColourChooser extends JalviewDialog { if (!adjusting) { - thresholdValue.setText(((float) slider.getValue() / 1000f) + ""); + thresholdValue.setText((slider.getValue() / 1000f) + ""); valueChanged(); } } @@ -158,7 +171,7 @@ public class FeatureColourChooser extends JalviewDialog : 2); slider.setEnabled(true); thresholdValue.setEnabled(true); - threshline = new jalview.datamodel.GraphLine((max - min) / 2f, + threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); } @@ -410,7 +423,7 @@ public class FeatureColourChooser extends JalviewDialog && threshline == null) { // todo visual indication of feature threshold - threshline = new jalview.datamodel.GraphLine((max - min) / 2f, + threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); } @@ -529,7 +542,7 @@ public class FeatureColourChooser extends JalviewDialog public void valueChanged() { - threshline.value = (float) slider.getValue() / 1000f; + threshline.value = slider.getValue() / 1000f; cs.setThresh(threshline.value); changeColour(); ap.paintAlignment(false); diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 9e09bfb..6e03dd7 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -23,7 +23,9 @@ package jalview.gui; import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.io.FeaturesFile; import jalview.schemes.GraduatedColor; +import jalview.schemes.UserColourScheme; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -200,7 +202,7 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere Object col = getFeatureStyle(name.getText()); if (col == null) { - col = new jalview.schemes.UserColourScheme() + col = new UserColourScheme() .createColourFromName(name.getText()); } oldcol = fcol = col; @@ -322,7 +324,7 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere bigPanel, title, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, MessageManager.getString("action.ok")); - jalview.io.FeaturesFile ffile = new jalview.io.FeaturesFile(); + FeaturesFile ffile = new FeaturesFile(); if (reply == JOptionPane.OK_OPTION && name.getText().length() > 0) { diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 2818fb9..30794df 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -26,10 +26,15 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; +import jalview.util.Format; import jalview.util.MessageManager; +import jalview.util.Platform; +import jalview.util.QuickSort; import jalview.viewmodel.AlignmentViewport; +import jalview.ws.DasSequenceFeatureFetcher; import jalview.ws.dbsources.das.api.jalviewSourceI; import java.awt.BorderLayout; @@ -94,7 +99,7 @@ public class FeatureSettings extends JPanel implements { DasSourceBrowser dassourceBrowser; - jalview.ws.DasSequenceFeatureFetcher dasFeatureFetcher; + DasSequenceFeatureFetcher dasFeatureFetcher; JPanel settingsPane = new JPanel(); @@ -249,7 +254,7 @@ public class FeatureSettings extends JPanel implements frame = new JInternalFrame(); frame.setContentPane(this); - if (new jalview.util.Platform().isAMac()) + if (Platform.isAMac()) { Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), @@ -698,17 +703,17 @@ public class FeatureSettings extends JPanel implements } if (sort) { - jalview.util.QuickSort.sortFloat(order, data); + QuickSort.sortFloat(order, data); } } void load() { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "fc" }, new String[] { "Sequence Feature Colours" }, "Sequence Feature Colours"); - chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.load_feature_colours")); chooser.setToolTipText(MessageManager.getString("action.load")); @@ -803,10 +808,10 @@ public class FeatureSettings extends JPanel implements void save() { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "fc" }, new String[] { "Sequence Feature Colours" }, "Sequence Feature Colours"); - chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_feature_colours")); chooser.setToolTipText(MessageManager.getString("action.save")); @@ -833,7 +838,7 @@ public class FeatureSettings extends JPanel implements sortOrder[i] = fr.getOrder(sortTypes[i]); i++; } - jalview.util.QuickSort.sortFloat(sortOrder, sortTypes); + QuickSort.sortFloat(sortOrder, sortTypes); sortOrder = null; Object fcol; GraduatedColor gcol; @@ -841,7 +846,7 @@ public class FeatureSettings extends JPanel implements { jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); col.setName(sortTypes[i]); - col.setRGB(jalview.util.Format.getHexString(fr.getColour(col + col.setRGB(Format.getHexString(fr.getColour(col .getName()))); fcol = fr.getFeatureStyle(sortTypes[i]); if (fcol instanceof GraduatedColor) @@ -849,7 +854,7 @@ public class FeatureSettings extends JPanel implements gcol = (GraduatedColor) fcol; col.setMin(gcol.getMin()); col.setMax(gcol.getMax()); - col.setMinRGB(jalview.util.Format.getHexString(gcol + col.setMinRGB(Format.getHexString(gcol .getMinColor())); col.setAutoScale(gcol.isAutoScale()); col.setThreshold(gcol.getThresh()); @@ -943,7 +948,7 @@ public class FeatureSettings extends JPanel implements } if (sort) { - jalview.util.QuickSort.sortFloat(width, data); + QuickSort.sortFloat(width, data); // update global priority order } @@ -1236,7 +1241,7 @@ public class FeatureSettings extends JPanel implements } cancelDAS.setEnabled(true); - dasFeatureFetcher = new jalview.ws.DasSequenceFeatureFetcher(dataset, + dasFeatureFetcher = new DasSequenceFeatureFetcher(dataset, this, selectedSources, checkDbRefs, promptFetchDbRefs); af.getViewport().setShowSequenceFeatures(true); af.showSeqFeatures.setSelected(true); @@ -1320,7 +1325,7 @@ public class FeatureSettings extends JPanel implements public void saveDAS_actionPerformed(ActionEvent e) { dassourceBrowser - .saveProperties(jalview.bin.Cache.applicationProperties); + .saveProperties(Cache.applicationProperties); } public void complete() diff --git a/src/jalview/gui/HTMLOptions.java b/src/jalview/gui/HTMLOptions.java index 0ef4710..7e826a8 100644 --- a/src/jalview/gui/HTMLOptions.java +++ b/src/jalview/gui/HTMLOptions.java @@ -1,5 +1,6 @@ package jalview.gui; +import jalview.bin.Cache; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -120,11 +121,11 @@ public class HTMLOptions extends JPanel if (!askAgain.isSelected()) { - jalview.bin.Cache.applicationProperties.remove("HTML_RENDERING"); + Cache.applicationProperties.remove("HTML_RENDERING"); } else { - jalview.bin.Cache.setProperty("HTML_RENDERING", value); + Cache.setProperty("HTML_RENDERING", value); } dialog.setVisible(false); diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 88d0c69..fe05c4d 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -20,11 +20,13 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.io.SequenceAnnotationReport; +import jalview.util.BrowserLauncher; import jalview.util.MessageManager; import jalview.util.UrlLink; import jalview.viewmodel.AlignmentViewport; @@ -212,13 +214,13 @@ public class IdPanel extends JPanel implements MouseListener, // DEFAULT LINK IS FIRST IN THE LINK LIST // BUT IF ITS A REGEX AND DOES NOT MATCH THE NEXT ONE WILL BE TRIED url = links.elementAt(i++).toString(); - jalview.util.UrlLink urlLink = null; + UrlLink urlLink = null; try { urlLink = new UrlLink(url); } catch (Exception foo) { - jalview.bin.Cache.log.error("Exception for URLLink '" + url + "'", + Cache.log.error("Exception for URLLink '" + url + "'", foo); url = null; continue; @@ -226,7 +228,7 @@ public class IdPanel extends JPanel implements MouseListener, ; if (!urlLink.isValid()) { - jalview.bin.Cache.log.error(urlLink.getInvalidMessage()); + Cache.log.error(urlLink.getInvalidMessage()); url = null; continue; } @@ -242,7 +244,7 @@ public class IdPanel extends JPanel implements MouseListener, } try { - jalview.util.BrowserLauncher.openURL(url); + BrowserLauncher.openURL(url); } catch (Exception ex) { JOptionPane @@ -339,7 +341,7 @@ public class IdPanel extends JPanel implements MouseListener, } } - jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel, sq, + PopupMenu pop = new PopupMenu(alignPanel, sq, nlinks, new Vector(Preferences.getGroupURLLinks())); pop.show(this, e.getX(), e.getY()); diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index 94ac141..ac76ba4 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -22,6 +22,7 @@ package jalview.gui; import jalview.bin.Cache; import jalview.util.MessageManager; +import jalview.util.QuickSort; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -222,7 +223,7 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener throw new Error(MessageManager.getString("error.implementation_error_cant_reorder_tree")); } } - jalview.util.QuickSort.sort(names, nodes); + QuickSort.sort(names, nodes); root.removeAllChildren(); for (int i = count - 1; i >= 0; i--) { diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 7caea29..5318889 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.analysis.AlignSeq; import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.AlignedCodonFrame; @@ -34,6 +35,7 @@ import jalview.datamodel.StructureViewerModel; import jalview.datamodel.StructureViewerModel.StructureData; import jalview.ext.varna.RnaModel; import jalview.gui.StructureViewer.ViewerType; +import jalview.io.AppletFormatAdapter; import jalview.schemabinding.version2.AlcodMap; import jalview.schemabinding.version2.AlcodonFrame; import jalview.schemabinding.version2.Annotation; @@ -76,6 +78,8 @@ import jalview.schemes.ResidueProperties; import jalview.schemes.UserColourScheme; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; +import jalview.util.Comparison; +import jalview.util.MapList; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.jarInputStreamProvider; @@ -629,10 +633,10 @@ public class Jalview2XML object.setVamsasModel(new jalview.schemabinding.version2.VamsasModel()); object.setCreationDate(new java.util.Date(System.currentTimeMillis())); - object.setVersion(jalview.bin.Cache.getDefault("VERSION", + object.setVersion(Cache.getDefault("VERSION", "Development Build")); - jalview.datamodel.AlignmentI jal = av.getAlignment(); + AlignmentI jal = av.getAlignment(); if (av.hasHiddenRows()) { @@ -1974,7 +1978,7 @@ public class Jalview2XML { mp = new Mapping(); - jalview.util.MapList mlst = jmp.getMap(); + MapList mlst = jmp.getMap(); List r = mlst.getFromRanges(); for (int[] range : r) { @@ -2020,12 +2024,12 @@ public class Jalview2XML mpc.setDseqFor(jmpid); if (!seqRefIds.containsKey(mpc.getDseqFor())) { - jalview.bin.Cache.log.debug("creatign new DseqFor ID"); + Cache.log.debug("creatign new DseqFor ID"); seqRefIds.put(mpc.getDseqFor(), ps); } else { - jalview.bin.Cache.log.debug("reusing DseqFor ID"); + Cache.log.debug("reusing DseqFor ID"); } } mp.setMappingChoice(mpc); @@ -2618,7 +2622,7 @@ public class Jalview2XML /** * persisted version of annotation row from which to take vis properties */ - public jalview.datamodel.AlignmentAnnotation template; + public AlignmentAnnotation template; /** * original position of the annotation row in the alignment @@ -2943,7 +2947,7 @@ public class Jalview2XML } } } - jalview.datamodel.AlignmentAnnotation jaa = null; + AlignmentAnnotation jaa = null; if (annotation.getGraph()) { @@ -2951,7 +2955,7 @@ public class Jalview2XML // if (autoForView || an[i].isAutoCalculated()) { // hlim=11f; // } - jaa = new jalview.datamodel.AlignmentAnnotation( + jaa = new AlignmentAnnotation( annotation.getLabel(), annotation.getDescription(), anot, llim, hlim, annotation.getGraphType()); @@ -2974,7 +2978,7 @@ public class Jalview2XML } else { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + jaa = new AlignmentAnnotation(an[i].getLabel(), an[i].getDescription(), anot); jaa._linecolour = firstColour; } @@ -3004,11 +3008,11 @@ public class Jalview2XML // and make a note of any group association if (an[i].getGroupRef() != null && an[i].getGroupRef().length() > 0) { - List aal = groupAnnotRefs + List aal = groupAnnotRefs .get(an[i].getGroupRef()); if (aal == null) { - aal = new ArrayList(); + aal = new ArrayList(); groupAnnotRefs.put(an[i].getGroupRef(), aal); } aal.add(jaa); @@ -3968,7 +3972,7 @@ public class Jalview2XML String pdbFile = filedat.getFilePath(); SequenceI[] seq = filedat.getSeqList().toArray(new SequenceI[0]); binding.getSsm().setMapping(seq, null, pdbFile, - jalview.io.AppletFormatAdapter.FILE); + AppletFormatAdapter.FILE); binding.addSequenceForStructFile(pdbFile, seq); } // and add the AlignmentPanel's reference to the view panel @@ -4593,7 +4597,7 @@ public class Jalview2XML List remains = new ArrayList(visan.keySet()); for (int h = 0; h < hSize; h++) { - jalview.datamodel.AlignmentAnnotation jalan = al + AlignmentAnnotation jalan = al .getAlignmentAnnotation()[h]; if (jalan.autoCalculated) { @@ -4839,8 +4843,8 @@ public class Jalview2XML if (sq != dsq) { // StringBuffer sb = new StringBuffer(); - String newres = jalview.analysis.AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, sq.getSequenceAsString()); + String newres = AlignSeq.extractGaps( + Comparison.GapChars, sq.getSequenceAsString()); if (!newres.equalsIgnoreCase(dsq.getSequenceAsString()) && newres.length() > dsq.getLength()) { @@ -5024,7 +5028,7 @@ public class Jalview2XML seqRefIds.put(sqid, djs); } - jalview.bin.Cache.log.debug("about to recurse on addDBRefs."); + Cache.log.debug("about to recurse on addDBRefs."); addDBRefs(djs, ms); } @@ -5202,7 +5206,7 @@ public class Jalview2XML seqRefIds.put(jv2vobj.get(jvobj).toString(), (SequenceI) jvobj); seqsToIds.put((SequenceI) jvobj, id); } - else if (jvobj instanceof jalview.datamodel.AlignmentAnnotation) + else if (jvobj instanceof AlignmentAnnotation) { String anid; AlignmentAnnotation jvann = (AlignmentAnnotation) jvobj; diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index cb572cd..51db9df 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.analysis.Conservation; import jalview.binding.Annotation; import jalview.binding.AnnotationElement; import jalview.binding.Features; @@ -34,10 +35,12 @@ import jalview.binding.Setting; import jalview.binding.Tree; import jalview.binding.UserColours; import jalview.binding.Viewport; +import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.PDBEntry; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; import jalview.schemes.ResidueProperties; +import jalview.schemes.UserColourScheme; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.util.jarInputStreamProvider; @@ -73,8 +76,7 @@ public class Jalview2XML_V1 this.raiseGUI = raiseGUI; }; - jalview.schemes.UserColourScheme GetUserColourScheme( - JalviewModelSequence jms, String id) + UserColourScheme GetUserColourScheme(JalviewModelSequence jms, String id) { UserColours[] uc = jms.getUserColours(); UserColours colours = null; @@ -98,7 +100,7 @@ public class Jalview2XML_V1 .getUserColourScheme().getColour(i).getRGB(), 16)); } - return new jalview.schemes.UserColourScheme(newColours); + return new UserColourScheme(newColours); } /** @@ -110,7 +112,7 @@ public class Jalview2XML_V1 public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider) { final String file = jprovider.getFilename(); - jalview.gui.AlignFrame af = null; + AlignFrame af = null; try { @@ -281,17 +283,17 @@ public class Jalview2XML_V1 ae[aa].getValue()); } - jalview.datamodel.AlignmentAnnotation jaa = null; + AlignmentAnnotation jaa = null; if (an[i].getGraph()) { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + jaa = new AlignmentAnnotation(an[i].getLabel(), an[i].getDescription(), anot, 0, 0, - jalview.datamodel.AlignmentAnnotation.BAR_GRAPH); + AlignmentAnnotation.BAR_GRAPH); } else { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + jaa = new AlignmentAnnotation(an[i].getLabel(), an[i].getDescription(), anot); } @@ -361,7 +363,7 @@ public class Jalview2XML_V1 if (groups[i].getConsThreshold() != 0) { - jalview.analysis.Conservation c = new jalview.analysis.Conservation( + Conservation c = new Conservation( "All", ResidueProperties.propHash, 3, sg.getSequences(null), 0, sg.getWidth() - 1); c.calculate(); diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java index 319c283..c8b42c6 100644 --- a/src/jalview/gui/OOMWarning.java +++ b/src/jalview/gui/OOMWarning.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.util.MessageManager; import java.awt.Component; @@ -54,9 +55,9 @@ public class OOMWarning implements Runnable desktop = instance; if (oomex != null) { - if (jalview.bin.Cache.log != null) + if (Cache.log != null) { - jalview.bin.Cache.log + Cache.log .error("Out of Memory when " + action, oomex); } else diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 609e010..bd9e241 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.datamodel.SequenceI; import jalview.renderer.AnnotationRenderer; import java.awt.Color; @@ -291,7 +292,7 @@ public class OverviewPanel extends JPanel implements Runnable int lastcol = -1, lastrow = -1; int color = Color.white.getRGB(); int row, col; - jalview.datamodel.SequenceI seq; + SequenceI seq; final boolean hasHiddenRows = av.hasHiddenRows(), hasHiddenCols = av .hasHiddenColumns(); boolean hiddenRow = false; diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index f4fd70b..f5f6332 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -20,6 +20,19 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SeqCigar; +import jalview.datamodel.SequenceI; +import jalview.jbgui.GPCAPanel; +import jalview.schemes.ResidueProperties; +import jalview.util.ImageMaker; +import jalview.util.MessageManager; +import jalview.viewmodel.AlignmentViewport; +import jalview.viewmodel.PCAModel; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; @@ -37,17 +50,6 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JRadioButtonMenuItem; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentView; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.SeqCigar; -import jalview.datamodel.SequenceI; -import jalview.jbgui.GPCAPanel; -import jalview.schemes.ResidueProperties; -import jalview.util.MessageManager; -import jalview.viewmodel.AlignmentViewport; -import jalview.viewmodel.PCAModel; - /** * DOCUMENT ME! * @@ -347,7 +349,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, // make this an abstract function of all jalview analysis windows if (pcaModel.getSeqtrings() == null) { - jalview.bin.Cache.log + Cache.log .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); return; } @@ -464,7 +466,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, */ public void eps_actionPerformed(ActionEvent e) { - makePCAImage(jalview.util.ImageMaker.TYPE.EPS); + makePCAImage(ImageMaker.TYPE.EPS); } /** @@ -475,33 +477,31 @@ public class PCAPanel extends GPCAPanel implements Runnable, */ public void png_actionPerformed(ActionEvent e) { - makePCAImage(jalview.util.ImageMaker.TYPE.PNG); + makePCAImage(ImageMaker.TYPE.PNG); } - void makePCAImage(jalview.util.ImageMaker.TYPE type) + void makePCAImage(ImageMaker.TYPE type) { int width = rc.getWidth(); int height = rc.getHeight(); - jalview.util.ImageMaker im; + ImageMaker im; - if (type == jalview.util.ImageMaker.TYPE.PNG) + if (type == ImageMaker.TYPE.PNG) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.PNG, + im = new ImageMaker(this, ImageMaker.TYPE.PNG, "Make PNG image from PCA", width, height, null, null); } - else if (type == jalview.util.ImageMaker.TYPE.EPS) + else if (type == ImageMaker.TYPE.EPS) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.EPS, + im = new ImageMaker(this, ImageMaker.TYPE.EPS, "Make EPS file from PCA", width, height, null, this.getTitle()); } else { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA", + im = new ImageMaker(this, ImageMaker.TYPE.SVG, + "Make SVG file from PCA", width, height, null, this.getTitle()); } diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index 2c65a49..292b970 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -25,6 +25,7 @@ import jalview.datamodel.Alignment; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.jbgui.GPairwiseAlignPanel; +import jalview.util.Format; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; @@ -112,8 +113,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel for (int i = 0; i < count; i++) { - jalview.util.Format.print(System.out, "%s \n", ("" + i) + " " - + seqs[i].getName()); + Format.print(System.out, "%s \n", + ("" + i) + " " + seqs[i].getName()); } System.out.println("\n"); @@ -122,8 +123,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel { for (int j = 0; j < i; j++) { - jalview.util.Format.printDouble(System.out, "%7.3f", scores[i][j] - / totscore); + Format.printDouble(System.out, "%7.3f", scores[i][j] / totscore); } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index ad3d6af..c9d9e50 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -20,31 +20,11 @@ */ package jalview.gui; -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Arrays; -import java.util.Collections; -import java.util.Hashtable; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.Vector; - -import javax.swing.ButtonGroup; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JColorChooser; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButtonMenuItem; - import jalview.analysis.AAFrequency; import jalview.analysis.AlignmentAnnotationUtils; import jalview.analysis.AlignmentUtils; import jalview.analysis.Conservation; +import jalview.bin.Cache; import jalview.commands.ChangeCaseCommand; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; @@ -58,7 +38,9 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; import jalview.io.FormatAdapter; +import jalview.io.JalviewFileChooser; import jalview.io.SequenceAnnotationReport; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.Blosum62ColourScheme; @@ -75,10 +57,35 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; +import jalview.util.BrowserLauncher; +import jalview.util.DBRefUtils; import jalview.util.GroupUrlLink; import jalview.util.GroupUrlLink.UrlStringTooLongException; import jalview.util.MessageManager; import jalview.util.UrlLink; +import jalview.ws.DBRefFetcher; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.Vector; + +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JColorChooser; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButtonMenuItem; /** * DOCUMENT ME! @@ -263,10 +270,10 @@ public class PopupMenu extends JPopupMenu colours.add(purinePyrimidineColour); colours.add(RNAInteractionColour); - for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++) + for (int i = 0; i < FormatAdapter.WRITEABLE_FORMATS.length; i++) { JMenuItem item = new JMenuItem( - jalview.io.FormatAdapter.WRITEABLE_FORMATS[i]); + FormatAdapter.WRITEABLE_FORMATS[i]); item.addActionListener(new java.awt.event.ActionListener() { @@ -618,14 +625,14 @@ public class PopupMenu extends JPopupMenu urlLink = new UrlLink(link); } catch (Exception foo) { - jalview.bin.Cache.log.error("Exception for URLLink '" + link + Cache.log.error("Exception for URLLink '" + link + "'", foo); continue; } ; if (!urlLink.isValid()) { - jalview.bin.Cache.log.error(urlLink.getInvalidMessage()); + Cache.log.error(urlLink.getInvalidMessage()); continue; } final String label = urlLink.getLabel(); @@ -633,7 +640,7 @@ public class PopupMenu extends JPopupMenu { // collect matching db-refs - DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] dbr = DBRefUtils.selectRefs( seq.getDBRef(), new String[] { urlLink.getTarget() }); // collect id string too @@ -896,7 +903,7 @@ public class PopupMenu extends JPopupMenu { for (int d = 0; d < dbr.length; d++) { - String src = dbr[d].getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(); + String src = dbr[d].getSource(); // DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(); Object[] sarray = (Object[]) commonDbrefs.get(src); if (sarray == null) { @@ -932,20 +939,20 @@ public class PopupMenu extends JPopupMenu urlLink = new GroupUrlLink(link); } catch (Exception foo) { - jalview.bin.Cache.log.error("Exception for GroupURLLink '" + link + Cache.log.error("Exception for GroupURLLink '" + link + "'", foo); continue; } ; if (!urlLink.isValid()) { - jalview.bin.Cache.log.error(urlLink.getInvalidMessage()); + Cache.log.error(urlLink.getInvalidMessage()); continue; } final String label = urlLink.getLabel(); boolean usingNames = false; // Now see which parts of the group apply for this URL - String ltarget = urlLink.getTarget(); // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget()); + String ltarget = urlLink.getTarget(); // DBRefUtils.getCanonicalName(urlLink.getTarget()); Object[] idset = (Object[]) commonDbrefs.get(ltarget.toUpperCase()); String[] seqstr, ids; // input to makeUrl if (idset != null) @@ -1452,9 +1459,9 @@ public class PopupMenu extends JPopupMenu } colourMenu.add(userDefinedColour); - if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null) + if (UserDefinedColours.getUserColourSchemes() != null) { - java.util.Enumeration userColours = jalview.gui.UserDefinedColours + Enumeration userColours = UserDefinedColours .getUserColourSchemes().keys(); while (userColours.hasMoreElements()) @@ -2292,7 +2299,7 @@ public class PopupMenu extends JPopupMenu { try { - jalview.util.BrowserLauncher.openURL(url); + BrowserLauncher.openURL(url); } catch (Exception ex) { JOptionPane.showInternalMessageDialog(Desktop.desktop, @@ -2403,8 +2410,8 @@ public class PopupMenu extends JPopupMenu public void pdbFromFile_actionPerformed() { - jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + JalviewFileChooser chooser = new JalviewFileChooser( + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new jalview.io.JalviewFileView()); chooser.setDialogTitle(MessageManager.formatMessage( "label.select_pdb_file_for", new Object[] @@ -2415,12 +2422,12 @@ public class PopupMenu extends JPopupMenu int value = chooser.showOpenDialog(null); - if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION) + if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + Cache.setProperty("LAST_DIRECTORY", choice); new AssociatePdbFileWithSeq().associatePdbWithSeq(choice, - jalview.io.AppletFormatAdapter.FILE, sequence, true, + AppletFormatAdapter.FILE, sequence, true, Desktop.instance); } @@ -2454,7 +2461,7 @@ public class PopupMenu extends JPopupMenu public void run() { - new jalview.ws.DBRefFetcher(sequences, ap.alignFrame) + new DBRefFetcher(sequences, ap.alignFrame) .fetchDBRefs(false); } diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 67e0f83..4c5e83f 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -20,6 +20,20 @@ */ package jalview.gui; +import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; +import jalview.bin.Cache; +import jalview.gui.Help.HelpId; +import jalview.gui.StructureViewer.ViewerType; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.io.PIRFile; +import jalview.jbgui.GPreferences; +import jalview.jbgui.GSequenceLink; +import jalview.schemes.ColourSchemeProperty; +import jalview.util.BrowserLauncher; +import jalview.util.MessageManager; +import jalview.util.Platform; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -42,17 +56,6 @@ import javax.swing.JPanel; import ext.edu.ucsf.rbvi.strucviz2.StructureManager; -import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; -import jalview.bin.Cache; -import jalview.gui.Help.HelpId; -import jalview.gui.StructureViewer.ViewerType; -import jalview.io.JalviewFileChooser; -import jalview.io.JalviewFileView; -import jalview.jbgui.GPreferences; -import jalview.jbgui.GSequenceLink; -import jalview.schemes.ColourSchemeProperty; -import jalview.util.MessageManager; - /** * DOCUMENT ME! * @@ -175,7 +178,7 @@ public class Preferences extends GPreferences wsPrefs = new WsPreferences(); wsTab.add(wsPrefs, BorderLayout.CENTER); int width = 500, height = 450; - if (new jalview.util.Platform().isAMac()) + if (Platform.isAMac()) { width = 570; height = 480; @@ -511,7 +514,7 @@ public class Preferences extends GPreferences */ Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText()); - jalview.util.BrowserLauncher.resetBrowser(); + BrowserLauncher.resetBrowser(); if (nameLinks.size() > 0) { @@ -589,7 +592,7 @@ public class Preferences extends GPreferences Boolean.toString(pirjv.isSelected())); Cache.applicationProperties.setProperty("PIR_MODELLER", Boolean.toString(modellerOutput.isSelected())); - jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected(); + PIRFile.useModellerOutput = modellerOutput.isSelected(); Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH", Boolean.toString(autoIdWidth.isSelected())); @@ -647,12 +650,12 @@ public class Preferences extends GPreferences public void startupFileTextfield_mouseClicked() { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), + Cache.getProperty("LAST_DIRECTORY"), new String[] { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "jar" }, new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" }, - jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT")); + Cache.getProperty("DEFAULT_FILE_FORMAT")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.select_startup_file")); @@ -660,7 +663,7 @@ public class Preferences extends GPreferences if (value == JalviewFileChooser.APPROVE_OPTION) { - jalview.bin.Cache.applicationProperties.setProperty( + Cache.applicationProperties.setProperty( "DEFAULT_FILE_FORMAT", chooser.getSelectedFormat()); startupFileTextfield.setText(chooser.getSelectedFile() .getAbsolutePath()); diff --git a/src/jalview/gui/PromptUserConfig.java b/src/jalview/gui/PromptUserConfig.java index 7655251..41b082c 100644 --- a/src/jalview/gui/PromptUserConfig.java +++ b/src/jalview/gui/PromptUserConfig.java @@ -91,7 +91,7 @@ public class PromptUserConfig implements Runnable * @param desktop * - where the dialog box will be shown * @param property - * - boolean property in jalview.bin.Cache + * - boolean property in Cache * @param dialogTitle * - title of prompt box * @param dialogText @@ -127,14 +127,14 @@ public class PromptUserConfig implements Runnable return; } // First - check to see if wee have an old questionnaire/response id pair. - String lastq = jalview.bin.Cache.getProperty(property); + String lastq = Cache.getProperty(property); if (lastq == null) { raiseDialog(); Cache.log.debug("Got user response."); } - lastq = jalview.bin.Cache.getProperty(property); + lastq = Cache.getProperty(property); String extype = ""; Exception e = null; if (lastq == null) @@ -194,9 +194,9 @@ public class PromptUserConfig implements Runnable */ private void raiseDialog() { - if (jalview.bin.Cache.log.isDebugEnabled()) + if (Cache.log.isDebugEnabled()) { - jalview.bin.Cache.log.debug("Prompting user for " + dialogTitle + Cache.log.debug("Prompting user for " + dialogTitle + " for Cache property " + property); } try @@ -214,36 +214,36 @@ public class PromptUserConfig implements Runnable Desktop.instance.relayerWindows(); } // and finish parsing the result - jalview.bin.Cache.log.debug("Got response : " + reply); + Cache.log.debug("Got response : " + reply); if (reply == JOptionPane.YES_OPTION) { - jalview.bin.Cache.setProperty(property, "true"); + Cache.setProperty(property, "true"); } else if (reply == JOptionPane.NO_OPTION) { if (removeifunset) { - jalview.bin.Cache.removeProperty(property); + Cache.removeProperty(property); } else { - jalview.bin.Cache.setProperty(property, "false"); + Cache.setProperty(property, "false"); } } else { - jalview.bin.Cache.log.debug("User cancelled setting " + property); + Cache.log.debug("User cancelled setting " + property); return; } // verify the property is set for debugging - if (jalview.bin.Cache.log.isDebugEnabled()) + if (Cache.log.isDebugEnabled()) { - jalview.bin.Cache.log.debug("User set property to " - + jalview.bin.Cache.getProperty(property)); + Cache.log.debug("User set property to " + + Cache.getProperty(property)); } } catch (Exception e) { - jalview.bin.Cache.log.warn( + Cache.log.warn( "Unexpected exception when prompting user for yes/no setting for property " + property, e); } diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index 8a77329..cf01ab6 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -24,6 +24,7 @@ import jalview.io.packed.DataProvider.JvDataType; import jalview.jbgui.GRestServiceEditorPane; import jalview.util.MessageManager; import jalview.ws.rest.InputType; +import jalview.ws.rest.RestClient; import jalview.ws.rest.RestServiceDescription; import java.awt.BorderLayout; @@ -54,13 +55,13 @@ public class RestServiceEditorPane extends GRestServiceEditorPane /** * the latest version of the service definition. */ - jalview.ws.rest.RestServiceDescription currentservice = null; + RestServiceDescription currentservice = null; /** * original service passed to editor if we are modifying an existing service * definition */ - jalview.ws.rest.RestServiceDescription oldservice = null; + RestServiceDescription oldservice = null; public RestServiceEditorPane() { @@ -474,8 +475,7 @@ public class RestServiceEditorPane extends GRestServiceEditorPane df.getContentPane().setLayout(new BorderLayout()); df.getContentPane().add( (nulserv = !nulserv) ? new RestServiceEditorPane( - jalview.ws.rest.RestClient - .makeShmmrRestClient() + RestClient.makeShmmrRestClient() .getRestDescription()) : new RestServiceEditorPane(), BorderLayout.CENTER); diff --git a/src/jalview/gui/SVGOptions.java b/src/jalview/gui/SVGOptions.java index c3bdc70..fb4287c 100644 --- a/src/jalview/gui/SVGOptions.java +++ b/src/jalview/gui/SVGOptions.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -140,11 +141,11 @@ public class SVGOptions extends JPanel if (!askAgain.isSelected()) { - jalview.bin.Cache.applicationProperties.remove("SVG_RENDERING"); + Cache.applicationProperties.remove("SVG_RENDERING"); } else { - jalview.bin.Cache.setProperty("SVG_RENDERING", value); + Cache.setProperty("SVG_RENDERING", value); } dialog.setVisible(false); diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 4c04ad3..2feba14 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -24,6 +24,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.util.Comparison; import java.awt.BasicStroke; import java.awt.BorderLayout; @@ -181,7 +182,7 @@ public class SeqCanvas extends JComponent while (index < endx) { - if (jalview.util.Comparison.isGap(seq.getCharAt(index))) + if (Comparison.isGap(seq.getCharAt(index))) { index++; @@ -234,7 +235,7 @@ public class SeqCanvas extends JComponent while (index > startx) { - if (jalview.util.Comparison.isGap(seq.getCharAt(index))) + if (Comparison.isGap(seq.getCharAt(index))) { index--; diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e34a864..875b3a7 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -20,24 +20,8 @@ */ package jalview.gui; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseWheelEvent; -import java.awt.event.MouseWheelListener; -import java.util.List; -import java.util.Vector; - -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.ToolTipManager; - import jalview.api.AlignViewportI; +import jalview.bin.Cache; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; import jalview.commands.EditCommand.Edit; @@ -60,6 +44,23 @@ import jalview.util.MappingUtils; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.util.List; +import java.util.Vector; + +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.ToolTipManager; + /** * DOCUMENT ME! * @@ -1141,7 +1142,7 @@ public class SeqPanel extends JPanel implements MouseListener, { for (int j = 0; j < startres - lastres; j++) { - if (!jalview.util.Comparison.isGap(groupSeqs[g] + if (!Comparison.isGap(groupSeqs[g] .getCharAt(fixedRight - j))) { blank = false; @@ -1204,7 +1205,7 @@ public class SeqPanel extends JPanel implements MouseListener, continue; } - if (!jalview.util.Comparison.isGap(groupSeqs[g].getCharAt(j))) + if (!Comparison.isGap(groupSeqs[g].getCharAt(j))) { // Not a gap, block edit not valid endEditing(); @@ -1339,7 +1340,7 @@ public class SeqPanel extends JPanel implements MouseListener, for (blankColumn = fixedColumn; blankColumn > j; blankColumn--) { - if (jalview.util.Comparison.isGap(seq[s].getCharAt(blankColumn))) + if (Comparison.isGap(seq[s].getCharAt(blankColumn))) { // Theres a space, so break and insert the gap break; @@ -1585,7 +1586,7 @@ public class SeqPanel extends JPanel implements MouseListener, } } - jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(ap, null, links); + PopupMenu pop = new PopupMenu(ap, null, links); pop.show(this, evt.getX(), evt.getY()); return; } @@ -1927,7 +1928,7 @@ public class SeqPanel extends JPanel implements MouseListener, { if (av.getAlignment() == null) { - jalview.bin.Cache.log.warn("alignviewport av SeqSetId=" + Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId() + " ViewId=" + av.getViewId() + " 's alignment is NULL! returning immediately."); return; diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index c330a92..1561ecc 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; @@ -29,7 +30,9 @@ import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.util.DBRefUtils; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.ws.dbsources.das.api.DasSourceRegistryI; +import jalview.ws.dbsources.das.datamodel.DasSequenceSource; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -155,9 +158,9 @@ public class SequenceFetcher extends JPanel implements Runnable } } if (sfetch == null - || dasRegistry != jalview.bin.Cache.getDasSourceRegistry() - || lastDasSourceRegistry != (jalview.bin.Cache - .getDasSourceRegistry().getDasRegistryURL() + jalview.bin.Cache + || dasRegistry != Cache.getDasSourceRegistry() + || lastDasSourceRegistry != (Cache + .getDasSourceRegistry().getDasRegistryURL() + Cache .getDasSourceRegistry().getLocalSourceString()) .hashCode()) { @@ -171,7 +174,7 @@ public class SequenceFetcher extends JPanel implements Runnable guiWindow.setProgressBar(MessageManager.getString("status.init_sequence_database_fetchers"), Thread.currentThread().hashCode()); } - dasRegistry = jalview.bin.Cache.getDasSourceRegistry(); + dasRegistry = Cache.getDasSourceRegistry(); dasRegistry.refreshSources(); jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher(); @@ -260,7 +263,7 @@ public class SequenceFetcher extends JPanel implements Runnable frame = new JInternalFrame(); frame.setContentPane(this); - if (new jalview.util.Platform().isAMac()) + if (Platform.isAMac()) { Desktop.addInternalFrame(frame, getFrameTitle(), 400, 240); } @@ -408,7 +411,7 @@ public class SequenceFetcher extends JPanel implements Runnable boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); for (DbSourceProxy dbs : database.getSelectedSources()) { - if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) + if (dbs instanceof DasSequenceSource) { enablePunct = false; break; @@ -484,21 +487,21 @@ public class SequenceFetcher extends JPanel implements Runnable error += "Please select the source database\n"; } // TODO: make this transformation more configurable - com.stevesoft.pat.Regex empty; + Regex empty; if (replacePunctuation.isEnabled() && replacePunctuation.isSelected()) { - empty = new com.stevesoft.pat.Regex( + empty = new Regex( // replace commas and spaces with a semicolon "(\\s|[,; ])+", ";"); } else { // just turn spaces and semicolons into single semicolons - empty = new com.stevesoft.pat.Regex("(\\s|[; ])+", ";"); + empty = new Regex("(\\s|[; ])+", ";"); } textArea.setText(empty.replaceAll(textArea.getText())); // see if there's anthing to search with - if (!new com.stevesoft.pat.Regex("[A-Za-z0-9_.]").search(textArea + if (!new Regex("[A-Za-z0-9_.]").search(textArea .getText())) { error += "Please enter a (semi-colon separated list of) database id(s)"; @@ -579,7 +582,7 @@ public class SequenceFetcher extends JPanel implements Runnable } } catch (Exception e) { - jalview.bin.Cache.log.info("Error retrieving " + item + Cache.log.info("Error retrieving " + item + " from " + proxy.getDbName(), e); nextfetch.add(item); } @@ -856,7 +859,7 @@ public class SequenceFetcher extends JPanel implements Runnable try { - af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", + af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN", false)); } catch (Exception ex) { diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 21286ad..aca07b7 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -24,6 +24,7 @@ import jalview.api.FeatureRenderer; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.schemes.ColourSchemeI; +import jalview.util.Comparison; import java.awt.Color; import java.awt.FontMetrics; @@ -150,7 +151,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer resBoxColour = cs.findColour(seq.getCharAt(i), i, seq); } else if (forOverview - && !jalview.util.Comparison.isGap(seq.getCharAt(i))) + && !Comparison.isGap(seq.getCharAt(i))) { resBoxColour = Color.lightGray; } @@ -334,7 +335,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer getboxColour = false; s = seq.getCharAt(i); - if (!renderGaps && jalview.util.Comparison.isGap(s)) + if (!renderGaps && Comparison.isGap(s)) { continue; } diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java index 16ec9d9..21fbd41 100755 --- a/src/jalview/gui/SplashScreen.java +++ b/src/jalview/gui/SplashScreen.java @@ -283,26 +283,26 @@ public class SplashScreen extends JPanel implements Runnable, /* * int y = yoffset; * - * g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50, + * g.drawString("Jalview " + Cache.getProperty("VERSION"), 50, * y); * * FontMetrics fm = g.getFontMetrics(); int vwidth = - * fm.stringWidth("Jalview " + jalview.bin.Cache.getProperty("VERSION")); + * fm.stringWidth("Jalview " + Cache.getProperty("VERSION")); * g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2)); g.drawString( - * "Last updated: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"), - * 50 + vwidth + 5, y); if (jalview.bin.Cache.getDefault("LATEST_VERSION", + * "Last updated: " + Cache.getDefault("BUILD_DATE", "unknown"), + * 50 + vwidth + 5, y); if (Cache.getDefault("LATEST_VERSION", * "Checking").equals( "Checking")) { // Displayed when code version and * jnlp version do not match g.drawString("...Checking latest version...", * 50, y += fontSize + 10); y += 5; g.setColor(Color.black); } else if - * (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking") - * .equals(jalview.bin.Cache.getProperty("VERSION"))) { if - * (jalview.bin.Cache.getProperty("VERSION").toLowerCase() + * (!Cache.getDefault("LATEST_VERSION", "Checking") + * .equals(Cache.getProperty("VERSION"))) { if + * (Cache.getProperty("VERSION").toLowerCase() * .indexOf("automated build") == -1) { // Displayed when code version and * jnlp version do not match and code // version is not a development build * g.setColor(Color.red); } g.drawString( "!! Jalview version " + - * jalview.bin.Cache.getDefault("LATEST_VERSION", "..Checking..") + + * Cache.getDefault("LATEST_VERSION", "..Checking..") + * " is available for download from " - * +jalview.bin.Cache.getDefault("www.jalview.org" + * +Cache.getDefault("www.jalview.org" * ,"http://www.jalview.org")+" !!", 50, y += fontSize + 10); y += 5; * g.setColor(Color.black); } * diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 2e3b37a..afadbea 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -22,6 +22,23 @@ package jalview.gui; +import jalview.bin.Cache; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.jbgui.GStructureChooser; +import jalview.jbgui.PDBDocFieldPreferences; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; +import jalview.ws.dbsources.PDBRestClient; +import jalview.ws.dbsources.PDBRestClient.PDBDocField; +import jalview.ws.uimodel.PDBRestRequest; +import jalview.ws.uimodel.PDBRestResponse; +import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary; + import java.awt.event.ItemEvent; import java.util.ArrayList; import java.util.Collection; @@ -36,19 +53,6 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.jbgui.GStructureChooser; -import jalview.jbgui.PDBDocFieldPreferences; -import jalview.structure.StructureSelectionManager; -import jalview.util.MessageManager; -import jalview.ws.dbsources.PDBRestClient; -import jalview.ws.dbsources.PDBRestClient.PDBDocField; -import jalview.ws.uimodel.PDBRestRequest; -import jalview.ws.uimodel.PDBRestResponse; -import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary; - /** * Provides the behaviors for the Structure chooser Panel @@ -446,9 +450,9 @@ public class StructureChooser extends GStructureChooser */ public void pdbFromFile_actionPerformed() { - jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); - chooser.setFileView(new jalview.io.JalviewFileView()); + JalviewFileChooser chooser = new JalviewFileChooser( + Cache.getProperty("LAST_DIRECTORY")); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.formatMessage( "label.select_pdb_file_for", new String[] { selectedSequence.getDisplayId(false) })); @@ -457,10 +461,10 @@ public class StructureChooser extends GStructureChooser { selectedSequence.getDisplayId(false) })); int value = chooser.showOpenDialog(null); - if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION) + if (value == JalviewFileChooser.APPROVE_OPTION) { selectedPdbFileName = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName); + Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName); validateSelections(); } } @@ -733,7 +737,7 @@ public class StructureChooser extends GStructureChooser } PDBEntry fileEntry = new AssociatePdbFileWithSeq() .associatePdbWithSeq( - selectedPdbFileName, jalview.io.AppletFormatAdapter.FILE, + selectedPdbFileName, AppletFormatAdapter.FILE, selectedSequence, true, Desktop.instance); launchStructureViewer(ap.getStructureSelectionManager(), diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 7177e43..cbcea76 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -42,6 +42,7 @@ import jalview.io.JalviewFileView; import jalview.io.NewickFile; import jalview.jbgui.GTreePanel; import jalview.schemes.ResidueProperties; +import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; @@ -262,7 +263,7 @@ public class TreePanel extends GTreePanel { NewickFile newtree; - jalview.datamodel.AlignmentView odata = null; + AlignmentView odata = null; public TreeLoader(NewickFile newtree) { @@ -413,8 +414,7 @@ public class TreePanel extends GTreePanel buffer.append("PID"); } - jalview.io.NewickFile fout = new jalview.io.NewickFile( - tree.getTopNode()); + NewickFile fout = new NewickFile(tree.getTopNode()); try { cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(), @@ -437,7 +437,7 @@ public class TreePanel extends GTreePanel public void saveAsNewick_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_tree_as_newick")); chooser.setToolTipText(MessageManager.getString("action.save")); @@ -447,13 +447,12 @@ public class TreePanel extends GTreePanel if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser + Cache.setProperty("LAST_DIRECTORY", chooser .getSelectedFile().getParent()); try { - jalview.io.NewickFile fout = new jalview.io.NewickFile( - tree.getTopNode()); + NewickFile fout = new NewickFile(tree.getTopNode()); String output = fout.print(tree.isHasBootstrap(), tree.isHasDistances(), tree.isHasRootDistance()); java.io.PrintWriter out = new java.io.PrintWriter( @@ -483,7 +482,7 @@ public class TreePanel extends GTreePanel { if (!tree.hasOriginalSequenceData()) { - jalview.bin.Cache.log + Cache.log .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); return; } @@ -702,7 +701,7 @@ public class TreePanel extends GTreePanel { boolean accurateText = true; - String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING", + String renderStyle = Cache.getDefault("EPS_RENDERING", "Prompt each time"); // If we need to prompt, and if the GUI is visible then @@ -731,8 +730,8 @@ public class TreePanel extends GTreePanel try { - jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + JalviewFileChooser chooser = new JalviewFileChooser( + Cache.getProperty("LAST_DIRECTORY"), new String[] { "eps" }, new String[] { "Encapsulated Postscript" }, "Encapsulated Postscript"); chooser.setFileView(new jalview.io.JalviewFileView()); @@ -741,12 +740,12 @@ public class TreePanel extends GTreePanel int value = chooser.showSaveDialog(this); - if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION) + if (value != JalviewFileChooser.APPROVE_OPTION) { return; } - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser + Cache.setProperty("LAST_DIRECTORY", chooser .getSelectedFile().getParent()); FileOutputStream out = new FileOutputStream(chooser.getSelectedFile()); @@ -777,23 +776,23 @@ public class TreePanel extends GTreePanel try { - jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + JalviewFileChooser chooser = new JalviewFileChooser( + Cache.getProperty("LAST_DIRECTORY"), new String[] { "png" }, new String[] { "Portable network graphics" }, "Portable network graphics"); - chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.create_png_from_tree")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); - if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION) + if (value != JalviewFileChooser.APPROVE_OPTION) { return; } - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser + Cache.setProperty("LAST_DIRECTORY", chooser .getSelectedFile().getParent()); FileOutputStream out = new FileOutputStream(chooser.getSelectedFile()); @@ -836,7 +835,7 @@ public class TreePanel extends GTreePanel if (sq != null) { // search dbrefs, features and annotation - DBRefEntry[] refs = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] refs = DBRefUtils.selectRefs( sq.getDBRef(), new String[] { labelClass.toUpperCase() }); if (refs != null) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index a907187..b4a513e 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -20,6 +20,19 @@ */ package jalview.gui; +import jalview.api.structures.JalviewStructureDisplayI; +import jalview.bin.Cache; +import jalview.datamodel.SequenceGroup; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.jbgui.GUserDefinedColours; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ResidueProperties; +import jalview.schemes.UserColourScheme; +import jalview.util.ColorUtils; +import jalview.util.Format; +import jalview.util.MessageManager; + import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; @@ -40,16 +53,6 @@ import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import jalview.api.structures.JalviewStructureDisplayI; -import jalview.datamodel.SequenceGroup; -import jalview.io.JalviewFileChooser; -import jalview.jbgui.GUserDefinedColours; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.ResidueProperties; -import jalview.schemes.UserColourScheme; -import jalview.util.ColorUtils; -import jalview.util.MessageManager; - /** * This panel allows the user to assign colours to Amino Acid residue codes, and * save the colour scheme. @@ -585,10 +588,10 @@ public class UserDefinedColours extends GUserDefinedColours implements lowerCaseButtons = new ArrayList(); JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "jc" }, new String[] { "Jalview User Colours" }, "Jalview User Colours"); - chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager .getString("label.load_colour_scheme")); chooser.setToolTipText(MessageManager.getString("action.load")); @@ -598,8 +601,8 @@ public class UserDefinedColours extends GUserDefinedColours implements if (value == JalviewFileChooser.APPROVE_OPTION) { File choice = chooser.getSelectedFile(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent()); - String defaultColours = jalview.bin.Cache.getDefault( + Cache.setProperty("LAST_DIRECTORY", choice.getParent()); + String defaultColours = Cache.getDefault( "USER_DEFINED_COLOURS", choice.getPath()); if (defaultColours.indexOf(choice.getPath()) == -1) { @@ -607,7 +610,7 @@ public class UserDefinedColours extends GUserDefinedColours implements .concat(choice.getPath()); } - jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", defaultColours); + Cache.setProperty("USER_DEFINED_COLOURS", defaultColours); UserColourScheme ucs = loadColours(choice.getAbsolutePath()); Color[] colors = ucs.getColours(); @@ -650,7 +653,7 @@ public class UserDefinedColours extends GUserDefinedColours implements { UserColourScheme ret = null; - String colours = jalview.bin.Cache.getProperty("USER_DEFINED_COLOURS"); + String colours = Cache.getProperty("USER_DEFINED_COLOURS"); if (colours != null) { if (colours.indexOf("|") > -1) @@ -822,11 +825,11 @@ public class UserDefinedColours extends GUserDefinedColours implements userColourSchemes.remove(schemeName.getText()); } JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + Cache.getProperty("LAST_DIRECTORY"), new String[] { "jc" }, new String[] { "Jalview User Colours" }, "Jalview User Colours"); - chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_colour_scheme")); chooser.setToolTipText(MessageManager.getString("action.save")); @@ -835,7 +838,7 @@ public class UserDefinedColours extends GUserDefinedColours implements if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - String defaultColours = jalview.bin.Cache.getDefault( + String defaultColours = Cache.getDefault( "USER_DEFINED_COLOURS", choice); if (defaultColours.indexOf(choice) == -1) { @@ -850,7 +853,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ap.alignFrame.updateUserColourMenu(); - jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", defaultColours); + Cache.setProperty("USER_DEFINED_COLOURS", defaultColours); jalview.schemabinding.version2.JalviewUserColours ucs = new jalview.schemabinding.version2.JalviewUserColours(); @@ -865,8 +868,7 @@ public class UserDefinedColours extends GUserDefinedColours implements JButton button = (JButton) buttonPanel.getComponent(i); jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); col.setName(button.getText()); - col.setRGB(jalview.util.Format.getHexString(button - .getBackground())); + col.setRGB(Format.getHexString(button.getBackground())); ucs.addColour(col); } @@ -958,12 +960,12 @@ public class UserDefinedColours extends GUserDefinedColours implements { if (coloursFound.toString().length() > 1) { - jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", + Cache.setProperty("USER_DEFINED_COLOURS", coloursFound.toString()); } else { - jalview.bin.Cache.applicationProperties + Cache.applicationProperties .remove("USER_DEFINED_COLOURS"); } } @@ -979,7 +981,7 @@ public class UserDefinedColours extends GUserDefinedColours implements StringBuffer coloursFound = new StringBuffer(); StringTokenizer st = new StringTokenizer( - jalview.bin.Cache.getProperty("USER_DEFINED_COLOURS"), "|"); + Cache.getProperty("USER_DEFINED_COLOURS"), "|"); while (st.hasMoreElements()) { @@ -1004,12 +1006,12 @@ public class UserDefinedColours extends GUserDefinedColours implements if (coloursFound.toString().length() > 1) { - jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", + Cache.setProperty("USER_DEFINED_COLOURS", coloursFound.toString()); } else { - jalview.bin.Cache.applicationProperties + Cache.applicationProperties .remove("USER_DEFINED_COLOURS"); } diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java index 02f6054..068e7cc 100644 --- a/src/jalview/gui/UserQuestionnaireCheck.java +++ b/src/jalview/gui/UserQuestionnaireCheck.java @@ -20,12 +20,15 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.util.BrowserLauncher; import jalview.util.MessageManager; -import java.io.*; -import java.net.*; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; -import javax.swing.*; +import javax.swing.JOptionPane; public class UserQuestionnaireCheck implements Runnable { @@ -41,7 +44,7 @@ public class UserQuestionnaireCheck implements Runnable { if (url.indexOf("questionnaire.pl") == -1) { - jalview.bin.Cache.log + Cache.log .error("'" + url + "' is an Invalid URL for the checkForQuestionnaire() method.\n" @@ -57,7 +60,7 @@ public class UserQuestionnaireCheck implements Runnable private boolean checkresponse(URL qurl) throws Exception { - jalview.bin.Cache.log.debug("Checking Response for : " + qurl); + Cache.log.debug("Checking Response for : " + qurl); boolean prompt = false; // see if we have already responsed to this questionnaire or get a new // qid/rid pair @@ -102,7 +105,7 @@ public class UserQuestionnaireCheck implements Runnable try { // First - check to see if wee have an old questionnaire/response id pair. - String lastq = jalview.bin.Cache.getProperty("QUESTIONNAIRE"); + String lastq = Cache.getProperty("QUESTIONNAIRE"); if (lastq == null) { prompt = checkresponse(new URL(url @@ -133,13 +136,13 @@ public class UserQuestionnaireCheck implements Runnable if (qid != null && rid != null) { // Update our local property cache with latest qid and rid - jalview.bin.Cache.setProperty("QUESTIONNAIRE", qid + ":" + rid); + Cache.setProperty("QUESTIONNAIRE", qid + ":" + rid); } if (prompt) { String qurl = url + (url.indexOf('?') > -1 ? "&" : "?") + "qid=" + qid + "&rid=" + rid; - jalview.bin.Cache.log.info("Prompting user for questionnaire at " + Cache.log.info("Prompting user for questionnaire at " + qurl); int reply = JOptionPane .showInternalConfirmDialog(Desktop.desktop, MessageManager @@ -151,13 +154,13 @@ public class UserQuestionnaireCheck implements Runnable if (reply == JOptionPane.YES_OPTION) { - jalview.bin.Cache.log.debug("Opening " + qurl); - jalview.util.BrowserLauncher.openURL(qurl); + Cache.log.debug("Opening " + qurl); + BrowserLauncher.openURL(qurl); } } } catch (Exception e) { - jalview.bin.Cache.log.warn("When trying to access questionnaire URL " + Cache.log.warn("When trying to access questionnaire URL " + url, e); } } diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index 6444667..38f1571 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -200,7 +200,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource } catch (Exception e) { - jalview.bin.Cache.log + Cache.log .error("Couldn't instantiate vamsas client !", e); return false; } @@ -243,7 +243,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource private ClientHandle getJalviewHandle() { return new ClientHandle("jalview.bin.Jalview", - jalview.bin.Cache.getProperty("VERSION")); + Cache.getProperty("VERSION")); } /** diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 8e78b93..3cafaf4 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -20,6 +20,10 @@ */ package jalview.gui; +import jalview.jbgui.GWebserviceInfo; +import jalview.util.MessageManager; +import jalview.ws.WSClientI; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; @@ -45,10 +49,6 @@ import javax.swing.event.HyperlinkListener; import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.StyleSheet; -import jalview.jbgui.GWebserviceInfo; -import jalview.util.MessageManager; -import jalview.ws.WSClientI; - /** * Base class for web service client thread and gui TODO: create StAX parser to * extract html body content reliably when preparing html formatted job statuses @@ -86,7 +86,7 @@ public class WebserviceInfo extends GWebserviceInfo implements String title = ""; - jalview.ws.WSClientI thisService; + WSClientI thisService; boolean serviceIsCancellable; @@ -265,7 +265,7 @@ public class WebserviceInfo extends GWebserviceInfo implements * * @return DOCUMENT ME! */ - public jalview.ws.WSClientI getthisService() + public WSClientI getthisService() { return thisService; } @@ -277,7 +277,7 @@ public class WebserviceInfo extends GWebserviceInfo implements * @param newservice * service client to query for capabilities */ - public void setthisService(jalview.ws.WSClientI newservice) + public void setthisService(WSClientI newservice) { thisService = newservice; serviceIsCancellable = newservice.isCancellable(); diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index a3a61b7..c1b09b7 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -20,6 +20,20 @@ */ package jalview.gui; +import jalview.gui.OptsAndParamsPage.OptionBox; +import jalview.gui.OptsAndParamsPage.ParamBox; +import jalview.util.MessageManager; +import jalview.ws.jws2.JabaParamStore; +import jalview.ws.jws2.JabaPreset; +import jalview.ws.jws2.Jws2Discoverer; +import jalview.ws.jws2.ParameterUtils; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; +import jalview.ws.params.OptionI; +import jalview.ws.params.ParamDatastoreI; +import jalview.ws.params.ParameterI; +import jalview.ws.params.WsParamSetI; + import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -66,19 +80,6 @@ import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; -import jalview.gui.OptsAndParamsPage.OptionBox; -import jalview.gui.OptsAndParamsPage.ParamBox; -import jalview.util.MessageManager; -import jalview.ws.jws2.JabaParamStore; -import jalview.ws.jws2.JabaPreset; -import jalview.ws.jws2.Jws2Discoverer; -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.ArgumentI; -import jalview.ws.params.OptionI; -import jalview.ws.params.ParamDatastoreI; -import jalview.ws.params.ParameterI; -import jalview.ws.params.WsParamSetI; - /** * job parameter editing/browsing dialog box. User can browse existing settings * (user + presets + Defaults), and any changes to parameters creates a modified @@ -952,8 +953,7 @@ public class WsJobParameters extends JPanel implements ItemListener, */ public static void main(String[] args) { - jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer - .getDiscoverer(); + Jws2Discoverer disc = Jws2Discoverer.getDiscoverer(); int p = 0; if (args.length > 0) { @@ -1021,7 +1021,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { try { - Option cpy = jalview.ws.jws2.ParameterUtils.copyOption(o); + Option cpy = ParameterUtils.copyOption(o); } catch (Exception e) { System.err.println("Failed to copy " + o.getName()); @@ -1041,7 +1041,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { try { - Parameter cpy = jalview.ws.jws2.ParameterUtils + Parameter cpy = ParameterUtils .copyParameter(o); } catch (Exception e) { @@ -1059,15 +1059,15 @@ public class WsJobParameters extends JPanel implements ItemListener, List writeparam = null, readparam = null; try { - writeparam = jalview.ws.jws2.ParameterUtils + writeparam = ParameterUtils .writeParameterSet( pr.getArguments(lastserv.getRunnerConfig()), " "); System.out.println("Testing param read :"); - List