Changeset 707 for trunk/src/org/expeditee/items
- Timestamp:
- 01/16/14 15:31:50 (10 years ago)
- Location:
- trunk/src/org/expeditee/items
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Item.java
r676 r707 16 16 import java.awt.geom.Rectangle2D; 17 17 import java.util.ArrayList; 18 import java.util.Arrays; 18 19 import java.util.Collection; 19 20 import java.util.ConcurrentModificationException; … … 28 29 import org.expeditee.actions.Misc; 29 30 import org.expeditee.actions.Simple; 31 import org.expeditee.gui.AttributeUtils; 30 32 import org.expeditee.gui.AttributeValuePair; 31 33 import org.expeditee.gui.DisplayIO; … … 158 160 protected boolean _filled = true; 159 161 160 private String_tooltip = null;162 private List<String> _tooltip = null; 161 163 private static Text _tooltipItem = null; 162 164 private static Item _tooltipOwner = null; … … 178 180 dest.setBorderColor(source.getBorderColor()); 179 181 180 dest.setTooltip (source.getTooltip());182 dest.setTooltips(source.getTooltip()); 181 183 dest.setData(source.getData()); 182 184 dest.setTag(source.getTag()); … … 1130 1132 public abstract void paint(Graphics2D g); 1131 1133 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 1132 1142 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 } 1134 1149 } 1135 1150 1136 public StringgetTooltip() {1151 public List<String> getTooltip() { 1137 1152 return _tooltip; 1138 1153 } … … 1149 1164 // generate tooltip item 1150 1165 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 } 1155 1183 } else { 1156 1184 return; -
trunk/src/org/expeditee/items/XRayable.java
r697 r707 115 115 116 116 @Override 117 public void setTooltips(List<String> tooltips) { 118 _source.setTooltips(tooltips); 119 } 120 121 @Override 117 122 public void setTooltip(String tooltip) { 118 123 _source.setTooltip(tooltip); … … 120 125 121 126 @Override 122 public StringgetTooltip() {127 public List<String> getTooltip() { 123 128 return _source.getTooltip(); 124 129 }
Note:
See TracChangeset
for help on using the changeset viewer.