Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Tooltip.java

    r977 r1102  
    99import org.expeditee.settings.templates.TemplateSettings;
    1010
     11/**
     12 * TODO: Comment. cts16
     13 *
     14 * @author cts16
     15 */
    1116public class Tooltip {
     17
     18        /** TODO: Comment. cts16 */
     19        private Map<Text, Item> _tooltipItems = new HashMap<Text, Item>();
    1220       
    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(":")) {
    1930                        content = content.substring(content.indexOf(':') + 1);
     31                }
    2032                final Text tooltip = TemplateSettings.TooltipTemplate.get().copy();
     33                tooltip.setWidth(Integer.MAX_VALUE); // Tooltip shouldn't be width-limited
    2134                tooltip.setText(content);
    2235                return addTooltip(tooltip, toItem);
    2336        }
    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);
    2742                return tooltip;
    2843        }
    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        {
    3354                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());
    3556                return ret;
    3657        }
    37        
    38         public int getWidth() {
     58
     59        /** TODO: Comment. cts16 */
     60        public int getWidth()
     61        {
    3962                int max = 0;
    40                 for(final Text tooltip: tooltipItems.keySet())
     63                for(final Text tooltip: _tooltipItems.keySet()) {
    4164                        if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsWidth();
     65                }
    4266                return max;
    4367        }
    4468
    45         public int getHeight() {
     69        /** TODO: Comment. cts16 */
     70        public int getHeight()
     71        {
    4672                int max = 0;
    47                 for(final Text tooltip: tooltipItems.keySet())
     73                for(final Text tooltip: _tooltipItems.keySet()) {
    4874                        if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsHeight();
     75                }
    4976                return max;
    5077        }
    51        
    52         public int getCollectiveHeight() {
     78
     79        /** TODO: Comment. cts16 */
     80        public int getCollectiveHeight()
     81        {
    5382                int height = 0;
    54                 for(final Text tooltip: tooltipItems.keySet()) height += tooltip.getBoundsHeight();
     83                for(final Text tooltip: _tooltipItems.keySet()) height += tooltip.getBoundsHeight();
    5584                return height;
    5685        }
Note: See TracChangeset for help on using the changeset viewer.