label.show_experimental = Enable experimental features
label.show_experimental_tip = Enable any new and currently 'experimental' features (see Latest Release Notes for details)
label.warning_hidden = Warning: {0} {1} is currently hidden
+label.overview_settings = Overview settings
+label.ov_legacy_gap = Use legacy gap colouring (gaps are white)
+label.gap_colour = Gap colour:
+label.ov_show_hide_default = Show hidden regions when opening overview
+label.hidden_colour = Hidden colour:
+label.select_gap_colour = Select gap colour
+label.select_hidden_colour = Select hidden colour
+label.overview = Overview
\ No newline at end of file
label.show_experimental = Habilitar funciones experimentales
label.show_experimental_tip = Habilitar funciones nuevas y experimentales (ver Latest Release Notes para más detalles)
label.warning_hidden = Advertencia: {0} {1} está actualmente oculto
+label.overview_settings = Overview settings
+label.ov_legacy_gap = Use legacy gap colouring (gaps are white)
+label.gap_colour = Gap colour:
+label.ov_show_hide_default = Show hidden regions when opening overview
+label.hidden_colour = Hidden colour:
+label.select_gap_colour = Select gap colour
+label.select_hidden_colour = Select hidden colour
+label.overview = Overview
\ No newline at end of file
* @return true if the column at the position is hidden
*/
public boolean isHidden(int c);
+
+ /**
+ * Answers if any column in this collection is hidden
+ *
+ * @return true if there is at least 1 hidden column
+ */
+ public boolean hasHidden();
}
public boolean isHidden(int r);
/**
+ * Answers if any row in this collection is hidden
+ *
+ * @return true if there is at least 1 hidden row
+ */
+ public boolean hasHidden();
+
+ /**
* Answers the sequence at the given position in the alignment
*
* @param r
{
return !hidden.isVisible(c);
}
+
+ @Override
+ public boolean hasHidden()
+ {
+ return hidden.hasHiddenColumns();
+ }
}
{
return alignment.getSequenceAtAbsoluteIndex(seq);
}
+
+ @Override
+ public boolean hasHidden()
+ {
+ return (hidden.getSize() > 0);
+ }
}
return false;
}
+ @Override
+ public boolean hasHidden()
+ {
+ return false;
+ }
+
}
{
return alignment.getSequenceAtAbsoluteIndex(seq);
}
+
+ @Override
+ public boolean hasHidden()
+ {
+ return false;
+ }
}
public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
+ public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
+
+ public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
+
private static final int MIN_FONT_SIZE = 1;
private static final int MAX_FONT_SIZE = 30;
* .properties file as '|' separated strings
*/
- groupURLLinks = new ArrayList<String>();
+ groupURLLinks = new ArrayList<>();
}
JInternalFrame frame;
Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
/*
+ * Set overview panel defaults
+ */
+ gapColour.setBackground(
+ Cache.getDefaultColour("GAP_COLOUR", Color.lightGray));
+ hiddenColour.setBackground(
+ Cache.getDefaultColour("HIDDEN_COLOUR", Color.darkGray));
+ useLegacyGap.setSelected(Cache.getDefault("USE_LEGACY_GAP", false));
+ gapLabel.setEnabled(!useLegacyGap.isSelected());
+ gapColour.setEnabled(!useLegacyGap.isSelected());
+ showHiddenAtStart
+ .setSelected(Cache.getDefault("SHOW_OV_HIDDEN_AT_START", true));
+
+ /*
* Set Structure tab defaults.
*/
final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
maxColour.getBackground());
/*
+ * Save Overview settings
+ */
+ Cache.setColourProperty("GAP_COLOUR", gapColour.getBackground());
+ Cache.setColourProperty("HIDDEN_COLOUR", hiddenColour.getBackground());
+ Cache.applicationProperties.setProperty(USE_LEGACY_GAP,
+ Boolean.toString(useLegacyGap.isSelected()));
+ Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START,
+ Boolean.toString(showHiddenAtStart.isSelected()));
+
+ /*
* Save Structure settings
*/
Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
}
@Override
+ public void gapColour_actionPerformed(JPanel gap)
+ {
+ if (!useLegacyGap.isSelected())
+ {
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_gap_colour"),
+ gapColour.getBackground());
+ if (col != null)
+ {
+ gap.setBackground(col);
+ }
+ gap.repaint();
+ }
+ }
+
+ @Override
+ public void hiddenColour_actionPerformed(JPanel hidden)
+ {
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_hidden_colour"),
+ hiddenColour.getBackground());
+ if (col != null)
+ {
+ hidden.setBackground(col);
+ }
+ hidden.repaint();
+ }
+
+ @Override
protected void userIdWidth_actionPerformed()
{
try
protected JCheckBox rightAlign = new JCheckBox();
- protected JComboBox<String> fontSizeCB = new JComboBox<String>();
+ protected JComboBox<String> fontSizeCB = new JComboBox<>();
- protected JComboBox<String> fontStyleCB = new JComboBox<String>();
+ protected JComboBox<String> fontStyleCB = new JComboBox<>();
- protected JComboBox<String> fontNameCB = new JComboBox<String>();
+ protected JComboBox<String> fontNameCB = new JComboBox<>();
protected JCheckBox showOccupancy = new JCheckBox();
protected JCheckBox scaleProteinToCdna = new JCheckBox();
- protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
+ protected JComboBox<String> gapSymbolCB = new JComboBox<>();
protected JCheckBox wrap = new JCheckBox();
- protected JComboBox<String> sortby = new JComboBox<String>();
+ protected JComboBox<String> sortby = new JComboBox<>();
- protected JComboBox<String> sortAnnBy = new JComboBox<String>();
+ protected JComboBox<String> sortAnnBy = new JComboBox<>();
- protected JComboBox<String> sortAutocalc = new JComboBox<String>();
+ protected JComboBox<String> sortAutocalc = new JComboBox<>();
protected JCheckBox startupCheckbox = new JCheckBox();
protected JCheckBox addTempFactor = new JCheckBox();
- protected JComboBox<String> structViewer = new JComboBox<String>();
+ protected JComboBox<String> structViewer = new JComboBox<>();
protected JTextField chimeraPath = new JTextField();
protected JPanel maxColour = new JPanel();
- protected JComboBox<String> protColour = new JComboBox<String>();
+ protected JComboBox<String> protColour = new JComboBox<>();
- protected JComboBox<String> nucColour = new JComboBox<String>();
+ protected JComboBox<String> nucColour = new JComboBox<>();
+
+ /*
+ * Overview tab components
+ */
+ protected JPanel overviewTab;
+
+ protected JPanel gapColour = new JPanel();
+
+ protected JPanel hiddenColour = new JPanel();
+
+ protected JCheckBox useLegacyGap;
+
+ protected JCheckBox showHiddenAtStart;
+
+ protected JLabel gapLabel;
/*
* Connections tab components
/*
* Output tab components
*/
- protected JComboBox<Object> epsRendering = new JComboBox<Object>();
+ protected JComboBox<Object> epsRendering = new JComboBox<>();
protected JLabel userIdWidthlabel = new JLabel();
tabbedPane.add(initColoursTab(),
MessageManager.getString("label.colours"));
+ tabbedPane.add(initOverviewTab(),
+ MessageManager.getString("label.overview"));
+
tabbedPane.add(initStructureTab(),
MessageManager.getString("label.structure"));
}
/**
+ * Initialises the Overview tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initOverviewTab()
+ {
+ JPanel overviewPanel = new JPanel();
+ overviewPanel.setBorder(new TitledBorder(
+ MessageManager.getString("label.overview_settings")));
+
+ gapColour.setFont(LABEL_FONT);
+ // fixing the border colours stops apparent colour bleed from the panel
+ gapColour.setBorder(
+ BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
+ gapColour.setPreferredSize(new Dimension(40, 20));
+ gapColour.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ gapColour_actionPerformed(gapColour);
+ }
+ });
+
+ hiddenColour.setFont(LABEL_FONT);
+ // fixing the border colours stops apparent colour bleed from the panel
+ hiddenColour.setBorder(
+ BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
+ hiddenColour.setPreferredSize(new Dimension(40, 20));
+ hiddenColour.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ hiddenColour_actionPerformed(hiddenColour);
+ }
+ });
+
+ useLegacyGap = new JCheckBox(
+ MessageManager.getString("label.ov_legacy_gap"));
+ useLegacyGap.setFont(LABEL_FONT);
+ useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
+ gapLabel = new JLabel(
+ MessageManager.getString("label.gap_colour"));
+ gapLabel.setFont(LABEL_FONT);
+ gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ showHiddenAtStart = new JCheckBox(
+ MessageManager.getString("label.ov_show_hide_default"));
+ showHiddenAtStart.setFont(LABEL_FONT);
+ showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
+ JLabel hiddenLabel = new JLabel(
+ MessageManager.getString("label.hidden_colour"));
+ hiddenLabel.setFont(LABEL_FONT);
+ hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
+
+ useLegacyGap.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ useLegacyGaps_actionPerformed(e);
+ }
+ });
+
+ overviewPanel.setLayout(new GridBagLayout());
+ GridBagConstraints c1 = new GridBagConstraints();
+
+ c1.fill = GridBagConstraints.HORIZONTAL;
+ c1.gridx = 0;
+ c1.gridy = 0;
+ c1.weightx = 1;
+ c1.ipady = 20;
+ c1.anchor = GridBagConstraints.FIRST_LINE_START;
+ overviewPanel.add(useLegacyGap, c1);
+
+ GridBagConstraints c2 = new GridBagConstraints();
+ c2.fill = GridBagConstraints.HORIZONTAL;
+ c2.gridx = 1;
+ c2.gridy = 0;
+ c2.insets = new Insets(0, 15, 0, 10);
+ overviewPanel.add(gapLabel, c2);
+
+ GridBagConstraints c3 = new GridBagConstraints();
+ c3.fill = GridBagConstraints.HORIZONTAL;
+ c3.gridx = 2;
+ c3.gridy = 0;
+ c3.insets = new Insets(0, 0, 0, 15);
+ overviewPanel.add(gapColour, c3);
+
+ GridBagConstraints c4 = new GridBagConstraints();
+ c4.fill = GridBagConstraints.HORIZONTAL;
+ c4.gridx = 0;
+ c4.gridy = 1;
+ c4.weightx = 1;
+ overviewPanel.add(showHiddenAtStart, c4);
+
+ GridBagConstraints c5 = new GridBagConstraints();
+ c5.fill = GridBagConstraints.HORIZONTAL;
+ c5.gridx = 1;
+ c5.gridy = 1;
+ c5.insets = new Insets(0, 15, 0, 10);
+ overviewPanel.add(hiddenLabel, c5);
+
+ GridBagConstraints c6 = new GridBagConstraints();
+ c6.fill = GridBagConstraints.HORIZONTAL;
+ c6.gridx = 2;
+ c6.gridy = 1;
+ c6.insets = new Insets(0, 0, 0, 15);
+ overviewPanel.add(hiddenColour, c6);
+
+ // Add padding so the panel doesn't look ridiculous
+ JPanel spacePanel = new JPanel();
+ overviewPanel.add(spacePanel,
+ new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
+ GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ new Insets(0, 0, 0, 5), 0, 0));
+
+ return overviewPanel;
+ }
+
+ /**
* Initialises the Structure tabbed panel.
*
* @return
{
}
+ protected void gapColour_actionPerformed(JPanel panel)
+ {
+ }
+
+ protected void hiddenColour_actionPerformed(JPanel panel)
+ {
+ }
+
protected void showunconserved_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
}
+ protected void useLegacyGaps_actionPerformed(ActionEvent e)
+ {
+ boolean enabled = useLegacyGap.isSelected();
+ if (enabled)
+ {
+ gapColour.setBackground(Color.WHITE);
+ }
+ gapColour.setEnabled(!enabled);
+ gapLabel.setEnabled(!enabled);
+ }
+
/**
* DOCUMENT ME!
*
import jalview.renderer.seqfeatures.FeatureRenderer;
import jalview.viewmodel.OverviewDimensions;
+import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
public class OverviewRenderer
{
+ // transparency of hidden cols/seqs overlay
+ private final float TRANSPARENCY = 0.5f;
+
private FeatureColourFinder finder;
// image to render on
{
break;
}
-
+
// get details of this alignment row
- boolean hidden = rows.isHidden(alignmentRow);
SequenceI seq = rows.getSequence(alignmentRow);
+
// rate limiting step when rendering overview for lots of groups
SequenceGroup[] allGroups = al.findAllGroups(seq);
// calculate where this row extends to in pixels
int endRow = Math.min(Math.round((seqIndex + 1) * pixelsPerSeq) - 1,
miniMe.getHeight() - 1);
-
+
int colIndex = 0;
int pixelCol = 0;
for (int alignmentCol : cols)
{
break;
}
-
+
// calculate where this column extends to in pixels
int endCol = Math.min(Math.round((colIndex + 1) * pixelsPerCol) - 1,
miniMe.getWidth() - 1);
-
+
// don't do expensive colour determination if we're not going to use it
// NB this is important to avoid performance issues in the overview
// panel
if (pixelCol <= endCol)
{
- // determine the colour based on the sequence and column position
rgbcolor = getColumnColourFromSequence(allGroups, seq,
- hidden || cols.isHidden(alignmentCol), alignmentCol,
- finder);
-
+ alignmentCol, finder);
+
// fill in the appropriate number of pixels
for (int row = pixelRow; row <= endRow; ++row)
{
miniMe.setRGB(col, row, rgbcolor);
}
}
-
+
pixelCol = endCol + 1;
}
colIndex++;
pixelRow = endRow + 1;
seqIndex++;
}
+
+ overlayHiddenRegions(rows, cols);
return miniMe;
}
- /*
+ /**
* Find the colour of a sequence at a specified column position
+ *
+ * @param seq
+ * sequence to get colour for
+ * @param lastcol
+ * column position to get colour for
+ * @param fcfinder
+ * FeatureColourFinder to use
+ * @return colour of sequence at this position, as RGB
*/
private int getColumnColourFromSequence(SequenceGroup[] allGroups,
jalview.datamodel.SequenceI seq,
- boolean isHidden, int lastcol, FeatureColourFinder fcfinder)
+ int lastcol, FeatureColourFinder fcfinder)
{
Color color = Color.white;
fcfinder);
}
- if (isHidden)
+ return color.getRGB();
+ }
+
+ /**
+ * Overlay the hidden regions on the overview image
+ *
+ * @param rows
+ * collection of rows the overview is built over
+ * @param cols
+ * collection of columns the overview is built over
+ */
+ private void overlayHiddenRegions(AlignmentRowsCollectionI rows,
+ AlignmentColsCollectionI cols)
+ {
+ if (cols.hasHidden() || rows.hasHidden())
{
- color = color.darker().darker();
+ BufferedImage mask = buildHiddenImage(rows, cols, miniMe.getWidth(),
+ miniMe.getHeight());
+
+ Graphics2D g = (Graphics2D) miniMe.getGraphics();
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+ TRANSPARENCY));
+ g.drawImage(mask, 0, 0, miniMe.getWidth(), miniMe.getHeight(), null);
}
+ }
- return color.getRGB();
+ /**
+ * Build a masking image of hidden columns and rows to be applied on top of
+ * the main overview image.
+ *
+ * @param rows
+ * collection of rows the overview is built over
+ * @param cols
+ * collection of columns the overview is built over
+ * @param width
+ * width of overview in pixels
+ * @param height
+ * height of overview in pixels
+ * @return BufferedImage containing mask of hidden regions
+ */
+ private BufferedImage buildHiddenImage(AlignmentRowsCollectionI rows,
+ AlignmentColsCollectionI cols, int width, int height)
+ {
+ // new masking image
+ BufferedImage hiddenImage = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_ARGB);
+
+ int colIndex = 0;
+ int pixelCol = 0;
+
+ Color hidden = Color.DARK_GRAY.darker();
+
+ Graphics2D g2d = (Graphics2D) hiddenImage.getGraphics();
+
+ // set background to transparent
+ g2d.setComposite(AlphaComposite.Clear);
+ g2d.fillRect(0, 0, width, height);
+
+ // set next colour to opaque
+ g2d.setComposite(AlphaComposite.Src);
+
+ for (int alignmentCol : cols)
+ {
+ if (redraw)
+ {
+ break;
+ }
+
+ // calculate where this column extends to in pixels
+ int endCol = Math.min(Math.round((colIndex + 1) * pixelsPerCol) - 1,
+ hiddenImage.getWidth() - 1);
+
+ if (pixelCol <= endCol)
+ {
+ // determine the colour based on the sequence and column position
+ if (cols.isHidden(alignmentCol))
+ {
+ g2d.setColor(hidden);
+ g2d.fillRect(pixelCol, 0, endCol - pixelCol + 1, height);
+ }
+
+ pixelCol = endCol + 1;
+ }
+ colIndex++;
+
+ }
+
+ int seqIndex = 0;
+ int pixelRow = 0;
+ for (int alignmentRow : rows)
+ {
+ if (redraw)
+ {
+ break;
+ }
+
+ // calculate where this row extends to in pixels
+ int endRow = Math.min(Math.round((seqIndex + 1) * pixelsPerSeq) - 1,
+ miniMe.getHeight() - 1);
+
+ // get details of this alignment row
+ if (rows.isHidden(alignmentRow))
+ {
+ g2d.setColor(hidden);
+ g2d.fillRect(0, pixelRow, width, endRow - pixelRow + 1);
+ }
+ pixelRow = endRow + 1;
+ seqIndex++;
+ }
+
+ return hiddenImage;
}
/**
}
}
+ /**
+ * Allows redraw flag to be set
+ *
+ * @param b
+ * value to set redraw to: true = redraw is occurring, false = no
+ * redraw
+ */
public void setRedraw(boolean b)
{
synchronized (this)