void setShowSequenceFeatures(boolean b);
+ /**
+ *
+ * @param flag
+ * indicating if annotation panel shown below alignment
+ *
+ */
+ void setShowAnnotation(boolean b);
+
+ /**
+ * flag indicating if annotation panel shown below alignment
+ *
+ * @return
+ */
+ boolean isShowAnnotation();
}
public String outputAnnotations(boolean displayTextbox)
{
- String annotation = new AnnotationFile().printAnnotations(
- viewport.showAnnotation ? viewport.getAlignment()
- .getAlignmentAnnotation() : null, viewport
- .getAlignment().getGroups(), ((Alignment) viewport
- .getAlignment()).alignmentProperties);
+ String annotation = new AnnotationFile()
+ .printAnnotationsForView(viewport);
if (displayTextbox)
{
@Override
public void exportAnnotations_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportAnnotations(alignPanel,
- viewport.isShowAnnotation() ? viewport.getAlignment()
- .getAlignmentAnnotation() : null, viewport
- .getAlignment().getGroups(), ((Alignment) viewport
- .getAlignment()).alignmentProperties);
+ new AnnotationExporter().exportAnnotations(alignPanel);
}
@Override
Color textColour = Color.black;
Color textColour2 = Color.white;
- private boolean rightAlignIds = false;
private AnnotationColumnChooser annotationColumnSelectionState;
/**
this.showAutocalculatedAbove = showAutocalculatedAbove;
}
-
- public boolean isShowAnnotation()
- {
- return super.isShowAnnotation();
- }
-
- public boolean isRightAlignIds()
- {
- return rightAlignIds;
- }
-
- public void setRightAlignIds(boolean rightAlignIds)
- {
- this.rightAlignIds = rightAlignIds;
- }
-
public AnnotationColumnChooser getAnnotationColumnSelectionState()
{
return annotationColumnSelectionState;
setScrollValues(0, 0);
- setAnnotationVisible(av.getShowAnnotation());
+ setAnnotationVisible(av.isShowAnnotation());
hscroll.addAdjustmentListener(this);
vscroll.addAdjustmentListener(this);
getSeqPanel().seqCanvas.fastPaint(scrollX, scrollY);
getScalePanel().repaint();
- if (av.getShowAnnotation() && scrollX != 0)
+ if (av.isShowAnnotation() && scrollX != 0)
{
getAnnotationPanel().fastPaint(scrollX);
}
}
}
- else if (av.getShowAnnotation())
+ else if (av.isShowAnnotation())
{
height += getAnnotationPanel().adjustPanelHeight() + 3;
}
package jalview.gui;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.SequenceGroup;
import jalview.io.AnnotationFile;
import jalview.io.FeaturesFile;
import jalview.io.JalviewFileChooser;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.Hashtable;
-import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
boolean features = true;
- AlignmentAnnotation[] annotations;
+ private AlignmentAnnotation[] annotations;
- List<SequenceGroup> sequenceGroups;
-
- Hashtable alignmentProperties;
+ private boolean wholeView;
public AnnotationExporter()
{
frame.setTitle(MessageManager.getString("label.export_features"));
}
- public void exportAnnotations(AlignmentPanel ap,
- AlignmentAnnotation[] annotations, List<SequenceGroup> list,
- Hashtable alProperties)
+ public void exportAnnotations(AlignmentPanel ap)
{
this.ap = ap;
+ annotations = ap.av.isShowAnnotation() ? null : ap.av.getAlignment()
+ .getAlignmentAnnotation();
+ wholeView = true;
+ startExportAnnotation();
+ }
+
+ public void exportAnnotations(AlignmentPanel alp,
+ AlignmentAnnotation[] toExport)
+ {
+ ap = alp;
+ annotations = toExport;
+ wholeView = false;
+ startExportAnnotation();
+ }
+
+ private void startExportAnnotation()
+ {
features = false;
GFFFormat.setVisible(false);
CSVFormat.setVisible(true);
- this.annotations = annotations;
- this.sequenceGroups = list;
- this.alignmentProperties = alProperties;
frame.setTitle(MessageManager.getString("label.export_annotations"));
}
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- String text = MessageManager.getString("label.no_features_on_alignment");
- if (features)
- {
- if (GFFFormat.isSelected())
- {
- text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
- .getDataset().getSequencesArray(), ap
- .getFeatureRenderer().getDisplayedFeatureCols(), true,
- ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);
- }
- else
- {
- text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
- .getDataset().getSequencesArray(), ap
- .getFeatureRenderer().getDisplayedFeatureCols(), true,
- ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);
- }
- }
- else
- {
- if (CSVFormat.isSelected())
- {
- text = new AnnotationFile().printCSVAnnotations(annotations);
- }
- else
- {
- text = new AnnotationFile().printAnnotations(annotations,
- sequenceGroups, alignmentProperties);
- }
- }
+ String text = getFileContents();
try
{
close_actionPerformed(null);
}
- public void toTextbox_actionPerformed(ActionEvent e)
+ private String getFileContents()
{
- String text = MessageManager.getString("label.no_features_on_alignment");
+ String text = MessageManager
+ .getString("label.no_features_on_alignment");
if (features)
{
if (GFFFormat.isSelected())
{
text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
.getDataset().getSequencesArray(), ap.getFeatureRenderer()
- .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
+ .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);
}
else
{
text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
.getDataset().getSequencesArray(), ap.getFeatureRenderer()
- .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
+ .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);
}
}
- else if (!features)
+ else
{
if (CSVFormat.isSelected())
{
}
else
{
- text = new AnnotationFile().printAnnotations(annotations,
- sequenceGroups, alignmentProperties);
+ if (wholeView)
+ {
+ text = new AnnotationFile().printAnnotationsForView(ap.av);
+ }
+ else
+ {
+ text = new AnnotationFile().printAnnotations(annotations, null,
+ null);
+ }
}
}
-
+ return text;
+ }
+ public void toTextbox_actionPerformed(ActionEvent e)
+ {
CutAndPasteTransfer cap = new CutAndPasteTransfer();
+
try
{
+ String text = getFileContents();
cap.setText(text);
Desktop.addInternalFrame(
cap,
JPanel jPanel3 = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
-
}
{
new AnnotationExporter().exportAnnotations(ap,
new AlignmentAnnotation[]
- { aa[selectedRow] }, null, null);
+ { aa[selectedRow] });
}
else if (evt.getActionCommand().equals(COPYCONS_SEQ))
{
view.setFontSize(av.font.getSize());
view.setFontStyle(av.font.getStyle());
view.setRenderGaps(av.renderGaps);
- view.setShowAnnotation(av.getShowAnnotation());
+ view.setShowAnnotation(av.isShowAnnotation());
view.setShowBoxes(av.getShowBoxes());
view.setShowColourText(av.getColourText());
view.setShowFullId(av.getShowJVSuffix());
}
return sp.toString();
}
+
+ public String printAnnotationsForView(AlignViewportI viewport)
+ {
+ return printAnnotations(viewport.isShowAnnotation() ? viewport
+ .getAlignment().getAlignmentAnnotation() : null, viewport
+ .getAlignment().getGroups(), viewport.getAlignment()
+ .getProperties());
+ }
+
+ public String printAnnotationsForAlignment(AlignmentI al)
+ {
+ return printAnnotations(al.getAlignmentAnnotation(), al.getGroups(),
+ al.getProperties());
+ }
}
private boolean rightAlignIds = false;
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getShowAnnotation()
- {
- return isShowAnnotation();
- }
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
+ @Override
public void setShowAnnotation(boolean b)
{
showAnnotation = b;
}
+ @Override
public boolean isShowAnnotation()
{
return showAnnotation;
}
+ @Override
public boolean isRightAlignIds()
{
return rightAlignIds;
}
+ @Override
public void setRightAlignIds(boolean rightAlignIds)
{
this.rightAlignIds = rightAlignIds;
if (format.equals(JVANNOT))
{
return new StringBody(
- new jalview.io.AnnotationFile().printAnnotations(
- al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties()));
+ new jalview.io.AnnotationFile()
+ .printAnnotationsForAlignment(al));
}
else
{
*/
package jalview.ws.jabaws;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.io.AnnotationFile;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
+import java.util.ArrayList;
+import java.util.List;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
{
String aligfileout = new FormatAdapter().formatSequences("PFAM",
al.getSequencesArray());
- String anfileout = new AnnotationFile().printAnnotations(
- al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties());
+ String anfileout = new AnnotationFile()
+ .printAnnotationsForAlignment(al);
assertTrue(
"Test "
+ testname
String aligfileout = new FormatAdapter().formatSequences("PFAM",
al.getSequencesArray());
- String anfileout = new AnnotationFile().printAnnotations(
- al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties());
+ String anfileout = new AnnotationFile()
+ .printAnnotationsForAlignment(al);
assertTrue(
"Test "
+ testname
String aligfileout = new FormatAdapter().formatSequences("PFAM",
al.getSequencesArray());
- String anfileout = new AnnotationFile().printAnnotations(
- al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties());
+ String anfileout = new AnnotationFile()
+ .printAnnotationsForAlignment(al);
assertTrue(
"Test "
+ testname