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
|
Rev | Line | |
---|
[938] | 1 | package org.expeditee.items;
|
---|
| 2 |
|
---|
| 3 | import java.util.*;
|
---|
| 4 |
|
---|
[952] | 5 | import org.expeditee.settings.templates.TemplateSettings;
|
---|
| 6 |
|
---|
[938] | 7 | public 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);
|
---|
[952] | 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);
|
---|
[938] | 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.