1 19 20 28 29 package org.netbeans.modules.xml.nbprefuse; 30 31 import java.awt.Color ; 32 import java.awt.Font ; 33 import prefuse.Visualization; 34 import prefuse.action.assignment.ColorAction; 35 import prefuse.data.tuple.TupleSet; 36 import prefuse.visual.VisualItem; 37 38 42 public class NodeTextColorAction extends ColorAction { 43 public NodeTextColorAction() { 44 super(AnalysisConstants.GRAPH_GROUP_NODES, VisualItem.TEXTCOLOR); 45 } 46 public int getColor(VisualItem item) { 47 boolean mouseover = false; 48 if (item.canGetBoolean(AnalysisConstants.MOUSEOVER) && 49 item.getBoolean(AnalysisConstants.MOUSEOVER)){ 50 mouseover = true; 51 } 52 TupleSet selected = 53 item.getVisualization().getFocusGroup(Visualization.FOCUS_ITEMS); 54 if (selected.containsTuple(item) || mouseover){ 55 return Color.BLACK.getRGB(); 57 } 58 if (item.canGetBoolean(AnalysisConstants.IS_QUERY_NODE) && 59 item.getBoolean(AnalysisConstants.IS_QUERY_NODE)){ 60 item.setFont(item.getFont().deriveFont(Font.BOLD)); 61 if (item.canGetBoolean(AnalysisConstants.MOUSEOVER) && 62 item.getBoolean(AnalysisConstants.MOUSEOVER) == false && 63 item.isHighlighted() == false){ 64 return Color.WHITE.getRGB(); 65 } 66 } 67 return Color.BLACK.getRGB(); 68 } 69 70 } 71 | Popular Tags |