Changeset 707


Ignore:
Timestamp:
01/16/14 15:31:50 (10 years ago)
Author:
jts21
Message:

Implement setting tooltip attributes

Location:
trunk/src/org/expeditee
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/AttributeUtils.java

    r676 r707  
    266266                                                            Item.class.getMethod("setY", pFloat));
    267267                        _Attrib.put("Tooltip",              Item.class.getMethod("getTooltip"),
    268                                                             Item.class.getMethod("setTooltip", pString));
     268                                                            Item.class.getMethod("setTooltips", pList));
    269269                       
    270270                        // Text Items
     
    285285                        _Attrib.alias("d",                  "data");
    286286                        _Attrib.alias("f",                  "formula");
     287                        _Attrib.alias("font",               "family");
    287288                        _Attrib.alias("s",                  "size");
    288289                        _Attrib.alias("l",                  "link");
     
    363364                                try {
    364365                                        String s = getValue(prop, a, toExtract, true);
    365 
    366366                                        if (s == null)
    367367                                                continue;
     
    573573                                        if (nextAvp.getAttribute().equals(avp.getAttribute())) {
    574574                                                // strip the attribute from next
    575                                                 avp.appendValue(nextAvp.getValue());
     575                                                avp.appendValue(nextAvp.getValue() + "\n");
    576576
    577577                                                // if the attribute is not the same, then it may be a
  • trunk/src/org/expeditee/gui/AttributeValuePair.java

    r376 r707  
    99
    1010        public static final char VALUE_SEPARATOR_CHAR = ' ';
     11       
     12        public static final char VALUE_DELIM_CHAR = '\n';
    1113
    1214        public static final String SEPARATOR_STRING = "" + SEPARATOR_CHAR
     
    165167                        _value = new SString(value.trim());
    166168                else
    167                         _value.parse(_value.stringValue() + VALUE_SEPARATOR_CHAR
     169                        _value.parse(_value.stringValue() + VALUE_DELIM_CHAR
    168170                                        + value.trim());
    169171        }
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r676 r707  
    6969                        _ItemTags.put("s", Item.class.getMethod("getDateCreated", param));
    7070                        _ItemTags.put("d", Item.class.getMethod("getColor", param));
    71                         _ItemTags.put("G", Item.class
    72                                         .getMethod("getBackgroundColor", param));
     71                        _ItemTags.put("G", Item.class.getMethod("getBackgroundColor", param));
    7372                        _ItemTags.put("K", Item.class.getMethod("getBorderColor", param));
    7473                        _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param));
     
    114113                        _ItemTags.put("a", Text.class.getMethod("getWordSpacing", param));
    115114                        _ItemTags.put("b", Text.class.getMethod("getLetterSpacing", param));
    116                         _ItemTags
    117                                         .put("m", Text.class.getMethod("getInitialSpacing", param));
     115                        _ItemTags.put("m", Text.class.getMethod("getInitialSpacing", param));
    118116                        _ItemTags.put("w", Text.class.getMethod("getWidthToSave", param));
    119117                        _ItemTags.put("k", Text.class.getMethod("getJustification", param));
  • trunk/src/org/expeditee/items/Item.java

    r676 r707  
    1616import java.awt.geom.Rectangle2D;
    1717import java.util.ArrayList;
     18import java.util.Arrays;
    1819import java.util.Collection;
    1920import java.util.ConcurrentModificationException;
     
    2829import org.expeditee.actions.Misc;
    2930import org.expeditee.actions.Simple;
     31import org.expeditee.gui.AttributeUtils;
    3032import org.expeditee.gui.AttributeValuePair;
    3133import org.expeditee.gui.DisplayIO;
     
    158160        protected boolean _filled = true;
    159161       
    160         private String _tooltip = null;
     162        private List<String> _tooltip = null;
    161163        private static Text _tooltipItem = null;
    162164        private static Item _tooltipOwner = null;
     
    178180                dest.setBorderColor(source.getBorderColor());
    179181
    180                 dest.setTooltip(source.getTooltip());
     182                dest.setTooltips(source.getTooltip());
    181183                dest.setData(source.getData());
    182184                dest.setTag(source.getTag());
     
    11301132        public abstract void paint(Graphics2D g);
    11311133       
     1134        public void setTooltips(List<String> tooltips) {
     1135                if (tooltips == null || tooltips.size() == 0) {
     1136                        _tooltip = null;
     1137                } else {
     1138                        _tooltip = new LinkedList<String>(tooltips);
     1139                }
     1140        }
     1141       
    11321142        public void setTooltip(String tooltip) {
    1133                 _tooltip = tooltip;
     1143                if(_tooltip == null || _tooltip.size() == 0) {
     1144                        _tooltip = new LinkedList<String>();
     1145                }
     1146                if(tooltip != null && tooltip.trim().length() > 0) {
     1147                        _tooltip.add(tooltip);
     1148                }
    11341149        }
    11351150       
    1136         public String getTooltip() {
     1151        public List<String> getTooltip() {
    11371152                return _tooltip;
    11381153        }
     
    11491164                // generate tooltip item
    11501165                if(_tooltipItem == null) {
    1151                         String tooltip = getTooltip();
    1152                         if(tooltip != null && tooltip.trim().length() != 0) {
    1153                                 _tooltipItem = (Text) getParentOrCurrentFrame().getTooltipTextItem(tooltip);
    1154                                 _tooltipItem.setWidth(300);
     1166                        if(_tooltip != null && _tooltip.size() > 0) {
     1167                                StringBuffer tooltip = new StringBuffer();
     1168                                for(String t : _tooltip) {
     1169                                        tooltip.append(t).append("\n");
     1170                                }
     1171                                if(tooltip.length() > 0) {
     1172                                        tooltip.deleteCharAt(tooltip.length() - 1);
     1173                                }
     1174                                _tooltipItem = (Text) getParentOrCurrentFrame().getTooltipTextItem("");
     1175                                for(String s : _tooltip) {
     1176                                        // set text
     1177                                        if(s.trim().toLowerCase().startsWith("text") && s.contains(":")) {
     1178                                                _tooltipItem.appendLine(s.substring(s.indexOf(':') + 1).trim());
     1179                                        } else {
     1180                                                AttributeUtils.setAttribute(_tooltipItem, new Text(s));
     1181                                        }
     1182                                }
    11551183                        } else {
    11561184                                return;
  • trunk/src/org/expeditee/items/XRayable.java

    r697 r707  
    115115       
    116116        @Override
     117        public void setTooltips(List<String> tooltips) {
     118                _source.setTooltips(tooltips);
     119        }
     120       
     121        @Override
    117122        public void setTooltip(String tooltip) {
    118123                _source.setTooltip(tooltip);
     
    120125       
    121126        @Override
    122         public String getTooltip() {
     127        public List<String> getTooltip() {
    123128                return _source.getTooltip();
    124129        }
Note: See TracChangeset for help on using the changeset viewer.