From 7b0ab0889b9ecaf301c2259fe63e843fa9a895b3 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 6 Feb 2015 10:50:05 +0000 Subject: [PATCH] JAL-1640 more properties moved to style bean and rationalisation of layout update logic (wrap/non-wrap,idwidth,etc) to smaller number of methods --- src/jalview/api/AlignViewportI.java | 5 +- src/jalview/api/ViewStyleI.java | 62 ++++++++++++ src/jalview/gui/AlignFrame.java | 16 +-- src/jalview/gui/AlignViewport.java | 109 ++++++++------------- src/jalview/gui/AlignmentPanel.java | 32 ++++-- src/jalview/gui/AnnotationExporter.java | 4 +- src/jalview/gui/IdPanel.java | 2 +- src/jalview/gui/IdwidthAdjuster.java | 8 +- src/jalview/gui/Jalview2XML.java | 13 +-- src/jalview/gui/Jalview2XML_V1.java | 7 +- src/jalview/gui/SequenceRenderer.java | 4 +- src/jalview/renderer/AnnotationRenderer.java | 3 +- src/jalview/viewmodel/AlignmentViewport.java | 127 ++++++++++++++++++++++++ src/jalview/viewmodel/styles/ViewStyle.java | 135 ++++++++++++++++++++++++++ 14 files changed, 417 insertions(+), 110 deletions(-) diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index fe49488..b2fc4c2 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -40,7 +40,7 @@ import java.util.Map; * @author jimp * */ -public interface AlignViewportI +public interface AlignViewportI extends ViewStyleI { int getCharWidth(); @@ -77,8 +77,6 @@ public interface AlignViewportI Hashtable[] getRnaStructureConsensusHash(); - - boolean getCentreColumnLabels(); boolean isIgnoreGapsConsensus(); boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation); @@ -366,4 +364,5 @@ public interface AlignViewportI * @param settingsForView */ public void setViewStyle(ViewStyleI settingsForView); + } diff --git a/src/jalview/api/ViewStyleI.java b/src/jalview/api/ViewStyleI.java index e022f4c..8fa7f8f 100644 --- a/src/jalview/api/ViewStyleI.java +++ b/src/jalview/api/ViewStyleI.java @@ -137,4 +137,66 @@ public interface ViewStyleI boolean sameStyle(ViewStyleI them); + void setFontName(String name); + + void setFontStyle(int style); + + void setFontSize(int size); + + int getFontStyle(); + + String getFontName(); + + int getFontSize(); + + /** + * @return width of Sequence and Annotation ID margin. If less than zero, then + * width will be autocalculated + */ + int getIdWidth(); + + /** + * Set width if + * + * @param i + */ + + void setIdWidth(int i); + + /** + * centre columnar annotation labels in displayed alignment annotation + */ + boolean isCentreColumnLabels(); + + /** + * centre columnar annotation labels in displayed alignment annotation + */ + void setCentreColumnLabels(boolean centreColumnLabels); + + /** + * enable or disable the display of Database Cross References in the sequence + * ID tooltip + */ + void setShowDBRefs(boolean showdbrefs); + + /** + * + * @return true if Database References are to be displayed on tooltips. + */ + boolean isShowDBRefs(); + + /** + * + * @return true if Non-positional features are to be displayed on tooltips. + */ + boolean isShowNPFeats(); + + /** + * enable or disable the display of Non-Positional sequence features in the + * sequence ID tooltip + * + * @param show + */ + void setShowNPFeats(boolean shownpfeats); + } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2b6795b..c58c4ac 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -742,7 +742,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, conservationMenuItem.setSelected(av.getConservationSelected()); seqLimits.setSelected(av.getShowJVSuffix()); idRightAlign.setSelected(av.isRightAlignIds()); - centreColumnLabelsMenuItem.setState(av.centreColumnLabels); + centreColumnLabelsMenuItem.setState(av.isCentreColumnLabels()); renderGapsMenuItem.setSelected(av.isRenderGaps()); wrapMenuItem.setSelected(av.getWrapAlignment()); scaleAbove.setVisible(av.getWrapAlignment()); @@ -771,8 +771,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, showSeqFeatures.setSelected(av.isShowSequenceFeatures()); hiddenMarkers.setState(av.getShowHiddenMarkers()); applyToAllGroups.setState(av.getColourAppliesToAllGroups()); - showNpFeatsMenuitem.setSelected(av.isShowNpFeats()); - showDbRefsMenuitem.setSelected(av.isShowDbRefs()); + showNpFeatsMenuitem.setSelected(av.isShowNPFeats()); + showDbRefsMenuitem.setSelected(av.isShowDBRefs()); autoCalculate.setSelected(av.autoCalculateConsensus); sortByTree.setSelected(av.sortByTree); listenToViewSelections.setSelected(av.followSelection); @@ -2766,7 +2766,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void centreColumnLabels_actionPerformed(ActionEvent e) { - viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState(); + viewport.setCentreColumnLabels(centreColumnLabelsMenuItem.getState()); alignPanel.paintAlignment(true); } @@ -2811,7 +2811,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, scaleLeft.setVisible(wrapMenuItem.isSelected()); scaleRight.setVisible(wrapMenuItem.isSelected()); viewport.setWrapAlignment(wrapMenuItem.isSelected()); - alignPanel.setWrapAlignment(wrapMenuItem.isSelected()); + alignPanel.updateLayout(); } @Override @@ -3115,11 +3115,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { final boolean setVisible = annotationPanelMenuItem.isSelected(); viewport.setShowAnnotation(setVisible); - alignPanel.setAnnotationVisible(setVisible); this.showAllSeqAnnotations.setEnabled(setVisible); this.hideAllSeqAnnotations.setEnabled(setVisible); this.showAllAlAnnotations.setEnabled(setVisible); this.hideAllAlAnnotations.setEnabled(setVisible); + alignPanel.updateLayout(); } @Override @@ -5347,7 +5347,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void showDbRefs_actionPerformed(ActionEvent e) { - viewport.setShowDbRefs(showDbRefsMenuitem.isSelected()); + viewport.setShowDBRefs(showDbRefsMenuitem.isSelected()); } /* @@ -5359,7 +5359,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void showNpFeats_actionPerformed(ActionEvent e) { - viewport.setShowNpFeats(showNpFeatsMenuitem.isSelected()); + viewport.setShowNPFeats(showNpFeatsMenuitem.isSelected()); } /** diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index a54f9e8..37fe1d2 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -41,6 +41,7 @@ package jalview.gui; 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.AlignmentI; @@ -58,6 +59,7 @@ 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; @@ -219,12 +221,12 @@ public class AlignViewport extends AlignmentViewport implements setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true)); setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false)); - centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false); + setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false)); autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true); setPadGaps(Cache.getDefault("PAD_GAPS", true)); - shownpfeats = Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true); - showdbrefs = Cache.getDefault("SHOW_DBREFS_TOOLTIP", true); + setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true)); + setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true)); viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true)); viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false)); viewStyle.setShowUnconserved(Cache @@ -307,18 +309,6 @@ public class AlignViewport extends AlignmentViewport implements } /** - * centre columnar annotation labels in displayed alignment annotation TODO: - * add to jalviewXML and annotation display settings - */ - boolean centreColumnLabels = false; - - private boolean showdbrefs; - - private boolean shownpfeats; - - // --------END Structure Conservation - - /** * get the consensus sequence as displayed under the PID consensus annotation * row. * @@ -477,11 +467,32 @@ public class AlignViewport extends AlignmentViewport implements Container c = new Container(); java.awt.FontMetrics fm = c.getFontMetrics(font); - setCharHeight(fm.getHeight()); - setCharWidth(fm.charWidth('M')); + int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle + .getCharHeight(); + // only update width/height if the new font won't fit + if (h < fm.getHeight()) + { + setCharHeight(fm.getHeight()); + } + if (w < ww) + { + setCharWidth(ww); + } + viewStyle.setFontName(font.getName()); + viewStyle.setFontStyle(font.getStyle()); + viewStyle.setFontSize(font.getSize()); + validCharWidth = true; } + @Override + public void setViewStyle(ViewStyleI settingsForView) + { + super.setViewStyle(settingsForView); + setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(), + viewStyle.getFontSize())); + + } /** * DOCUMENT ME! * @@ -641,55 +652,6 @@ public class AlignViewport extends AlignmentViewport implements return false; } - public boolean getCentreColumnLabels() - { - return centreColumnLabels; - } - - public void setCentreColumnLabels(boolean centrecolumnlabels) - { - centreColumnLabels = centrecolumnlabels; - } - - /** - * enable or disable the display of Database Cross References in the sequence - * ID tooltip - */ - public void setShowDbRefs(boolean show) - { - showdbrefs = show; - } - - /** - * - * @return true if Database References are to be displayed on tooltips. - */ - public boolean isShowDbRefs() - { - return showdbrefs; - } - - /** - * - * @return true if Non-positional features are to be displayed on tooltips. - */ - public boolean isShowNpFeats() - { - return shownpfeats; - } - - /** - * enable or disable the display of Non-Positional sequence features in the - * sequence ID tooltip - * - * @param show - */ - public void setShowNpFeats(boolean show) - { - shownpfeats = show; - } - - /** * when set, view will scroll to show the highlighted position */ @@ -907,4 +869,19 @@ public class AlignViewport extends AlignmentViewport implements { this.annotationColumnSelectionState = currentAnnotationColumnSelectionState; } + + @Override + public void setIdWidth(int i) + { + super.setIdWidth(i); + AlignmentPanel ap = getAlignPanel(); + if (ap != null) + { + // modify GUI elements to reflect geometry change + Dimension idw = getAlignPanel().getIdPanel().getIdCanvas() + .getPreferredSize(); + idw.width = i; + getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw); + } + } } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index e638cc0..f493fcf 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -123,8 +123,6 @@ public class AlignmentPanel extends GAlignmentPanel implements setScrollValues(0, 0); - setAnnotationVisible(av.isShowAnnotation()); - hscroll.addAdjustmentListener(this); vscroll.addAdjustmentListener(this); @@ -142,7 +140,7 @@ public class AlignmentPanel extends GAlignmentPanel implements }); fontChanged(); adjustAnnotationHeight(); - + updateLayout(); } @Override @@ -180,6 +178,7 @@ public class AlignmentPanel extends GAlignmentPanel implements getAnnotationPanel().adjustPanelHeight(); Dimension d = calculateIdWidth(); + d.setSize(d.width + 4, d.height); getIdPanel().getIdCanvas().setPreferredSize(d); hscrollFillerPanel.setPreferredSize(d); @@ -202,11 +201,21 @@ public class AlignmentPanel extends GAlignmentPanel implements public Dimension calculateIdWidth() { // calculate sensible default width when no preference is available - - int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300); - int maxwidth = Math.max(20, - Math.min(afwidth - 200, 2 * afwidth / 3)); - return calculateIdWidth(maxwidth); + Dimension r = null; + if (av.getIdWidth() < 0) + { + int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300); + int maxwidth = Math.max(20, Math.min(afwidth - 200, 2 * afwidth / 3)); + r = calculateIdWidth(maxwidth); + av.setIdWidth(r.width); + } + else + { + r = new Dimension(); + r.width = av.getIdWidth(); + r.height = 0; + } + return r; } /** @@ -495,13 +504,16 @@ public class AlignmentPanel extends GAlignmentPanel implements } /** - * DOCUMENT ME! + * update alignment layout for viewport settings * * @param wrap * DOCUMENT ME! */ - public void setWrapAlignment(boolean wrap) + public void updateLayout() { + fontChanged(); + setAnnotationVisible(av.isShowAnnotation()); + boolean wrap = av.getWrapAlignment(); av.startSeq = 0; scalePanelHolder.setVisible(!wrap); hscroll.setVisible(!wrap); diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index df6f9eb..7271260 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -156,13 +156,13 @@ public class AnnotationExporter extends JPanel { text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() .getDataset().getSequencesArray(), ap.getFeatureRenderer() - .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//); + .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); + .getDisplayedFeatureCols(), true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed); } } else diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index a22e918..60daf28 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -110,7 +110,7 @@ public class IdPanel extends JPanel implements MouseListener, StringBuffer tip = new StringBuffer(64); seqAnnotReport .createSequenceAnnotationReport(tip, sequence, - av.isShowDbRefs(), av.isShowNpFeats(), + av.isShowDBRefs(), av.isShowNPFeats(), sp.seqCanvas.fr.getMinMax()); setToolTipText("" + sequence.getDisplayId(true) + " " + tip.toString() + ""); diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index a6e6c8d..cbe9c8b 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -124,13 +124,13 @@ public class IdwidthAdjuster extends JPanel implements MouseListener, { active = true; - Dimension d = ap.getIdPanel().getIdCanvas().getPreferredSize(); + int curwidth = ap.getAlignViewport().getIdWidth(); int dif = evt.getX() - oldX; - if (((d.width + dif) > 20) || (dif > 0)) + if (((curwidth + dif) > 20) || (dif > 0)) { - ap.getIdPanel().getIdCanvas().setPreferredSize(new Dimension(d.width + dif, - d.height)); + ap.getAlignViewport().setIdWidth(curwidth + dif); + ap.paintAlignment(true); } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 1d59ce0..e355ffe 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1115,8 +1115,8 @@ public class Jalview2XML view.setNormaliseSequenceLogo(av.isNormaliseSequenceLogo()); view.setShowGroupConsensus(av.isShowGroupConsensus()); view.setShowGroupConservation(av.isShowGroupConservation()); - view.setShowNPfeatureTooltip(av.isShowNpFeats()); - view.setShowDbRefTooltip(av.isShowDbRefs()); + view.setShowNPfeatureTooltip(av.isShowNPFeats()); + view.setShowDbRefTooltip(av.isShowDBRefs()); view.setFollowHighlight(av.followHighlight); view.setFollowSelection(av.followSelection); view.setIgnoreGapsinConsensus(av.isIgnoreGapsConsensus()); @@ -3684,12 +3684,9 @@ public class Jalview2XML af.viewport.setRightAlignIds(view.getRightAlignIds()); af.viewport.setFont(new java.awt.Font(view.getFontName(), view .getFontStyle(), view.getFontSize())); - af.alignPanel.fontChanged(); af.viewport.setRenderGaps(view.getRenderGaps()); af.viewport.setWrapAlignment(view.getWrapAlignment()); - af.alignPanel.setWrapAlignment(view.getWrapAlignment()); af.viewport.setShowAnnotation(view.getShowAnnotation()); - af.alignPanel.setAnnotationVisible(view.getShowAnnotation()); af.viewport.setShowBoxes(view.getShowBoxes()); @@ -3702,7 +3699,7 @@ public class Jalview2XML .isShowUnconserved() : false); af.viewport.setStartRes(view.getStartRes()); af.viewport.setStartSeq(view.getStartSeq()); - + af.alignPanel.updateLayout(); ColourSchemeI cs = null; // apply colourschemes if (view.getBgColour() != null) @@ -3785,11 +3782,11 @@ public class Jalview2XML } if (view.hasShowDbRefTooltip()) { - af.viewport.setShowDbRefs(view.getShowDbRefTooltip()); + af.viewport.setShowDBRefs(view.getShowDbRefTooltip()); } if (view.hasShowNPfeatureTooltip()) { - af.viewport.setShowNpFeats(view.hasShowNPfeatureTooltip()); + af.viewport.setShowNPFeats(view.hasShowNPfeatureTooltip()); } if (view.hasShowGroupConsensus()) { diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 586e2fa..e30497d 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -373,13 +373,11 @@ public class Jalview2XML_V1 af.viewport.setShowJVSuffix(view.getShowFullId()); af.viewport.setFont(new java.awt.Font(view.getFontName(), view .getFontStyle(), view.getFontSize())); - af.alignPanel.fontChanged(); af.viewport.setRenderGaps(view.getRenderGaps()); af.viewport.setWrapAlignment(view.getWrapAlignment()); - af.alignPanel.setWrapAlignment(view.getWrapAlignment()); - af.viewport.setShowAnnotation(view.getShowAnnotation()); - af.alignPanel.setAnnotationVisible(view.getShowAnnotation()); + + af.viewport.setShowAnnotation(view.isShowAnnotation()); af.viewport.setShowBoxes(view.getShowBoxes()); af.viewport.setShowText(view.getShowText()); @@ -405,6 +403,7 @@ public class Jalview2XML_V1 af.viewport.setGlobalColourScheme(cs); af.viewport.setColourAppliesToAllGroups(false); + af.alignPanel.updateLayout(); af.changeColour(cs); if (view.getConservationSelected() && cs != null) { diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index be02717..94a4115 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -498,7 +498,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer char s = '~'; // Need to find the sequence position here. - if (av.validCharWidth) + if (av.isValidCharWidth()) { for (int i = start; i <= end; i++) { @@ -522,7 +522,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer graphics.setColor(Color.black); graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight()); - if (av.validCharWidth) + if (av.isValidCharWidth()) { graphics.setColor(Color.white); diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index f4e9b1f..448bcd2 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -400,8 +400,7 @@ public class AnnotationRenderer boolean validRes = false; boolean validEnd = false; boolean labelAllCols = false; - boolean centreColLabels, centreColLabelsDef = av - .getCentreColumnLabels(); + boolean centreColLabels, centreColLabelsDef = av.isCentreColumnLabels(); boolean scaleColLabel = false; AlignmentAnnotation consensusAnnot = av .getAlignmentConsensusAnnotation(), structConsensusAnnot = av diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 152f155..3a40a16 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -64,6 +64,61 @@ public abstract class AlignmentViewport implements AlignViewportI, { protected ViewStyleI viewStyle = new ViewStyle(); + + /** + * @param name + * @see jalview.api.ViewStyleI#setFontName(java.lang.String) + */ + public void setFontName(String name) + { + viewStyle.setFontName(name); + } + + /** + * @param style + * @see jalview.api.ViewStyleI#setFontStyle(int) + */ + public void setFontStyle(int style) + { + viewStyle.setFontStyle(style); + } + + /** + * @param size + * @see jalview.api.ViewStyleI#setFontSize(int) + */ + public void setFontSize(int size) + { + viewStyle.setFontSize(size); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getFontStyle() + */ + public int getFontStyle() + { + return viewStyle.getFontStyle(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getFontName() + */ + public String getFontName() + { + return viewStyle.getFontName(); + } + + /** + * @return + * @see jalview.api.ViewStyleI#getFontSize() + */ + public int getFontSize() + { + return viewStyle.getFontSize(); + } + /** * @param upperCasebold * @see jalview.api.ViewStyleI#setUpperCasebold(boolean) @@ -2099,4 +2154,76 @@ public abstract class AlignmentViewport implements AlignViewportI, { 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); + } } diff --git a/src/jalview/viewmodel/styles/ViewStyle.java b/src/jalview/viewmodel/styles/ViewStyle.java index 9f845e4..1e97af4 100644 --- a/src/jalview/viewmodel/styles/ViewStyle.java +++ b/src/jalview/viewmodel/styles/ViewStyle.java @@ -24,12 +24,25 @@ public class ViewStyle implements ViewStyleI int charWidth; + int idWidth = -1; + /** * gui state - changes to colour scheme propagated to all groups */ private boolean colourAppliesToAllGroups; /** + * centre columnar annotation labels in displayed alignment annotation + */ + boolean centreColumnLabels = false; + + private boolean showdbrefs; + + private boolean shownpfeats; + + // --------END Structure Conservation + + /** * colour according to the reference sequence defined on the alignment */ private boolean colourByReferenceSeq = false; @@ -122,6 +135,15 @@ public class ViewStyle implements ViewStyleI */ boolean upperCasebold = false; + /** + * name of base font for view + */ + private String fontName; + /** + * size for base font + */ + private int fontSize; + public ViewStyle(ViewStyleI viewStyle) { ViewStyle.configureFrom(this, viewStyle); @@ -249,6 +271,8 @@ public class ViewStyle implements ViewStyleI */ int wrappedWidth; + private int fontStyle; + /** * GUI state * @@ -559,6 +583,7 @@ public class ViewStyle implements ViewStyleI abovePIDThreshold = b; } + /** * DOCUMENT ME! * @@ -869,4 +894,114 @@ public class ViewStyle implements ViewStyleI { return equivalent(this, them); } + + @Override + public String getFontName() + { + return fontName; + } + + @Override + public int getFontSize() + { + return fontSize; + } + + @Override + public int getFontStyle() + { + return fontStyle; + } + + @Override + public void setFontName(String name) + { + fontName = name; + } + + @Override + public void setFontSize(int size) + { + fontSize = size; + + } + + @Override + public void setFontStyle(int style) + { + fontStyle = style; + } + + @Override + public int getIdWidth() + { + return idWidth; + } + + /** + * @param idWidth + * the idWidth to set + */ + @Override + public void setIdWidth(int idWidth) + { + this.idWidth = idWidth; + } + + /** + * @return the centreColumnLabels + */ + @Override + public boolean isCentreColumnLabels() + { + return centreColumnLabels; + } + + /** + * @param centreColumnLabels + * the centreColumnLabels to set + */ + @Override + public void setCentreColumnLabels(boolean centreColumnLabels) + { + this.centreColumnLabels = centreColumnLabels; + } + + /** + * @return the showdbrefs + */ + @Override + public boolean isShowDBRefs() + { + return showdbrefs; + } + + /** + * @param showdbrefs + * the showdbrefs to set + */ + @Override + public void setShowDBRefs(boolean showdbrefs) + { + this.showdbrefs = showdbrefs; + } + + /** + * @return the shownpfeats + */ + @Override + public boolean isShowNPFeats() + { + return shownpfeats; + } + + /** + * @param shownpfeats + * the shownpfeats to set + */ + @Override + public void setShowNPFeats(boolean shownpfeats) + { + this.shownpfeats = shownpfeats; + } } -- 1.7.10.2