|
Lines 10-15
Link Here
|
| 10 |
* Matthias Wienand (itemis AG) - initial API and implementation |
10 |
* Matthias Wienand (itemis AG) - initial API and implementation |
| 11 |
* Alexander Nyßen (itemis AG) - initial API and implementation |
11 |
* Alexander Nyßen (itemis AG) - initial API and implementation |
| 12 |
* Tamas Miklossy (itemis AG) - Add support for arrowType edge decorations (bug #477980) |
12 |
* Tamas Miklossy (itemis AG) - Add support for arrowType edge decorations (bug #477980) |
|
|
13 |
* - Add support for polygon-based node shapes (bug #441352) |
| 13 |
* |
14 |
* |
| 14 |
*******************************************************************************/ |
15 |
*******************************************************************************/ |
| 15 |
package org.eclipse.gef4.dot.internal; |
16 |
package org.eclipse.gef4.dot.internal; |
|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.gef4.dot.internal.parser.dot.GraphType; |
29 |
import org.eclipse.gef4.dot.internal.parser.dot.GraphType; |
| 29 |
import org.eclipse.gef4.dot.internal.parser.point.Point; |
30 |
import org.eclipse.gef4.dot.internal.parser.point.Point; |
| 30 |
import org.eclipse.gef4.dot.internal.parser.rankdir.Rankdir; |
31 |
import org.eclipse.gef4.dot.internal.parser.rankdir.Rankdir; |
|
|
32 |
import org.eclipse.gef4.dot.internal.parser.shape.Shape; |
| 31 |
import org.eclipse.gef4.dot.internal.parser.splinetype.SplineType; |
33 |
import org.eclipse.gef4.dot.internal.parser.splinetype.SplineType; |
| 32 |
import org.eclipse.gef4.dot.internal.parser.validation.DotJavaValidator; |
34 |
import org.eclipse.gef4.dot.internal.parser.validation.DotJavaValidator; |
| 33 |
import org.eclipse.gef4.dot.internal.parser.validation.DotJavaValidator.AttributeContext; |
35 |
import org.eclipse.gef4.dot.internal.parser.validation.DotJavaValidator.AttributeContext; |
|
Lines 102-107
Link Here
|
| 102 |
* Specifies the 'dir' attribute of an edge. |
104 |
* Specifies the 'dir' attribute of an edge. |
| 103 |
*/ |
105 |
*/ |
| 104 |
public static final String DIR__E = "dir"; |
106 |
public static final String DIR__E = "dir"; |
|
|
107 |
|
| 108 |
/** |
| 109 |
* Specifies the 'distortion' attribute of a node. |
| 110 |
*/ |
| 111 |
public static final String DISTORTION__N = "distortion"; |
| 105 |
|
112 |
|
| 106 |
/** |
113 |
/** |
| 107 |
* Specifies the 'forceLabels' attribute of a graph. |
114 |
* Specifies the 'forceLabels' attribute of a graph. |
|
Lines 217-222
Link Here
|
| 217 |
* which is used for laying out the graph. |
224 |
* which is used for laying out the graph. |
| 218 |
*/ |
225 |
*/ |
| 219 |
public static final String RANKDIR__G = "rankdir"; |
226 |
public static final String RANKDIR__G = "rankdir"; |
|
|
227 |
|
| 228 |
/** |
| 229 |
* Specifies the 'shape' attribute of a node. |
| 230 |
*/ |
| 231 |
public static final String SHAPE__N = "shape"; |
| 232 |
|
| 233 |
/** |
| 234 |
* Specifies the 'sides' attribute of a node. |
| 235 |
*/ |
| 236 |
public static final String SIDES__N = "sides"; |
| 237 |
|
| 238 |
/** |
| 239 |
* Specifies the 'skew' attribute of a node. |
| 240 |
*/ |
| 241 |
public static final String SKEW__N = "skew"; |
| 220 |
|
242 |
|
| 221 |
/** |
243 |
/** |
| 222 |
* Specifies the name of the 'splines' attribute. It is used to control how |
244 |
* Specifies the name of the 'splines' attribute. It is used to control how |
|
Lines 430-437
Link Here
|
| 430 |
* |
452 |
* |
| 431 |
* @param edge |
453 |
* @param edge |
| 432 |
* The {@link Edge} for which to return the value of the |
454 |
* The {@link Edge} for which to return the value of the |
| 433 |
* {@link #ARROWSIZE__E} property, parsed as an {@link ArrowType} |
455 |
* {@link #ARROWSIZE__E} property, parsed as a {@link Double} . |
| 434 |
* . |
|
|
| 435 |
* |
456 |
* |
| 436 |
* @return The value of the {@link #ARROWSIZE__E} property of the given |
457 |
* @return The value of the {@link #ARROWSIZE__E} property of the given |
| 437 |
* {@link Edge}. |
458 |
* {@link Edge}. |
|
Lines 499-504
Link Here
|
| 499 |
public static DirType getDirParsed(Edge edge) { |
520 |
public static DirType getDirParsed(Edge edge) { |
| 500 |
return DotLanguageSupport.parseAttributeValue( |
521 |
return DotLanguageSupport.parseAttributeValue( |
| 501 |
DotLanguageSupport.DIRTYPE_PARSER, getDir(edge)); |
522 |
DotLanguageSupport.DIRTYPE_PARSER, getDir(edge)); |
|
|
523 |
} |
| 524 |
|
| 525 |
/** |
| 526 |
* Returns the value of the {@link #DISTORTION__N} property of the given |
| 527 |
* {@link Node}. |
| 528 |
* |
| 529 |
* @param node |
| 530 |
* The {@link Node} for which to return the value of the |
| 531 |
* {@link #DISTORTION__N} property. |
| 532 |
* @return The value of the {@link #DISTORTION__N} property of the given |
| 533 |
* {@link Node}. |
| 534 |
*/ |
| 535 |
public static String getDistortion(Node node) { |
| 536 |
return (String) node.attributesProperty().get(DISTORTION__N); |
| 537 |
} |
| 538 |
|
| 539 |
/** |
| 540 |
* Returns the (parsed) value of the {@link #DISTORTION__N} property of the |
| 541 |
* given {@link Node}. |
| 542 |
* |
| 543 |
* @param node |
| 544 |
* The {@link Node} for which to return the value of the |
| 545 |
* {@link #DISTORTION__N} property, parsed as a {@link Double} . |
| 546 |
* |
| 547 |
* @return The value of the {@link #DISTORTION__N} property of the given |
| 548 |
* {@link Node}. |
| 549 |
*/ |
| 550 |
public static Double getDistortionParsed(Node node) { |
| 551 |
return DotLanguageSupport.parseAttributeValue( |
| 552 |
DotLanguageSupport.DOUBLE_PARSER, getDistortion(node)); |
| 502 |
} |
553 |
} |
| 503 |
|
554 |
|
| 504 |
/** |
555 |
/** |
|
Lines 860-865
Link Here
|
| 860 |
} |
911 |
} |
| 861 |
|
912 |
|
| 862 |
/** |
913 |
/** |
|
|
914 |
* Returns the value of the {@link #SHAPE__N} property of the given |
| 915 |
* {@link Node}. |
| 916 |
* |
| 917 |
* @param node |
| 918 |
* The {@link Node} for which to return the value of the |
| 919 |
* {@link #SHAPE__N} property. |
| 920 |
* @return The value of the {@link #SHAPE__N} property of the given |
| 921 |
* {@link Node}. |
| 922 |
*/ |
| 923 |
public static String getShape(Node node) { |
| 924 |
return (String) node.attributesProperty().get(SHAPE__N); |
| 925 |
} |
| 926 |
|
| 927 |
/** |
| 928 |
* Returns the (parsed) value of the {@link #SHAPE__N} property of the given |
| 929 |
* {@link Node}. |
| 930 |
* |
| 931 |
* @param node |
| 932 |
* The {@link Node} for which to return the value of the |
| 933 |
* {@link #SHAPE__N} property, parsed as an {@link Shape} . |
| 934 |
* @return The value of the {@link #SHAPE__N} property of the given |
| 935 |
* {@link Node}. |
| 936 |
*/ |
| 937 |
public static Shape getShapeParsed(Node node) { |
| 938 |
return DotLanguageSupport.parseAttributeValue( |
| 939 |
DotLanguageSupport.SHAPE_PARSER, getShape(node)); |
| 940 |
} |
| 941 |
|
| 942 |
/** |
| 943 |
* Returns the value of the {@link #SIDES__N} property of the given |
| 944 |
* {@link Node}. |
| 945 |
* |
| 946 |
* @param node |
| 947 |
* The {@link Node} for which to return the value of the |
| 948 |
* {@link #SIDES__N} property. |
| 949 |
* @return The value of the {@link #SIDES__N} property of the given |
| 950 |
* {@link Node}. |
| 951 |
*/ |
| 952 |
public static String getSides(Node node) { |
| 953 |
return (String) node.attributesProperty().get(SIDES__N); |
| 954 |
} |
| 955 |
|
| 956 |
/** |
| 957 |
* Returns the (parsed) value of the {@link #SIDES__N} property of the given |
| 958 |
* {@link Node}. |
| 959 |
* |
| 960 |
* @param node |
| 961 |
* The {@link Node} for which to return the value of the |
| 962 |
* {@link #SIDES__N} property, parsed as a {@link Integer} . |
| 963 |
* |
| 964 |
* @return The value of the {@link #SIDES__N} property of the given |
| 965 |
* {@link Node}. |
| 966 |
*/ |
| 967 |
public static Integer getSidesParsed(Node node) { |
| 968 |
return DotLanguageSupport.parseAttributeValue( |
| 969 |
DotLanguageSupport.INT_PARSER, getSides(node)); |
| 970 |
} |
| 971 |
|
| 972 |
/** |
| 973 |
* Returns the value of the {@link #SKEW__N} property of the given |
| 974 |
* {@link Node}. |
| 975 |
* |
| 976 |
* @param node |
| 977 |
* The {@link Node} for which to return the value of the |
| 978 |
* {@link #SKEW__N} property. |
| 979 |
* @return The value of the {@link #SKEW__N} property of the given |
| 980 |
* {@link Node}. |
| 981 |
*/ |
| 982 |
public static String getSkew(Node node) { |
| 983 |
return (String) node.attributesProperty().get(SKEW__N); |
| 984 |
} |
| 985 |
|
| 986 |
/** |
| 987 |
* Returns the (parsed) value of the {@link #SKEW__N} property of the given |
| 988 |
* {@link Node}. |
| 989 |
* |
| 990 |
* @param node |
| 991 |
* The {@link Node} for which to return the value of the |
| 992 |
* {@link #SKEW__N} property, parsed as a {@link Double} . |
| 993 |
* |
| 994 |
* @return The value of the {@link #SKEW__N} property of the given |
| 995 |
* {@link Node}. |
| 996 |
*/ |
| 997 |
public static Double getSkewParsed(Node node) { |
| 998 |
return DotLanguageSupport.parseAttributeValue( |
| 999 |
DotLanguageSupport.DOUBLE_PARSER, getSkew(node)); |
| 1000 |
} |
| 1001 |
|
| 1002 |
/** |
| 863 |
* Returns the value of the {@link #SPLINES__G} attribute of the given |
1003 |
* Returns the value of the {@link #SPLINES__G} attribute of the given |
| 864 |
* {@link Graph}. |
1004 |
* {@link Graph}. |
| 865 |
* |
1005 |
* |
|
Lines 1193-1198
Link Here
|
| 1193 |
*/ |
1333 |
*/ |
| 1194 |
public static void setDirParsed(Edge edge, DirType dirParsed) { |
1334 |
public static void setDirParsed(Edge edge, DirType dirParsed) { |
| 1195 |
setDir(edge, dirParsed.toString()); |
1335 |
setDir(edge, dirParsed.toString()); |
|
|
1336 |
} |
| 1337 |
|
| 1338 |
/** |
| 1339 |
* Sets the {@link #DISTORTION__N} property of the given {@link Node} to the |
| 1340 |
* given <i>distortion</i> value. |
| 1341 |
* |
| 1342 |
* @param node |
| 1343 |
* The {@link Node} for which to change the value of the |
| 1344 |
* {@link #DISTORTION__N} property. |
| 1345 |
* @param distortion |
| 1346 |
* The new value for the {@link #DISTORTION__N} property. |
| 1347 |
*/ |
| 1348 |
public static void setDistortion(Node node, String distortion) { |
| 1349 |
validate(AttributeContext.NODE, DISTORTION__N, distortion); |
| 1350 |
node.attributesProperty().put(DISTORTION__N, distortion); |
| 1351 |
} |
| 1352 |
|
| 1353 |
/** |
| 1354 |
* Sets the {@link #DISTORTION__N} property of the given {@link Node} to the |
| 1355 |
* given <i>distortion</i> value. |
| 1356 |
* |
| 1357 |
* @param node |
| 1358 |
* The {@link Node} for which to change the value of the |
| 1359 |
* {@link #DISTORTION__N} property. |
| 1360 |
* @param distortionParsed |
| 1361 |
* The new value for the {@link #DISTORTION__N} property. |
| 1362 |
*/ |
| 1363 |
public static void setDistortionParsed(Node node, Double distortionParsed) { |
| 1364 |
setSkew(node, distortionParsed.toString()); |
| 1196 |
} |
1365 |
} |
| 1197 |
|
1366 |
|
| 1198 |
/** |
1367 |
/** |
|
Lines 1537-1542
Link Here
|
| 1537 |
} |
1706 |
} |
| 1538 |
|
1707 |
|
| 1539 |
/** |
1708 |
/** |
|
|
1709 |
* Sets the {@link #SIDES__N} property of the given {@link Node} to the |
| 1710 |
* given <i>sides</i> value. |
| 1711 |
* |
| 1712 |
* @param node |
| 1713 |
* The {@link Node} for which to change the value of the |
| 1714 |
* {@link #SIDES__N} property. |
| 1715 |
* @param sides |
| 1716 |
* The new value for the {@link #SIDES__N} property. |
| 1717 |
*/ |
| 1718 |
public static void setSides(Node node, String sides) { |
| 1719 |
validate(AttributeContext.NODE, SIDES__N, sides); |
| 1720 |
node.attributesProperty().put(SIDES__N, sides); |
| 1721 |
} |
| 1722 |
|
| 1723 |
/** |
| 1724 |
* Sets the {@link #SIDES__N} property of the given {@link Node} to the |
| 1725 |
* given <i>sides</i> value. |
| 1726 |
* |
| 1727 |
* @param node |
| 1728 |
* The {@link Node} for which to change the value of the |
| 1729 |
* {@link #SIDES__N} property. |
| 1730 |
* @param sidesParsed |
| 1731 |
* The new value for the {@link #SIDES__N} property. |
| 1732 |
*/ |
| 1733 |
public static void setSidesParsed(Node node, Integer sidesParsed) { |
| 1734 |
setSides(node, sidesParsed.toString()); |
| 1735 |
} |
| 1736 |
|
| 1737 |
/** |
| 1738 |
* Sets the {@link #SHAPE__N} property of the given {@link Node} to the |
| 1739 |
* given <i>shape</i> value. |
| 1740 |
* |
| 1741 |
* @param node |
| 1742 |
* The {@link Node} for which to change the value of the |
| 1743 |
* {@link #SHAPE__N} property. |
| 1744 |
* @param shape |
| 1745 |
* The new value for the {@link #SHAPE__N} property. |
| 1746 |
*/ |
| 1747 |
public static void setShape(Node node, String shape) { |
| 1748 |
validate(AttributeContext.NODE, SHAPE__N, shape); |
| 1749 |
node.attributesProperty().put(SHAPE__N, shape); |
| 1750 |
} |
| 1751 |
|
| 1752 |
/** |
| 1753 |
* Sets the {@link #SHAPE__N} property of the given {@link Node} to the |
| 1754 |
* given <i>shape</i> value. |
| 1755 |
* |
| 1756 |
* @param node |
| 1757 |
* The {@link Node} for which to change the value of the |
| 1758 |
* {@link #SHAPE__N} property. |
| 1759 |
* @param shapeParsed |
| 1760 |
* The new value for the {@link #SHAPE__N} property. |
| 1761 |
*/ |
| 1762 |
public static void setShapeParsed(Node node, Shape shapeParsed) { |
| 1763 |
setShape(node, |
| 1764 |
serialize(DotLanguageSupport.SHAPE_SERIALIZER, shapeParsed)); |
| 1765 |
} |
| 1766 |
|
| 1767 |
/** |
| 1768 |
* Sets the {@link #SKEW__N} property of the given {@link Node} to the given |
| 1769 |
* <i>skew</i> value. |
| 1770 |
* |
| 1771 |
* @param node |
| 1772 |
* The {@link Node} for which to change the value of the |
| 1773 |
* {@link #SKEW__N} property. |
| 1774 |
* @param skew |
| 1775 |
* The new value for the {@link #SKEW__N} property. |
| 1776 |
*/ |
| 1777 |
public static void setSkew(Node node, String skew) { |
| 1778 |
validate(AttributeContext.NODE, SKEW__N, skew); |
| 1779 |
node.attributesProperty().put(SKEW__N, skew); |
| 1780 |
} |
| 1781 |
|
| 1782 |
/** |
| 1783 |
* Sets the {@link #SKEW__N} property of the given {@link Node} to the given |
| 1784 |
* <i>skew</i> value. |
| 1785 |
* |
| 1786 |
* @param node |
| 1787 |
* The {@link Node} for which to change the value of the |
| 1788 |
* {@link #SKEW__N} property. |
| 1789 |
* @param skewParsed |
| 1790 |
* The new value for the {@link #SKEW__N} property. |
| 1791 |
*/ |
| 1792 |
public static void setSkewParsed(Node node, Double skewParsed) { |
| 1793 |
setSkew(node, skewParsed.toString()); |
| 1794 |
} |
| 1795 |
|
| 1796 |
/** |
| 1540 |
* Sets the {@link #SPLINES__G} attribute of the given {@link Graph} to the |
1797 |
* Sets the {@link #SPLINES__G} attribute of the given {@link Graph} to the |
| 1541 |
* given value. |
1798 |
* given value. |
| 1542 |
* |
1799 |
* |