source: trunk/src/org/expeditee/items/Tooltip.java@ 952

Last change on this file since 952 was 952, checked in by bln4, 9 years ago
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1package org.expeditee.items;
2
3import java.util.*;
4
5import org.expeditee.settings.templates.TemplateSettings;
6
7public class Tooltip {
8
9 private List<Text> tooltipItems = new LinkedList<Text>();
10
11 public Text addTooltip(String content) {
12 if(content.trim().toLowerCase().startsWith("text") && content.contains(":"))
13 content = content.substring(content.indexOf(':') + 1);
14// final Text tooltip = new Text(content);
15 final Text tooltip = TemplateSettings.TooltipTemplate.get().copy();
16 tooltip.setText(content);
17// return addTooltip((Text) tooltip.getParentOrCurrentFrame().getTooltipTextItem(content));
18 return addTooltip(tooltip);
19 }
20
21 public Text addTooltip(final Text tooltip) {
22 tooltipItems.add(tooltip);
23 return tooltip;
24 }
25
26 public List<Text> getTooltips() { return tooltipItems; }
27
28 public List<String> asStringList() {
29 final List<String> ret = new LinkedList<String>();
30 for(final Text tooltip: tooltipItems) ret.add(tooltip.getText());
31 return ret;
32 }
33
34 public int getWidth() {
35 int max = 0;
36 for(final Text tooltip: tooltipItems) if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsWidth();
37 return max;
38 }
39
40 public int getHeight() {
41 int max = 0;
42 for(final Text tooltip: tooltipItems) if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsHeight();
43 return max;
44 }
45
46 public int getCollectiveHeight() {
47 int height = 0;
48 for(final Text tooltip: tooltipItems) height += tooltip.getBoundsHeight();
49 return height;
50 }
51}
Note: See TracBrowser for help on using the repository browser.