Changeset 1102 for trunk/src/org/expeditee/items/Tooltip.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Tooltip.java
r977 r1102 9 9 import org.expeditee.settings.templates.TemplateSettings; 10 10 11 /** 12 * TODO: Comment. cts16 13 * 14 * @author cts16 15 */ 11 16 public class Tooltip { 17 18 /** TODO: Comment. cts16 */ 19 private Map<Text, Item> _tooltipItems = new HashMap<Text, Item>(); 12 20 13 Tooltip() { } 14 15 private Map<Text, Item> tooltipItems = new HashMap<Text, Item>(); 16 17 public Text addTooltip(String content, final Item toItem) { 18 if(content.trim().toLowerCase().startsWith("text") && content.contains(":")) 21 /** TODO: Comment. cts16 */ 22 Tooltip() 23 { 24 } 25 26 /** TODO: Comment. cts16 */ 27 public Text addTooltip(String content, final Item toItem) 28 { 29 if(content.trim().toLowerCase().startsWith("text") && content.contains(":")) { 19 30 content = content.substring(content.indexOf(':') + 1); 31 } 20 32 final Text tooltip = TemplateSettings.TooltipTemplate.get().copy(); 33 tooltip.setWidth(Integer.MAX_VALUE); // Tooltip shouldn't be width-limited 21 34 tooltip.setText(content); 22 35 return addTooltip(tooltip, toItem); 23 36 } 24 25 public Text addTooltip(final Text tooltip, final Item toItem) { 26 tooltipItems.put(tooltip, toItem); 37 38 /** TODO: Comment. cts16 */ 39 public Text addTooltip(final Text tooltip, final Item toItem) 40 { 41 _tooltipItems.put(tooltip, toItem); 27 42 return tooltip; 28 43 } 29 30 public Collection<Text> getTooltips() { return tooltipItems.keySet(); } 31 32 public List<String> asStringList() { 44 45 /** TODO: Comment. cts16 */ 46 public Collection<Text> getTooltips() 47 { 48 return _tooltipItems.keySet(); 49 } 50 51 /** TODO: Comment. cts16 */ 52 public List<String> asStringList() 53 { 33 54 final List<String> ret = new LinkedList<String>(); 34 for(final Text tooltip: tooltipItems.keySet()) ret.add(tooltip.getText());55 for(final Text tooltip: _tooltipItems.keySet()) ret.add(tooltip.getText()); 35 56 return ret; 36 57 } 37 38 public int getWidth() { 58 59 /** TODO: Comment. cts16 */ 60 public int getWidth() 61 { 39 62 int max = 0; 40 for(final Text tooltip: tooltipItems.keySet())63 for(final Text tooltip: _tooltipItems.keySet()) { 41 64 if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsWidth(); 65 } 42 66 return max; 43 67 } 44 68 45 public int getHeight() { 69 /** TODO: Comment. cts16 */ 70 public int getHeight() 71 { 46 72 int max = 0; 47 for(final Text tooltip: tooltipItems.keySet())73 for(final Text tooltip: _tooltipItems.keySet()) { 48 74 if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsHeight(); 75 } 49 76 return max; 50 77 } 51 52 public int getCollectiveHeight() { 78 79 /** TODO: Comment. cts16 */ 80 public int getCollectiveHeight() 81 { 53 82 int height = 0; 54 for(final Text tooltip: tooltipItems.keySet()) height += tooltip.getBoundsHeight();83 for(final Text tooltip: _tooltipItems.keySet()) height += tooltip.getBoundsHeight(); 55 84 return height; 56 85 }
Note:
See TracChangeset
for help on using the changeset viewer.