import jalview.schemes.FeatureColour;
import jalview.schemes.ResidueProperties;
import jalview.schemes.UserColourScheme;
+import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.Format;
import jalview.util.MessageManager;
String fileName, JarOutputStream jout)
{
- // BH: Question: What is this Dataset for, as it seems to
- // duplicate the actual XML file data.
-
for (String dssids : dsses.keySet())
{
AlignFrame _af = dsses.get(dssids);
* only view *should* be coped with sensibly.
*/
// This must have been loaded, is it still visible?
- JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
String matchedFile = null;
for (int f = frames.length - 1; f > -1; f--)
{
{
// FIND ANY ASSOCIATED TREES
// NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT
- if (Desktop.getDesktopPane() != null)
+ if (Desktop.desktop != null)
{
- JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int t = 0; t < frames.length; t++)
{
/*
* save PCA viewers
*/
- if (!storeDS && Desktop.getDesktopPane() != null)
+ if (!storeDS && Desktop.desktop != null)
{
- for (JInternalFrame frame : Desktop.getDesktopPane().getAllFrames())
+ for (JInternalFrame frame : Desktop.desktop.getAllFrames())
{
if (frame instanceof PCAPanel)
{
// using save and then load
try
{
- fileName = fileName.replace('\\', '/');
+ fileName = fileName.replace('\\', '/');
System.out.println("Writing jar entry " + fileName);
JarEntry entry = new JarEntry(fileName);
jout.putNextEntry(entry);
final SequenceI jds, List<String> viewIds, AlignmentPanel ap,
boolean storeDataset)
{
- if (Desktop.getDesktopPane() == null)
+ if (Desktop.desktop == null)
{
return;
}
- JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int f = frames.length - 1; f > -1; f--)
{
if (frames[f] instanceof AppVarna)
if (calcIdParam.getVersion().equals("1.0"))
{
final String[] calcIds = calcIdParam.getServiceURL().toArray(new String[0]);
- Jws2Instance service = Jws2Discoverer.getInstance()
+ Jws2Instance service = Jws2Discoverer.getDiscoverer()
.getPreferredServiceFor(calcIds);
if (service != null)
{
return af;
}
- @SuppressWarnings("unused")
- private jarInputStreamProvider createjarInputStreamProvider(final Object ofile) throws MalformedURLException {
+ @SuppressWarnings("unused")
+ private jarInputStreamProvider createjarInputStreamProvider(final Object ofile) throws MalformedURLException {
- // BH 2018 allow for bytes already attached to File object
- try {
- String file = (ofile instanceof File ? ((File) ofile).getCanonicalPath() : ofile.toString());
+ // BH 2018 allow for bytes already attached to File object
+ try {
+ String file = (ofile instanceof File ? ((File) ofile).getCanonicalPath() : ofile.toString());
byte[] bytes = Platform.isJS() ? Platform.getFileBytes((File) ofile)
: null;
- URL url = null;
- errorMessage = null;
- uniqueSetSuffix = null;
- seqRefIds = null;
- viewportsAdded.clear();
- frefedSequence = null;
-
- if (file.startsWith("http://")) {
- url = new URL(file);
- }
- final URL _url = url;
- return new jarInputStreamProvider() {
-
- @Override
- public JarInputStream getJarInputStream() throws IOException {
- if (bytes != null) {
-// System.out.println("Jalview2XML: opening byte jarInputStream for bytes.length=" + bytes.length);
- return new JarInputStream(new ByteArrayInputStream(bytes));
- }
- if (_url != null) {
-// System.out.println("Jalview2XML: opening url jarInputStream for " + _url);
- return new JarInputStream(_url.openStream());
- } else {
-// System.out.println("Jalview2XML: opening file jarInputStream for " + file);
- return new JarInputStream(new FileInputStream(file));
- }
- }
-
- @Override
- public String getFilename() {
- return file;
- }
- };
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
+ URL url = null;
+ errorMessage = null;
+ uniqueSetSuffix = null;
+ seqRefIds = null;
+ viewportsAdded.clear();
+ frefedSequence = null;
+
+ if (file.startsWith("http://")) {
+ url = new URL(file);
+ }
+ final URL _url = url;
+ return new jarInputStreamProvider() {
+
+ @Override
+ public JarInputStream getJarInputStream() throws IOException {
+ if (bytes != null) {
+// System.out.println("Jalview2XML: opening byte jarInputStream for bytes.length=" + bytes.length);
+ return new JarInputStream(new ByteArrayInputStream(bytes));
+ }
+ if (_url != null) {
+// System.out.println("Jalview2XML: opening url jarInputStream for " + _url);
+ return new JarInputStream(_url.openStream());
+ } else {
+// System.out.println("Jalview2XML: opening file jarInputStream for " + file);
+ return new JarInputStream(new FileInputStream(file));
+ }
+ }
+
+ @Override
+ public String getFilename() {
+ return file;
+ }
+ };
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
/**
* Recover jalview session from a jalview project archive. Caller may
{
jarentry = jin.getNextJarEntry();
}
- String name = (jarentry == null ? null : jarentry.getName());
- if (name != null && name.endsWith(".xml")
- // The question here is what to do with the two
- // .xml files in the jvp file. They are identical?
- // && name.indexOf(" Dataset for ") < 0 // BH 2019.05.21
- // we need to talk about how to avoid the full duplication of
- // reading these.
- )
+
+ if (jarentry != null && jarentry.getName().endsWith(".xml"))
{
JAXBContext jc = JAXBContext
.newInstance("jalview.xml.binding.jalview");
{
// used to attempt to parse as V1 castor-generated xml
}
- if (Desktop.getInstance() != null)
+ if (Desktop.instance != null)
{
- Desktop.getInstance().stopLoading();
+ Desktop.instance.stopLoading();
}
if (af != null)
{
*/
for (AlignFrame fr : gatherToThisFrame.values())
{
- Desktop.getInstance().gatherViews(fr);
+ Desktop.instance.gatherViews(fr);
}
restoreSplitFrames();
{
if (ds.getCodonFrames() != null)
{
- Desktop.getInstance().getStructureSelectionManager()
+ StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance)
.registerMappings(ds.getCodonFrames());
}
}
reportErrors();
}
- if (Desktop.getInstance() != null)
+ if (Desktop.instance != null)
{
- Desktop.getInstance().stopLoading();
+ Desktop.instance.stopLoading();
}
return af;
*/
for (SplitFrame sf : gatherTo)
{
- Desktop.getInstance().gatherViews(sf);
+ Desktop.instance.gatherViews(sf);
}
splitFrameCandidates.clear();
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
finalErrorMessage,
"Error " + (saving ? "saving" : "loading")
+ " Jalview file",
{
entry.setProperty(prop.getName(), prop.getValue());
}
- Desktop.getInstance().getStructureSelectionManager()
+ StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance)
.registerPDBEntry(entry);
// adds PDBEntry to datasequence's set (since Jalview 2.10)
if (al.getSequenceAt(i).getDatasetSequence() != null)
int height = safeInt(structureState.getHeight());
// Probably don't need to do this anymore...
- // Desktop.getDesktop().getComponentAt(x, y);
+ // Desktop.desktop.getComponentAt(x, y);
// TODO: NOW: check that this recovers the PDB file correctly.
String pdbFile = loadPDBFile(jprovider, pdbid.getId(),
pdbid.getFile());
String reformatedOldFilename = oldfilenam.replaceAll("/", "\\\\");
filedat = oldFiles.get(new File(reformatedOldFilename));
}
- newFileLoc.append(Platform.escapeString(filedat.getFilePath()));
+ newFileLoc.append(Platform.escapeBackslashes(filedat.getFilePath()));
pdbfilenames.add(filedat.getFilePath());
pdbids.add(filedat.getPdbId());
seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0]));
{
try
{
- frames = Desktop.getDesktopPane().getAllFrames();
+ frames = Desktop.desktop.getAllFrames();
} catch (ArrayIndexOutOfBoundsException e)
{
// occasional No such child exceptions are thrown here...
af = new AlignFrame(al, safeInt(view.getWidth()),
safeInt(view.getHeight()), uniqueSeqSetId, viewId)
// {
-//
-// @Override
-// protected void processKeyEvent(java.awt.event.KeyEvent e) {
-// System.out.println("Jalview2XML AF " + e);
-// super.processKeyEvent(e);
-//
-// }
-//
+//
+// @Override
+// protected void processKeyEvent(java.awt.event.KeyEvent e) {
+// System.out.println("Jalview2XML AF " + e);
+// super.processKeyEvent(e);
+//
+// }
+//
// }
;
viewport.setViewName(view.getViewName());
af.setInitialTabVisible();
}
- int x = safeInt(view.getXpos());
- int y = safeInt(view.getYpos());
- int w = safeInt(view.getWidth());
- int h = safeInt(view.getHeight());
- // // BH we cannot let the title bar go off the top
- // if (Platform.isJS())
- // {
- // x = Math.max(50 - w, x);
- // y = Math.max(0, y);
- // }
-
- af.setBounds(x, y, w, h);
+ af.setBounds(safeInt(view.getXpos()), safeInt(view.getYpos()),
+ safeInt(view.getWidth()), safeInt(view.getHeight()));
// startSeq set in af.alignPanel.updateLayout below
af.alignPanel.updateLayout();
ColourSchemeI cs = null;
}
else
{
- featureOrder.put(featureType, new Float(
+ featureOrder.put(featureType, Float.valueOf(
fs / jm.getFeatureSettings().getSetting().size()));
}
if (safeBoolean(setting.isDisplay()))
for (int gs = 0; gs < jm.getFeatureSettings().getGroup().size(); gs++)
{
Group grp = jm.getFeatureSettings().getGroup().get(gs);
- fgtable.put(grp.getName(), new Boolean(grp.isDisplay()));
+ fgtable.put(grp.getName(), Boolean.valueOf(grp.isDisplay()));
}
// FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder,
// fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ?