<classpathentry kind="lib" path="lib/miglayout-4.0-swing.jar"/>
<classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
- <classpathentry kind="lib" path="lib/Jmol-12.2.4.jar" sourcepath="/Users/jimp/Documents/e6-workspace-new/Jmol/src"/>
- <classpathentry kind="lib" path="appletlib/JmolApplet-12.2.4.jar"/>
<classpathentry kind="lib" path="lib/jdas-1.0.4.jar"/>
<classpathentry kind="lib" path="lib/spring-core-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/spring-web-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/jetty-http-9.2.10.v20150310.jar"/>
<classpathentry kind="lib" path="lib/jetty-io-9.2.10.v20150310.jar"/>
<classpathentry kind="lib" path="lib/java-json.jar"/>
+ <classpathentry kind="lib" path="lib/Jmol-14.2.14_2015.06.11.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
<property name="packageDir" value="dist" />
<property name="outputJar" value="jalview.jar" />
<!-- Jalview Applet JMol Jar Dependency -->
- <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
+ <property name="jmolJar" value="JmolApplet-14.2.14_2015.06.01.jar" />
<property name="varnaJar" value="VARNAv3-91.jar" />
<property name="jsoup" value="jsoup-1.8.1.jar" />
<property name="jsonSimple" value="json_simple-1.1.jar" />
*/
package jalview.appletgui;
-import java.awt.BorderLayout;
-import java.awt.Canvas;
-import java.awt.CheckboxMenuItem;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Label;
-import java.awt.Menu;
-import java.awt.MenuBar;
-import java.awt.MenuItem;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Arrays;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
import jalview.analysis.AlignmentSorter;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.api.AlignViewControllerGuiI;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.jmol.viewer.Viewer;
+
public class AlignFrame extends EmbmenuFrame implements ActionListener,
ItemListener, KeyListener, AlignViewControllerGuiI
{
public SequenceStructureBinding addStructureViewInstance(
Object jmolviewer, String[] sequenceIds)
{
- org.jmol.api.JmolViewer viewer = null;
+ // TODO method never called - remove?
+ Viewer viewer = null;
try
{
- viewer = (org.jmol.api.JmolViewer) jmolviewer;
+ viewer = (Viewer) jmolviewer;
} catch (ClassCastException ex)
{
System.err.println("Unsupported viewer object :"
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JalviewJmolBinding;
import jalview.structure.StructureSelectionManager;
import java.awt.Container;
-import java.util.BitSet;
+import java.util.Map;
+
+import javajs.awt.Dimension;
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
-import org.jmol.popup.JmolPopup;
+import org.jmol.console.AppletConsole;
+import org.jmol.java.BS;
+import org.jmol.popup.JmolAwtPopup;
-class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
+class AppletJmolBinding extends JalviewJmolBinding
{
/**
appletJmolBinding = appletJmol;
}
+ @Override
public jalview.api.FeatureRenderer getFeatureRenderer(
AlignmentViewPanel alignment)
{
return appletJmolBinding.fr;
}
+ @Override
public jalview.api.SequenceRenderer getSequenceRenderer(
AlignmentViewPanel alignment)
{
return new SequenceRenderer(((AlignmentPanel) alignment).av);
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
if (appletJmolBinding.scriptWindow == null)
appletJmolBinding.history.append("\n" + strEcho);
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
if (appletJmolBinding.history != null && strStatus != null
}
}
+ @Override
public void showUrl(String url, String target)
{
appletJmolBinding.ap.alignFrame.showURL(url, target);
}
+ @Override
public void refreshGUI()
{
appletJmolBinding.updateTitleAndMenus();
public void newJmolPopup(boolean translateLocale, String menuName,
boolean asPopup)
{
+ jmolpopup = new JmolAwtPopup(); // is this used?
+ jmolpopup.jpiInitialize((viewer), menuName);
- jmolpopup = new JmolPopup();
- jmolpopup.initialize(viewer, translateLocale, menuName, asPopup);
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// do nothing.
}
- public void selectionChanged(BitSet arg0)
+ public void selectionChanged(BS arg0)
{
// TODO Auto-generated method stub
}
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
- // return new org.jmol.console.AppletConsole(viewer2, consolePanel);
- JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole()
- .getAppConsole(viewer2);
+ JmolAppConsoleInterface appc = new AppletConsole();
+ appc.start(viewer);
return appc;
}
}
@Override
- public void resizeInnerPanel(String data)
+ public Dimension resizeInnerPanel(String data)
{
// TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
}
}
import java.awt.Container;
import java.util.ArrayList;
-import java.util.BitSet;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
+import org.jmol.java.BS;
+import org.jmol.viewer.Viewer;
/**
* bind an alignment view to an external Jmol instance.
chains, protocol);
}
- public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel,
+ public ExtJmol(Viewer viewer, AlignmentPanel alignPanel,
SequenceI[][] seqs)
{
super(alignPanel.getStructureSelectionManager(), seqs, viewer);
showUrl(arg0, "jmol");
}
+ @Override
public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
{
AlignmentPanel ap = (AlignmentPanel) alignment;
}
}
+ @Override
public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
{
return ((AlignmentPanel) alignment).getSequenceRenderer();
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// ignore
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
// ignore
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
// ignore
}
+ @Override
public void showUrl(String url, String target)
{
ap.alignFrame.showURL(url, target);
}
+ @Override
public void refreshGUI()
{
// ignore
}
- public void selectionChanged(BitSet arg0)
+ public void selectionChanged(BS arg0)
{
System.out.println(arg0);
}
+ @Override
public void refreshPdbEntries()
{
List<PDBEntry> pdbe = new ArrayList<PDBEntry>();
SequenceI[] sq = ap.av.getAlignment().getSequencesArray();
for (int s = 0; s < sq.length; s++)
{
- Vector pdbids = sq[s].getPDBId();
+ Vector<PDBEntry> pdbids = sq[s].getPDBId();
if (pdbids != null)
{
for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++)
{
- PDBEntry pentry = (PDBEntry) pdbids.elementAt(pe);
+ PDBEntry pentry = pdbids.elementAt(pe);
if (!fileids.contains(pentry.getId()))
{
pdbe.add(pentry);
}
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
// TODO Auto-generated method stub
}
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
*/
package jalview.ext.jmol;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ComponentEvent;
import java.util.Map;
import java.util.Vector;
+import javajs.awt.Dimension;
+
import org.jmol.adapter.smarter.SmarterJmolAdapter;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.api.JmolSelectionListener;
import org.jmol.api.JmolStatusListener;
import org.jmol.api.JmolViewer;
-import org.jmol.constant.EnumCallback;
-import org.jmol.popup.JmolPopup;
-
-import jalview.api.AlignmentViewPanel;
-import jalview.api.FeatureRenderer;
-import jalview.api.SequenceRenderer;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.SequenceI;
-import jalview.io.AppletFormatAdapter;
-import jalview.schemes.ColourSchemeI;
-import jalview.schemes.ResidueProperties;
-import jalview.structure.AtomSpec;
-import jalview.structure.StructureMappingcommandSet;
-import jalview.structure.StructureSelectionManager;
-import jalview.structures.models.AAStructureBindingModel;
+import org.jmol.c.CBK;
+import org.jmol.popup.JmolGenericPopup;
+import org.jmol.script.T;
+import org.jmol.viewer.JC;
+import org.jmol.viewer.Viewer;
public abstract class JalviewJmolBinding extends AAStructureBindingModel
implements JmolStatusListener, JmolSelectionListener,
*/
int frameNo = 0;
- protected JmolPopup jmolpopup;
+ protected JmolGenericPopup jmolpopup;
String lastCommand;
StringBuffer resetLastRes = new StringBuffer();
- public JmolViewer viewer;
+ public Viewer viewer;
public JalviewJmolBinding(StructureSelectionManager ssm,
PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
}
public JalviewJmolBinding(StructureSelectionManager ssm,
- SequenceI[][] seqs, JmolViewer theViewer)
+ SequenceI[][] seqs, Viewer theViewer)
{
super(ssm, seqs);
public void closeViewer()
{
- viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE);
+ viewer.acm.setModeMouse(JC.MOUSE_NONE);
// remove listeners for all structures in viewer
getSsm().removeStructureViewerListener(this, this.getPdbFile());
// and shut down jmol
return null;
}
// TODO: verify atomIndex is selecting correct model.
- return new Color(viewer.getAtomArgb(atomIndex));
+ // return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
+ int colour = viewer.ms.at[atomIndex]
+ .atomPropertyInt(T.color);
+ return new Color(colour);
}
/**
}
if (modelFileNames == null)
{
-
- String mset[] = new String[viewer.getModelCount()];
+ String mset[] = new String[viewer.ms.mc];
_modelFileNameMap = new int[mset.length];
- int j = 1;
- String m = viewer.getModelFileName(0);
+ String m = viewer.ms.getModelFileName(0);
if (m != null)
{
+ mset[0] = m;
try
{
mset[0] = new File(m).getAbsolutePath();
} catch (AccessControlException x)
{
- // usually not allowed to do this in applet, so keep raw handle
+ // usually not allowed to do this in applet
+ System.err
+ .println("jmolBinding: Using local file string from Jmol: "
+ + m);
+ }
+ if (mset[0].indexOf("/file:") != -1)
+ {
+ // applet path with docroot - discard as format won't match pdbfile
mset[0] = m;
- // System.err.println("jmolBinding: Using local file string from Jmol: "+m);
}
}
+ int j = 1;
for (int i = 1; i < mset.length; i++)
{
- m = viewer.getModelFileName(i);
+ m = viewer.ms.getModelFileName(i);
+ mset[j] = m;
if (m != null)
{
try
} catch (AccessControlException x)
{
// usually not allowed to do this in applet, so keep raw handle
- mset[j] = m;
// System.err.println("jmolBinding: Using local file string from Jmol: "+m);
}
}
public void handlePopupMenu(int x, int y)
{
- jmolpopup.show(x, y);
+ // jmolpopup.show(x, y);
+ jmolpopup.jpiShow(x, y);
}
/**
pdbfilename = modelFileNames[_mp];
if (pdbfilename == null)
{
- pdbfilename = new File(viewer.getModelFileName(mnumber))
+ pdbfilename = new File(
+ viewer.ms.getModelFileName(mnumber))
.getAbsolutePath();
}
}
@Override
- public void notifyCallback(EnumCallback type, Object[] data)
+ public void notifyCallback(CBK type, Object[] data)
{
try
{
}
@Override
- public boolean notifyEnabled(EnumCallback callbackPick)
+ public boolean notifyEnabled(CBK callbackPick)
{
switch (callbackPick)
{
case HOVER:
case ERROR:
return true;
- case RESIZE:
- case SYNC:
- case CLICK:
- case ANIMFRAME:
- case MINIMIZATION:
+ default:
+ return false;
}
- return false;
}
// incremented every time a load notification is successfully handled -
}
else
{
- File fl;
- if (matches = (fl = new File(getPdbEntry(pe).getFile()))
- .equals(new File(fileName)))
+ File fl = new File(getPdbEntry(pe).getFile());
+ matches = fl.equals(new File(fileName));
+ if (matches)
{
foundEntry = true;
// TODO: Jmol can in principle retrieve from CLASSLOADER but
{
commandOptions = "";
}
- viewer = JmolViewer.allocateViewer(renderPanel,
+ viewer = (Viewer) JmolViewer.allocateViewer(renderPanel,
(jmolfileio ? new SmarterJmolAdapter() : null), htmlName
+ ((Object) this).toString(), documentBase, codeBase,
commandOptions, this);
- console = createJmolConsole(viewer, consolePanel, buttonsToShow);
+ viewer.setJmolStatusListener(this); // extends JmolCallbackListener
+
+ console = createJmolConsole(consolePanel, buttonsToShow);
if (consolePanel != null)
{
consolePanel.addComponentListener(this);
}
protected abstract JmolAppConsoleInterface createJmolConsole(
- JmolViewer viewer2, Container consolePanel, String buttonsToShow);
+ Container consolePanel, String buttonsToShow);
protected org.jmol.api.JmolAppConsoleInterface console = null;
}
@Override
- public void resizeInnerPanel(String data)
+ public Dimension resizeInnerPanel(String data)
{
// Jalview doesn't honour resize panel requests
-
+ return null;
}
public boolean isFinishedInit()
showConsole(false);
}
}
+
import java.util.Hashtable;
import java.util.Map;
+import javajs.awt.Dimension;
+
import org.jmol.api.JmolStatusListener;
import org.jmol.api.JmolViewer;
-import org.jmol.constant.EnumCallback;
+import org.jmol.c.CBK;
import org.jmol.modelset.Group;
import org.jmol.modelset.Model;
import org.jmol.modelset.ModelSet;
-import org.jmol.modelset.Polymer;
+import org.jmol.modelsetbio.BioModel;
import org.jmol.modelsetbio.BioPolymer;
import org.jmol.viewer.Viewer;
import org.openscience.jmol.app.JmolApp;
private Viewer getJmolData()
{
if (viewer == null)
- { // note that -o -n -x are all implied
+ { // note that -o -n -x are all implied // TODO check for Jmol 14.2
jmolApp = new JmolApp();
jmolApp.isDataOnly = true;
jmolApp.haveConsole = false;
jmolApp.haveDisplay = false;
- jmolApp.exitUponCompletion = true;
try
{
viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
- null, jmolApp.commandOptions, this);
+ null, "-x -o -n", this);
viewer.setScreenDimension(jmolApp.startupWidth,
jmolApp.startupHeight);
- jmolApp.startViewer(viewer, null);
+ jmolApp.startViewer(viewer, null, false);
} catch (ClassCastException x)
{
throw new Error(MessageManager.formatMessage("error.jmol_version_not_compatible_with_jalview_version", new String[]{JmolViewer.getJmolVersion()}),
Viewer jmd = getJmolData();
jmd.openReader(getDataName(), getDataName(), getReader());
waitForScript(jmd);
- if (jmd.getModelCount() > 0)
+
+ if (jmd.ms.mc > 0)
{
- ModelSet ms = jmd.getModelSet();
- String structs = ms.calculateStructures(null, true, false, true);
+ ModelSet ms = jmd.ms;
+ // Jmol 14.2 added third argument doReport = false
+ ms.calculateStructures(null, true, false, false, true);
// System.out.println("Structs\n"+structs);
- for (Model model : ms.getModels())
+ Group group = null;
+ int modelIndex = -1;
+ for (Model model : ms.am)
{
- for (int _bp = 0, _bpc = model.getBioPolymerCount(); _bp < _bpc; _bp++)
+ modelIndex++;
+ for (BioPolymer bp : ((BioModel) model).bioPolymers)
{
- Polymer bp = model.getBioPolymer(_bp);
- if (bp instanceof BioPolymer)
+ int _lastChainId = 0;
+ int[] groups = bp.getLeadAtomIndices();
+ char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length];
+ int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0;
+
+ do
{
- BioPolymer biopoly = (BioPolymer) bp;
- char _lastChainId = 0;
- int[] groups = biopoly.getLeadAtomIndices();
- Group[] bpgrp = biopoly.getGroups();
- char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length];
- int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0;
- do
+ if (groupc >= groups.length
+ || ms.at[groups[groupc]].group.chain.chainID != _lastChainId)
{
- if (groupc >= groups.length
- || ms.atoms[groups[groupc]].getChainID() != _lastChainId)
+ /*
+ * on change of chain (or at end), construct the sequence and
+ * secondary structure annotation for the last chain
+ */
+ if (len > 0)
{
- if (len > 0)
+ boolean isNa = bp.isNucleic();
+ // normalise sequence from Jmol to jalview
+ int[] cinds = isNa ? ResidueProperties.nucleotideIndex
+ : ResidueProperties.aaIndex;
+ int nonGap = isNa ? ResidueProperties.maxNucleotideIndex
+ : ResidueProperties.maxProteinIndex;
+ char ngc = 'X';
+ char newseq[] = new char[len];
+ Annotation asecstr[] = new Annotation[len + firstrnum - 1];
+ for (int p = 0; p < len; p++)
{
- boolean isNa = (biopoly.isDna() || biopoly.isRna());
- // normalise sequence from Jmol to jalview
- int[] cinds = isNa ? ResidueProperties.nucleotideIndex : ResidueProperties.aaIndex;
- int nonGap = isNa ? ResidueProperties.maxNucleotideIndex
- : ResidueProperties.maxProteinIndex;
- char ngc = 'X';
- char newseq[] = new char[len];
- Annotation asecstr[] = new Annotation[len+firstrnum-1];
- for (int p = 0; p < len; p++)
+ newseq[p] = cinds[seq[p]] == nonGap ? ngc : seq[p];
+ if (secstr[p] >= 'A' && secstr[p] <= 'z')
{
- newseq[p] = cinds[seq[p]] == nonGap ? ngc : seq[p];
- if (secstr[p] >= 'A' && secstr[p] <= 'z')
- {
- asecstr[p] = new Annotation("" + secstr[p], null,
- secstrcode[p], Float.NaN);
- }
+ asecstr[p] = new Annotation("" + secstr[p], null,
+ secstrcode[p], Float.NaN);
}
- SequenceI sq = new Sequence("" + getDataName() + "|"
- + model.getModelTitle() + "|" + _lastChainId,
- newseq, firstrnum, lastrnum);
- PDBEntry pdbe = new PDBEntry();
- pdbe.setFile(getDataName());
- pdbe.setId(getDataName());
- pdbe.setProperty(new Hashtable());
- // pdbe.getProperty().put("CHAIN", "" + _lastChainId);
- pdbe.setChainCode(String.valueOf(_lastChainId));
- sq.addPDBId(pdbe);
- // JAL-1533
- // Need to put the number of models for this polymer somewhere for Chimera/others to grab
- // pdbe.getProperty().put("PDBMODELS", biopoly.)
- seqs.add(sq);
- if (!isNa)
+ }
+ String modelTitle = (String) ms
+ .getInfo(modelIndex, "title");
+ SequenceI sq = new Sequence("" + getDataName() + "|"
+ + modelTitle + "|" + _lastChainId, newseq,
+ firstrnum, lastrnum);
+ PDBEntry pdbe = new PDBEntry();
+ pdbe.setFile(getDataName());
+ pdbe.setId(getDataName());
+ pdbe.setProperty(new Hashtable());
+ // pdbe.getProperty().put("CHAIN", "" + _lastChainId);
+ pdbe.setChainCode(String.valueOf(_lastChainId));
+ sq.addPDBId(pdbe);
+ // JAL-1533
+ // Need to put the number of models for this polymer somewhere
+ // for Chimera/others to grab
+ // pdbe.getProperty().put("PDBMODELS", biopoly.)
+ seqs.add(sq);
+ if (!isNa)
+ {
+ String mt = modelTitle == null ? getDataName()
+ : modelTitle;
+ if (_lastChainId >= ' ')
{
- String mt = model.getModelTitle() == null ? getDataName()
- : model.getModelTitle();
- if (_lastChainId >= ' ')
- {
- mt += _lastChainId;
- }
- AlignmentAnnotation ann = new AlignmentAnnotation(
- "Secondary Structure",
- "Secondary Structure for " + mt, asecstr);
- ann.belowAlignment=true;
- ann.visible=true;
- ann.autoCalculated=false;
- ann.setCalcId(getClass().getName());
- sq.addAlignmentAnnotation(ann);
- ann.adjustForAlignment();
- ann.validateRangeAndDisplay();
- annotations.add(ann);
+ mt += _lastChainId;
}
+ AlignmentAnnotation ann = new AlignmentAnnotation(
+ "Secondary Structure", "Secondary Structure for "
+ + mt, asecstr);
+ ann.belowAlignment = true;
+ ann.visible = true;
+ ann.autoCalculated = false;
+ ann.setCalcId(getClass().getName());
+ sq.addAlignmentAnnotation(ann);
+ ann.adjustForAlignment();
+ ann.validateRangeAndDisplay();
+ annotations.add(ann);
}
- len = 0;
- firstrnum = 1;
- lastrnum = 0;
}
- if (groupc < groups.length)
+ len = 0;
+ firstrnum = 1;
+ lastrnum = 0;
+ }
+ if (groupc < groups.length)
+ {
+ group = ms.at[groups[groupc]].group;
+ if (len == 0)
+ {
+ firstrnum = group.getResno();
+ _lastChainId = group.chain.chainID;
+ }
+ else
+ {
+ lastrnum = group.getResno();
+ }
+ seq[len] = group.getGroup1();
+ switch (group.getProteinStructureSubType())
{
- if (len == 0)
+ case HELIX310:
+ if (secstr[len] == 0)
{
- firstrnum = bpgrp[groupc].getResno();
- _lastChainId = bpgrp[groupc].getChainID();
+ secstr[len] = '3';
}
- else
+ case HELIXALPHA:
+ if (secstr[len] == 0)
{
- lastrnum = bpgrp[groupc].getResno();
+ secstr[len] = 'H';
}
- seq[len] = bpgrp[groupc].getGroup1();
- switch (bpgrp[groupc].getProteinStructureSubType())
+ case HELIXPI:
+ if (secstr[len] == 0)
{
- case HELIX_310:
- if (secstr[len] == 0)
- {
- secstr[len] = '3';
- }
- case HELIX_ALPHA:
- if (secstr[len] == 0)
- {
- secstr[len] = 'H';
- }
- case HELIX_PI:
- if (secstr[len] == 0)
- {
- secstr[len] = 'P';
- }
- case HELIX:
- if (secstr[len] == 0)
- {
- secstr[len] = 'H';
- }
- secstrcode[len] = 'H';
- break;
- case SHEET:
- secstr[len] = 'E';
- secstrcode[len] = 'E';
- break;
- default:
- secstr[len] = 0;
- secstrcode[len] = 0;
+ secstr[len] = 'P';
}
- len++;
+ case HELIX:
+ if (secstr[len] == 0)
+ {
+ secstr[len] = 'H';
+ }
+ secstrcode[len] = 'H';
+ break;
+ case SHEET:
+ secstr[len] = 'E';
+ secstrcode[len] = 'E';
+ break;
+ default:
+ secstr[len] = 0;
+ secstrcode[len] = 0;
}
- } while (groupc++ < groups.length);
-
- }
+ len++;
+ }
+ } while (groupc++ < groups.length);
}
}
* System.err.println("Squashed Jmol callback handler error:");
* e.printStackTrace(); } }
*/
- public void notifyCallback(EnumCallback type, Object[] data)
+ public void notifyCallback(CBK type, Object[] data)
{
String strInfo = (data == null || data[1] == null ? null : data[1]
.toString());
}
}
- private void notifyFileLoaded(String string, String string2,
- String string3, String string4, int intValue)
- {
- // TODO Auto-generated method stub
-
- }
-
String lastConsoleEcho = "";
private void sendConsoleEcho(String string)
}
@Override
- public boolean notifyEnabled(EnumCallback callbackPick)
+ public boolean notifyEnabled(CBK callbackPick)
{
switch (callbackPick)
{
case LOADSTRUCT:
case ERROR:
return true;
- case MEASURE:
- case PICK:
- case HOVER:
- case RESIZE:
- case SYNC:
- case CLICK:
- case ANIMFRAME:
- case MINIMIZATION:
+ default:
+ return false;
}
- return false;
}
@Override
}
@Override
- public void resizeInnerPanel(String data)
+ public Dimension resizeInnerPanel(String data)
{
- // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ return null;
}
}
*/
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.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 java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
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.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;
-
public class AppJmol extends StructureViewerBase
{
AppJmolBinding jmb;
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
closeViewer(false);
}
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
closeViewer(false);
;
jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
null);
- jmb.newJmolPopup(true, "Jmol", true);
+ jmb.newJmolPopup("Jmol");
if (command == null)
{
command = "";
final Rectangle rectClip = new Rectangle();
+ @Override
public void paintComponent(Graphics g)
{
getSize(currentSize);
import jalview.structure.StructureSelectionManager;
import java.awt.Container;
-import java.util.BitSet;
+import java.util.Map;
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
-import org.jmol.popup.JmolPopup;
-import org.openscience.jmol.app.jmolpanel.AppConsole;
+import org.jmol.java.BS;
+import org.jmol.popup.JmolAwtPopup;
+import org.openscience.jmol.app.jmolpanel.console.AppConsole;
public class AppJmolBinding extends JalviewJmolBinding
{
return new SequenceRenderer(((AlignmentPanel) alignment).av);
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
if (console != null)
}
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
if (console != null && strStatus != null)
}
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// todo - script termination doesn't happen ?
showUrl(url, "jmol");
}
- public void newJmolPopup(boolean translateLocale, String menuName,
- boolean asPopup)
+ public void newJmolPopup(String menuName)
{
- jmolpopup = new JmolPopup();
- jmolpopup.initialize(viewer, translateLocale, menuName, asPopup);
+ jmolpopup = new JmolAwtPopup();
+ jmolpopup.jpiInitialize((viewer), menuName);
}
- public void selectionChanged(BitSet arg0)
+ @Override
+ public void selectionChanged(BS arg0)
{
// TODO Auto-generated method stub
}
+ @Override
public void refreshPdbEntries()
{
// TODO Auto-generated method stub
}
+ @Override
public void showConsole(boolean b)
{
appJmolWindow.showConsole(b);
}
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
+ viewer.setJmolCallbackListener(this);
return new AppConsole(viewer, consolePanel, buttonsToShow);
}
appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap);
}
}
+
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.gui;
-
-import org.jmol.api.*;
-
-import jalview.jbgui.GStructureViewer;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.text.*;
-
-import java.util.Vector;
-
-import org.jmol.i18n.GT;
-import org.jmol.util.Logger;
-import org.jmol.util.CommandHistory;
-
-// TODO: this class is copied in from jmol 11.0.2 - upgrade to 12.0.2 ?
-public final class ScriptWindow extends JPanel implements ActionListener,
- EnterListener
-{
-
- private ConsoleTextPane console;
-
- private JButton closeButton;
-
- private JButton runButton;
-
- private JButton haltButton;
-
- private JButton clearButton;
-
- private JButton historyButton;
-
- private JButton stateButton;
-
- JmolViewer viewer;
-
- GStructureViewer appJmol;
-
- public ScriptWindow(AppJmol appJmol)
- {
- this.viewer = appJmol.jmb.viewer;
- this.appJmol = appJmol;
-
- setLayout(new BorderLayout());
-
- console = new ConsoleTextPane(this);
-
- console.setPrompt();
- add(new JScrollPane(console), BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel();
- add(buttonPanel, BorderLayout.SOUTH);
-
- runButton = new JButton(GT._("Run"));
- haltButton = new JButton(GT._("Halt"));
- runButton.addActionListener(this);
- // buttonPanel.add(runButton);
- haltButton.addActionListener(this);
- // buttonPanel.add(haltButton);
- haltButton.setEnabled(false);
-
- clearButton = new JButton(GT._("Clear"));
- clearButton.addActionListener(this);
- buttonPanel.add(clearButton);
-
- historyButton = new JButton(GT._("History"));
- historyButton.addActionListener(this);
- buttonPanel.add(historyButton);
-
- stateButton = new JButton(GT._("State"));
- stateButton.addActionListener(this);
- buttonPanel.add(stateButton);
-
- closeButton = new JButton(GT._("Close"));
- closeButton.addActionListener(this);
- buttonPanel.add(closeButton);
-
- for (int i = 0; i < buttonPanel.getComponentCount(); i++)
- {
- // ((JButton)buttonPanel.getComponent(i))
- // .setMargin(new Insets(0, 0, 0, 0));
- }
-
- }
-
- public void sendConsoleEcho(String strEcho)
- {
- if (strEcho != null && !isError)
- {
-
- console.outputEcho(strEcho);
-
- }
- setError(false);
- }
-
- boolean isError = false;
-
- void setError(boolean TF)
- {
- isError = TF;
- // if (isError)
- // console.recallCommand(true);
- }
-
- public void sendConsoleMessage(String strStatus)
- {
- if (strStatus == null)
- {
- console.clearContent();
- console.outputStatus("");
- }
- else if (strStatus.indexOf("ERROR:") >= 0)
- {
- console.outputError(strStatus);
- isError = true;
- }
- else if (!isError)
- {
- console.outputStatus(strStatus);
- }
- }
-
- public void notifyScriptTermination(String strMsg, int msWalltime)
- {
- if (strMsg != null && strMsg.indexOf("ERROR") >= 0)
- {
- console.outputError(strMsg);
- }
- runButton.setEnabled(true);
- haltButton.setEnabled(false);
- }
-
- public void enterPressed()
- {
- runButton.doClick(100);
- // executeCommand();
- }
-
- class ExecuteCommandThread extends Thread
- {
-
- String strCommand;
-
- ExecuteCommandThread(String command)
- {
- strCommand = command;
- }
-
- public void run()
- {
- try
- {
- executeCommand(strCommand);
- } catch (Exception ie)
- {
- Logger.debug("execution command interrupted!" + ie);
- }
- }
- }
-
- ExecuteCommandThread execThread;
-
- void executeCommandAsThread()
- {
- String strCommand = console.getCommandString().trim();
- if (strCommand.length() > 0)
- {
- execThread = new ExecuteCommandThread(strCommand);
- execThread.start();
- }
- }
-
- void executeCommand(String strCommand)
- {
- boolean doWait;
- setError(false);
- console.appendNewline();
- console.setPrompt();
- if (strCommand.length() > 0)
- {
- String strErrorMessage = null;
- doWait = (strCommand.indexOf("WAIT ") == 0);
- if (doWait)
- { // for testing, mainly
- // demonstrates using the statusManager system.
- runButton.setEnabled(false);
- haltButton.setEnabled(true);
-
- Vector info = (Vector) viewer
- .scriptWaitStatus(strCommand.substring(5),
- "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
- runButton.setEnabled(true);
- haltButton.setEnabled(false);
- /*
- * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...]
- * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...]
- * statusRecord = [int msgPtr, String statusName, int intInfo, String
- * msg]
- */
- for (int i = 0; i < info.size(); i++)
- {
- Vector statusRecordSet = (Vector) info.get(i);
- for (int j = 0; j < statusRecordSet.size(); j++)
- {
- Vector statusRecord = (Vector) statusRecordSet.get(j);
- Logger.info("msg#=" + statusRecord.get(0) + " "
- + statusRecord.get(1) + " intInfo="
- + statusRecord.get(2) + " stringInfo="
- + statusRecord.get(3));
- }
- }
- console.appendNewline();
- }
- else
- {
- boolean isScriptExecuting = viewer.isScriptExecuting();
- if (viewer.checkHalt(strCommand, true))
- strErrorMessage = (isScriptExecuting ? "string execution halted with "
- + strCommand
- : "no script was executing");
- else
- strErrorMessage = "";// viewer.scriptCheck(strCommand);
- // the problem is that scriptCheck is synchronized, so these might get
- // backed up.
- if (strErrorMessage != null && strErrorMessage.length() > 0)
- {
- console.outputError(strErrorMessage);
- }
- else
- {
- // runButton.setEnabled(false);
- haltButton.setEnabled(true);
- viewer.script(strCommand);
- }
- }
- }
- console.grabFocus();
- }
-
- public void actionPerformed(ActionEvent e)
- {
- Object source = e.getSource();
- if (source == closeButton)
- {
- // appJmol.showConsole(false);
- }
- else if (source == runButton)
- {
- executeCommandAsThread();
- }
- else if (source == clearButton)
- {
- console.clearContent();
- }
- else if (source == historyButton)
- {
- console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE));
- }
- else if (source == stateButton)
- {
- console.clearContent(viewer.getStateInfo());
- }
- else if (source == haltButton)
- {
- viewer.haltScriptExecution();
- }
- console.grabFocus(); // always grab the focus (e.g., after clear)
- }
-}
-
-class ConsoleTextPane extends JTextPane
-{
-
- ConsoleDocument consoleDoc;
-
- EnterListener enterListener;
-
- JmolViewer viewer;
-
- ConsoleTextPane(ScriptWindow scriptWindow)
- {
- super(new ConsoleDocument());
- consoleDoc = (ConsoleDocument) getDocument();
- consoleDoc.setConsoleTextPane(this);
- this.enterListener = (EnterListener) scriptWindow;
- this.viewer = scriptWindow.viewer;
- }
-
- public String getCommandString()
- {
- String cmd = consoleDoc.getCommandString();
- return cmd;
- }
-
- public void setPrompt()
- {
- consoleDoc.setPrompt();
- }
-
- public void appendNewline()
- {
- consoleDoc.appendNewline();
- }
-
- public void outputError(String strError)
- {
- consoleDoc.outputError(strError);
- }
-
- public void outputErrorForeground(String strError)
- {
- consoleDoc.outputErrorForeground(strError);
- }
-
- public void outputEcho(String strEcho)
- {
- consoleDoc.outputEcho(strEcho);
- }
-
- public void outputStatus(String strStatus)
- {
- consoleDoc.outputStatus(strStatus);
- }
-
- public void enterPressed()
- {
- if (enterListener != null)
- enterListener.enterPressed();
- }
-
- public void clearContent()
- {
- clearContent(null);
- }
-
- public void clearContent(String text)
- {
- consoleDoc.clearContent();
- if (text != null)
- consoleDoc.outputEcho(text);
- setPrompt();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
-
- /**
- * Custom key event processing for command 0 implementation.
- *
- * Captures key up and key down strokes to call command history and redefines
- * the same events with control down to allow caret vertical shift.
- *
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
- protected void processKeyEvent(KeyEvent ke)
- {
- // Id Control key is down, captures events does command
- // history recall and inhibits caret vertical shift.
- if (ke.getKeyCode() == KeyEvent.VK_UP
- && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
- {
- recallCommand(true);
- }
- else if (ke.getKeyCode() == KeyEvent.VK_DOWN
- && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
- {
- recallCommand(false);
- }
- // If Control key is down, redefines the event as if it
- // where a key up or key down stroke without modifiers.
- // This allows to move the caret up and down
- // with no command history recall.
- else if ((ke.getKeyCode() == KeyEvent.VK_DOWN || ke.getKeyCode() == KeyEvent.VK_UP)
- && ke.getID() == KeyEvent.KEY_PRESSED && ke.isControlDown())
- {
- super.processKeyEvent(new KeyEvent((Component) ke.getSource(), ke
- .getID(), ke.getWhen(), 0, // No modifiers
- ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()));
- }
- // Standard processing for other events.
- else
- {
- super.processKeyEvent(ke);
- // check command for compiler-identifyable syntax issues
- // this may have to be taken out if people start complaining
- // that only some of the commands are being checked
- // that is -- that the script itself is not being fully checked
-
- // not perfect -- help here?
- if (ke.getID() == KeyEvent.KEY_RELEASED
- && (ke.getKeyCode() > KeyEvent.VK_DOWN)
- || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)
- checkCommand();
- }
- }
-
- /**
- * Recall command history.
- *
- * @param up
- * - history up or down
- */
- void recallCommand(boolean up)
- {
- String cmd = viewer.getSetHistory(up ? -1 : 1);
- if (cmd == null)
- {
- return;
- }
- try
- {
- if (cmd.endsWith(CommandHistory.ERROR_FLAG))
- {
- cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG));
- consoleDoc.replaceCommand(cmd, true);
- }
- else
- {
- consoleDoc.replaceCommand(cmd, false);
- }
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void checkCommand()
- {
- String strCommand = consoleDoc.getCommandString();
- if (strCommand.length() == 0)
- return;
- consoleDoc
- .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput
- : consoleDoc.attError);
- }
-
-}
-
-class ConsoleDocument extends DefaultStyledDocument
-{
-
- ConsoleTextPane consoleTextPane;
-
- SimpleAttributeSet attError;
-
- SimpleAttributeSet attEcho;
-
- SimpleAttributeSet attPrompt;
-
- SimpleAttributeSet attUserInput;
-
- SimpleAttributeSet attStatus;
-
- ConsoleDocument()
- {
- super();
-
- attError = new SimpleAttributeSet();
- StyleConstants.setForeground(attError, Color.red);
-
- attPrompt = new SimpleAttributeSet();
- StyleConstants.setForeground(attPrompt, Color.magenta);
-
- attUserInput = new SimpleAttributeSet();
- StyleConstants.setForeground(attUserInput, Color.black);
-
- attEcho = new SimpleAttributeSet();
- StyleConstants.setForeground(attEcho, Color.blue);
- StyleConstants.setBold(attEcho, true);
-
- attStatus = new SimpleAttributeSet();
- StyleConstants.setForeground(attStatus, Color.black);
- StyleConstants.setItalic(attStatus, true);
- }
-
- void setConsoleTextPane(ConsoleTextPane consoleTextPane)
- {
- this.consoleTextPane = consoleTextPane;
- }
-
- Position positionBeforePrompt; // starts at 0, so first time isn't tracked
-
- // (at least on Mac OS X)
-
- Position positionAfterPrompt; // immediately after $, so this will track
-
- int offsetAfterPrompt; // only still needed for the insertString override and
-
- // replaceCommand
-
- /**
- * Removes all content of the script window, and add a new prompt.
- */
- void clearContent()
- {
- try
- {
- super.remove(0, getLength());
- } catch (BadLocationException exception)
- {
- System.out.println("Could not clear script window content: "
- + exception.getMessage());
- }
- }
-
- void setPrompt()
- {
- try
- {
- super.insertString(getLength(), "$ ", attPrompt);
- setOffsetPositions();
- consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void setOffsetPositions()
- {
- try
- {
- offsetAfterPrompt = getLength();
- positionBeforePrompt = createPosition(offsetAfterPrompt - 2);
- // after prompt should be immediately after $ otherwise tracks the end
- // of the line (and no command will be found) at least on Mac OS X it did.
- positionAfterPrompt = createPosition(offsetAfterPrompt - 1);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void setNoPrompt()
- {
- try
- {
- offsetAfterPrompt = getLength();
- positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt);
- consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- // it looks like the positionBeforePrompt does not track when it started out
- // as 0
- // and a insertString at location 0 occurs. It may be better to track the
- // position after the prompt in stead
- void outputBeforePrompt(String str, SimpleAttributeSet attribute)
- {
- try
- {
- int pt = consoleTextPane.getCaretPosition();
- Position caretPosition = createPosition(pt);
- pt = positionBeforePrompt.getOffset();
- super.insertString(pt, str + "\n", attribute);
- setOffsetPositions();
- pt = caretPosition.getOffset();
- consoleTextPane.setCaretPosition(pt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void outputError(String strError)
- {
- outputBeforePrompt(strError, attError);
- }
-
- void outputErrorForeground(String strError)
- {
- try
- {
- super.insertString(getLength(), strError + "\n", attError);
- consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e)
- {
- e.printStackTrace();
-
- }
- }
-
- void outputEcho(String strEcho)
- {
- outputBeforePrompt(strEcho, attEcho);
- }
-
- void outputStatus(String strStatus)
- {
- outputBeforePrompt(strStatus, attStatus);
- }
-
- void appendNewline()
- {
- try
- {
- super.insertString(getLength(), "\n", attUserInput);
- consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- // override the insertString to make sure everything typed ends up at the end
- // or in the 'command line' using the proper font, and the newline is
- // processed.
- public void insertString(int offs, String str, AttributeSet a)
- throws BadLocationException
- {
- int ichNewline = str.indexOf('\n');
- if (ichNewline > 0)
- str = str.substring(0, ichNewline);
- if (ichNewline != 0)
- {
- if (offs < offsetAfterPrompt)
- {
- offs = getLength();
- }
- super.insertString(offs, str, a == attError ? a : attUserInput);
- consoleTextPane.setCaretPosition(offs + str.length());
- }
- if (ichNewline >= 0)
- {
- consoleTextPane.enterPressed();
- }
- }
-
- String getCommandString()
- {
- String strCommand = "";
- try
- {
- int cmdStart = positionAfterPrompt.getOffset();
- strCommand = getText(cmdStart, getLength() - cmdStart);
- while (strCommand.length() > 0 && strCommand.charAt(0) == ' ')
- strCommand = strCommand.substring(1);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- return strCommand;
- }
-
- public void remove(int offs, int len) throws BadLocationException
- {
- if (offs < offsetAfterPrompt)
- {
- len -= offsetAfterPrompt - offs;
- if (len <= 0)
- return;
- offs = offsetAfterPrompt;
- }
- super.remove(offs, len);
- // consoleTextPane.setCaretPosition(offs);
- }
-
- public void replace(int offs, int length, String str, AttributeSet attrs)
- throws BadLocationException
- {
- if (offs < offsetAfterPrompt)
- {
- if (offs + length < offsetAfterPrompt)
- {
- offs = getLength();
- length = 0;
- }
- else
- {
- length -= offsetAfterPrompt - offs;
- offs = offsetAfterPrompt;
- }
- }
- super.replace(offs, length, str, attrs);
- // consoleTextPane.setCaretPosition(offs + str.length());
- }
-
- /**
- * Replaces current command on script.
- *
- * @param newCommand
- * new command value
- * @param isError
- * true to set error color ends with #??
- *
- * @throws BadLocationException
- */
- void replaceCommand(String newCommand, boolean isError)
- throws BadLocationException
- {
- if (positionAfterPrompt == positionBeforePrompt)
- return;
- replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand,
- isError ? attError : attUserInput);
- }
-
- void colorCommand(SimpleAttributeSet att)
- {
- if (positionAfterPrompt == positionBeforePrompt)
- return;
- setCharacterAttributes(offsetAfterPrompt, getLength()
- - offsetAfterPrompt, att, true);
- }
-}
-
-interface EnterListener
-{
- public void enterPressed();
-}
*/
package jalview.ws;
-import jalview.bin.Cache;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.gui.JvSwingUtils;
-import jalview.util.GroupUrlLink;
-import jalview.util.MessageManager;
-import jalview.util.GroupUrlLink.UrlStringTooLongException;
-
import java.awt.Component;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import com.lowagie.text.html.HtmlEncoder;
+import jalview.bin.Cache;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.util.GroupUrlLink;
+import jalview.util.GroupUrlLink.UrlStringTooLongException;
+import jalview.util.MessageManager;
/**
* Lightweight runnable to discover dynamic 'one way' group URL services
* @deprecated
*
*/
+@Deprecated
public class EnfinEnvision2OneWay extends DefaultHandler implements
Runnable, WSMenuEntryProviderI
{
}
try
{
- descr = HtmlEncoder.encode(descr);
+ // TODO check with Jim if this class (EnfinEnvision) is obsolete
+ // descr = HtmlEncoder.encode(descr); // iText removed from Jmol 14.2
} catch (Exception e)
{
}
private JMenu buildGroupURLMenu(SequenceI[] seqs, SequenceGroup sg)
{
if (groupURLdescr == null || groupURLLinks == null)
+ {
return null;
+ }
// TODO: usability: thread off the generation of group url content so root
// menu appears asap
// sequence only URLs
import java.util.List;
import java.util.StringTokenizer;
-import org.jmol.util.ArrayUtil;
import compbio.metadata.Argument;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
*/
package jalview.io;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Iterator;
import java.util.Vector;
-import jalview.analysis.NJTree;
-import jalview.analysis.SequenceIdMatcher;
-import jalview.datamodel.SequenceI;
-import jalview.datamodel.SequenceNode;
-
-import org.jmol.util.ArrayUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import jalview.analysis.NJTree;
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+
/**
* @author jimp
*
{
olsqs[i] = (SequenceI) ((SequenceNode) oseqs.get(i)).element();
}
- nseqs = (Vector) new NJTree(new SequenceI[0], nf_regen).findLeaves(
+ nseqs = new NJTree(new SequenceI[0], nf_regen).findLeaves(
nf_regen.getTree(), new Vector());
assertTrue(stage + "No nodes in regerated tree.", nseqs.size() > 0);
SequenceI[] nsqs = new SequenceI[nseqs.size()];