X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=997f185a56799b7b8c867db959e54dc64e88b6a2;hb=b87512d6e28a2a93ea2f08dcfbee320856c5c8de;hp=ef8767128db8fca4832a3fac584f3c66a88b25bd;hpb=4ed4e90803e3a463458410be06b678ff3154937f;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index ef87671..997f185 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -25,6 +25,7 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.TreeBuilder; import jalview.analysis.scoremodels.PIDModel; import jalview.analysis.scoremodels.ScoreModels; +import jalview.api.AlignFrameI; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; @@ -95,6 +96,7 @@ import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.Panel; +import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; @@ -106,6 +108,7 @@ import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; import java.util.Arrays; @@ -119,7 +122,7 @@ import java.util.Vector; import org.jmol.viewer.Viewer; public class AlignFrame extends EmbmenuFrame implements ActionListener, - ItemListener, KeyListener, AlignViewControllerGuiI + ItemListener, KeyListener, AlignViewControllerGuiI, AlignFrameI { public AlignViewControllerI avc; @@ -416,7 +419,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.featureSettings.refreshTable(); } alignPanel.paintAlignment(true, true); - statusBar.setText(MessageManager + setStatus(MessageManager .getString("label.successfully_added_features_alignment")); } return featuresFile; @@ -574,7 +577,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText(MessageManager + setStatus(MessageManager .formatMessage("label.keyboard_editing_mode", new String[] { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) @@ -880,7 +883,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else if (source == autoCalculate) { - viewport.autoCalculateConsensus = autoCalculate.getState(); + viewport.setAutoCalculateConsensusAndConservation(autoCalculate.getState()); } else if (source == sortByTree) { @@ -1202,7 +1205,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else if (source == featureSettings) { - new FeatureSettings(alignPanel); + showFeatureSettingsUI(); } else if (source == alProperties) { @@ -1445,15 +1448,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, FeaturesFile formatter = new FeaturesFile(); if (format.equalsIgnoreCase("Jalview")) { - features = formatter.printJalviewFormat(viewport.getAlignment() - .getSequencesArray(), getDisplayedFeatureCols(), - getDisplayedFeatureGroups(), true); + features = formatter.printJalviewFormat( + viewport.getAlignment().getSequencesArray(), + alignPanel.getFeatureRenderer(), true, false); } else { features = formatter.printGffFormat(viewport.getAlignment() - .getSequencesArray(), getDisplayedFeatureCols(), - getDisplayedFeatureGroups(), true); + .getSequencesArray(), alignPanel.getFeatureRenderer(), true, + false); } if (displayTextbox) @@ -1570,7 +1573,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, try { new URL(url); - url = URLEncoder.encode(url); + url = URLEncoder.encode(url, "UTF-8"); } /* * When we finally deprecate 1.1 compatibility, we can start to use @@ -1583,6 +1586,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { url = viewport.applet.getCodeBase() + url; } + catch (UnsupportedEncodingException ex) + { + System.err.println( + "WARNING = IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR " + + url); + ex.printStackTrace(); + } return url; } @@ -1905,7 +1915,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, static StringBuffer copiedSequences; - static Vector copiedHiddenColumns; + static HiddenColumns copiedHiddenColumns; protected void copy_actionPerformed() { @@ -1929,14 +1939,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null) { - copiedHiddenColumns = new Vector<>(viewport.getAlignment() - .getHiddenColumns().getHiddenColumnsCopy()); int hiddenOffset = viewport.getSelectionGroup().getStartRes(); - for (int[] region : copiedHiddenColumns) - { - region[0] = region[0] - hiddenOffset; - region[1] = region[1] - hiddenOffset; - } + int hiddenCutoff = viewport.getSelectionGroup().getEndRes(); + + // create new HiddenColumns object with copy of hidden regions + // between startRes and endRes, offset by startRes + copiedHiddenColumns = new HiddenColumns( + viewport.getAlignment().getHiddenColumns(), hiddenOffset, + hiddenCutoff, hiddenOffset); } else { @@ -2005,13 +2015,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { try { - if (copiedSequences == null) { return; } - StringTokenizer st = new StringTokenizer(copiedSequences.toString()); + StringTokenizer st = new StringTokenizer(copiedSequences.toString(), + "\t"); Vector seqs = new Vector(); while (st.hasMoreElements()) { @@ -2043,14 +2053,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } AlignFrame af = new AlignFrame(new Alignment(newSeqs), viewport.applet, newtitle, false); - if (copiedHiddenColumns != null) - { - for (int i = 0; i < copiedHiddenColumns.size(); i++) - { - int[] region = copiedHiddenColumns.elementAt(i); - af.viewport.hideColumns(region[0], region[1]); - } - } + af.viewport.setHiddenColumns(copiedHiddenColumns); jalview.bin.JalviewLite.addFrame(af, newtitle, frameWidth, frameHeight); @@ -2079,7 +2082,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, seqs, 0, viewport.getAlignment().getWidth(), viewport.getAlignment())); - viewport.getRanges().setEndSeq(viewport.getAlignment().getHeight()); + viewport.getRanges().setEndSeq(viewport.getAlignment().getHeight() - 1); // BH + // 2019.04.18 viewport.getAlignment().getWidth(); viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); @@ -2355,7 +2359,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, column, al); } - statusBar.setText(MessageManager + setStatus(MessageManager .formatMessage("label.removed_columns", new String[] { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); @@ -2399,7 +2403,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(removeGapCols); - statusBar.setText(MessageManager + setStatus(MessageManager .formatMessage("label.removed_empty_columns", new String[] { Integer.valueOf(removeGapCols.getSize()).toString() })); @@ -3821,7 +3825,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, */ statusBar.setBackground(Color.white); statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); - statusBar.setText(MessageManager.getString("label.status_bar")); + setStatus(MessageManager.getString("label.status_bar")); this.add(statusBar, BorderLayout.SOUTH); } @@ -4189,7 +4193,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else { - new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol); + new mc_view.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol); } } @@ -4337,4 +4341,24 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return alignPanel.av.featureSettings; } + @Override + public FeatureSettingsControllerI showFeatureSettingsUI() + { + return new FeatureSettings(alignPanel); + } + + private Rectangle fs_bounds = null; + + @Override + public void setFeatureSettingsGeometry(Rectangle bounds) + { + fs_bounds = bounds; + } + + @Override + public Rectangle getFeatureSettingsGeometry() + { + return fs_bounds; + } + }