*/
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
*
* Set whether view should scroll to show the highlighted region of a sequence
*/
void setFollowHighlight(boolean b);
-
- /**
- * Returns a FeatureRenderer instance
- *
- * @return
- */
- public FeatureRenderer getFeatureRenderer();
-
- /**
- * Sets a FeatureRenderer for a viewport
- *
- * @param featureRenderer
- */
- public void setFeatureRenderer(FeatureRenderer featureRenderer);
-
- /**
- * Returns Settings for exporting an Alignment
- *
- * @return
- */
- public AlignExportSettingI getExportSettings();
-
}
{ e.getActionCommand() }), 600, 500);
FeatureRenderer fr = this.alignPanel.cloneFeatureRenderer();
- viewport.setFeatureRenderer(fr);
cap.setText(new AppletFormatAdapter(viewport).formatSequences(
e.getActionCommand(), viewport.getAlignment(),
viewport.getShowJVSuffix()));
*/
package jalview.appletgui;
-import java.awt.Font;
-
import jalview.analysis.NJTree;
import jalview.api.AlignExportSettingI;
import jalview.api.AlignViewportI;
import jalview.structure.VamsasSource;
import jalview.viewmodel.AlignmentViewport;
+import java.awt.Font;
+
public class AlignViewport extends AlignmentViewport implements
SelectionSource, VamsasSource, CommandListener
{
}
}
- @Override
- public FeatureRenderer getFeatureRenderer()
- {
- return featureRenderer;
- }
-
- @Override
- public void setFeatureRenderer(FeatureRenderer featureRenderer)
- {
- this.featureRenderer = featureRenderer;
-
- }
-
- public AlignExportSettingI getExportSettings()
- {
- return exportSettings;
- }
-
- public void setExportSettings(AlignExportSettingI exportSettings)
- {
- this.exportSettings = exportSettings;
- }
-
}
*/
package jalview.gui;
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.DnDConstants;
-import java.awt.dnd.DropTargetDragEvent;
-import java.awt.dnd.DropTargetDropEvent;
-import java.awt.dnd.DropTargetEvent;
-import java.awt.dnd.DropTargetListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.print.PageFormat;
-import java.awt.print.PrinterJob;
-import java.beans.PropertyChangeEvent;
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Deque;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JEditorPane;
-import javax.swing.JInternalFrame;
-import javax.swing.JLayeredPane;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
-
import jalview.analysis.AAFrequency;
import jalview.analysis.AlignmentSorter;
import jalview.analysis.AlignmentUtils;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.seqfetcher.DbSourceProxy;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.PrinterJob;
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JEditorPane;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
/**
* DOCUMENT ME!
*
AlignmentI alignmentToExport = null;
String[] omitHidden = null;
int[] alignmentStartEnd = new int[2];
- FeatureRenderer fr = new FeatureRenderer(this.alignPanel);
- viewport.setFeatureRenderer(fr);
+
HiddenSequences hiddenSeqs = viewport.getAlignment()
.getHiddenSequences();
boolean hasHiddenSeqs = hiddenSeqs.getSize() > 0;
AlignExportSettingI settings = new AlignExportSettings(hasHiddenSeqs,
viewport.hasHiddenColumns(), exportFomat);
- viewport.setExportSettings(settings);
settings.isExportAnnotations();
if (viewport.hasHiddenColumns() && !settings.isExportHiddenColumns())
@Override
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel,
- alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer());
+ BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
bjs.exportJalviewAlignmentAsBioJsHtmlFile();
}
public void createImageMap(File file, String image)
*/
package jalview.gui;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
import jalview.analysis.AlignmentUtils;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.NJTree;
-import jalview.api.AlignExportSettingI;
import jalview.api.AlignViewportI;
-import jalview.api.FeatureRenderer;
import jalview.api.ViewStyleI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.params.AutoCalcSetting;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+
/**
* DOCUMENT ME!
*
private Rectangle explodedGeometry;
- private FeatureRenderer featureRenderer;
-
- private boolean includeHiddenRegion = true;
-
- private AlignExportSettingI exportSettings;
-
String viewName;
/*
}
}
- @Override
- public FeatureRenderer getFeatureRenderer()
- {
- return featureRenderer;
- }
-
- @Override
- public void setFeatureRenderer(FeatureRenderer featureRenderer)
- {
- this.featureRenderer = featureRenderer;
- }
-
- public AlignExportSettingI getExportSettings()
- {
- return exportSettings;
- }
-
- public void setExportSettings(AlignExportSettingI exportSettings)
- {
- this.exportSettings = exportSettings;
- }
}
package jalview.io;
+import jalview.api.AlignmentViewPanel;
import jalview.exceptions.NoFileSelectedException;
-import jalview.gui.AlignViewport;
-import jalview.gui.AlignmentPanel;
-import jalview.gui.FeatureRenderer;
import jalview.json.binding.v1.BioJSReleasePojo;
import jalview.json.binding.v1.BioJSRepositoryPojo;
import jalview.util.MessageManager;
public class BioJsHTMLOutput
{
- private AlignViewport av;
+ private AlignmentViewPanel ap;
private static File currentBJSTemplateFile;
"biojs_template_git_repo",
"https://raw.githubusercontent.com/tcofoegbu/bjs-template/master/package.json");
- public BioJsHTMLOutput(AlignmentPanel ap, FeatureRenderer fr1)
+ public BioJsHTMLOutput(AlignmentViewPanel ap)
{
if (ap != null)
{
- this.av = ap.av;
- av.setFeatureRenderer(new FeatureRenderer(ap));
+ this.ap = ap;
}
}
try
{
String outputFile = getOutputFile();
- String jalviewAlignmentJson = JSONFile.getJSONData(av);
+ String jalviewAlignmentJson = JSONFile.getJSONData(ap);
String bioJSTemplateString = getBioJsTemplateAsString();
String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString
.replaceAll(
*/
package jalview.io;
+import jalview.api.AlignExportSettingI;
import jalview.api.AlignViewportI;
import jalview.util.MessageManager;
private AlignViewportI viewport;
public int index = 1; // sequence counter for FileParse object created from
+ /**
+ * specific settings for exporting data from the current context
+ */
+ private AlignExportSettingI exportSettings;
// same data source
{
this.viewport = viewport;
}
+
+ /**
+ * @return the currently configured exportSettings for writing data.
+ */
+ public AlignExportSettingI getExportSettings()
+ {
+ return exportSettings;
+ }
+
+ /**
+ * Set configuration for export of data.
+ *
+ * @param exportSettings
+ * the exportSettings to set
+ */
+ public void setExportSettings(AlignExportSettingI exportSettings)
+ {
+ this.exportSettings = exportSettings;
+ }
}
package jalview.io;
+import jalview.api.FeatureRenderer;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
-import jalview.gui.AnnotationPanel;
-import jalview.gui.FeatureRenderer;
import jalview.gui.HTMLOptions;
import jalview.math.AlignmentDimension;
import jalview.util.MessageManager;
FeatureRenderer fr;
AlignmentPanel ap;
- AnnotationPanel annotationPanel;
public HtmlSvgOutput(File file, AlignmentPanel ap)
{
-
- this.av = ap.av;
- this.ap = ap;
- av.setFeatureRenderer(new FeatureRenderer(ap));
- this.annotationPanel = ap.getAnnotationPanel();
+ this.av = ap.av;
+ this.ap = ap;
+ fr = ap.cloneFeatureRenderer();
generateHtmlSvgOutput(file);
}
String titleSvgData = g1.getSVGDocument();
String alignSvgData = g2.getSVGDocument();
- String jsonData = JSONFile.getJSONData(av);
+ String jsonData = JSONFile.getJSONData(ap);
String htmlData = getHtml(titleSvgData, alignSvgData, jsonData);
out.write(htmlData.getBytes());
package jalview.io;
-import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
import jalview.api.ComplexAlignFile;
import jalview.api.FeatureRenderer;
import jalview.api.FeaturesDisplayedI;
parse(getReader());
}
-
@Override
public String print()
{
AlignmentPojo jsonAlignmentPojo = new AlignmentPojo();
if (getViewport() != null)
{
- globalColorScheme = ColourSchemeProperty
- .getColourName(getViewport()
- .getGlobalColourScheme());
- setDisplayedFeatures(getViewport().getFeaturesDisplayed());
- showSeqFeatures = getViewport().isShowSequenceFeatures();
- fr = getViewport().getFeatureRenderer();
+ configureFromViewport();
+
}
int count = 0;
if (hiddenSections != null)
{
if (hiddenSections[0] != null
- && getViewport().getExportSettings()
+ && getExportSettings()
.isExportHiddenColumns())
{
jsonAlignmentPojo.getAppSettings().put("hiddenCols",
String.valueOf(hiddenSections[0]));
}
if (hiddenSections[1] != null
- && getViewport().getExportSettings()
+ && getExportSettings()
.isExportHiddenSequences())
{
jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
}
}
- if (getViewport().getExportSettings().isExportAnnotations())
+ if (getExportSettings().isExportAnnotations())
{
jsonAlignmentPojo
.setAlignAnnotation(annotationToJsonPojo(annotations));
}
- if (getViewport().getExportSettings().isExportFeatures())
+ if (getExportSettings().isExportFeatures())
{
jsonAlignmentPojo
.setSeqFeatures(sequenceFeatureToJsonPojo(seqs, fr));
}
- if (getViewport().getExportSettings().isExportGroups()
+ if (getExportSettings().isExportGroups()
&& seqGroups != null
&& seqGroups.size() > 0)
{
this.displayedFeatures = displayedFeatures;
}
-
- public static String getJSONData(AlignViewportI av)
+ public void configureForView(AlignmentViewPanel avpanel)
{
- JSONFile jsonFile = new JSONFile();
- jsonFile.setViewport(av);
- jsonFile.seqGroups = av.getAlignment().getGroups();
- jsonFile.setDisplayedFeatures(av.getFeaturesDisplayed());
- for (SequenceI seq : av.getAlignment().getSequences())
+ setViewport(avpanel.getAlignViewport());
+ seqGroups = avpanel.getAlignment().getGroups();
+ setDisplayedFeatures(getViewport().getFeaturesDisplayed());
+ fr = avpanel.cloneFeatureRenderer();
+
+ for (SequenceI seq : getViewport().getAlignment().getSequences())
{
- jsonFile.seqs.add(seq);
+ seqs.add(seq);
}
// Add non auto calculated annotation to AlignFile
- for (AlignmentAnnotation annot : av.getAlignment()
+ for (AlignmentAnnotation annot : getViewport().getAlignment()
.getAlignmentAnnotation())
{
if (annot != null && !annot.autoCalculated)
{
continue;
}
- jsonFile.annotations.add(annot);
+ annotations.add(annot);
}
}
+ }
+
+ public void configureFromViewport()
+ {
+ if (getViewport() == null)
+ {
+ return;
+ }
+ globalColorScheme = ColourSchemeProperty.getColourName(getViewport()
+ .getGlobalColourScheme());
+ setDisplayedFeatures(getViewport().getFeaturesDisplayed());
+ showSeqFeatures = getViewport().isShowSequenceFeatures();
+ }
+
+ public static String getJSONData(AlignmentViewPanel av)
+ {
+ JSONFile jsonFile = new JSONFile();
+ jsonFile.configureForView(av);
String jsonString = jsonFile.print();
return jsonString;
}