import jalview.api.AlignViewControllerGuiI;
import jalview.api.AlignViewControllerI;
import jalview.api.AlignViewportI;
+import jalview.api.FeatureColourI;
import jalview.api.FeatureRenderer;
import jalview.api.FeatureSettingsControllerI;
import jalview.api.SequenceStructureBinding;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
{
viewport.setColumnSelection(columnSelection);
}
+ viewport.setScaleAboveWrapped(scaleAbove.getState());
alignPanel = new AlignmentPanel(this, viewport);
avc = new jalview.controller.AlignViewController(this, viewport,
normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());
applyToAllGroups.setState(viewport.getColourAppliesToAllGroups());
annotationPanelMenuItem.setState(viewport.isShowAnnotation());
- showAlignmentAnnotations.setState(viewport.isShowAnnotation());
- showSequenceAnnotations.setState(viewport.isShowAnnotation());
+ showAlignmentAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ showSequenceAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ showAlignmentAnnotations.setState(true);
+ showSequenceAnnotations.setState(false);
seqLimits.setState(viewport.getShowJVSuffix());
public boolean parseFeaturesFile(String file, String type,
boolean autoenabledisplay)
{
- // TODO: test if importing a features file onto an alignment which already
- // has features with links overwrites the original links.
-
- Hashtable featureLinks = new Hashtable();
boolean featuresFile = false;
try
{
- featuresFile = new jalview.io.FeaturesFile(file, type).parse(viewport
- .getAlignment(), alignPanel.seqPanel.seqCanvas
- .getFeatureRenderer().getFeatureColours(), featureLinks,
- true, viewport.applet.getDefaultParameter("relaxedidmatch",
- false));
+ Map<String, FeatureColourI> colours = alignPanel.seqPanel.seqCanvas
+ .getFeatureRenderer().getFeatureColours();
+ boolean relaxedIdMatching = viewport.applet.getDefaultParameter(
+ "relaxedidmatch", false);
+ featuresFile = new FeaturesFile(file, type).parse(
+ viewport.getAlignment(), colours, true, relaxedIdMatching);
} catch (Exception ex)
{
ex.printStackTrace();
if (featuresFile)
{
- if (featureLinks.size() > 0)
- {
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks;
- }
if (autoenabledisplay)
{
viewport.setShowSequenceFeatures(true);
// Hide everything by the current selection - this is a hack - we do the
// invert and then hide
// first check that there will be visible columns after the invert.
- if ((viewport.getColumnSelection() != null
- && viewport.getColumnSelection().getSelected() != null && viewport
- .getColumnSelection().getSelected().size() > 0)
+ if (viewport.hasSelectedColumns()
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
.getEndRes()))
{
hide = true;
viewport.hideAllSelectedSeqs();
}
- else if (!(toggleCols && viewport.getColumnSelection().getSelected()
- .size() > 0))
+ else if (!(toggleCols && viewport.hasSelectedColumns()))
{
viewport.showAllHiddenSeqs();
}
if (toggleCols)
{
- if (viewport.getColumnSelection().getSelected().size() > 0)
+ if (viewport.hasSelectedColumns())
{
viewport.hideSelectedColumns();
if (!toggleSeqs)
{
viewport.showAllHiddenColumns();
}
+ viewport.sendSelection();
}
}
}
else if (source == annotationPanelMenuItem)
{
- viewport.setShowAnnotation(annotationPanelMenuItem.getState());
- alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());
+ boolean showAnnotations = annotationPanelMenuItem.getState();
+ showAlignmentAnnotations.setEnabled(showAnnotations);
+ showSequenceAnnotations.setEnabled(showAnnotations);
+ viewport.setShowAnnotation(showAnnotations);
+ alignPanel.setAnnotationVisible(showAnnotations);
}
else if (source == sequenceFeatures)
{
{
boolean showForAlignment = showAlignmentAnnotations.getState();
boolean showForSequences = showSequenceAnnotations.getState();
- for (AlignmentAnnotation aa : alignPanel.getAlignment()
- .getAlignmentAnnotation())
+ if (alignPanel.getAlignment().getAlignmentAnnotation() != null)
{
- boolean visible = (aa.sequenceRef == null ? showForAlignment
- : showForSequences);
- aa.visible = visible;
+ for (AlignmentAnnotation aa : alignPanel.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ boolean visible = (aa.sequenceRef == null ? showForAlignment
+ : showForSequences);
+ aa.visible = visible;
+ }
}
alignPanel.validateAnnotationDimensions(true);
validate();
else if (source == invertSequenceMenuItem)
{
invertSequenceMenuItem_actionPerformed();
+ // uncomment to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == invertColSel)
{
viewport.invertColumnSelection();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == remove2LeftMenuItem)
{
{
viewport.showAllHiddenColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showSeqs)
{
viewport.showAllHiddenSeqs();
alignPanel.paintAlignment(true);
+ // uncomment if we want to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == hideColumns)
{
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == hideSequences
&& viewport.getSelectionGroup() != null)
{
viewport.hideAllSelectedSeqs();
alignPanel.paintAlignment(true);
+ // uncomment if we want to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == hideAllButSelection)
{
toggleHiddenRegions(false, false);
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == hideAllSelection)
{
viewport.hideAllSelectedSeqs();
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showAllHidden)
{
viewport.showAllHiddenColumns();
viewport.showAllHiddenSeqs();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showGroupConsensus)
{
return annotation;
}
- private Map<String, Object> getDisplayedFeatureCols()
+ private Map<String, FeatureColourI> getDisplayedFeatureCols()
{
if (alignPanel.getFeatureRenderer() != null
&& viewport.getFeaturesDisplayed() != null)
public String outputFeatures(boolean displayTextbox, String format)
{
String features;
+ FeaturesFile formatter = new FeaturesFile();
if (format.equalsIgnoreCase("Jalview"))
{
- features = new FeaturesFile().printJalviewFormat(viewport
- .getAlignment().getSequencesArray(),
- getDisplayedFeatureCols());
+ features = formatter.printJalviewFormat(viewport.getAlignment()
+ .getSequencesArray(), getDisplayedFeatureCols());
}
else
{
- features = new FeaturesFile().printGFFFormat(viewport.getAlignment()
+ features = formatter.printGffFormat(viewport.getAlignment()
.getSequencesArray(), getDisplayedFeatureCols());
}
viewport, complement);
complement.getAlignment().moveSelectedSequencesByOne(mappedSelection,
up ? null : complement.getHiddenRepSequences(), up);
- // TODO need to trigger a repaint of the complementary panel - how?
- // would prefer to handle in SplitFrame but it is not overriding key
- // listener chiz
+ getSplitFrame().getComplement(this).alignPanel.paintAlignment(true);
}
}
.getAlignment().getWidth()) ? true : false;
if (isEntireAlignWidth)
{
-
String title = MessageManager.getString("label.delete_all");
- Panel mp = new Panel();
- mp.setLayout(new FlowLayout());
- mp.add(new Label(MessageManager.getString("warn.delete_all")));
-
- final JVDialog dialog = new JVDialog(this, title, true, 400,
- 200);
- dialog.setMainPanel(mp);
+ Panel infoPanel = new Panel();
+ infoPanel.setLayout(new FlowLayout());
+ infoPanel
+ .add(new Label(MessageManager.getString("warn.delete_all")));
+
+ final JVDialog dialog = new JVDialog(this, title, true, 400, 200);
+ dialog.setMainPanel(infoPanel);
+ dialog.ok.setLabel(MessageManager.getString("action.ok"));
+ dialog.cancel.setLabel(MessageManager.getString("action.cancel"));
dialog.setVisible(true);
if (!dialog.accept)
}
sg.setEndRes(viewport.getAlignment().getWidth() - 1);
viewport.setSelectionGroup(sg);
- alignPanel.paintAlignment(true);
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ alignPanel.paintAlignment(false);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
viewport.sendSelection();
}
viewport.setSelectionGroup(null);
alignPanel.idPanel.idCanvas.searchResults = null;
alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
- alignPanel.paintAlignment(true);
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ alignPanel.paintAlignment(false);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
viewport.sendSelection();
}
ColumnSelection colSel = viewport.getColumnSelection();
int column;
- if (colSel.size() > 0)
+ if (!colSel.isEmpty())
{
if (trimLeft)
{
TrimRegionCommand trimRegion;
if (trimLeft)
{
- trimRegion = new TrimRegionCommand("Remove Left",
- TrimRegionCommand.TRIM_LEFT, seqs, column,
- viewport.getAlignment(), viewport.getColumnSelection(),
- viewport.getSelectionGroup());
+ trimRegion = new TrimRegionCommand("Remove Left", true, seqs,
+ column, viewport.getAlignment());
viewport.setStartRes(0);
}
else
{
- trimRegion = new TrimRegionCommand("Remove Right",
- TrimRegionCommand.TRIM_RIGHT, seqs, column,
- viewport.getAlignment(), viewport.getColumnSelection(),
- viewport.getSelectionGroup());
+ trimRegion = new TrimRegionCommand("Remove Right", false, seqs,
+ column, viewport.getAlignment());
}
statusBar.setText(MessageManager.formatMessage(
}
+ @Override
public void changeColour(ColourSchemeI cs)
{
nucleotideColour.setLabel(MessageManager.getString("label.nucleotide"));
nucleotideColour.addActionListener(this);
modifyPID.setLabel(MessageManager
- .getString("label.modify_identity_thereshold"));
+ .getString("label.modify_identity_threshold"));
modifyPID.addActionListener(this);
modifyConservation.setLabel(MessageManager
- .getString("label.modify_conservation_thereshold"));
+ .getString("label.modify_conservation_threshold"));
modifyConservation.addActionListener(this);
annotationColour.setLabel(MessageManager
.getString("action.by_annotation"));
this.add(statusBar, BorderLayout.SOUTH);
}
+ @Override
public void setStatus(String string)
{
statusBar.setText(string);
}
if (needtoadd)
{
- // make a note of the access mode and add
- if (pdbentry.getProperty() == null)
- {
- pdbentry.setProperty(new Hashtable());
- }
- pdbentry.getProperty().put("protocol", protocol);
+ pdbentry.setProperty("protocol", protocol);
toaddpdb.addPDBId(pdbentry);
alignPanel.getStructureSelectionManager()
.registerPDBEntry(pdbentry);
if (protocol == null || protocol.trim().length() == 0
|| protocol.equals("null"))
{
- protocol = (String) pdb.getProperty().get("protocol");
+ protocol = (String) pdb.getProperty("protocol");
if (protocol == null)
{
System.err.println("Couldn't work out protocol to open structure: "