if (avm == null)
return true;
- /*
- * // script to execute after all loading is completed one way or another String
- * groovyscript = m.get(Arg.GROOVY) == null ? null :
- * m.get(Arg.GROOVY).getValue(); String file = m.get(Arg.OPEN) == null ? null :
- * m.get(Arg.OPEN).getValue(); String data = null; FileFormatI format = null;
- * DataSourceType protocol = null;
- */
+ // set wrap scope here so it can be applied after structures are opened
+ boolean wrap = false;
+
if (avm.containsArg(Arg.APPEND) || avm.containsArg(Arg.OPEN))
{
commandArgsProvided = true;
af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
format);
- // wrap alignment?
- boolean wrap = ArgParser.getFromSubValArgOrPref(avm, Arg.WRAP, sv,
- null, "WRAP_ALIGNMENT", false);
- af.getCurrentView().setWrapAlignment(wrap);
-
// colour alignment?
String colour = ArgParser.getFromSubValArgOrPref(avm, av,
Arg.COLOUR, sv, null, "DEFAULT_COLOUR_PROT", "");
false, false);
}
+ // wrap alignment? do this last for formatting reasons
+ wrap = ArgParser.getFromSubValArgOrPref(avm, Arg.WRAP, sv, null,
+ "WRAP_ALIGNMENT", false);
+ // af.setWrapFormat(wrap) is applied after structures are opened for
+ // annotation reasons
+
// store the AlignFrame for this id
afMap.put(id, af);
}
}
+ if (wrap)
+ {
+ AlignFrame af = afMap.get(id);
+ if (af != null)
+ {
+ af.setWrapFormat(wrap);
+ }
+ }
+
/*
boolean doShading = avm.getBoolean(Arg.TEMPFAC_SHADING);
if (doShading)
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
-import jalview.ws.datamodel.alphafold.PAEContactMatrix;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
- try {
+ try
+ {
htmlSVG.exportHTML(null);
- } catch (ImageOutputException x) {
+ } catch (ImageOutputException x)
+ {
// report problem to console and raise dialog
}
}
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
- try {
- bjs.exportHTML(null);
- } catch (ImageOutputException x) {
- // report problem to console and raise dialog
- }
+ try
+ {
+ bjs.exportHTML(null);
+ } catch (ImageOutputException x)
+ {
+ // report problem to console and raise dialog
+ }
}
public void createImageMap(File file, String image)
{
- try {
- alignPanel.makePNGImageMap(file, image);
- } catch (ImageOutputException x) {
+ try
+ {
+ alignPanel.makePNGImageMap(file, image);
+ } catch (ImageOutputException x)
+ {
// report problem to console and raise dialog
}
}
@Override
- public void createPNG_actionPerformed(ActionEvent e) {
- try{
+ public void createPNG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createPNG(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
}
+
@Override
- public void createEPS_actionPerformed(ActionEvent e) {
- try{
+ public void createEPS_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createEPS(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
-
+
}
+
@Override
- public void createSVG_actionPerformed(ActionEvent e) {
- try{
+ public void createSVG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createSVG(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
-
+
}
+
/**
* Creates a PNG image of the alignment and writes it to the given file. If
* the file is null, the user is prompted to choose a file.
createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
}
- public void createPNG(File f, String renderer, BitmapImageSizing userBis) throws ImageOutputException
+ public void createPNG(File f, String renderer, BitmapImageSizing userBis)
+ throws ImageOutputException
{
alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis);
}
*
* @param f
*/
- public void createEPS(File f) throws ImageOutputException
+ public void createEPS(File f) throws ImageOutputException
{
createEPS(f, null);
}
*
* @param f
*/
- public void createSVG(File f) throws ImageOutputException
+ public void createSVG(File f) throws ImageOutputException
{
createSVG(f, null);
}
// annotation was duplicated earlier
alignment.addAnnotation(sequences[i].getAnnotation()[a]);
// take care of contact matrix too
- ContactMatrixI cm=sequences[i].getContactMatrixFor(sequences[i].getAnnotation()[a]);
- if (cm!=null)
+ ContactMatrixI cm = sequences[i]
+ .getContactMatrixFor(sequences[i].getAnnotation()[a]);
+ if (cm != null)
{
- alignment.addContactListFor(sequences[i].getAnnotation()[a], cm);
+ alignment.addContactListFor(sequences[i].getAnnotation()[a],
+ cm);
}
-
+
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a],
a);
}
@Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
- scaleAbove.setVisible(wrapMenuItem.isSelected());
- scaleLeft.setVisible(wrapMenuItem.isSelected());
- scaleRight.setVisible(wrapMenuItem.isSelected());
- viewport.setWrapAlignment(wrapMenuItem.isSelected());
+ setWrapFormat(wrapMenuItem.isSelected());
+ }
+
+ public void setWrapFormat(boolean b)
+ {
+ scaleAbove.setVisible(b);
+ scaleLeft.setVisible(b);
+ scaleRight.setVisible(b);
+ viewport.setWrapAlignment(b);
alignPanel.updateLayout();
}
return tp;
}
- public void showContactMapTree(AlignmentAnnotation aa,
- ContactMatrixI cm)
+ public void showContactMapTree(AlignmentAnnotation aa, ContactMatrixI cm)
{
int x = 4, y = 5;
int w = 400, h = 500;
int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
- return calculateIdWidth(-1, false, true);
+ return calculateIdWidth(-1, false, false);
}
/**
ranges.setStartSeq(0);
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
- idwidthAdjuster.setVisible(!wrap);
+ // Allow idPanel width adjustment in wrap mode
+ idwidthAdjuster.setVisible(true);
if (wrap)
{
}
}
- idSpaceFillerPanel1.setVisible(!wrap);
+ // idSpaceFillerPanel1.setVisible(!wrap);
repaint();
}
{
int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
+ if (Jalview.isHeadlessMode())
{
seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
- vscroll.getPreferredSize().width
Graphics dummy = g2d.create();
int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
null);
+ dummy.dispose();
Dimension d = ap.calculateDefaultAlignmentIdWidth();
int alignmentIdWidth = d.width;
if (iwa != null && !iwa.manuallyAdjusted())
}
}
}
+ else
+ {
+ Graphics2D g2d = (Graphics2D) g;
+ Graphics dummy = g2d.create();
+ int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
+ null);
+ width = Math.max(newAnnotationIdWidth, givenWidth);
+ }
drawLabels(g, clip, width, true, null);
}
boolean actuallyDraw, FontMetrics fmetrics)
{
int actualWidth = 0;
- if (actuallyDraw && g != null)
+ if (g != null)
{
if (av.getFont().getSize() < 10)
{
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
int startSeq, int pageHeight)
{
+ drawIdsWrapped(g, alignViewport, startSeq, pageHeight, -1);
+ }
+
+ void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
+ int startSeq, int pageHeight, int idWidth)
+ {
int alignmentWidth = alignViewport.getAlignment().getWidth();
final int alheight = alignViewport.getAlignment().getHeight();
if (labels != null && alignViewport.isShowAnnotation())
{
g.translate(0, ypos + (alheight * charHeight));
- labels.drawComponent(g, getWidth());
+ int getAnnotationsIdWidth = labels.drawLabels(g, false, -1, false,
+ null);
+ int thisIdWidth = idWidth < 0 ? getAnnotationsIdWidth : idWidth;
+ if (thisIdWidth > getWidth())
+ {
+ this.setPreferredSize(
+ new Dimension(this.getHeight(), thisIdWidth));
+ this.repaint();
+ }
+ labels.drawComponent(g, false, thisIdWidth);
g.translate(0, -ypos - (alheight * charHeight));
}