final static String clickto_options[][] = {
{ "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
{ "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree(s)", "display" },
- { "Colorize Node", "display" }, { "Change Node Font", "display" }, { "Open Sequence DB", "display" }, { "Go to PDB", "display" },
- { "Open Taxonomy DB", "display" }, { "Blast", "display" }, { "Cut Subtree", "display" },
- { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
- { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Sort Descendants", "display" },
- { "Return", "display" }, { "Select Node(s)", "display" } };
+ { "Colorize Node", "display" }, { "Change Node Font", "display" }, { "Open Sequence DB", "display" },
+ { "Go to PDB", "display" }, { "Open Taxonomy DB", "display" }, { "Blast", "display" },
+ { "Cut Subtree", "display" }, { "Copy Subtree", "display" }, { "Paste Subtree", "display" },
+ { "Delete Subtree/Node", "display" }, { "Add New Node", "display" }, { "Edit Node Data", "display" },
+ { "Sort Descendants", "display" }, { "Return", "display" }, { "Select Node(s)", "display" } };
final static int display_node_data = 0;
final static int collapse_uncollapse = 1;
final static int reroot = 2;
final static int swap = 4;
final static int color_subtree = 5;
final static int color_node_font = 6;
- final static int change_node_font = 7;
+ final static int change_node_font = 7;
final static int open_seq_web = 8;
final static int open_pdb_web = 9;
final static int open_tax_web = 10;
else if ( name.equals( "color_subtree" ) ) {
index = Configuration.color_subtree;
}
-
else if ( name.equals( "change_node_font" ) ) {
index = Configuration.change_node_font;
}
-
else if ( name.equals( "color_node_font" ) ) {
index = Configuration.color_node_font;
}
-
else if ( name.equals( "color_subtree" ) ) {
index = Configuration.color_subtree;
}
-
-
return index;
}
private boolean _color_branches;
private JCheckBox _color_branches_cb;
private int _color_subtree_cb_item;
+ private int _change_node_font_item;
// The settings from the conf file
private final Configuration _configuration;
private int _copy_subtree_item;
else if ( action == _color_node_font_item ) {
setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
}
+ else if ( action == _change_node_font_item ) {
+ setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
+ }
else {
throw new RuntimeException( "unknown action: " + action );
}
}
cb_index++;
}
+ if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
+ _change_node_font_item = cb_index;
+ addClickToOption( Configuration.change_node_font,
+ _configuration.getClickToTitle( Configuration.change_node_font ) );
+ if ( default_option == Configuration.change_node_font ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
_open_seq_web_item = cb_index;
addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
import org.forester.phylogeny.data.Event;
import org.forester.phylogeny.data.NodeData.NODE_DATA;
import org.forester.phylogeny.data.NodeVisualData;
+import org.forester.phylogeny.data.NodeVisualData.FontType;
import org.forester.phylogeny.data.NodeVisualData.NodeFill;
import org.forester.phylogeny.data.NodeVisualData.NodeShape;
import org.forester.phylogeny.data.PhylogenyDataUtil;
dialog.setVisible( true );
}
- private void colorNodeFont( PhylogenyNode node ) {
+ private void colorNodeFont( final PhylogenyNode node ) {
_color_chooser.setPreviewPanel( new JPanel() );
NodeColorizationActionListener al;
if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) {
dialog.setVisible( true );
}
- private void changeNodeFont( PhylogenyNode node ) {
- // TODO Auto-generated method stub
+ private void changeNodeFont( final PhylogenyNode node ) {
+ final FontChooser fc = new FontChooser();
+ Font f = null;
+ if ( node.getNodeData().getNodeVisualData() != null && !node.getNodeData().getNodeVisualData().isEmpty() ) {
+ f = node.getNodeData().getNodeVisualData().getFontObject();
+ }
+ if ( f != null ) {
+ fc.setFont( f );
+ }
+ else {
+ fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
+ }
+ fc.showDialog( this, "Select Font" );
+ if ( fc.getFont() != null ) {
+ NodeVisualData v = node.getNodeData().getNodeVisualData();
+ Font ff = fc.getFont();
+ v.setFont( ff.getFamily() );
+ v.setFontSize( ( byte ) ( ff.getSize() ) );
+ if ( ff.getStyle() == Font.BOLD && ff.getStyle() == Font.ITALIC ) {
+ v.setFontType( FontType.BOLD_ITALIC );
+ }
+ else if ( ff.getStyle() == Font.ITALIC ) {
+ v.setFontType( FontType.ITALIC );
+ }
+ else if ( ff.getStyle() == Font.BOLD ) {
+ v.setFontType( FontType.BOLD );
+ }
+ else {
+ v.setFontType( FontType.NORMAL );
+ }
+ }
}
final private void copySubtree( final PhylogenyNode node ) {
package org.forester.phylogeny.data;\r
\r
import java.awt.Color;\r
+import java.awt.Font;\r
import java.io.IOException;\r
import java.io.Writer;\r
import java.util.ArrayList;\r
_transparancy = transparancy;\r
}\r
\r
+ public final int getFontStyle() {\r
+ if ( getFontType() == FontType.BOLD ) {\r
+ return Font.BOLD;\r
+ }\r
+ else if ( getFontType() == FontType.ITALIC ) {\r
+ return Font.ITALIC;\r
+ }\r
+ else if ( getFontType() == FontType.BOLD_ITALIC ) {\r
+ return Font.BOLD & Font.ITALIC;\r
+ }\r
+ return Font.PLAIN;\r
+ }\r
+\r
+ public final Font getFontObject() {\r
+ if ( !ForesterUtil.isEmpty( getFont() ) ) {\r
+ return new Font( getFont(), getFontStyle(), getFontSize() );\r
+ }\r
+ return null;\r
+ }\r
+\r
@Override\r
public final StringBuffer toNHX() {\r
throw new UnsupportedOperationException();\r