+ protected void resizePanel()
+ {
+ int ph = (progressPanel.getParent() == null ? 0
+ : progressPanel.getHeight());
+ // Resize is called on the initial display of the overview.
+ // This code adjusts sizes to account for the progress bar if it has not
+ // already been accounted for, which triggers another resize call for
+ // the correct sizing, at which point the overview image is updated.
+ // (This avoids a double recalculation of the image.)
+ if (getWidth() == od.getWidth() && getHeight() == od.getHeight() + ph)
+ {
+ if (canvas.lastMiniMe == null)
+ {
+ updateOverviewImage();
+ }
+ }
+ else
+ {
+ int w = getWidth();
+ int h = getHeight();
+ if ((w > 0) && (h > 0))
+ {
+ if (dim != null)
+ {
+ dim.setSize(w, h - ph);
+ }
+ od.setWidth(w);
+ od.setHeight(h - ph);
+ updateOverviewImage();
+ }
+ }
+ }
+
+ /**
+ * Create the appropriate type of OverViewDimensions, with the desired size.
+ */
+ private void createOverviewDimensions()
+ {
+ boolean showAnnotation = (av.isShowAnnotation()
+ && av.getAlignmentConservationAnnotation() != null);
+ if (showHidden)
+ {
+ od = new OverviewDimensionsShowHidden(av.getRanges(), showAnnotation,
+ dim);
+ }
+ else
+ {
+ od = new OverviewDimensionsHideHidden(av.getRanges(), showAnnotation,
+ dim);
+ }
+
+ }
+
+ /**
+ * Displays the popup menu and acts on user input
+ */
+ protected void showPopupMenu(MouseEvent e)
+ {
+ JPopupMenu popup = new JPopupMenu();
+ ActionListener menuListener = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent event)
+ {
+ // switch on/off the hidden columns view
+ toggleHiddenColumns();
+ displayToggle.setSelected(showHidden);
+ }
+ };
+ displayToggle = new JCheckBoxMenuItem(
+ MessageManager.getString("label.togglehidden"));
+ displayToggle.setEnabled(true);
+ displayToggle.setSelected(showHidden);
+ popup.add(displayToggle);
+ displayToggle.addActionListener(menuListener);
+ popup.show(this, e.getX(), e.getY());
+ }
+
+ /**
+ * Toggle overview display between showing hidden columns and hiding hidden
+ * columns
+ */
+ protected void toggleHiddenColumns()
+ {
+ showHidden = !showHidden;
+ createOverviewDimensions();
+ canvas.resetOviewDims(od);