From: Steve S. <se...@us...> - 2007-08-31 09:36:10
|
Update of /cvsroot/gmod/apollo/src/java/apollo/gui/genomemap In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27729/genomemap Modified Files: ApolloPanel.java SplitterView.java StrandedZoomableApolloPanel.java Log Message: Small thing first: Changed FeatureTreeFrame so that when a new set is loaded it no longer hides, but instead just updates its set. Should save the user from having to redisplay it. Bigger thing: I've added the ability to save/load the layout of the ApolloFrame to a file. The motivation behind this was to make it easier to setup the display of multispecies synteny data. However I think it will have several other possible uses. The layout is saved using the 'Save window layout' item in the File menu and loaded using the 'Load window layout'. The following things are saved: - Size and location of ApolloFrame - Location and Orientation of splitpane divider between EvidencePanelContainer and SyntenyPanel - Location of splitpane divider in each EvidencePanel - Location of splitpane dividers in SyntenyPanel - For each StrandedZoomableApolloPanel - control panel and nav bar visibility - Location of splitter view dividers - Forward strand visibility - Reverse strand visibility - Results visibility - Annotation visibility - Scale visibility - Whether sites are shown when zoomed in - Whether edge matches are highlighted - Whether display is reverse complemented - Centre base * - Zoom factor * The base position specific data (*'d) is only applied if the 'Update base location' checkbox is ticked in the 'Load window layout' JFileChooser dialog. I've also added a Style variable 'LayoutIniFile' which specifies a file to use to set the window layout when a set using that style is loaded. Base position data is not loaded. One check that is done to make sure the layout data is compatible with the current displayed data is to check that the number of species is the same. The ini file also has a version number stored which is checked. If base position data is being loaded then the range of the current curation set is checked against the range that was present when the layout was saved and a warning given if they differ. Index: ApolloPanel.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/gui/genomemap/ApolloPanel.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ApolloPanel.java 3 Jan 2007 13:50:38 -0000 1.47 --- ApolloPanel.java 31 Aug 2007 09:36:02 -0000 1.48 *************** *** 921,924 **** --- 921,928 ---- } + public boolean isShowingEdgeMatches() { + return showEdgeMatches; + } + public void clearEdges() { Index: SplitterView.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/gui/genomemap/SplitterView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SplitterView.java 27 Aug 2005 09:26:34 -0000 1.6 --- SplitterView.java 31 Aug 2007 09:36:02 -0000 1.7 *************** *** 113,116 **** --- 113,126 ---- } + public double getSplitFract() { + return splitFract; + } + + public void setSplitFract(double newFract) { + splitFract = newFract; + getComponent().invalidate(); + getComponent().repaint(); + } + /** * Draws the v1 and v2 views (if they are visible) and then if both are visible Index: StrandedZoomableApolloPanel.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/gui/genomemap/StrandedZoomableApolloPanel.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** StrandedZoomableApolloPanel.java 3 Jan 2007 13:50:39 -0000 1.96 --- StrandedZoomableApolloPanel.java 31 Aug 2007 09:36:02 -0000 1.97 *************** *** 35,38 **** --- 35,40 ---- import apollo.util.*; + import misc.JIniFile; + import org.apache.log4j.*; *************** *** 1951,1954 **** --- 1953,2053 ---- return scrollingPropagated; } + + public boolean isShowingEdgeMatches(){ + return apolloPanel.isShowingEdgeMatches(); + } + + public void saveLayout(JIniFile iniFile, String section) { + iniFile.writeInteger(section,"width",getSize().width); + iniFile.writeInteger(section,"height",getSize().height); + iniFile.writeInteger(section,"xorigin",getLocation().x); + iniFile.writeInteger(section,"yorigin",getLocation().y); + + iniFile.writeBoolean(section,"controls_visible",isControlPanelVisible()); + iniFile.writeBoolean(section,"navbar_visible",curationState.getNavigationBar().isVisible()); + + iniFile.writeInteger(section,"centre_base",getCentreBase()); + iniFile.writeDouble(section,"zoom_factor",getZoomFactor()); + iniFile.writeDouble(section,"curation_low",curationSet.getLow()); + iniFile.writeDouble(section,"curation_high",curationSet.getHigh()); + + iniFile.writeBoolean(section,"reverse_complement",isReverseComplement()); + + iniFile.writeDouble(section,"strand_split_fract",strandSplitter.getSplitFract()); + iniFile.writeDouble(section,"forward_split_fract",forwardSplitterView.getSplitFract()); + iniFile.writeDouble(section,"reverse_split_fract",reverseSplitterView.getSplitFract()); + + iniFile.writeBoolean(section,"forward_views_visible",isForwardStrandVisible()); + iniFile.writeBoolean(section,"reverse_views_visible",isReverseStrandVisible()); + iniFile.writeBoolean(section,"annotation_views_visible",areAnnotationViewsVisible()); + iniFile.writeBoolean(section,"result_views_visible",areResultViewsVisible()); + iniFile.writeBoolean(section,"scale_visible",isScaleViewVisible()); + iniFile.writeBoolean(section,"sites_visible",getSiteViewVisibleOnZoom()); + + iniFile.writeBoolean(section,"show_edge_matches",isShowingEdgeMatches()); + } + + public void applyVisibilityFromLayout(JIniFile iniFile, String section) { + boolean controlVis = iniFile.readBoolean(section,"controls_visible",isControlPanelVisible()); + boolean navVis = iniFile.readBoolean(section,"navbar_visible",curationState.getNavigationBar().isVisible()); + boolean sitesVis = iniFile.readBoolean(section,"sites_visible",getSiteViewVisibleOnZoom()); + + if (curationState.getNavigationBar().isVisible() != navVis) { + // Fake up an event to modify the nav bar visibility through its action + curationState.getNavigationBar().getNavigationAction().actionPerformed(new ActionEvent(this,0,"windowarranger")); + } + + setControlPanelVisibility(controlVis); + setSiteViewVisibleOnZoom(sitesVis); + + boolean forwardVis = iniFile.readBoolean(section,"forward_views_visible",isForwardStrandVisible()); + boolean reverseVis = iniFile.readBoolean(section,"reverse_views_visible",isReverseStrandVisible()); + boolean annotVis = iniFile.readBoolean(section,"annotation_views_visible",areAnnotationViewsVisible()); + boolean resultVis = iniFile.readBoolean(section,"result_views_visible",areResultViewsVisible()); + boolean scaleVis = iniFile.readBoolean(section,"scale_visible",isScaleViewVisible()); + + if (forwardVis != isForwardStrandVisible()) setForwardVisible(forwardVis); + if (reverseVis != isReverseStrandVisible()) setReverseVisible(reverseVis); + if (annotVis != areAnnotationViewsVisible()) setAnnotationViewsVisible(annotVis); + if (resultVis != areResultViewsVisible()) setResultViewsVisible(resultVis); + if (scaleVis != isScaleViewVisible()) setScaleViewVisible(scaleVis); + } + + public void applyLayout(JIniFile iniFile, String section, boolean updateBaseLocation) { + applyVisibilityFromLayout(iniFile, section); + + if (updateBaseLocation) { + int basePos = iniFile.readInteger(section,"centre_base",getCentreBase()); + double zoomFactor = iniFile.readDouble(section,"zoom_factor",getZoomFactor()); + int curationLow = iniFile.readInteger(section,"curation_low",0); + int curationHigh = iniFile.readInteger(section,"curation_high",0); + + if (curationLow != curationSet.getLow() || curationHigh != curationSet.getHigh()) { + logger.warn("Curation set bounds in ini file different to current set. Zoom factor setting from ini file may not do what you expect"); + } + + setCentreBase(basePos); + setZoomFactor(zoomFactor); + } + + boolean reverseComplemented = iniFile.readBoolean(section,"reverse_complement",isReverseComplement()); + if (reverseComplemented != isReverseComplement()) { + setReverseComplement(reverseComplemented); + } + + double splitFract; + splitFract = iniFile.readDouble(section,"strand_split_fract",strandSplitter.getSplitFract()); + strandSplitter.setSplitFract(splitFract); + + splitFract = iniFile.readDouble(section,"forward_split_fract",forwardSplitterView.getSplitFract()); + forwardSplitterView.setSplitFract(splitFract); + + splitFract = iniFile.readDouble(section,"reverse_split_fract",reverseSplitterView.getSplitFract()); + reverseSplitterView.setSplitFract(splitFract); + + boolean showEdges = iniFile.readBoolean(section,"show_edge_matches",isShowingEdgeMatches()); + setEdgeMatching(showEdges); + } + /** * My zoom-buttons are aware of when they are pressed with a shift-key. *************** *** 2071,2074 **** } } // end of HighlightDragListener - } --- 2170,2172 ---- |