1 19 20 package ca.mcgill.sable.soot.cfg.figures; 21 22 import org.eclipse.draw2d.*; 23 import java.util.*; 24 import org.eclipse.swt.*; 25 import org.eclipse.swt.graphics.*; 26 import ca.mcgill.sable.soot.*; 27 import org.eclipse.draw2d.text.*; 28 import ca.mcgill.sable.soot.editors.*; 29 import org.eclipse.jface.resource.*; 30 31 public class CFGNodeFigure extends Figure { 32 33 private Panel nodeFigure; 35 private XYAnchor srcAnchor; 36 private XYAnchor tgtAnchor; 37 38 private CFGNodeDataFigure data; 39 private CFGFlowFigure before; 40 private CFGFlowFigure after; 41 42 private boolean hasBefore; 43 private boolean hasAfter; 44 45 Font f = new Font(null, "Arial", 8, SWT.NORMAL); 46 47 48 51 public CFGNodeFigure() { 52 super(); 53 54 ToolbarLayout layout2 = new ToolbarLayout(); 55 layout2.setMinorAlignment(ToolbarLayout.ALIGN_CENTER); 56 57 this.setLayoutManager(layout2); 58 59 layout2.setStretchMinorAxis(false); 60 61 } 62 63 64 private int getLineBreak(String text){ 65 return text.lastIndexOf(" ", 50); 66 } 67 68 69 70 73 public Panel getNodeFigure() { 74 return nodeFigure; 75 } 76 77 80 public void setNodeFigure(Panel panel) { 81 nodeFigure = panel; 82 } 83 84 85 86 87 88 91 public void setAfter(CFGFlowFigure figure) { 92 after = figure; 93 } 94 95 98 public void setBefore(CFGFlowFigure figure) { 99 before = figure; 100 } 101 102 105 public void setData(CFGNodeDataFigure figure) { 106 data = figure; 107 } 108 109 112 public CFGFlowFigure getAfter() { 113 return after; 114 } 115 116 119 public CFGFlowFigure getBefore() { 120 return before; 121 } 122 123 126 public CFGNodeDataFigure getData() { 127 return data; 128 } 129 130 133 public XYAnchor getSrcAnchor() { 134 int x = this.getBounds().x; 135 int y = this.getBounds().y; 136 int width = this.getBounds().width; 137 int height = this.getBounds().height; 138 org.eclipse.draw2d.geometry.Point p = new org.eclipse.draw2d.geometry.Point(x+width/2, y+height); 139 return new XYAnchor(p); 140 } 141 142 145 public XYAnchor getTgtAnchor() { 146 return tgtAnchor; 147 } 148 149 Image indicatorImage = null; 150 Label indicatorFigure = null; 151 152 153 public void addIndicator(){ 154 155 156 } 157 158 public void removeIndicator(){ 159 160 } 161 162 163 } 164 | Popular Tags |