git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
24eb9d2
)
JAL-244 Allow adjusting Id column width in wrap mode. Set Id column width in gui...
author
Ben Soares
<b.soares@dundee.ac.uk>
Thu, 27 Jul 2023 16:28:48 +0000
(17:28 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Thu, 27 Jul 2023 16:28:48 +0000
(17:28 +0100)
src/jalview/bin/Commands.java
patch
|
blob
|
history
src/jalview/gui/AlignFrame.java
patch
|
blob
|
history
src/jalview/gui/AlignmentPanel.java
patch
|
blob
|
history
src/jalview/gui/AnnotationLabels.java
patch
|
blob
|
history
src/jalview/gui/IdCanvas.java
patch
|
blob
|
history
diff --git
a/src/jalview/bin/Commands.java
b/src/jalview/bin/Commands.java
index
838b381
..
e1c88e1
100644
(file)
--- a/
src/jalview/bin/Commands.java
+++ b/
src/jalview/bin/Commands.java
@@
-166,13
+166,9
@@
public class Commands
if (avm == null)
return true;
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;
if (avm.containsArg(Arg.APPEND) || avm.containsArg(Arg.OPEN))
{
commandArgsProvided = true;
@@
-256,11
+252,6
@@
public class Commands
af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
format);
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", "");
// colour alignment?
String colour = ArgParser.getFromSubValArgOrPref(avm, av,
Arg.COLOUR, sv, null, "DEFAULT_COLOUR_PROT", "");
@@
-365,6
+356,12
@@
public class Commands
false, false);
}
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);
// store the AlignFrame for this id
afMap.put(id, af);
@@
-689,6
+686,15
@@
public class Commands
}
}
}
}
+ if (wrap)
+ {
+ AlignFrame af = afMap.get(id);
+ if (af != null)
+ {
+ af.setWrapFormat(wrap);
+ }
+ }
+
/*
boolean doShading = avm.getBoolean(Arg.TEMPFAC_SHADING);
if (doShading)
/*
boolean doShading = avm.getBoolean(Arg.TEMPFAC_SHADING);
if (doShading)
diff --git
a/src/jalview/gui/AlignFrame.java
b/src/jalview/gui/AlignFrame.java
index
ab705c2
..
7f9bfff
100644
(file)
--- a/
src/jalview/gui/AlignFrame.java
+++ b/
src/jalview/gui/AlignFrame.java
@@
-157,7
+157,6
@@
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
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;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
@@
-1456,9
+1455,11
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
- try {
+ try
+ {
htmlSVG.exportHTML(null);
htmlSVG.exportHTML(null);
- } catch (ImageOutputException x) {
+ } catch (ImageOutputException x)
+ {
// report problem to console and raise dialog
}
}
// report problem to console and raise dialog
}
}
@@
-1467,51
+1468,64
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
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)
{
}
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
// 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
}
}
createPNG(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
}
+
@Override
@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
}
createEPS(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
-
+
}
}
+
@Override
@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
}
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.
/**
* 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.
@@
-1523,7
+1537,8
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
}
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);
}
{
alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis);
}
@@
-1534,7
+1549,7
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
*
* @param f
*/
*
* @param f
*/
- public void createEPS(File f) throws ImageOutputException
+ public void createEPS(File f) throws ImageOutputException
{
createEPS(f, null);
}
{
createEPS(f, null);
}
@@
-1550,7
+1565,7
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
*
* @param f
*/
*
* @param f
*/
- public void createSVG(File f) throws ImageOutputException
+ public void createSVG(File f) throws ImageOutputException
{
createSVG(f, null);
}
{
createSVG(f, null);
}
@@
-2341,12
+2356,14
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
// annotation was duplicated earlier
alignment.addAnnotation(sequences[i].getAnnotation()[a]);
// take care of contact matrix too
// 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);
}
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a],
a);
}
@@
-3138,10
+3155,15
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
@Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
@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();
}
alignPanel.updateLayout();
}
@@
-4239,8
+4261,7
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
return tp;
}
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 x = 4, y = 5;
int w = 400, h = 500;
diff --git
a/src/jalview/gui/AlignmentPanel.java
b/src/jalview/gui/AlignmentPanel.java
index
8a43a4a
..
c7c03b3
100644
(file)
--- a/
src/jalview/gui/AlignmentPanel.java
+++ b/
src/jalview/gui/AlignmentPanel.java
@@
-297,7
+297,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
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);
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);
}
/**
}
/**
@@
-624,7
+624,8
@@
public class AlignmentPanel extends GAlignmentPanel implements
ranges.setStartSeq(0);
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
ranges.setStartSeq(0);
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
- idwidthAdjuster.setVisible(!wrap);
+ // Allow idPanel width adjustment in wrap mode
+ idwidthAdjuster.setVisible(true);
if (wrap)
{
if (wrap)
{
@@
-658,7
+659,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
}
}
}
}
- idSpaceFillerPanel1.setVisible(!wrap);
+ // idSpaceFillerPanel1.setVisible(!wrap);
repaint();
}
repaint();
}
@@
-1437,8
+1438,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
{
int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
{
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
{
seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
- vscroll.getPreferredSize().width
diff --git
a/src/jalview/gui/AnnotationLabels.java
b/src/jalview/gui/AnnotationLabels.java
index
afee3d0
..
241e0a3
100755
(executable)
--- a/
src/jalview/gui/AnnotationLabels.java
+++ b/
src/jalview/gui/AnnotationLabels.java
@@
-1206,6
+1206,7
@@
public class AnnotationLabels extends JPanel
Graphics dummy = g2d.create();
int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
null);
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())
Dimension d = ap.calculateDefaultAlignmentIdWidth();
int alignmentIdWidth = d.width;
if (iwa != null && !iwa.manuallyAdjusted())
@@
-1230,6
+1231,14
@@
public class AnnotationLabels extends JPanel
}
}
}
}
}
}
+ 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);
}
drawLabels(g, clip, width, true, null);
}
@@
-1255,7
+1264,7
@@
public class AnnotationLabels extends JPanel
boolean actuallyDraw, FontMetrics fmetrics)
{
int actualWidth = 0;
boolean actuallyDraw, FontMetrics fmetrics)
{
int actualWidth = 0;
- if (actuallyDraw && g != null)
+ if (g != null)
{
if (av.getFont().getSize() < 10)
{
{
if (av.getFont().getSize() < 10)
{
diff --git
a/src/jalview/gui/IdCanvas.java
b/src/jalview/gui/IdCanvas.java
index
c94dee0
..
d9997a0
100755
(executable)
--- a/
src/jalview/gui/IdCanvas.java
+++ b/
src/jalview/gui/IdCanvas.java
@@
-22,6
+22,7
@@
package jalview.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
@@
-382,6
+383,12
@@
public class IdCanvas extends JPanel implements ViewportListenerI
void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
int startSeq, int pageHeight)
{
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();
int alignmentWidth = alignViewport.getAlignment().getWidth();
final int alheight = alignViewport.getAlignment().getHeight();
@@
-429,7
+436,16
@@
public class IdCanvas extends JPanel implements ViewportListenerI
if (labels != null && alignViewport.isShowAnnotation())
{
g.translate(0, ypos + (alheight * charHeight));
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));
}
g.translate(0, -ypos - (alheight * charHeight));
}