* @return the created Figure
*/
private static IFigure createTooltipFigure(GraphConnection connection,
Relation relation, Element source, Element target, String weight) {
Figure tooltipFigure = new Figure();
ToolbarLayout layout = new ToolbarLayout();
tooltipFigure.setLayoutManager(layout);
tooltipFigure.setOpaque(true);
String relationType = "";
if (relation instanceof Impact){
relationType = "Impact";
} else if (relation instanceof Decomposition){
relationType = "Decomposition";
} else if (relation instanceof isA){
relationType = "IsA";
} else if (relation instanceof Offset){
relationType = "Offset";
} else {
relationType = "Relation";
}
String sourceName = source != null? source.getName() : "";
String targetName = target != null? target.getName() : "";;
String tooltipText = "";
//3 free spaces before and behind each line start and line end due to ascetic reasons (prevent text to border on tooltip bounds)
tooltipText += "\n";
tooltipText += " Source:\t"+ sourceName+" \n";
tooltipText += " Target:\t"+ targetName+" \n";
if (weight != ""){
tooltipText += " Weight:\t"+ weight+" \n";
}
Label titleLabel = new Label(" "+relationType+" ");
titleLabel.setFont(decoractionFontLarge);
tooltipFigure.add(titleLabel);
Label valuesLabel = new Label(tooltipText);
valuesLabel.setFont(decoractionFontNormal);
tooltipFigure.add(valuesLabel);
tooltipFigure.setSize(-1, -1);
return tooltipFigure;
}