* @return displayed name for the view
*/
String getViewName();
+
+ /**
+ * Answers the title of the panel
+ *
+ * @return
+ */
+ String getTitle();
+
+ /**
+ * Make/Unmake this alignment panel the current input focus
+ *
+ * @param b
+ */
+ void setSelected(boolean b);
}
*/
void raiseViewer();
+ boolean isUsedforcolourby(AlignmentViewPanel ap);
+
}
}
+ @Override
+ public String getTitle()
+ {
+ return alignFrame.getTitle();
+ }
+
+ @Override
+ public void setSelected(boolean b)
+ {
+ // noop
+ }
+
}
addKeyListener();
- final List<AlignmentPanel> selviews = new ArrayList<>();
- final List<AlignmentPanel> origview = new ArrayList<>();
+ final List<AlignmentViewPanel> selviews = new ArrayList<>();
+ final List<AlignmentViewPanel> origview = new ArrayList<>();
final String menuLabel = MessageManager
.getString("label.copy_format_from");
ViewSelectionMenu vsel = new ViewSelectionMenu(menuLabel,
{
@Override
- public AlignmentPanel[] getAllAlignmentPanels()
+ public AlignmentViewPanel[] getAllAlignmentPanels()
{
origview.clear();
origview.add(alignPanel);
{
if (origview.size() > 0)
{
- final AlignmentPanel ap = origview.get(0);
+ final AlignmentViewPanel avp = origview.get(0);
/*
* Copy the ViewStyle of the selected panel to 'this one'.
.getAlignViewport().getCodingComplement() != null;
if (!fromSplitFrame)
{
- vs.setScaleProteinAsCdna(ap.getAlignViewport()
+ vs.setScaleProteinAsCdna(avp.getAlignViewport()
.getViewStyle().isScaleProteinAsCdna());
}
- ap.getAlignViewport().setViewStyle(vs);
+ avp.getAlignViewport().setViewStyle(vs);
/*
* Also rescale ViewStyle of SplitFrame complement if there is
* the whole ViewStyle (allow cDNA protein to have different
* fonts)
*/
- AlignViewportI complement = ap.getAlignViewport()
+ AlignViewportI complement = avp.getAlignViewport()
.getCodingComplement();
if (complement != null && vs.isScaleProteinAsCdna())
{
af.setMenusForViewport();
}
+ AlignmentPanel ap = (AlignmentPanel) avp;
ap.updateLayout();
ap.setSelected(true);
ap.alignFrame.setMenusForViewport();
-
}
}
});
{
return calculationDialog;
}
+
+ @Override
+ public String getTitle()
+ {
+ return alignFrame == null ? null : alignFrame.getTitle();
+ }
}
*/
package jalview.gui;
+import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
}
// refresh the sequence colours for the new structure(s)
- for (AlignmentPanel ap : _colourwith)
+ for (AlignmentViewPanel avp : _colourwith)
{
- jmb.updateColours(ap);
+ jmb.updateColours(avp);
}
// do superposition if asked to
if (alignAddedStructures)
}
@Override
- public void updateColours(Object source)
- {
- AlignmentPanel ap = (AlignmentPanel) source;
- // ignore events from panels not used to colour this view
- if (!appJmolWindow.isUsedforcolourby(ap))
- {
- return;
- }
- if (!isLoadingFromArchive())
- {
- colourBySequence(ap);
- }
- }
-
- @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// todo - script termination doesn't happen ?
*/
package jalview.gui;
+import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
}
// refresh the sequence colours for the new structure(s)
- for (AlignmentPanel ap : _colourwith)
+ for (AlignmentViewPanel avp : _colourwith)
{
- jmb.updateColours(ap);
+ jmb.updateColours(avp);
}
// do superposition if asked to
if (alignAddedStructures)
}
@Override
- public void updateColours(Object source)
- {
- AlignmentPanel ap = (AlignmentPanel) source;
- // ignore events from panels not used to colour this view
- if (!cvf.isUsedforcolourby(ap))
- {
- return;
- }
- if (!isLoadingFromArchive())
- {
- colourBySequence(ap);
- }
- }
-
- @Override
public void releaseReferences(Object svl)
{
}
*/
package jalview.gui;
+import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
/**
* list of alignment panels to use for superposition
*/
- protected Vector<AlignmentPanel> _alignwith = new Vector<>();
+ protected Vector<AlignmentViewPanel> _alignwith = new Vector<>();
/**
* list of alignment panels that are used for colouring structures by aligned
* sequences
*/
- protected Vector<AlignmentPanel> _colourwith = new Vector<>();
+ protected Vector<AlignmentViewPanel> _colourwith = new Vector<>();
private String viewId = null;
return (_alignwith != null) && _alignwith.contains(ap2);
}
- public boolean isUsedforcolourby(AlignmentPanel ap2)
+ @Override
+ public boolean isUsedforcolourby(AlignmentViewPanel avp)
{
- return (_colourwith != null) && _colourwith.contains(ap2);
+ return (_colourwith != null) && _colourwith.contains(avp);
}
/**
int[] alm = new int[_alignwith.size()];
int a = 0;
- for (AlignmentPanel alignPanel : _alignwith)
+ for (AlignmentViewPanel alignPanel : _alignwith)
{
- als[a] = alignPanel.av.getAlignment();
+ AlignViewportI av = alignPanel.getAlignViewport();
+ als[a] = av.getAlignment();
alm[a] = -1;
- alc[a++] = alignPanel.av.getAlignment().getHiddenColumns();
+ alc[a++] = av.getAlignment().getHiddenColumns();
}
reply = getBinding().superposeStructures(als, alm, alc);
if (reply != null)
} catch (Exception e)
{
StringBuffer sp = new StringBuffer();
- for (AlignmentPanel alignPanel : _alignwith)
+ for (AlignmentViewPanel avp : _alignwith)
{
- sp.append("'" + alignPanel.alignFrame.getTitle() + "' ");
+ sp.append(
+ "'" + ((AlignmentPanel) avp).alignFrame.getTitle() + "' ");
}
Cache.log.info("Couldn't align structures with the " + sp.toString()
+ "associated alignment panels.", e);
}
}
// Set the colour using the current view for the associated alignframe
- for (AlignmentPanel alignPanel : _colourwith)
+ for (AlignmentViewPanel avp : _colourwith)
{
- binding.colourBySequence(alignPanel);
+ binding.colourBySequence(avp);
}
seqColoursApplied = true;
}
*/
package jalview.gui;
+import jalview.api.AlignmentViewPanel;
import jalview.util.MessageManager;
import java.awt.Component;
{
public interface ViewSetProvider
{
- public AlignmentPanel[] getAllAlignmentPanels();
+ public AlignmentViewPanel[] getAllAlignmentPanels();
}
private ViewSetProvider _allviews;
- private List<AlignmentPanel> _selectedviews;
+ private List<AlignmentViewPanel> _selectedviews;
private ItemListener _handler;
* selection/deselection state
*/
public ViewSelectionMenu(String title, final ViewSetProvider allviews,
- final List<AlignmentPanel> selectedviews,
+ final List<AlignmentViewPanel> selectedviews,
final ItemListener handler)
{
super(title);
private void rebuild()
{
removeAll();
- AlignmentPanel[] allviews = _allviews.getAllAlignmentPanels();
+ AlignmentViewPanel[] allviews = _allviews.getAllAlignmentPanels();
if (allviews == null)
{
setVisible(false);
invertSel.setEnabled(append);
selectAll.setEnabled(append);
}
- for (final AlignmentPanel ap : allviews)
+ for (final AlignmentViewPanel ap : allviews)
{
String nm = ((ap.getViewName() == null
|| ap.getViewName().length() == 0) ? ""
: ap.getViewName() + " for ")
- + ap.alignFrame.getTitle();
+ + ap.getTitle();
final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(nm,
_selectedviews.contains(ap));
checkBox.addItemListener(new ItemListener()
public abstract void colourByCharge();
/**
- * colour any structures associated with sequences in the given alignment
- * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
- * if colourBySequence is enabled.
+ * Recolours the displayed structures, if they are coloured by sequence, or
+ * 'show only visible alignment' is selected. This supports updating structure
+ * colours on either change of alignment colours, or change to the visible
+ * region of the alignment.
*/
public void colourBySequence(AlignmentViewPanel alignmentv)
{
- if (!colourBySequence || !isLoadingFinished())
+ if (!isLoadingFinished())
+ {
+ return;
+ }
+ // todo: property change event for visibleAlignment
+ // to avoid unnecessary redraws here
+ if (!colourBySequence && !isShowAlignmentOnly())
{
return;
}
*
* @param alignViewportI
*/
- public abstract void showStructures(AlignViewportI alignViewportI);
+ public void showStructures(AlignViewportI alignViewportI)
+ {
+ // override with implementation
+ }
+
+ @Override
+ public void updateColours(Object source)
+ {
+ AlignmentViewPanel ap = (AlignmentViewPanel) source;
+ // ignore events from panels not used to colour this view
+ if (!getViewer().isUsedforcolourby(ap))
+ {
+ return;
+ }
+ if (!isLoadingFromArchive())
+ {
+ colourBySequence(ap);
+ }
+ }
}