label.eps_file = EPS file
label.png_image = PNG image
status.saving_file = Saving {0}
-status.export_complete = Export complete.
+status.export_complete = {0} Export completed.
status.fetching_pdb = Fetching PDB {0}
status.refreshing_news = Refreshing news
status.importing_vamsas_session_from = Importing VAMSAS session from {0}
label.nw_mapping = Needleman & Wunsch Alignment
label.sifts_mapping = SIFTs Mapping
label.mapping_method = Sequence \u27f7 Structure mapping method
+label.mapping_method = Sequence \u27f7 Structure mapping method
+status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file.
+status.cancelled_image_export_operation = Cancelled {0} export operation.
+info.error_creating_file = Error creating {0} file.
\ No newline at end of file
Desktop.addInternalFrame(this, title.toString(), 400, 400);
}
+ @Override
public void run()
{
try
{
this.addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
pdbcanvas.keyPressed(evt);
png.setText("PNG");
png.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
png_actionPerformed(e);
eps.setText("EPS");
eps.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
eps_actionPerformed(e);
mapping.setText(MessageManager.getString("label.view_mapping"));
mapping.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
mapping_actionPerformed(e);
wire.setText(MessageManager.getString("label.wireframe"));
wire.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
wire_actionPerformed(e);
depth.setText(MessageManager.getString("label.depthcue"));
depth.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
depth_actionPerformed(e);
zbuffer.setText(MessageManager.getString("label.z_buffering"));
zbuffer.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
zbuffer_actionPerformed(e);
charge.setText(MessageManager.getString("label.charge_cysteine"));
charge.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
charge_actionPerformed(e);
chain.setText(MessageManager.getString("action.by_chain"));
chain.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
chain_actionPerformed(e);
seqButton.setText(MessageManager.getString("action.by_sequence"));
seqButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
seqButton_actionPerformed(e);
allchains.setText(MessageManager.getString("label.show_all_chains"));
allchains.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
allchains_itemStateChanged(e);
zappo.setText(MessageManager.getString("label.zappo"));
zappo.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
zappo_actionPerformed(e);
taylor.setText(MessageManager.getString("label.taylor"));
taylor.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
taylor_actionPerformed(e);
hydro.setText(MessageManager.getString("label.hydrophobicity"));
hydro.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hydro_actionPerformed(e);
helix.setText(MessageManager.getString("label.helix_propensity"));
helix.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
helix_actionPerformed(e);
strand.setText(MessageManager.getString("label.strand_propensity"));
strand.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
strand_actionPerformed(e);
turn.setText(MessageManager.getString("label.turn_propensity"));
turn.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
turn_actionPerformed(e);
buried.setText(MessageManager.getString("label.buried_index"));
buried.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
buried_actionPerformed(e);
user.setText(MessageManager.getString("action.user_defined"));
user.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
user_actionPerformed(e);
.setText(MessageManager.getString("action.background_colour"));
background.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
background_actionPerformed(e);
savePDB.setText(MessageManager.getString("label.pdb_file"));
savePDB.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
savePDB_actionPerformed(e);
radioItem.setName("USER_DEFINED");
radioItem.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (evt.isControlDown()
{
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
user_actionPerformed(evt);
});
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
user_actionPerformed(evt);
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
- width, height, null, null);
+ width, height, null, null, null, 0, false);
}
else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
else
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
if (im.getGraphics() != null)
addColourRange(colourMap, lastColour, pdbfnum, startPos,
lastPos, lastChain);
}
- break;
+ // break;
}
}
}
}
StringBuilder atomSpecs = new StringBuilder();
boolean first = true;
+
for (AtomSpec atom : atoms)
{
int pdbResNum = atom.getPdbResNum();
List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
if (cms != null && !cms.isEmpty())
{
- /*
- * Formatting as #0:34.A,#1:33.A doesn't work as desired, so instead we
- * concatenate multiple 'show' commands
- */
- atomSpecs.append(first ? "" : ";show ");
+ atomSpecs.append(first ? "" : ",");
first = false;
- atomSpecs.append("#" + cms.get(0).getModelNumber());
+ atomSpecs.append(cms.get(0).getModelNumber());
atomSpecs.append(":" + pdbResNum);
if (!chain.equals(" "))
{
viewerCommandHistory(false);
if (atomSpec.length() > 0)
{
- command.append("show ").append(atomSpec);
+ command.append("show #").append(atomSpec);
viewer.sendChimeraCommand(command.toString(), false);
}
viewerCommandHistory(true);
*/
public abstract void refreshGUI();
+ @Override
public void setLoadingFromArchive(boolean loadingFromArchive)
{
this.loadingFromArchive = loadingFromArchive;
* @return true if Chimeral is still restoring state or loading is still going
* on (see setFinsihedLoadingFromArchive)
*/
+ @Override
public boolean isLoadingFromArchive()
{
return loadingFromArchive && !loadingFinished;
*
* @param finishedLoading
*/
+ @Override
public void setFinishedLoadingFromArchive(boolean finishedLoading)
{
loadingFinished = finishedLoading;
@Override
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
+ BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel, this);
bjs.exportJalviewAlignmentAsBioJsHtmlFile();
}
final AlignmentPanel ap = this;
av.addPropertyChangeListener(new PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals("alignment"))
* automatically adjust annotation panel height for new annotation whilst
* ensuring the alignment is still visible.
*/
+ @Override
public void adjustAnnotationHeight()
{
// TODO: display vertical annotation scrollbar if necessary
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
int oldX = av.getStartRes();
// as preference setting
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
setScrollValues(av.getStartRes(), av.getStartSeq());
* Repaint the alignment including the annotations and overview panels (if
* shown).
*/
+ @Override
public void paintAlignment(boolean updateOverview)
{
final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
invalidate();
* @throws PrinterException
* DOCUMENT ME!
*/
+ @Override
public int print(Graphics pg, PageFormat pf, int pi)
throws PrinterException
{
void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
{
- long progress = System.currentTimeMillis();
+ long pSessionId = System.currentTimeMillis();
headless = (System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true"));
if (alignFrame != null && !headless)
{
- alignFrame.setProgressBar(MessageManager.formatMessage(
+ if (file != null)
+ {
+ alignFrame.setProgressBar(MessageManager.formatMessage(
"status.saving_file", new Object[] { type.getLabel() }),
- progress);
+ pSessionId);
+ }
}
try
{
im = new jalview.util.ImageMaker(this, type, imageAction,
aDimension.getWidth(), aDimension.getHeight(), file,
- imageTitle);
+ imageTitle, alignFrame, pSessionId, headless);
if (av.getWrapAlignment())
{
if (im.getGraphics() != null)
im.writeImage();
}
}
+
} catch (OutOfMemoryError err)
{
// Be noisy here.
}
} finally
{
- if (alignFrame != null && !headless)
- {
- alignFrame.setProgressBar(
- MessageManager.getString("status.export_complete"),
- progress);
- }
+
}
}
MessageManager.getString("label.all"));
menuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
allChainsSelected = true;
menuItem = new JCheckBoxMenuItem(chain, true);
menuItem.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent evt)
{
if (!allChainsSelected)
jmb.centerViewer(toshow);
}
+ @Override
public void closeViewer(boolean closeExternalViewer)
{
// Jmol does not use an external viewer
jmb = null;
}
+ @Override
public void run()
{
_started = true;
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
if (jmb.viewer.isScriptExecuting())
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
- width, height, null, null);
+ width, height, null, null, null, 0, false);
}
else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
else
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
if (im.getGraphics() != null)
}
+ @Override
public void setJalviewColourScheme(ColourSchemeI ucs)
{
jmb.setJalviewColourScheme(ucs);
this.delegate = delegate;
}
+ @Override
public void activateFrame(JInternalFrame f)
{
try
}
}
+ @Override
public void beginDraggingFrame(JComponent f)
{
delegate.beginDraggingFrame(f);
}
+ @Override
public void beginResizingFrame(JComponent f, int direction)
{
delegate.beginResizingFrame(f, direction);
}
+ @Override
public void closeFrame(JInternalFrame f)
{
delegate.closeFrame(f);
}
+ @Override
public void deactivateFrame(JInternalFrame f)
{
delegate.deactivateFrame(f);
}
+ @Override
public void deiconifyFrame(JInternalFrame f)
{
delegate.deiconifyFrame(f);
}
+ @Override
public void dragFrame(JComponent f, int newX, int newY)
{
if (newY < 0)
delegate.dragFrame(f, newX, newY);
}
+ @Override
public void endDraggingFrame(JComponent f)
{
delegate.endDraggingFrame(f);
}
+ @Override
public void endResizingFrame(JComponent f)
{
delegate.endResizingFrame(f);
}
+ @Override
public void iconifyFrame(JInternalFrame f)
{
delegate.iconifyFrame(f);
}
+ @Override
public void maximizeFrame(JInternalFrame f)
{
delegate.maximizeFrame(f);
}
+ @Override
public void minimizeFrame(JInternalFrame f)
{
delegate.minimizeFrame(f);
}
+ @Override
public void openFrame(JInternalFrame f)
{
delegate.openFrame(f);
delegate.resizeFrame(f, newX, newY, newWidth, newHeight);
}
+ @Override
public void setBoundsForFrame(JComponent f, int newX, int newY,
int newWidth, int newHeight)
{
this.addWindowListener(new WindowAdapter()
{
+ @Override
public void windowClosing(WindowEvent evt)
{
quit();
MouseAdapter ma;
this.addMouseListener(ma = new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (SwingUtilities.isRightMouseButton(evt))
// Spawn a thread that shows the splashscreen
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
new SplashScreen();
// takes to open it later on.
new Thread(new Runnable()
{
+ @Override
public void run()
{
Cache.log.debug("Filechooser init thread started.");
// reselected again.
boolean refresh = true;
+ @Override
public void menuCanceled(MenuEvent e)
{
refresh = true;
}
+ @Override
public void menuDeselected(MenuEvent e)
{
refresh = true;
}
+ @Override
public void menuSelected(MenuEvent e)
{
if (refresh)
MessageManager.getString("label.paste_new_window"));
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
paste();
final JMenuItem menuItem = new JMenuItem(title);
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
{
+ @Override
public void internalFrameActivated(
javax.swing.event.InternalFrameEvent evt)
{
}
+ @Override
public void internalFrameClosed(
javax.swing.event.InternalFrameEvent evt)
{
menuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
try
}
}
+ @Override
public void lostOwnership(Clipboard clipboard, Transferable contents)
{
if (!internalCopy)
internalCopy = false;
}
+ @Override
public void dragEnter(DropTargetDragEvent evt)
{
}
+ @Override
public void dragExit(DropTargetEvent evt)
{
}
+ @Override
public void dragOver(DropTargetDragEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void drop(DropTargetDropEvent evt)
{
boolean success = true;
// message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
new Thread(new Runnable()
{
+ @Override
public void run()
{
new SplashScreen(true);
new Thread(new Runnable()
{
+ @Override
public void run()
{
// TODO: refactor to Jalview desktop session controller action.
selectedFile.getParent());
new Thread(new Runnable()
{
+ @Override
public void run()
{
setProgressBar(
sessit.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
if (dsktp.v_client == null)
Thread rthr = new Thread(new Runnable()
{
+ @Override
public void run()
{
dsktp.v_client = new VamsasApplication(dsktp, mysesid);
return showMemoryUsage;
}
+ @Override
public void run()
{
df = java.text.NumberFormat.getNumberInstance();
groovyShell.setText(MessageManager.getString("label.groovy_console"));
groovyShell.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
groovyShell_actionPerformed();
*
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
+ @Override
public void setProgressBar(String message, long id)
{
if (progressBars == null)
* @see jalview.gui.IProgressIndicator#registerHandler(long,
* jalview.gui.IProgressIndicatorHandler)
*/
+ @Override
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
cancel.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
handler.cancelActivity(id);
// only run if we aren't already displaying one of these.
addDialogThread(serviceChangedDialog = new Runnable()
{
+ @Override
public void run()
{
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
try
{
dialogExecutor.submit(new Runnable()
{
+ @Override
public void run()
{
if (dialogPause)
ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS,
"View of Desktop", getWidth(), getHeight(), of = new File(
"Jalview_snapshot" + System.currentTimeMillis()
- + ".eps"), "View of desktop");
+ + ".eps"), "View of desktop", null, 0, false);
try
{
paintAll(im.getGraphics());
boolean adjusting = false;
- private float min;
+ final private float min;
- private float max;
+ final private float max;
+
+ final private float scaleFactor;
String type = null;
{
if (!adjusting)
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ thresholdValue.setText((slider.getValue() / scaleFactor) + "");
valueChanged();
}
}
float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
min = mm[0];
max = mm[1];
+
+ /*
+ * ensure scale factor allows a scaled range with
+ * 10 integer divisions ('ticks'); if we have got here,
+ * we should expect that max != min
+ */
+ scaleFactor = (max == min) ? 1f : 100f / (max - min);
+
oldcs = fr.getFeatureColours().get(type);
if (oldcs instanceof GraduatedColor)
{
waitForInput();
}
- public FeatureColourChooser()
- {
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
private void jbInit() throws Exception
{
adjusting = true;
acg.setThresh(threshline.value);
- float range = max * 1000f - min * 1000f;
+ float range = (max - min) * scaleFactor;
- slider.setMinimum((int) (min * 1000));
- slider.setMaximum((int) (max * 1000));
- slider.setValue((int) (threshline.value * 1000));
+ slider.setMinimum((int) (min * scaleFactor));
+ slider.setMaximum((int) (max * scaleFactor));
+ slider.setValue((int) (threshline.value * scaleFactor));
thresholdValue.setText(threshline.value + "");
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
try
{
float f = Float.parseFloat(thresholdValue.getText());
- slider.setValue((int) (f * 1000));
+ slider.setValue((int) (f * scaleFactor));
threshline.value = f;
} catch (NumberFormatException ex)
{
public void valueChanged()
{
- threshline.value = slider.getValue() / 1000f;
+ threshline.value = slider.getValue() / scaleFactor;
cs.setThresh(threshline.value);
changeColour();
ap.paintAlignment(false);
}
}
+ @Override
public void bgcolour_actionPerformed(ActionEvent e)
{
Color col = JColorChooser.showDialog(this,
/**
* DOCUMENT ME!
*/
+ @Override
public void run()
{
long progId = System.currentTimeMillis();
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void xCombobox_actionPerformed(ActionEvent e)
{
doDimensionChange();
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void yCombobox_actionPerformed(ActionEvent e)
{
doDimensionChange();
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void zCombobox_actionPerformed(ActionEvent e)
{
doDimensionChange();
}
+ @Override
public void outputValues_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
}
}
+ @Override
public void showLabels_actionPerformed(ActionEvent e)
{
rc.showLabels(showLabels.getState());
}
+ @Override
public void print_actionPerformed(ActionEvent e)
{
PCAPrinter printer = new PCAPrinter();
printer.start();
}
+ @Override
public void originalSeqData_actionPerformed(ActionEvent e)
{
// this was cut'n'pasted from the equivalent TreePanel method - we should
class PCAPrinter extends Thread implements Printable
{
+ @Override
public void run()
{
PrinterJob printJob = PrinterJob.getPrinterJob();
}
}
+ @Override
public int print(Graphics pg, PageFormat pf, int pi)
throws PrinterException
{
* @param e
* DOCUMENT ME!
*/
+ @Override
public void eps_actionPerformed(ActionEvent e)
{
makePCAImage(jalview.util.ImageMaker.TYPE.EPS);
* @param e
* DOCUMENT ME!
*/
+ @Override
public void png_actionPerformed(ActionEvent e)
{
makePCAImage(jalview.util.ImageMaker.TYPE.PNG);
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from PCA",
- width, height, null, null);
+ width, height, null, null, null, 0, false);
}
else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from PCA",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
else
{
im = new jalview.util.ImageMaker(this,
jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
- width, height, null, this.getTitle());
+ width, height, null, this.getTitle(), null, 0, false);
}
}
}
+ @Override
public void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
buttonGroup.add(item);
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
rc.applyToAllViews = false;
itemf.setSelected(rc.applyToAllViews);
itemf.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
rc.applyToAllViews = itemf.isSelected();
* jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
* )
*/
+ @Override
protected void outputPoints_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
* jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
* .ActionEvent)
*/
+ @Override
protected void outputProjPoints_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.AlignmentExportData;
import jalview.exceptions.NoFileSelectedException;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
import jalview.json.binding.biojs.BioJSReleasePojo;
import jalview.json.binding.biojs.BioJSRepositoryPojo;
import jalview.util.MessageManager;
{
private AlignmentViewPanel ap;
+ private long pSessionId;
+
+ private IProgressIndicator pIndicator;
+
+ private boolean headless;
+
private static File currentBJSTemplateFile;
private static TreeMap<String, File> bioJsMSAVersions;
"biojs_template_git_repo",
"https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json");
- public BioJsHTMLOutput(AlignmentViewPanel ap)
+ public BioJsHTMLOutput(AlignmentViewPanel ap,
+ IProgressIndicator pIndicator)
{
if (ap != null)
{
this.ap = ap;
+ this.pSessionId = System.currentTimeMillis();
+ this.pIndicator = pIndicator;
+ this.headless = (System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true"));
}
}
public void exportJalviewAlignmentAsBioJsHtmlFile()
{
+ String outputFile = null;
try
{
- String outputFile = getOutputFile();
- // String jalviewAlignmentJson = JSONFile.getJSONData(ap);
+ outputFile = getOutputFile();
AlignExportSettingI exportSettings = new AlignExportSettingI()
{
@Override
out.flush();
out.close();
jalview.util.BrowserLauncher.openURL("file:///" + outputFile);
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.export_complete", "BioJS"), pSessionId);
+ }
} catch (NoFileSelectedException ex)
{
// do noting if no file was selected
+ } catch (OutOfMemoryError err)
+ {
+ System.out.println("########################\n" + "OUT OF MEMORY "
+ + outputFile + "\n" + "########################");
+ new OOMWarning("Creating Image for " + outputFile, err);
} catch (Exception e)
{
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "info.error_creating_file", "HTML"), pSessionId);
e.printStackTrace();
}
}
public String getOutputFile() throws NoFileSelectedException
{
String selectedFile = null;
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file", "HTML"),
+ pSessionId);
+ }
+
JalviewFileChooser jvFileChooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
new String[] { "html" }, new String[] { "HTML files" },
}
else
{
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "BioJS"),
+ pSessionId);
throw new NoFileSelectedException("No file was selected.");
}
return selectedFile;
{
Thread updateThread = new Thread()
{
+ @Override
public void run()
{
try
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.HTMLOptions;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
import jalview.math.AlignmentDimension;
import jalview.util.MessageManager;
public void generateHtmlSvgOutput(File file)
{
+ IProgressIndicator pIndicator = ap.alignFrame;
+ long pSessionId = System.currentTimeMillis();
try
{
+ boolean headless = (System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true"));
if (file == null)
{
-
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file", "HTML"),
+ pSessionId);
+ }
JalviewFileChooser chooser = getHTMLChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle(ap.alignFrame.getTitle());
}
else
{
+
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "HTML"),
+ pSessionId);
+ }
return;
}
}
{
jalview.util.BrowserLauncher.openURL("file:///" + file);
}
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.export_complete", "HTML"), pSessionId);
+ }
+ } catch (OutOfMemoryError err)
+ {
+ System.out.println("########################\n" + "OUT OF MEMORY "
+ + file + "\n" + "########################");
+ new OOMWarning("Creating Image for " + file, err);
} catch (Exception e)
{
e.printStackTrace();
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "info.error_creating_file", "HTML"), pSessionId);
}
}
import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
+import jalview.gui.IProgressIndicator;
import jalview.gui.SVGOptions;
import jalview.io.JalviewFileChooser;
}
public ImageMaker(Component parent, TYPE type, String title, int width,
- int height, File file, String fileTitle)
+ int height, File file, String fileTitle,
+ IProgressIndicator pIndicator, long pSessionId, boolean headless)
{
this.type = type;
if (file == null)
{
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(
+ MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file",
+ type.name), pSessionId);
+ }
JalviewFileChooser chooser;
chooser = type.getChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
.getSelectedFile().getParent());
file = chooser.getSelectedFile();
}
+ else
+ {
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", type.name),
+ pSessionId);
+ }
+ }
}
if (file != null)
{
setupPNG(width, height);
}
-
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(
+MessageManager.formatMessage(
+ "status.export_complete", type.getName()),
+ pSessionId);
+ }
} catch (Exception ex)
{
System.out.println("Error creating " + type.getName() + " file.");
+
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "info.error_creating_file", type.getName()), pSessionId);
}
}
}