From: Jim Procter Date: Mon, 9 Feb 2015 16:06:40 +0000 (+0000) Subject: Merge branch 'features/JAL-845splitPaneMergeDevelop' into merge_JAL-845_JAL-1640 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e07fc11d5aaf4d1237d83e5f7ea0909dea09902e;p=jalview.git Merge branch 'features/JAL-845splitPaneMergeDevelop' into merge_JAL-845_JAL-1640 minimal conflicts where list accessors were used in methods where logic also modified on Desktop Conflicts: .classpath resources/lang/Messages.properties src/jalview/api/AlignViewportI.java src/jalview/gui/Desktop.java src/jalview/gui/ScalePanel.java src/jalview/gui/TreeCanvas.java src/jalview/viewmodel/AlignmentViewport.java --- e07fc11d5aaf4d1237d83e5f7ea0909dea09902e diff --cc .classpath index c110217,f34aa90..6abc315 --- a/.classpath +++ b/.classpath @@@ -49,9 -49,6 +49,9 @@@ + + - ++ diff --cc resources/lang/Messages.properties index 2e37e06,8581238..bdf75df --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@@ -1191,4 -1213,4 +1213,5 @@@ label.structures_filter = Structures Fi label.search_filter = Search Filter label.display_name = Display Label label.description = Description +label.include_description= Include Description + diff --cc src/jalview/api/AlignViewportI.java index b2fc4c2,324e6ca..d23fc75 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@@ -353,16 -355,26 +353,37 @@@ public interface AlignViewportI extend boolean hasHiddenRows(); /** + * + * @return a copy of this view's current display settings + */ + public ViewStyleI getViewStyle(); + + /** + * update the view's display settings with the given style set + * + * @param settingsForView + */ + public void setViewStyle(ViewStyleI settingsForView); + ++ /** + * Returns a viewport which holds the cDna for this (protein), or vice versa, + * or null if none is set. + * + * @return + */ + AlignViewportI getCodingComplement(); + - + /** + * Sets the viewport which holds the cDna for this (protein), or vice versa. + * Implementation should guarantee that the reciprocal relationship is always + * set, i.e. each viewport is the complement of the other. + */ + void setCodingComplement(AlignViewportI sl); + + /** + * Answers true if viewport hosts DNA/RNA, else false. + * + * @return + */ + boolean isNucleotide(); - } diff --cc src/jalview/gui/AlignViewport.java index 37fe1d2,5698e0f..6ea8df1 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@@ -41,9 -43,9 +43,10 @@@ import jalview.analysis.AlignmentUtils. import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.NJTree; import jalview.api.AlignViewportI; +import jalview.api.ViewStyleI; import jalview.bin.Cache; import jalview.commands.CommandI; + import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; @@@ -58,15 -63,21 +64,21 @@@ import jalview.util.StringUtils import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.AutoCalcSetting; -import java.awt.Color; import java.awt.Container; +import java.awt.Dimension; import java.awt.Font; import java.awt.Rectangle; + import java.io.File; + import java.util.ArrayDeque; import java.util.ArrayList; + import java.util.Deque; import java.util.Hashtable; - import java.util.Stack; + import java.util.Set; import java.util.Vector; + import javax.swing.JInternalFrame; + import javax.swing.JOptionPane; + /** * DOCUMENT ME! * @@@ -101,10 -141,16 +113,10 @@@ public class AlignViewport extends Alig boolean gatherViewsHere = false; - Stack historyList = new Stack(); + private Deque historyList = new ArrayDeque(); - Stack redoList = new Stack(); + private Deque redoList = new ArrayDeque(); - int thresholdTextColour = 0; - - Color textColour = Color.black; - - Color textColour2 = Color.white; - private AnnotationColumnChooser annotationColumnSelectionState; /** * Creates a new AlignViewport object. diff --cc src/jalview/gui/AnnotationLabels.java index f9a9e7e,6521503..c34a5c5 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@@ -683,10 -683,10 +683,10 @@@ public class AnnotationLabels extends J pop.addSeparator(); // av and sequencegroup need to implement same interface for final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( - MessageManager.getString("label.ignore_gaps_consensus"), + MessageManager.getString("label.ignore_gaps_consensus"), (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef .getIgnoreGapsConsensus() : ap.av - .getIgnoreGapsConsensus()); + .isIgnoreGapsConsensus()); final AlignmentAnnotation aaa = aa[selectedRow]; cbmi.addActionListener(new ActionListener() { diff --cc src/jalview/gui/Desktop.java index c737be8,4bb828c..b9e796e --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@@ -1689,23 -1702,29 +1703,29 @@@ public class Desktop extends jalview.jb // TODO: verify that frames are recoverable when in headless mode return null; } - JInternalFrame[] frames = Desktop.desktop.getAllFrames(); - ArrayList aps = new ArrayList(); - for (int t = 0; t < frames.length; t++) + List aps = new ArrayList(); + AlignFrame[] frames = getAlignFrames(); + if (frames == null) { - if (frames[t] instanceof AlignFrame) + return null; + } + for (AlignFrame af : frames) + { + for (AlignmentPanel ap : af.alignPanels) { - AlignFrame af = (AlignFrame) frames[t]; - for (int a = 0; a < af.alignPanels.size(); a++) - if (alignmentId.equals(ap.av.getSequenceSetId())) ++ if (alignmentId==null || alignmentId.equals(ap.av.getSequenceSetId())) { - if (alignmentId == null - || alignmentId.equals(((AlignmentPanel) af.alignPanels - .elementAt(a)).av.getSequenceSetId())) - { - aps.add(af.alignPanels.elementAt(a)); - } + aps.add(ap); } } + // for (int a = 0; a < af.alignPanels.size(); a++) + // { + // if (alignmentId.equals(af.alignPanels + // .get(a).av.getSequenceSetId())) + // { + // aps.add(af.alignPanels.get(a)); + // } + // } } if (aps.size() == 0) { @@@ -1723,44 -1738,33 +1739,35 @@@ * get all the viewports on an alignment. * * @param sequenceSetId - * unique alignment id + * unique alignment id (may be null - all viewports returned in that + * case) * @return all viewports on the alignment bound to sequenceSetId */ - public static AlignViewport[] getViewports(String sequenceSetId) + public static AlignmentViewport[] getViewports(String sequenceSetId) { - Vector viewp = new Vector(); + List viewp = new ArrayList(); if (desktop != null) { - javax.swing.JInternalFrame[] frames = instance.getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); - for (int t = 0; t < frames.length; t++) + for (AlignFrame afr : frames) { - if (frames[t] instanceof AlignFrame) - if (afr.getViewport().getSequenceSetId().equals(sequenceSetId)) ++ if (sequenceSetId==null || afr.getViewport().getSequenceSetId().equals(sequenceSetId)) { - AlignFrame afr = ((AlignFrame) frames[t]); - if (sequenceSetId == null - || afr.getViewport().getSequenceSetId() - .equals(sequenceSetId)) + if (afr.alignPanels != null) { - if (afr.alignPanels != null) + for (AlignmentPanel ap : afr.alignPanels) { - for (int a = 0; a < afr.alignPanels.size(); a++) - if (sequenceSetId.equals(ap.av.getSequenceSetId())) ++ if (sequenceSetId == null ++ || sequenceSetId.equals(ap.av.getSequenceSetId())) { - if (sequenceSetId == null - || sequenceSetId - .equals(((AlignmentPanel) afr.alignPanels - .elementAt(a)).av.getSequenceSetId())) - { - viewp.addElement(((AlignmentPanel) afr.alignPanels - .elementAt(a)).av); - } + viewp.add(ap.av); } } - else - { - viewp.addElement(((AlignFrame) frames[t]).getViewport()); - } + } + else + { + viewp.add(afr.getViewport()); } } } diff --cc src/jalview/gui/ScalePanel.java index 21160ef,754b763..1eede34 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@@ -474,27 -472,22 +474,22 @@@ public class ScalePanel extends JPanel { string = String.valueOf(av.getColumnSelection() .adjustForHiddenColumns(i)); - if ((i - startx - 1) * av.charWidth > maxX) + if ((i - startx - 1) * avCharWidth > maxX) { - gg.drawString(string, (i - startx - 1) * av.charWidth, y); - maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string); + gg.drawString(string, (i - startx - 1) * avCharWidth, y); + maxX = (i - startx + 1) * avCharWidth + fm.stringWidth(string); } - gg.drawLine( - ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), - gg.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2), - y + 2, ((i - startx - 1) * av.charWidth) - + (av.charWidth / 2), y + (fm.getDescent() * 2)); - ++ gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2), + y + 2, + ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), + y + (fm.getDescent() * 2)); } else { - gg.drawLine( - ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), - y + fm.getDescent(), - ((i - startx - 1) * avCharWidth) - + (avCharWidth / 2), - y + (fm.getDescent() * 2)); - gg.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2), - y + fm.getDescent(), ((i - startx - 1) * av.charWidth) - + (av.charWidth / 2), y + (fm.getDescent() * 2)); ++ gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2), ++ y + fm.getDescent(), ((i - startx - 1) * avCharWidth) ++ + (avCharWidth / 2), y + (fm.getDescent() * 2)); } } diff --cc src/jalview/viewmodel/AlignmentViewport.java index 3a40a16,364222e..3293291 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@@ -59,105 -59,48 +61,110 @@@ import java.util.Vector * @author jimp * */ -public abstract class AlignmentViewport implements AlignViewportI +public abstract class AlignmentViewport implements AlignViewportI, + ViewStyleI { - /* + protected ViewStyleI viewStyle = new ViewStyle(); - - ++ ++ /** + * A viewport that hosts the cDna view of this (protein), or vice versa (if + * set). + */ + AlignViewportI codingComplement = null; + /** - * alignment displayed in the viewport. Please use get/setter + * @param name + * @see jalview.api.ViewStyleI#setFontName(java.lang.String) */ - protected AlignmentI alignment; + public void setFontName(String name) + { + viewStyle.setFontName(name); + } - protected String sequenceSetID; + /** + * @param style + * @see jalview.api.ViewStyleI#setFontStyle(int) + */ + public void setFontStyle(int style) + { + viewStyle.setFontStyle(style); + } /** - * probably unused indicator that view is of a dataset rather than an - * alignment + * @param size + * @see jalview.api.ViewStyleI#setFontSize(int) */ - protected boolean isDataset = false; + public void setFontSize(int size) + { + viewStyle.setFontSize(size); + } - private Map hiddenRepSequences; + /** + * @return + * @see jalview.api.ViewStyleI#getFontStyle() + */ + public int getFontStyle() + { + return viewStyle.getFontStyle(); + } - protected ColumnSelection colSel = new ColumnSelection(); + /** + * @return + * @see jalview.api.ViewStyleI#getFontName() + */ + public String getFontName() + { + return viewStyle.getFontName(); + } - public boolean autoCalculateConsensus = true; + /** + * @return + * @see jalview.api.ViewStyleI#getFontSize() + */ + public int getFontSize() + { + return viewStyle.getFontSize(); + } - protected boolean autoCalculateStrucConsensus = true; + /** + * @param upperCasebold + * @see jalview.api.ViewStyleI#setUpperCasebold(boolean) + */ + public void setUpperCasebold(boolean upperCasebold) + { + viewStyle.setUpperCasebold(upperCasebold); + } - protected boolean ignoreGapsInConsensusCalculation = false; + /** + * @return + * @see jalview.api.ViewStyleI#isUpperCasebold() + */ + public boolean isUpperCasebold() + { + return viewStyle.isUpperCasebold(); + } - protected ColourSchemeI globalColourScheme = null; + /** + * @return + * @see jalview.api.ViewStyleI#isSeqNameItalics() + */ + public boolean isSeqNameItalics() + { + return viewStyle.isSeqNameItalics(); + } /** - * gui state - changes to colour scheme propagated to all groups + * @param colourByReferenceSeq + * @see jalview.api.ViewStyleI#setColourByReferenceSeq(boolean) */ - private boolean colourAppliesToAllGroups; + public void setColourByReferenceSeq(boolean colourByReferenceSeq) + { + viewStyle.setColourByReferenceSeq(colourByReferenceSeq); + } /** - * @param value - * indicating if subsequent colourscheme changes will be propagated - * to all groups + * @param b + * @see jalview.api.ViewStyleI#setColourAppliesToAllGroups(boolean) */ public void setColourAppliesToAllGroups(boolean b) { @@@ -1874,15 -1574,21 +1878,15 @@@ @Override public void setDisplayReferenceSeq(boolean displayReferenceSeq) { - this.displayReferenceSeq = displayReferenceSeq; + viewStyle.setDisplayReferenceSeq(displayReferenceSeq); } + @Override public boolean isColourByReferenceSeq() { - return alignment.hasSeqrep() && colourByReferenceSeq; - } - - @Override - public void setColourByReferenceSeq(boolean colourByReferenceSeq) - { - this.colourByReferenceSeq = colourByReferenceSeq; + return alignment.hasSeqrep() && viewStyle.isColourByReferenceSeq(); } - @Override public Color getSequenceColour(SequenceI seq) { @@@ -2013,217 -1746,6 +2034,216 @@@ @Override public void setRightAlignIds(boolean rightAlignIds) { - this.rightAlignIds = rightAlignIds; + viewStyle.setRightAlignIds(rightAlignIds); + } + + @Override + public boolean getConservationSelected() + { + return viewStyle.getConservationSelected(); + } + + @Override + public void setShowBoxes(boolean state) + { + viewStyle.setShowBoxes(state); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getTextColour() + */ + public Color getTextColour() + { + return viewStyle.getTextColour(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getTextColour2() + */ + public Color getTextColour2() + { + return viewStyle.getTextColour2(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getThresholdTextColour() + */ + public int getThresholdTextColour() + { + return viewStyle.getThresholdTextColour(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isConservationColourSelected() + */ + public boolean isConservationColourSelected() + { + return viewStyle.isConservationColourSelected(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isRenderGaps() + */ + public boolean isRenderGaps() + { + return viewStyle.isRenderGaps(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isShowColourText() + */ + public boolean isShowColourText() + { + return viewStyle.isShowColourText(); + } - + /** + * @return + * @see jalview.api.ViewStyleI#isShowSeqFeaturesHeight() + */ + public boolean isShowSeqFeaturesHeight() + { + return viewStyle.isShowSeqFeaturesHeight(); + } + + /** + * @param conservationColourSelected + * @see jalview.api.ViewStyleI#setConservationColourSelected(boolean) + */ + public void setConservationColourSelected( + boolean conservationColourSelected) + { + viewStyle.setConservationColourSelected(conservationColourSelected); + } + + /** + * @param showColourText + * @see jalview.api.ViewStyleI#setShowColourText(boolean) + */ + public void setShowColourText(boolean showColourText) + { + viewStyle.setShowColourText(showColourText); + } + + /** + * @param textColour + * @see jalview.api.ViewStyleI#setTextColour(java.awt.Color) + */ + public void setTextColour(Color textColour) + { + viewStyle.setTextColour(textColour); + } + + /** + * @param thresholdTextColour + * @see jalview.api.ViewStyleI#setThresholdTextColour(int) + */ + public void setThresholdTextColour(int thresholdTextColour) + { + viewStyle.setThresholdTextColour(thresholdTextColour); + } + + /** + * @param textColour2 + * @see jalview.api.ViewStyleI#setTextColour2(java.awt.Color) + */ + public void setTextColour2(Color textColour2) + { + viewStyle.setTextColour2(textColour2); + } + + @Override + public ViewStyleI getViewStyle() + { + return new ViewStyle(viewStyle); + } + + @Override + public void setViewStyle(ViewStyleI settingsForView) + { + viewStyle = new ViewStyle(settingsForView); + } + + @Override + public boolean sameStyle(ViewStyleI them) + { + return viewStyle.sameStyle(them); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getIdWidth() + */ + public int getIdWidth() + { + return viewStyle.getIdWidth(); + } + + /** + * @param i + * @see jalview.api.ViewStyleI#setIdWidth(int) + */ + public void setIdWidth(int i) + { + viewStyle.setIdWidth(i); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isCentreColumnLabels() + */ + public boolean isCentreColumnLabels() + { + return viewStyle.isCentreColumnLabels(); + } + + /** + * @param centreColumnLabels + * @see jalview.api.ViewStyleI#setCentreColumnLabels(boolean) + */ + public void setCentreColumnLabels(boolean centreColumnLabels) + { + viewStyle.setCentreColumnLabels(centreColumnLabels); + } + + /** + * @param showdbrefs + * @see jalview.api.ViewStyleI#setShowDBRefs(boolean) + */ + public void setShowDBRefs(boolean showdbrefs) + { + viewStyle.setShowDBRefs(showdbrefs); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isShowDBRefs() + */ + public boolean isShowDBRefs() + { + return viewStyle.isShowDBRefs(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#isShowNPFeats() + */ + public boolean isShowNPFeats() + { + return viewStyle.isShowNPFeats(); + } + + /** + * @param shownpfeats + * @see jalview.api.ViewStyleI#setShowNPFeats(boolean) + */ + public void setShowNPFeats(boolean shownpfeats) + { + viewStyle.setShowNPFeats(shownpfeats); } }