label.copy_to_clipboard_tooltip = Copy all of the log text in this console to the system clipboard
label.ignore_hidden = Ignore hidden columns
label.ignore_hidden_tooltip = Ignore any characters in hidden columns when matching
+label.colour_gaps = Colour Gaps
\ No newline at end of file
label.copy_to_clipboard_tooltip = Copie todo el texto de registro en esta consola al portapapeles del sistema
label.ignore_hidden = Ignorar columnas ocultas
label.ignore_hidden_tooltip = Ignorar caracteres en columnas ocultas
+label.colour_gaps = Color del huecos
\ No newline at end of file
* @return
*/
void setProteinFontAsCdna(boolean b);
+
+ /**
+ * Set flag indicating that gaps should be coloured with the overview gap
+ * colour in the alignment view
+ */
+ void setColourGaps(boolean b);
+
+ /**
+ * @return true if gaps should be coloured according to the overview gap
+ * colour
+ */
+ boolean getColourGaps();
}
{
padGapsMenuitem.setSelected(av.isPadGaps());
colourTextMenuItem.setSelected(av.isShowColourText());
+ colourGapsMenuItem.setSelected(av.getColourGaps());
abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
modifyPID.setEnabled(abovePIDThreshold.isSelected());
conservationMenuItem.setSelected(av.getConservationSelected());
* DOCUMENT ME!
*/
@Override
+ protected void colourGapsMenuItem_actionPerformed(ActionEvent e)
+ {
+ viewport.setColourGaps(colourGapsMenuItem.isSelected());
+ alignPanel.paintAlignment(false, false);
+ }
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ @Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
scaleAbove.setVisible(wrapMenuItem.isSelected());
int charWidth = av.getCharWidth();
g.setFont(av.getFont());
- seqRdr.prepare(g, av.isRenderGaps());
+ seqRdr.prepare(g, av.isRenderGaps(), av.getColourGaps());
SequenceI nextSeq;
package jalview.gui;
import jalview.api.AlignViewportI;
+import jalview.bin.Cache;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.renderer.ResidueColourFinder;
ResidueColourFinder resColourFinder;
+ private boolean colourGaps;
+ private Color gapColour=Color.white;
+
/**
* Creates a new SequenceRenderer object
*
}
/**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
+ * initialise state for a render
+ * @param renderGaps - whether gap symbols are shown
+ * @param colourGaps - whether boxes for gaps are to be coloured
*/
- public void prepare(Graphics g, boolean renderGaps)
+ public void prepare(Graphics g, boolean renderGaps, boolean colourGaps)
{
graphics = g;
fm = g.getFontMetrics();
&& av.getCharWidth() == dwidth);
this.renderGaps = renderGaps;
+ this.colourGaps = colourGaps;
+ this.gapColour = Color.white;
+ if (colourGaps)
+ {
+ this.gapColour = Cache.getDefaultColour(Preferences.GAP_COLOUR,
+ jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP);
+ }
+ resColourFinder = new ResidueColourFinder(gapColour);
}
/**
public synchronized void drawBoxes(SequenceI seq, int start, int end,
int y1)
{
- Color resBoxColour = Color.white;
+ Color resBoxColour = gapColour;
if (seq == null)
{
resBoxColour = resColourFinder
.getBoxColour(av.getResidueShading(), seq, i);
}
+ } else {
+ resBoxColour = gapColour;
}
if (resBoxColour != tempColour)
protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem colourGapsMenuItem = new JCheckBoxMenuItem();
+
protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
protected JMenuItem undoMenuItem = new JMenuItem();
colourTextMenuItem_actionPerformed(e);
}
});
-
+ colourGapsMenuItem = new JCheckBoxMenuItem(
+ MessageManager.getString("label.colour_gaps"));
+ colourGapsMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ colourGapsMenuItem_actionPerformed(e);
+ }
+ });
JMenuItem htmlMenuItem = new JMenuItem(
MessageManager.getString("label.html"));
htmlMenuItem.addActionListener(new ActionListener()
formatMenu.add(viewTextMenuItem);
formatMenu.add(colourTextMenuItem);
formatMenu.add(renderGapsMenuItem);
+ formatMenu.add(colourGapsMenuItem);
formatMenu.add(centreColumnLabelsMenuItem);
formatMenu.add(showNonconservedMenuItem);
selectMenu.add(findMenuItem);
// selectMenu.add(listenToViewSelections);
}
+ protected void colourGapsMenuItem_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void loadVcf_actionPerformed()
{
}
public class OverviewResColourFinder extends ResidueColourFinder
{
- final Color GAP_COLOUR; // default colour to use at gaps
-
- final Color RESIDUE_COLOUR; // default colour to use at residues
final Color HIDDEN_COLOUR; // colour for hidden regions
}
}
- @Override
- public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
- {
- Color resBoxColour = RESIDUE_COLOUR;
- char currentChar = seq.getCharAt(i);
-
- // In the overview window, gaps are coloured grey, unless the colour scheme
- // specifies a gap colour, in which case gaps honour the colour scheme
- // settings
- if (shader.getColourScheme() != null)
- {
- if (Comparison.isGap(currentChar)
- && (!shader.getColourScheme().hasGapColour()))
- {
- resBoxColour = GAP_COLOUR;
- }
- else
- {
- resBoxColour = shader.findColour(currentChar, i, seq);
- }
- }
- else if (Comparison.isGap(currentChar))
- {
- resBoxColour = GAP_COLOUR;
- }
-
- return resBoxColour;
- }
-
/**
* {@inheritDoc} In the overview, the showBoxes setting is ignored, as the
* overview displays the colours regardless.
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.renderer.seqfeatures.FeatureColourFinder;
+import jalview.util.Comparison;
import java.awt.Color;
public class ResidueColourFinder
{
+ private static final Color BACKGROUND_COLOUR = Color.white;
+
+ protected Color GAP_COLOUR=Color.white; // default colour to use at gaps
+
+ protected Color RESIDUE_COLOUR=BACKGROUND_COLOUR; // default colour to use at residues
+
public ResidueColourFinder()
{
}
+ public ResidueColourFinder(Color gapColour)
+ {
+ GAP_COLOUR = gapColour;
+ }
/**
* Get the colour of a residue in a sequence
return getBoxColour(shader, seq, i);
}
- return Color.white;
+ return BACKGROUND_COLOUR;
}
/**
}
/**
- * DOCUMENT ME!
+ * Find the colour for a sequence's position in the alignment
*
* @param shader
* the viewport's colour scheme
*/
public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
{
- Color resBoxColour = Color.white;
+ Color resBoxColour = RESIDUE_COLOUR;
+ char currentChar = seq.getCharAt(i);
+
+ // In the overview window, gaps are coloured grey, unless the colour scheme
+ // specifies a gap colour, in which case gaps honour the colour scheme
+ // settings
if (shader.getColourScheme() != null)
{
- resBoxColour = shader.findColour(seq.getCharAt(i), i, seq);
+ if (Comparison.isGap(currentChar)
+ && (!shader.getColourScheme().hasGapColour()))
+ {
+ resBoxColour = GAP_COLOUR;
+ }
+ else
+ {
+ resBoxColour = shader.findColour(currentChar, i, seq);
+ }
}
+ else if (Comparison.isGap(currentChar))
+ {
+ resBoxColour = GAP_COLOUR;
+ }
+
return resBoxColour;
}
/**
* @return
+ * @see jalview.api.ViewStyleI#getColourGaps()
+ */
+ @Override
+ public boolean getColourGaps()
+ {
+ return viewStyle.getColourGaps();
+ }
+
+ /**
+ * @param state
+ * @see jalview.api.ViewStyleI#setColourGaps(boolean)
+ */
+ @Override
+ public void setColourGaps(boolean state)
+ {
+ viewStyle.setColourGaps(state);
+ }
+
+ /**
+ * @return
* @see jalview.api.ViewStyleI#getWrapAlignment()
*/
@Override
boolean showText = true;
/**
+ * colour gaps in the alignment view according to the overview gap colour
+ */
+ boolean colourGaps = false;
+ /**
* show non-conserved residues only
*/
protected boolean showUnconserved = false;
setUpperCasebold(vs.isUpperCasebold());
setWrapAlignment(vs.getWrapAlignment());
setWrappedWidth(vs.getWrappedWidth());
+ setColourGaps(vs.getColourGaps());
// ViewStyle.configureFrom(this, viewStyle);
}
&& getThresholdTextColour() == vs.getThresholdTextColour()
&& isUpperCasebold() == vs.isUpperCasebold()
&& getWrapAlignment() == vs.getWrapAlignment()
- && getWrappedWidth() == vs.getWrappedWidth());
+ && getWrappedWidth() == vs.getWrappedWidth()
+ && getColourGaps() == vs.getColourGaps());
/*
* and compare non-primitive types; syntax below will match null with null
* values
hash += m++ * Boolean.valueOf(this.showSequenceFeatures).hashCode();
hash += m++ * Boolean.valueOf(this.showUnconserved).hashCode();
hash += m++ * Boolean.valueOf(this.wrapAlignment).hashCode();
+ hash += m++ * Boolean.valueOf(this.colourGaps).hashCode();
+ hash += m++ * Boolean.valueOf(this.showColourText).hashCode();
hash += m++ * this.charHeight;
hash += m++ * this.charWidth;
hash += m++ * fontSize;
{
return showComplementFeaturesOnTop;
}
+
+ @Override
+ public void setColourGaps(boolean b)
+ {
+ colourGaps = b;
+ }
+
+ @Override
+ public boolean getColourGaps()
+ {
+ return colourGaps;
+ }
}