Changeset 940
- Timestamp:
- 12/09/14 14:54:14 (9 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameCreator.java
r919 r940 20 20 21 21 import java.awt.Color; 22 import java.util.*; 22 23 23 24 import org.expeditee.agents.ExistingFramesetException; 24 25 import org.expeditee.items.Item; 25 import org.expeditee.items.PermissionPair;26 26 import org.expeditee.items.Text; 27 import org.expeditee.items.UserAppliedPermission;28 27 29 28 public class FrameCreator { … … 57 56 58 57 private boolean _multiColumn; 58 59 private final List<Frame> framesCreated = new LinkedList<Frame>(); 59 60 60 61 public FrameCreator(String frameTitle) { … … 124 125 if (toUse == null) { 125 126 toUse = FrameIO.CreateFrame(name, frameTitle, null); 127 this.framesCreated.add(toUse); 126 128 } 127 129 … … 149 151 _current.getTitle(), null); 150 152 153 this.framesCreated.add(newFrame); 154 151 155 // add link to previous frame 152 156 // _prev = … … 168 172 return false; 169 173 } 174 } 175 176 public List<Frame> getFramesCreated() { 177 return this.framesCreated; 170 178 } 171 179 -
trunk/src/org/expeditee/gui/FrameGraphics.java
r919 r940 541 541 if(current != null) { 542 542 current.paintTooltip(bg); 543 } else { 544 Item.clearTooltipOwner(); 545 } 543 } //else { 544 // Item.clearTooltipOwner(); 545 // } 546 if(previous != null) previous.clearTooltips(); 547 previous = current; 546 548 } 547 549 … … 550 552 PaintNonLinesNonPicture(bg, FreeItems.getCursor()); 551 553 } 554 555 private static Item previous = null; 552 556 553 557 // creates a new line so that lines are shown correctly when spanning -
trunk/src/org/expeditee/items/Item.java
r919 r940 46 46 import org.expeditee.actions.Misc; 47 47 import org.expeditee.actions.Simple; 48 import org.expeditee.gui.AttributeUtils;49 48 import org.expeditee.gui.AttributeValuePair; 50 49 import org.expeditee.gui.DisplayIO; … … 164 163 protected boolean _filled = true; 165 164 166 private List<String> _tooltip = null; 167 private static Text _tooltipItem = null; 168 private static Item _tooltipOwner = null; 165 private Tooltip _tooltip = new Tooltip(); 169 166 170 167 public enum AnchorEdgeType { … … 1158 1155 public abstract void paint(Graphics2D g); 1159 1156 1160 public void setTooltips(List<String> tooltips) { 1161 if (tooltips == null || tooltips.size() == 0) { 1162 _tooltip = null; 1163 } else { 1164 _tooltip = new LinkedList<String>(tooltips); 1165 } 1166 } 1167 1168 public void setTooltip(String tooltip) { 1169 if(_tooltip == null || _tooltip.size() == 0) { 1170 _tooltip = new LinkedList<String>(); 1171 } 1157 public void setTooltips(final List<String> tooltips) { 1158 if(tooltips == null || tooltips.size() == 0) _tooltip = new Tooltip(); 1159 else for(final String content: tooltips) _tooltip.addTooltip(content); 1160 } 1161 1162 public void setTooltip(final String tooltip) { 1172 1163 if(tooltip != null && tooltip.trim().length() > 0) { 1173 _tooltip.add (tooltip);1164 _tooltip.addTooltip(tooltip); 1174 1165 } 1175 1166 } 1176 1167 1177 1168 public List<String> getTooltip() { 1178 return _tooltip; 1179 } 1180 1181 public static void clearTooltipOwner() { 1182 _tooltipOwner = null; 1183 } 1184 1185 public void paintTooltip(Graphics2D g) { 1186 if(_tooltipOwner != this) { 1187 _tooltipItem = null; 1188 _tooltipOwner = this; 1189 } 1190 // generate tooltip item 1191 if(_tooltipItem == null) { 1192 if(_tooltip != null && _tooltip.size() > 0) { 1193 StringBuffer tooltip = new StringBuffer(); 1194 for(String t : _tooltip) { 1195 tooltip.append(t).append("\n"); 1196 } 1197 if(tooltip.length() > 0) { 1198 tooltip.deleteCharAt(tooltip.length() - 1); 1199 } 1200 _tooltipItem = (Text) getParentOrCurrentFrame().getTooltipTextItem(""); 1201 for(String s : _tooltip) { 1202 // set text 1203 if(s.trim().toLowerCase().startsWith("text") && s.contains(":")) { 1204 _tooltipItem.appendLine(s.substring(s.indexOf(':') + 1).trim()); 1205 } else { 1206 AttributeUtils.setAttribute(_tooltipItem, new Text(s)); 1207 } 1208 } 1209 } else { 1210 return; 1211 } 1212 } 1213 Rectangle bounds = getPolygon().getBounds(); 1214 _tooltipItem.invalidateAll(); 1169 return _tooltip.asStringList(); 1170 } 1171 1172 public List<Text> getTooltipItems() { 1173 return _tooltip.getTooltips(); 1174 } 1175 1176 public void clearTooltips() { 1177 final Frame frame = this.getParent(); 1178 for(final Text tooltip: _tooltip.getTooltips()) frame.removeItem(tooltip); 1179 } 1180 1181 public void paintTooltip(final Graphics2D g) { 1182 final Rectangle bounds = this.getPolygon().getBounds(); 1215 1183 int x = bounds.x + bounds.width; 1216 if(x + _tooltipItem.getPolygon().getBounds().width > FrameGraphics.getMaxFrameSize().width) { 1217 x -= x + _tooltipItem.getPolygon().getBounds().width - FrameGraphics.getMaxFrameSize().width; 1218 } 1219 int y = bounds.y + bounds.height + bounds.height / 2; 1220 if(y + _tooltipItem.getPolygon().getBounds().height > FrameGraphics.getMaxFrameSize().height) { 1221 y = bounds.y + bounds.height / 2 - _tooltipItem.getPolygon().getBounds().height; 1222 } 1223 _tooltipItem.setPosition(x, y); 1224 _tooltipItem.paint(g); 1184 if(x + _tooltip.getWidth() > FrameGraphics.getMaxFrameSize().width) { 1185 x -= x + _tooltip.getWidth() - FrameGraphics.getMaxFrameSize().width; 1186 } 1187 int y = bounds.y + bounds.height; 1188 if(y + _tooltip.getCollectiveHeight() > FrameGraphics.getMaxFrameSize().height) { 1189 y = bounds.y + bounds.height / 2 - _tooltip.getCollectiveHeight(); 1190 } 1191 for(final Text tooltip : _tooltip.getTooltips()) { 1192 this.getParent().addItem(tooltip); 1193 tooltip.setPosition(x, y); 1194 tooltip.paint(g); 1195 y += tooltip.getHeight(); 1196 } 1225 1197 } 1226 1198
Note:
See TracChangeset
for help on using the changeset viewer.