/**
* height in pixels for allowing height adjuster to be active
*/
- private static int HEIGHT_ADJUSTER_HEIGHT = 10;
+ public static int HEIGHT_ADJUSTER_HEIGHT = 10;
private static final Font font = new Font("Arial", Font.PLAIN, 11);
private int annotationIdWidth = -1;
+ public static final String RESIZE_MARGINS_MARK_PREF = "RESIZE_MARGINS_MARK";
+
/**
* Creates a new AnnotationLabels object
*
public void actionPerformed(ActionEvent e)
{
sel_row.setShowGroupsForContactMatrix(chitem.getState());
- ap.getAnnotationPanel()
- .paint(ap.getAnnotationPanel().getGraphics());
+ // so any annotation colour changes are propagated - though they
+ // probably won't be unless the annotation row colours are removed
+ // too!
+ ap.alignmentChanged();
}
});
pop.add(chitem);
"action.clustering_matrix_for",
cm.getAnnotDescr(), 5f),
progBar = System.currentTimeMillis());
- cm.setGroupSet(GroupSet.makeGroups(cm, 5f, true));
+ cm.setGroupSet(GroupSet.makeGroups(cm, true));
+ cm.randomlyReColourGroups();
+ cm.transferGroupColorsTo(alignmentAnnotation);
+ ap.alignmentChanged();
ap.alignFrame.showContactMapTree(alignmentAnnotation, cm);
ap.alignFrame.setProgressBar(null, progBar);
}
}
drawComponent(g2, true, width);
-
}
/**
public void drawComponent(Graphics g, boolean clip, int givenWidth)
{
int width = givenWidth;
- IdwidthAdjuster iwa = ap.idwidthAdjuster;
- if ((Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true)
- || Jalview.isHeadlessMode()))
+ IdwidthAdjuster iwa = null;
+ if (ap != null)
{
- Graphics2D g2d = (Graphics2D) g;
- Graphics dummy = g2d.create();
- int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
- null);
- Dimension d = ap.calculateDefaultAlignmentIdWidth();
- int alignmentIdWidth = d.width;
- if (!iwa.manuallyAdjusted())
- {
- // If no manual adjustment to ID column with has been made then adjust
- // width match widest of alignment or annotation id widths
- width = Math.max(alignmentIdWidth, newAnnotationIdWidth);
- }
- else if (newAnnotationIdWidth != annotationIdWidth
- && newAnnotationIdWidth > givenWidth
- && newAnnotationIdWidth > alignmentIdWidth)
+ iwa = ap.idwidthAdjuster;
+ if ((Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true)
+ || Jalview.isHeadlessMode()))
{
- // otherwise if the annotation id width has become larger than the
- // current id width, increase
- width = newAnnotationIdWidth;
- annotationIdWidth = newAnnotationIdWidth;
- }
- // set the width if it's changed
- if (width != ap.av.getIdWidth())
- {
- iwa.setWidth(width);
+ Graphics2D g2d = (Graphics2D) g;
+ 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())
+ {
+ // If no manual adjustment to ID column with has been made then adjust
+ // width match widest of alignment or annotation id widths
+ boolean allowShrink = Cache.getDefault("ALLOW_SHRINK_ID_WIDTH",
+ false);
+ width = Math.max(alignmentIdWidth, newAnnotationIdWidth);
+ if (clip && width < givenWidth && !allowShrink)
+ {
+ width = givenWidth;
+ }
+ }
+ else if (newAnnotationIdWidth != annotationIdWidth
+ && newAnnotationIdWidth > givenWidth
+ && newAnnotationIdWidth > alignmentIdWidth)
+ {
+ // otherwise if the annotation id width has become larger than the
+ // current id width, increase
+ width = newAnnotationIdWidth;
+ annotationIdWidth = newAnnotationIdWidth;
+ }
+ // set the width if it's changed
+ if (width != ap.av.getIdWidth())
+ {
+ iwa.setWidth(width);
+ }
}
}
+ else
+ {
+ int newAnnotationIdWidth = drawLabels(g, clip, width, false, null);
+ width = Math.max(newAnnotationIdWidth, givenWidth);
+ }
drawLabels(g, clip, width, true, null);
}
* @param fmetrics
* FontMetrics if Graphics object g is null
*/
- public int drawLabels(Graphics g, boolean clip, int width,
+ public int drawLabels(Graphics g0, boolean clip, int width,
boolean actuallyDraw, FontMetrics fmetrics)
{
+ if (clip)
+ {
+ clip = Cache.getDefault("MOVE_SEQUENCE_ID_WITH_VISIBLE_ANNOTATIONS",
+ true);
+ }
+ Graphics g = null;
+ // create a dummy Graphics object if not drawing and one is supplied
+ if (g0 != null)
+ {
+ if (!actuallyDraw)
+ {
+ Graphics2D g2d = (Graphics2D) g0;
+ g = g2d.create();
+ }
+ else
+ {
+ g = g0;
+ }
+ }
int actualWidth = 0;
- if (actuallyDraw && g != null)
+ if (g != null)
{
if (av.getFont().getSize() < 10)
{
{
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
+
+ if (!Cache.getDefault(RESIZE_MARGINS_MARK_PREF, false)
+ && !av.getWrapAlignment())
+ {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(0, HEIGHT_ADJUSTER_HEIGHT / 4, HEIGHT_ADJUSTER_WIDTH / 4,
+ HEIGHT_ADJUSTER_HEIGHT / 4);
+ g.drawLine(0, 3 * HEIGHT_ADJUSTER_HEIGHT / 4,
+ HEIGHT_ADJUSTER_WIDTH / 4, 3 * HEIGHT_ADJUSTER_HEIGHT / 4);
+
+ }
}
if (actuallyDraw)