- Timestamp:
- 11/28/18 16:16:29 (6 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/AttributeUtils.java
r1188 r1200 283 283 _Attrib.put("Width", Item.class.getMethod("getWidthToSave"), 284 284 Item.class.getMethod("setWidth", pIntO)); 285 _Attrib.put("MinWidth", Item.class.getMethod("getMinWidthToSave"), 286 Item.class.getMethod("setMinWidth", pIntO)); 285 287 _Attrib.put("X", null, 286 288 Item.class.getMethod("setX", pFloat)); … … 307 309 _Attrib.put("LetterSpacing", Text.class.getMethod("getLetterSpacing"), 308 310 Text.class.getMethod("setLetterSpacing", pFloat)); 311 _Attrib.put("Mask", Text.class.getMethod("getMask"), 312 Text.class.getMethod("setMask", pIntO)); 309 313 310 314 // Aliases for attribute setting … … 340 344 _Attrib.alias("j", "justification"); 341 345 _Attrib.alias("w", "width"); 346 _Attrib.alias("mw", "minwidth"); 342 347 _Attrib.alias("as", "autostamp"); 343 344 345 348 } catch (SecurityException e) { 346 349 // TODO Auto-generated catch block -
trunk/src/org/expeditee/gui/Frame.java
r1193 r1200 126 126 private Stack<History> _redo = new Stack<History>(); 127 127 128 // basically just a list of smaller objects?129 // maybe a hashtable (id -> item?)130 // Note: Needs to be able to be iterated through (for painting)131 128 private List<Item> _body = new ArrayList<Item>(); 129 private List<Item> _bodyHiddenDueToPermissions = new ArrayList<Item>(); 132 130 133 131 // for drawing purposes … … 964 962 } 965 963 966 public void removeItem(Item item) 967 { 964 public void removeItem(Item item) { 968 965 removeItem(item, true); 969 966 } … … 2607 2604 return _observers != null && _observers.size() > 0; 2608 2605 } 2606 2607 public List<Item> getBodyItemsWithInsufficientPermissions() { 2608 return _bodyHiddenDueToPermissions; 2609 } 2610 2611 public void moveItemToBodyHiddenDueToPermission(final Item i) { 2612 _body.remove(i); 2613 _bodyHiddenDueToPermissions.add(i); 2614 } 2609 2615 2610 2616 public Collection<? extends Item> getInteractableItems() -
trunk/src/org/expeditee/gui/FrameIO.java
r1188 r1200 40 40 import org.expeditee.actions.Actions; 41 41 import org.expeditee.agents.ExistingFramesetException; 42 import org.expeditee.auth.io.EncryptedExpReader; 43 import org.expeditee.auth.io.EncryptedExpWriter; 42 44 import org.expeditee.io.Conversion; 43 45 import org.expeditee.io.ExpReader; … … 465 467 466 468 if (fullPath.endsWith(ExpReader.EXTENTION)) { 467 reader = new ExpReader(frameName); 469 if (EncryptedExpReader.isEncryptedExpediteeFile(fullPath)) { 470 reader = new EncryptedExpReader(frameName); 471 } else { 472 reader = new ExpReader(frameName); 473 } 468 474 } else { 469 475 reader = new KMSReader(); … … 952 958 /* Dont save the frame if it has the noSave tag */ 953 959 if (toSave.hasAnnotation("nosave")) { 954 Actions. PerformActionCatchErrors(toSave, null, "Restore");960 Actions.LegacyPerformActionCatchErrors(toSave, null, "Restore"); 955 961 return ""; 956 962 } … … 964 970 /* Format the frame if it has the autoFormat tag */ 965 971 if (toSave.hasAnnotation("autoformat")) { 966 Actions. PerformActionCatchErrors(toSave, null, "Format");972 Actions.LegacyPerformActionCatchErrors(toSave, null, "Format"); 967 973 } 968 974 … … 988 994 // if its a new frame or an existing Exp frame... 989 995 if (fullPath == null || fullPath.endsWith(ExpReader.EXTENTION)) { 990 writer = new ExpWriter(); 996 //writer = new ExpWriter(); 997 writer = new ExpWriter();//new EncryptedExpWriter(); 991 998 savedVersion = ExpReader.getVersion(fullPath); 992 999 } else { … … 1198 1205 public static Frame LoadProfile(String userName) 1199 1206 { 1200 return LoadFrame(userName + "1"); 1207 final String profilesLoc = System.getProperty("profiles.loc"); 1208 if (profilesLoc != null) { 1209 return LoadFrame(userName + "1", profilesLoc); 1210 } else { 1211 return LoadFrame(userName + "1"); 1212 } 1201 1213 } 1202 1214 -
trunk/src/org/expeditee/gui/FrameUtils.java
r1193 r1200 1288 1288 } 1289 1289 } 1290 1291 if (i.getData() != null && !i.getData().isEmpty() && i.getText().isEmpty()) { 1292 System.err.println(); 1293 } 1290 1294 1291 1295 if (i.contains(new Point(x, y))){ … … 1867 1871 } 1868 1872 } 1869 if (lastEdited != LastEdited && LastEdited.getText().length() == 0 ) {1873 if (lastEdited != LastEdited && LastEdited.getText().length() == 0 && LastEdited.getMinWidth() == null) { 1870 1874 parent.removeItem(LastEdited); 1871 1875 } -
trunk/src/org/expeditee/io/DefaultFrameReader.java
r1102 r1200 96 96 pColor)); 97 97 98 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. 98 99 _ItemTags.put('S', Item.class.getMethod("setID", pInt)); 99 100 _ItemTags.put('s', Item.class.getMethod("setDateCreated", pString)); … … 150 151 _ItemTags.put('m', Text.class.getMethod("setInitialSpacing", pFloat)); 151 152 _ItemTags.put('w', Text.class.getMethod("setWidth", pIntO)); 153 _ItemTags.put('M', Text.class.getMethod("setMinWidth", pIntO)); 152 154 _ItemTags.put('k', Text.class.getMethod("setJustification", pJustification)); 153 155 _ItemTags.put('r', Text.class.getMethod("setAutoWrap", pBool)); … … 161 163 162 164 _ItemTags.put('p', Item.class.getMethod("setPermission", pPermission)); 165 166 _ItemTags.put('O', Text.class.getMethod("setMask", pIntO)); 163 167 164 168 // Lines and constraints are created differently -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r1102 r1200 33 33 import org.expeditee.agents.WriteTree; 34 34 import org.expeditee.gio.EcosystemManager; 35 import org.expeditee.gui.Browser;36 35 import org.expeditee.gui.Frame; 37 36 import org.expeditee.gui.FrameIO; … … 80 79 _FrameTags.put('B', Frame.class.getMethod("getBackgroundColor")); 81 80 81 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. 82 82 _ItemTags.put('S', Item.class.getMethod("getTypeAndID")); 83 83 _ItemTags.put('s', Item.class.getMethod("getDateCreated")); … … 120 120 _ItemTags.put('f', Text.class.getMethod("getFont")); 121 121 _ItemTags.put('t', Text.class.getMethod("getSpacing")); 122 123 _ItemTags.put('O', Text.class.getMethod("getMask")); 122 124 123 125 // TODO set a boolean flag to indicate that the text is a formula … … 129 131 _ItemTags.put('m', Text.class.getMethod("getInitialSpacing")); 130 132 _ItemTags.put('w', Text.class.getMethod("getWidthToSave")); 133 _ItemTags.put('M', Text.class.getMethod("getMinWidthToSave")); 131 134 _ItemTags.put('k', Text.class.getMethod("getJustification")); 132 135 _ItemTags.put('r', Text.class.getMethod("getAutoWrapToSave")); -
trunk/src/org/expeditee/io/ExpReader.java
r1189 r1200 68 68 */ 69 69 protected static boolean isValidLine(String s) { 70 return s.length() >= 2 && s.charAt(1) == ' ' 71 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '[' || s.charAt(0) == ']' || s.charAt(0) == '^' || s.charAt(0) == '_'); 70 // Previously lines in a .exp file had to start with a letter (A-Z, a-z). This allowed for an efficient check for valid lines. 71 // As we started to run out of spare letters to use for properties, we wished to use the full range of characters. But we did not 72 // wish to loose the efficiency of the Character.isLetter check. In order to maintain as much of this efficiency as possible, but 73 // allow for all characters, we take advantage of how || is evaluated: 74 // if the check for Character.isLetter passes, then the more complex map lookup operation does not take place. 75 return s.length() >= 2 && (Character.isLetter(s.charAt(0)) || _ItemTags.keySet().contains(s.charAt(0))); 72 76 } 73 77 … … 117 121 break; 118 122 } 119 _linePoints.put(currentItem.getID(), currentItem); 123 _linePoints.put(currentItem.getID(), currentItem); 120 124 newFrame.addItem(currentItem); 121 125 } else if (currentItem != null && actionShouldBeDelayed(getTag(next))) { … … 123 127 } else if (currentItem != null) { 124 128 processBodyLine(currentItem, next); 129 // final boolean hasSpecifiedPermission = currentItem.getPermission() != null; 130 // final boolean hasSpecifiedOwner = currentItem.getOwner() != null; 131 // if (hasSpecifiedPermission && hasSpecifiedOwner && currentItem.getPermission().getPermission(currentItem.getOwner()) == UserAppliedPermission.denied) { 132 // newFrame.removeItem(currentItem); 133 // newFrame.addItemHidden(currentItem); 134 // continue; 135 // } 125 136 } else { 126 137 System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to."); … … 236 247 Character tag = getTag(line); 237 248 String value = getValue(line); 238 249 239 250 Method toRun = _ItemTags.get(tag); 251 240 252 if (toRun == null) { 241 253 System.out.println("Error accessing tag method: " + tag); 242 254 } 255 243 256 Object[] vals = Conversion.Convert(toRun, value); 244 245 257 try { 246 258 if (vals != null) { … … 322 334 String value = getValue(next); 323 335 if (tag.equals('V')) { 336 reader.close(); 324 337 return Integer.parseInt(value); 325 338 } 326 339 } 327 340 } 341 reader.close(); 328 342 } catch (Exception e) { 329 343 } -
trunk/src/org/expeditee/io/ExpWriter.java
r919 r1200 47 47 public class ExpWriter extends DefaultFrameWriter { 48 48 49 pr ivateProxyWriter _writer = null;49 protected ProxyWriter _writer = null; 50 50 51 51 protected StringBuilder _stringWriter = null; … … 104 104 if (_writer == null) 105 105 return; 106 107 preOutputFrame(); 106 108 107 109 writeHeader(frame); … … 109 111 // write each item in the frame 110 112 for (Item i : frame.getItemsToSave()) { 113 assert (!(i instanceof Line)); 114 writeItem(i); 115 } 116 117 for (final Item i: frame.getBodyItemsWithInsufficientPermissions()) { 111 118 assert (!(i instanceof Line)); 112 119 writeItem(i); … … 122 129 123 130 return; 131 } 132 133 protected void preOutputFrame() { 124 134 } 125 135 -
trunk/src/org/expeditee/items/Item.java
r1190 r1200 50 50 import org.expeditee.gui.DisplayController; 51 51 import org.expeditee.gui.Frame; 52 import org.expeditee.gui.FrameGraphics;53 52 import org.expeditee.gui.FrameIO; 54 53 import org.expeditee.gui.FrameUtils; … … 59 58 import org.expeditee.io.Conversion; 60 59 import org.expeditee.settings.UserSettings; 60 import org.expeditee.settings.legacy.LegacyFeatures; 61 61 import org.expeditee.simple.Context; 62 62 import org.expeditee.stats.AgentStats; … … 275 275 276 276 private List<String> _data = null; 277 277 278 278 private String _formula = null; 279 279 … … 309 309 310 310 protected boolean _filled = true; 311 312 // NGIKM Attributes 313 private List<String> _ngikmLabels = new ArrayList<String>(); 314 private List<String> _ngikmKeys = new ArrayList<String>(); 311 315 312 316 /** Just calls source.duplicateOnto(dest). */ … … 380 384 381 385 dest._visible = this._visible; 386 387 dest._ngikmKeys = new ArrayList<String>(this._ngikmKeys); 388 dest._ngikmLabels = new ArrayList<String>(this._ngikmLabels); 382 389 383 390 Frame parent = DisplayController.getCurrentFrame(); … … 494 501 { 495 502 _permissionPair = permissionPair; 503 if (_permissionPair.getPermission(_owner) == UserAppliedPermission.denied) { 504 this.getParent().moveItemToBodyHiddenDueToPermission(this); 505 } 496 506 } 497 507 … … 1155 1165 return getWidth(); 1156 1166 } 1167 1168 public Integer getMinWidthToSave() { 1169 return getMinWidth(); 1170 } 1157 1171 1158 1172 public Integer getWidth() 1159 1173 { 1174 return null; 1175 } 1176 1177 public Integer getMinWidth() { 1160 1178 return null; 1161 1179 } … … 1458 1476 1459 1477 for (String s : getAction()) { 1460 Object returnValue = Actions.PerformActionCatchErrors(sourceFrame, 1461 sourceItem, s); 1478 Object returnValue; 1479 if (LegacyFeatures.UseLegacyActionArgumentMapping.get()) { 1480 returnValue = Actions.LegacyPerformActionCatchErrors(sourceFrame, sourceItem, s); 1481 } else { 1482 returnValue = Actions.PerformActionCatchErrors(sourceFrame, sourceItem, s, this); 1483 } 1484 1462 1485 if (returnValue != null) { 1463 1486 FreeItems.getInstance().clear(); … … 2254 2277 throw new UnsupportedOperationException("Item type does not support width attribute!"); 2255 2278 } 2279 2280 public void setMinWidth(final Integer width) throws UnsupportedOperationException { 2281 throw new UnsupportedOperationException("Item type does not support minwidth attribute."); 2282 } 2256 2283 2257 2284 public void setRightMargin(int i, boolean fixWidth) … … 2283 2310 */ 2284 2311 public void setY(float newY) { 2312 if (newY == 265) { 2313 System.err.println("Item::setY::setting y to 265"); 2314 } 2285 2315 setPosition(getX(), newY); 2286 2316 } -
trunk/src/org/expeditee/items/PermissionPair.java
r1193 r1200 35 35 if (permissionCode.length() != 0) { 36 36 37 if (permissionCode.length() == 1 ) {37 if (permissionCode.length() == 1 || (permissionCode.length() == 2 && permissionCode.startsWith("-"))) { 38 38 // replicate it to cover ifOwner/ifNotOwner 39 39 permissionCode += permissionCode; … … 50 50 ownerPermission = UserAppliedPermission.getPermission(ownerPermissionCode, defaultPermission); 51 51 notOwnerPermission = UserAppliedPermission.getPermission(notOwnerPermissionCode, defaultPermission); 52 //ownerPermission = UserAppliedPermission.getPermission(permissionCode.substring(0, 1),53 // defaultPermission);54 //notOwnerPermission = UserAppliedPermission.getPermission(permissionCode.substring(1, 2),55 // defaultPermission);56 52 } 57 53 } -
trunk/src/org/expeditee/items/Text.java
r1190 r1200 136 136 */ 137 137 private Integer _maxWidth = -Integer.MAX_VALUE; 138 139 private Integer _minWidth = -Integer.MAX_VALUE; 138 140 139 141 private Justification _justification = Justification.left; … … 172 174 173 175 // text is broken up into lines 174 pr ivateStringBuffer _text = new StringBuffer();175 176 pr ivateList<TextLayout> _textLayouts = new LinkedList<TextLayout>();176 protected StringBuffer _text = new StringBuffer(); 177 178 protected List<TextLayout> _textLayouts = new LinkedList<TextLayout>(); 177 179 178 180 // The font to display this text in 179 181 private Font _font; 182 183 // The optional mask character to us in place of the text's content. 184 private Integer _mask = null; 180 185 181 186 protected static void InitFontFamily(File fontFamilyDir) … … 373 378 374 379 /** 375 <<<<<<< .mine376 * Sets the maximum width of this Text item when justification is used.377 * passing in 0 or -1 means there is no maximum width378 ||||||| .r1094379 * Sets the maximum width of this Text item when justifcation is used.380 * passing in 0 or -1 means there is no maximum width381 =======382 * Sets the maximum width of this Text item when justifcation is used. passing383 * in 0 or -1 means there is no maximum width384 >>>>>>> .r1100385 *386 380 * @param width 387 381 * The maximum width of this item when justification is applied to … … 399 393 400 394 _maxWidth = width; 395 rebuild(true); 396 invalidateAll(); 397 } 398 399 @Override 400 public void setMinWidth(final Integer width) { 401 invalidateAll(); 402 403 if (width == null) { 404 setJustification(Justification.left); 405 setRightMargin(DisplayController.getFramePaintArea().getWidth(), false); 406 return; 407 } 408 409 _minWidth = width; 401 410 rebuild(true); 402 411 invalidateAll(); … … 433 442 434 443 return Math.abs(_maxWidth); 444 } 445 446 public Integer getMinWidth() { 447 if (_minWidth == null || _minWidth <= 0) { 448 return null; 449 } 450 return _minWidth; 451 } 452 453 public Integer getAbsoluteMinWidth() { 454 if (_minWidth == null) { 455 return Integer.MAX_VALUE; 456 } 457 return Math.abs(_minWidth); 435 458 } 436 459 … … 1035 1058 lineIndex = newLine; 1036 1059 } 1037 1038 // move the cursor to the new location1039 float[] caret = current.getCaretInfo(hit);1040 float y = getLineDrop(current) * lineIndex;1041 y = getY() + y + caret[1];1042 1043 float x = getX() + caret[0] + getJustOffset(current);1044 x = Math.min(x, (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));1045 1046 invalidateAll();1047 1060 1048 // System.err.println("Mouse location: " + mouseX + "," + mouseY); 1049 // System.err.println("Caret location: " + caret[0] + "," + caret[1]); 1050 1051 // System.err.println(text); 1052 // System.err.println("X delta: " + (x - getX())); 1053 final Point newCursor = new Point(Math.round(x), Math.round(y)); 1054 // System.err.println("Moving cursor to: " + newCursor); 1055 return newCursor; 1061 if (this.getMask() != null) { 1062 // If we are working with a mask than the positioning of the mouse is simplified. (as character length is constant) 1063 String content = ""; 1064 for (int i = 0; i < this._text.length(); i++) { 1065 content += (char) this.getMask().intValue(); 1066 } 1067 final TextLayout fakeLayout = TextLayout.getManager().layoutStringSimple(content, this.getFont()); 1068 //final TextHitInfo fakeHitInfo = fakeLayout.getNextRightHit(hit.getCharIndex()); 1069 final float[] fakeCaretInfo = fakeLayout.getCaretInfo(hit); 1070 1071 float y = getLineDrop(current) * lineIndex; 1072 y = getY() + y + fakeCaretInfo[1]; 1073 float x = getX() + fakeCaretInfo[0] + getJustOffset(current); 1074 x = Math.min(x, (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 1075 1076 return new Point(Math.round(x), Math.round(y)); 1077 } else { 1078 // If we have no mask then.... 1079 // move the cursor to the new location 1080 float[] caret = current.getCaretInfo(hit); 1081 float y = getLineDrop(current) * lineIndex; 1082 y = getY() + y + caret[1]; 1083 1084 float x = getX() + caret[0] + getJustOffset(current); 1085 x = Math.min(x, (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 1086 1087 invalidateAll(); 1088 1089 final Point newCursor = new Point(Math.round(x), Math.round(y)); 1090 return newCursor; 1091 } 1056 1092 } 1057 1093 … … 1503 1539 * The distance to advance in the y-direction before the next line. 1504 1540 */ 1505 pr ivatefloat getLineDrop(TextLayout layout)1541 protected float getLineDrop(TextLayout layout) 1506 1542 { 1507 1543 if (getSpacing() < 0) { … … 1620 1656 return false; 1621 1657 } 1658 1659 if (this.getMinWidth() != null && outline.contains(mouseX, mouseY)) { 1660 return true; 1661 } 1622 1662 1623 1663 for (TextLayout text : _textLayouts) { … … 1628 1668 // gravity of right 1629 1669 int justOffset = getJustOffset(text); 1630 1670 1631 1671 if (mouseY - textY > textOutline.getMinY() && 1632 1672 mouseY - textY < textOutline.getMinY() + textOutline.getHeight() && … … 1653 1693 } 1654 1694 1655 if (_textLayouts == null || _textLayouts.size() < 1) { 1695 // if there is no text layouts and the text has no min width, do nothing 1696 if (_textLayouts == null || (_textLayouts.size() < 1 && this.getMinWidth() == null)) { 1656 1697 return null; 1657 } 1698 } 1658 1699 1659 1700 int preChangeWidth = 0; … … 1669 1710 1670 1711 float y = -1; 1712 1713 if (this.getMinWidth() != null && _textLayouts.size() == 0 && this.getFont() != null) { 1714 final TextLayout fakeLayout = TextLayout.getManager().layoutStringSimple("p", this.getFont()); 1715 final int xPos = getX() - getGravity(); 1716 final int yPos = getY() - getGravity() - (int) fakeLayout.getAscent(); 1717 final int width = 2 * getGravity() + this.getMinWidth(); 1718 final int height = 2 * getGravity() + EcosystemManager.getGraphicsManager().getFontHeight(getFont()); 1719 TextLayout.getManager().releaseLayout(fakeLayout); 1720 return new AxisAlignedBoxBounds(xPos, yPos, width, height); 1721 } 1671 1722 1672 1723 // Fix concurrency error in ScaleFrameset … … 1676 1727 } 1677 1728 1678 for (TextLayout layout : tmpTextLayouts) { 1729 for (int index = 0; index < tmpTextLayouts.size(); index++) { 1730 final TextLayout layout = tmpTextLayouts.get(index); 1679 1731 AxisAlignedBoxBounds bounds = layout.getLogicalHighlightShape(0, layout.getCharacterCount()); 1680 1732 1681 1733 if (y < 0) { 1682 1734 y = 0; 1683 } else { 1735 } else { 1684 1736 y += getLineDrop(layout); 1685 1737 } 1686 1687 maxX = Math.max(maxX, bounds.getMaxX()); 1738 1739 int minWidth = getAbsoluteMinWidth(); 1740 1688 1741 minX = Math.min(minX, bounds.getMinX()); 1742 maxX = minWidth < Integer.MAX_VALUE 1743 ? Math.max(minX + minWidth, bounds.getMaxX()) 1744 : Math.max(maxX, bounds.getMaxX()); 1745 minY = Math.min(minY, (int) (bounds.getMinY() + y)); 1689 1746 maxY = Math.max(maxY, (int) (bounds.getMaxY() + y)); 1690 minY = Math.min(minY, (int) (bounds.getMinY() + y));1691 1747 } 1692 1748 … … 1805 1861 //System.err.println(Arrays.toString(_text.toString().toCharArray())); 1806 1862 } 1863 1807 1864 invalidateBounds(); 1808 1809 1865 } 1810 1866 … … 1933 1989 1934 1990 // if there is no text to paint, do nothing. 1935 if (_text == null || _text.length() == 0) { 1991 if (_text == null) { 1992 return; 1993 } 1994 1995 // if the text to paint is empty string and there is no min width, do nothing. 1996 if ((_text.length() == 0 && getMinWidth() == null)) { 1936 1997 return; 1937 1998 } … … 2001 2062 fill = null; 2002 2063 } 2003 // System.err.println("Top left: " + getBoundingBox().getTopLeft() + ", " + "Bottom right: " + getBoundingBox().getBottomRight());2004 2064 g.drawRectangle(bounds, 0.0, fill, getPaintHighlightColor(), highlightStroke, null); 2005 2065 } … … 2032 2092 } 2033 2093 2094 if (layout.getCharacterCount() == 0) { continue; } 2034 2095 int ldx = 1 + getX() + getJustOffset(layout); // Layout draw x 2035 2036 g.drawTextLayout(layout, new Point(ldx, (int) y), paintColour); 2096 if (_mask == null) { 2097 g.drawTextLayout(layout, new Point(ldx, (int) y), paintColour); 2098 } else { 2099 String mask = ""; 2100 for(int o = 0; o < layout.getCharacterCount(); o++) { mask += (char) getMask().intValue(); } 2101 g.drawString(mask, new Point(ldx, (int) y), layout.getFont(), paintColour); 2102 } 2037 2103 2038 2104 y += getLineDrop(layout); 2039 2105 } 2040 2106 } 2041 2107 2042 2108 paintLink(); 2043 2109 } … … 2076 2142 copy.setWidth(getWidthToSave()); 2077 2143 copy.setFont(getFont().clone()); 2144 copy.setMinWidth(getMinWidthToSave()); 2145 copy.setMask(_mask); 2078 2146 if (hasFormula()) { 2079 2147 copy.calculate(getFormula()); … … 2168 2236 2169 2237 if (_text.length() == 0) { 2238 if (this.getMinWidth() != null) { 2239 // final TextLayout base = _textLayouts.get(0); 2240 // _textLayouts.set(0, TextLayout.get(" ", base.getFont(), 0, 1)); 2241 _textLayouts.clear(); 2242 } 2170 2243 if (this.isLineEnd()) { 2171 2244 // Remove and replace with a dot … … 2496 2569 String text = getText(); 2497 2570 assert (text != null); 2498 return text.trim().length() == 0 || super.dontSave();2571 return super.dontSave() || (text.trim().length() == 0 && this.getMinWidth() == null); 2499 2572 } 2500 2573 … … 2713 2786 @Override 2714 2787 public void setAnchorTop(Integer anchor) { 2715 if (!isLineEnd()) { 2788 if (!isLineEnd()) { 2716 2789 super.setAnchorTop(anchor); 2717 2790 if (anchor != null) { 2718 setY(anchor + _textLayouts.get(0).getAscent()); 2791 if (!_textLayouts.isEmpty()) { 2792 final float ascent = _textLayouts.get(0).getAscent(); 2793 setY(anchor + ascent); 2794 } else if (this.getFont() != null) { 2795 // p could be any character 2796 final TextLayout fakeLayout = TextLayout.getManager().layoutStringSimple("p", this.getFont()); 2797 final float ascent = fakeLayout.getAscent(); 2798 EcosystemManager.getTextLayoutManager().releaseLayout(fakeLayout); 2799 setY(anchor + ascent); 2800 } 2719 2801 } 2720 2802 return; … … 2740 2822 super.setAnchorBottom(anchor); 2741 2823 if (anchor != null) { 2742 setY(DisplayController.getFramePaintArea().getHeight() - (anchor + this.getBoundsHeight() - _textLayouts.get(0).getAscent() - _textLayouts.get(0).getDescent())); 2824 if (!_textLayouts.isEmpty()) { 2825 final float ascent = _textLayouts.get(0).getAscent(); 2826 final float descent = _textLayouts.get(0).getDescent(); 2827 setY(DisplayController.getFramePaintArea().getHeight() - (anchor + this.getBoundsHeight() - ascent - descent)); 2828 } else if (this.getFont() != null) { 2829 // p could be any character 2830 final TextLayout fakeLayout = TextLayout.getManager().layoutStringSimple("p", this.getFont()); 2831 final float ascent = fakeLayout.getAscent(); 2832 final float descent = fakeLayout.getDescent(); 2833 setY(DisplayController.getFramePaintArea().getHeight() - (anchor + this.getBoundsHeight() - ascent - descent)); 2834 } 2835 2743 2836 } 2744 2837 return; … … 3055 3148 DisplayController.setCursorPosition(newText.getParagraphEndPosition()); 3056 3149 } 3057 3058 } 3150 } 3151 3152 public Integer getMask() { 3153 if (_mask == null) { return null; } 3154 else { return _mask; } 3155 } 3156 3157 public void setMask(final Integer c) { _mask = c; } 3059 3158 }
Note:
See TracChangeset
for help on using the changeset viewer.