*/
package jalview.api;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
import jalview.analysis.Conservation;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.schemes.ColourSchemeI;
-import java.awt.Color;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
/**
* @author jimp
*
public void setFeatureRenderer(FeatureRenderer featureRenderer);
+ public boolean isIncludeHiddenRegion();
+
}
jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
"label.alignment_output_command", new Object[]
{ e.getActionCommand() }), 600, 500);
- cap.setText(new AppletFormatAdapter().formatSequences(
+
+ FeatureRenderer fr = this.alignPanel.cloneFeatureRenderer();
+ viewport.setFeatureRenderer(fr);
+ viewport.setIncludeHiddenRegion(false);
+ cap.setText(new AppletFormatAdapter(viewport).formatSequences(
e.getActionCommand(), viewport.getAlignment(),
viewport.getShowJVSuffix()));
}
@Override
public void setShowSeqFeatures(boolean b)
{
- // showSeqFeatures.setSelected(b);
- // viewport.setShowSequenceFeatures(b);
-
+ this.sequenceFeatures.setState(b);
+ viewport.setShowSequenceFeatures(b);
}
@Override
*/
package jalview.appletgui;
+import java.awt.Font;
+
import jalview.analysis.NJTree;
import jalview.api.AlignViewportI;
import jalview.api.FeatureRenderer;
import jalview.structure.VamsasSource;
import jalview.viewmodel.AlignmentViewport;
-import java.awt.Font;
-
public class AlignViewport extends AlignmentViewport implements
SelectionSource, VamsasSource, CommandListener
{
private FeatureRenderer featureRenderer;
+ private boolean includeHiddenRegion = true;
+
public void finalize()
{
applet = null;
}
+ public boolean isIncludeHiddenRegion()
+ {
+ return includeHiddenRegion;
+ }
+
+ public void setIncludeHiddenRegion(boolean includeHiddenRegion)
+ {
+ this.includeHiddenRegion = includeHiddenRegion;
+ }
+
}
import jalview.datamodel.SequenceI;
import jalview.io.AnnotationFile;
import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.HtmlFile;
import jalview.io.IdentifyFile;
+import jalview.io.JSONFile;
import jalview.io.NewickFile;
import jalview.io.TCoffeeScoreFile;
import jalview.schemes.TCoffeeColourScheme;
AlignFrame alignFrame;
+ FileParse source = null;
+
public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
{
try
}
else if (alignFrame != null)
{
- loadAlignment(text, newWindow);
+ loadAlignment(text, newWindow, alignFrame.getAlignViewport());
}
// TODO: dialog should indicate if data was parsed correctly or not - see
* @param text
* @param newWindow
*/
- protected void loadAlignment(String text, boolean newWindow)
+ protected void loadAlignment(String text, boolean newWindow,
+ AlignViewport viewport)
{
Alignment al = null;
String format = new IdentifyFile().Identify(text,
AppletFormatAdapter.PASTE);
+ AppletFormatAdapter afa = new AppletFormatAdapter(viewport);
try
{
- al = new AppletFormatAdapter().readFile(text,
- AppletFormatAdapter.PASTE, format);
+ al = afa.readFile(text, AppletFormatAdapter.PASTE, format);
+ source = afa.getAlignFile();
} catch (java.io.IOException ex)
{
ex.printStackTrace();
af.statusBar
.setText(MessageManager
.getString("label.successfully_pasted_annotation_to_alignment"));
+
+ if (source instanceof HtmlFile)
+ {
+ ((HtmlFile) source).applySettingsToAlignmentView(af);
+ }
+ else if (source instanceof JSONFile)
+ {
+ ((JSONFile) source).applySettingsToAlignmentView(af);
+ }
}
else
{
alignmentToExport = viewport.getAlignment();
alignmentStartEnd = getStartEnd(alignmentStartEnd, viewport
.getColumnSelection().getHiddenColumns());
+ viewport.setIncludeHiddenRegion(false);
}
else
{
// export all region including visible
alignmentToExport = hiddenSeqs.getFullAlignment();
+ viewport.setIncludeHiddenRegion(true);
}
}
{
AlignmentI al = viewport.getAlignment();
HiddenSequences hiddenSeqs = al.getHiddenSequences();
+ boolean hasHiddenRows = false;
for (SequenceI seq : al.getSequencesArray())
{
if (seq.isHidden())
{
hiddenSeqs.hideSequence(seq);
+ hasHiddenRows = true;
}
}
+ viewport.setHasHiddenRows(hasHiddenRows);
+ firePropertyChange("alignment", null, al.getSequences());
}
}
private FeatureRenderer featureRenderer;
+ private boolean includeHiddenRegion = true;
String viewName;
/*
{
this.featureRenderer = featureRenderer;
}
+
+ public boolean isIncludeHiddenRegion()
+ {
+ return includeHiddenRegion;
+ }
+
+ public void setIncludeHiddenRegion(boolean includeHiddenRegion)
+ {
+ this.includeHiddenRegion = includeHiddenRegion;
+ }
}
String.valueOf(showSeqFeatures));
String[] hiddenSections = exportHiddenSections();
- if (hiddenSections != null)
+ if (hiddenSections != null && getViewport().isIncludeHiddenRegion())
{
- jsonAlignmentPojo.getAppSettings().put("hiddenCols",
- String.valueOf(hiddenSections[0]));
- jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
- String.valueOf(hiddenSections[1]));
+ if (hiddenSections[0] != null)
+ {
+ jsonAlignmentPojo.getAppSettings().put("hiddenCols",
+ String.valueOf(hiddenSections[0]));
+ }
+ if (hiddenSections[1] != null)
+ {
+ jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
+ String.valueOf(hiddenSections[1]));
+ }
}
}
// hidden rows/seqs business
HiddenSequences hiddenSeqsObj = getViewport().getAlignment()
.getHiddenSequences();
- if (hiddenSeqsObj == null)
+ if (hiddenSeqsObj == null || hiddenSeqsObj.hiddenSequences == null)
{
return hiddenSections;
}
SequenceI[] hiddenSeqs = hiddenSeqsObj.hiddenSequences;
System.out.print("Hidden Seqs : ");
+ // if(hiddenSeqs != null){
StringBuilder hiddenSeqsBuilder = new StringBuilder();
for (SequenceI hiddenSeq : hiddenSeqs)
{
}
}
if (hiddenSeqsBuilder.length() > 0)
- {
+ {
hiddenSeqsBuilder.deleteCharAt(0);
- }
+ }
hiddenSections[1] = hiddenSeqsBuilder.toString();
System.out.println(hiddenSections[1]);
+ // }
+
return hiddenSections;
}
SequenceFeature[] seqFeatures = (dataSetSequence == null) ? null
: seq.getDatasetSequence().getSequenceFeatures();
+ seqFeatures = (seqFeatures == null) ? seq.getSequenceFeatures()
+ : seqFeatures;
if (seqFeatures == null)
{
continue;
int end = Integer.valueOf(sequence.get("end").toString());
Sequence seq = new Sequence(sequenceName, sequcenceString, start,
end);
- if (hiddenSeqRefs.contains(seqUniqueId))
+ if (hiddenSeqRefs != null && hiddenSeqRefs.contains(seqUniqueId))
{
seq.setHidden(true);
}
return hasHiddenRows;
}
+ public void setHasHiddenRows(boolean hasHiddenRows)
+ {
+ this.hasHiddenRows = hasHiddenRows;
+ }
+
protected SequenceGroup selectionGroup;
public void setSequenceSetId(String newid)