+ setDrawPhylogramEnabled( false );
+ setTreeDisplayType( Options.PHYLOGENY_DISPLAY_TYPE.CLADOGRAM );
+ }
+ getMainPanel().getMainFrame()
+ .setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel().getPhylogenyGraphicsType() );
+ getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
+ getMainPanel().getCurrentTreePanel().updateButtonToUncollapseAll();
+ getMainPanel().getControlPanel().search0();
+ getMainPanel().getControlPanel().search1();
+ getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
+ getMainPanel().getControlPanel().updateDepthCollapseDepthDisplay();
+ getMainPanel().getControlPanel().updateRankCollapseRankDisplay();
+ getSequenceRelationTypeBox().removeAllItems();
+ for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
+ .getRelevantSequenceRelationTypes() ) {
+ _sequence_relation_type_box.addItem( type );
+ }
+ getMainPanel().getCurrentTreePanel().repaint();
+ //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
+ // according to GUILHEM the line above can be removed.
+ }
+ }
+
+ /**
+ * Uncollapse all nodes.
+ */
+ final void uncollapseAll( final TreePanel tp ) {
+ final Phylogeny t = tp.getPhylogeny();
+ if ( ( t != null ) && !t.isEmpty() ) {
+ for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
+ final PhylogenyNode node = iter.next();
+ node.setCollapse( false );
+ }
+ tp.resetNodeIdToDistToLeafMap();
+ tp.updateSetOfCollapsedExternalNodes();
+ t.recalculateNumberOfExternalDescendants( false );
+ tp.setNodeInPreorderToNull();
+ t.clearHashIdToNodeMap();
+ tp.resetDepthCollapseDepthValue();
+ tp.resetRankCollapseRankValue();
+ showWhole();
+ }
+ }
+
+ final void updateDomainStructureEvaluethresholdDisplay() {
+ if ( _domain_structure_evalue_thr_tf != null ) {
+ _domain_structure_evalue_thr_tf
+ .setText( "10^" + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
+ }
+ }
+
+ private final String obtainDepthCollapseDepthValue() {
+ if ( getMainPanel().getCurrentTreePanel() == null ) {
+ return "";
+ }
+ final TreePanel tp = getMainPanel().getCurrentTreePanel();
+ final Phylogeny p = tp.getPhylogeny();
+ if ( ( p == null ) || ( p.getNumberOfExternalNodes() < 3 ) ) {
+ return "off";
+ }
+ else if ( tp.getDepthCollapseDepthValue() < 0 ) {
+ tp.setDepthCollapseDepthValue( PhylogenyMethods.calculateMaxDepth( p ) );
+ return "off";
+ }
+ else if ( tp.getDepthCollapseDepthValue() == PhylogenyMethods.calculateMaxDepth( p ) ) {
+ return "off";
+ }
+ return String.valueOf( tp.getDepthCollapseDepthValue() );
+ }
+
+ private final String obtainRankCollapseDepthValue() {
+ if ( getMainPanel().getCurrentTreePanel() == null ) {
+ return "";
+ }
+ final TreePanel tp = getMainPanel().getCurrentTreePanel();
+ final Phylogeny p = tp.getPhylogeny();
+ if ( ( p == null ) || ( p.getNumberOfExternalNodes() < 3 ) ) {
+ return "off";
+ }
+ else {
+ final String ranks[] = PhylogenyMethods.obtainPresentRanksSorted( p );
+ if ( ranks.length < 1 ) {
+ return "off";
+ }
+ else if ( tp.getRankCollapseRankValue() < 0 ) {
+ tp.setRankCollapseRankValue( ranks.length - 1 );
+ return "off";
+ }
+ else if ( tp.getRankCollapseRankValue() == ( ranks.length - 1 ) ) {
+ return "off";
+ }
+ }
+ return String.valueOf( tp.getRankCollapseRankValue() );
+ }
+
+ final void updateDepthCollapseDepthDisplay() {
+ if ( _depth_collapse_depth_tf != null ) {
+ _depth_collapse_depth_tf.setText( " " + obtainDepthCollapseDepthValue() );
+ }
+ }
+
+ final void updateRankCollapseRankDisplay() {
+ if ( _rank_collapse_depth_tf != null ) {
+ final String r = obtainRankCollapseDepthValue();
+ if ( r.equals( "off" ) ) {
+ _rank_collapse_depth_tf.setText( " off" );
+ _rank_collapse_depth_tf.setToolTipText( "the current taxonomic rank threshold" );
+ }
+ else {
+ final String ranks[] = PhylogenyMethods
+ .obtainPresentRanksSorted( getMainPanel().getCurrentTreePanel().getPhylogeny() );
+ final int rr = Integer.parseInt( r );
+ _rank_collapse_depth_tf.setText( ranks[ rr ] );
+ _rank_collapse_depth_tf.setToolTipText( ( rr + 1 ) + "/" + ( ranks.length - 1 ) + ": "
+ + ranks[ Integer.parseInt( r ) ] );
+ }
+ }
+ }
+
+ final void zoomInX( final float factor, final float x_correction_factor ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1f );
+ if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
+ || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
+ || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
+ || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
+ final double x = ( sb.getMaximum() - sb.getMinimum() )
+ / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil
+ .roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x ) - ( sb.getVisibleAmount() / 2.0 ) ) );
+ }
+ else {
+ final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
+ }
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+
+ final void zoomInY( final float factor ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1.1f );
+ final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil
+ .roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x ) - ( sb.getVisibleAmount() / 2.0 ) ) );
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+
+ final void zoomOutX( final float factor, final float x_correction_factor ) {
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1f );
+ if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
+ if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
+ || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
+ || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
+ || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ final double x = ( sb.getMaximum() - sb.getMinimum() )
+ / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
+ - ( sb.getVisibleAmount() / 2.0 ) ) );
+ }
+ else {
+ final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
+ treepanel.setXdistance( treepanel.getXdistance() * factor );
+ treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
+ if ( x > 0 ) {
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );