X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fprofile%2FTextGridStyle.java;h=54972155d8d69579294e4d6e49718a453e14e66d;hb=08dc7080753f3ea35985e76e9effb9d3ff92c3b5;hp=d660d47a5be007f7e33acd9349c820cd1d1c7615;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/TextGridStyle.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/TextGridStyle.java index d660d47a5..54972155d 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/TextGridStyle.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/TextGridStyle.java @@ -94,7 +94,7 @@ public abstract class TextGridStyle extends StyleBase { String name = graph.getPossibleRelatedValue(config, getPropertyRelation(graph,element), Bindings.STRING); return name; } - + public AffineTransform getTransform(INode node, AffineTransform parentTransform, Rectangle2D elementBounds, int location, boolean up) { return getTransform(parentTransform, elementBounds, location, up); } @@ -110,7 +110,7 @@ public abstract class TextGridStyle extends StyleBase { at.scale(0.15, 0.15); return at; - + } protected String rowId() { @@ -161,7 +161,7 @@ public abstract class TextGridStyle extends StyleBase { String value2 = result != null ? result.getText2() : null; String value3 = result != null ? result.getText3() : null; - + double spacing = result.getSpacing(); final Function1 modifier = result != null ? result.getModifier() : null; @@ -209,7 +209,7 @@ public abstract class TextGridStyle extends StyleBase { node.setCache(1, row, result); boolean isConnection = _node instanceof ConnectionNode; - + Rectangle2D elementBounds = isConnection ? EMPTY_BOUNDS : NodeUtil.getLocalElementBounds(_node); if(elementBounds == null) { new Exception("Cannot get local element bounds for node " + _node.toString()).printStackTrace(); @@ -225,14 +225,14 @@ public abstract class TextGridStyle extends StyleBase { Vec2d offset = result.getOffset(); Point2D[] cellOffsets = getCellOffsets(); - + AffineTransform at1 = new AffineTransform(at); at1.translate(cellOffsets[0].getX(),cellOffsets[0].getY()); AffineTransform at2 = new AffineTransform(at); at2.translate(cellOffsets[1].getX()+spacing,cellOffsets[1].getY()); AffineTransform at3 = new AffineTransform(at); at3.translate(cellOffsets[2].getX()+spacing,cellOffsets[2].getY()); - + at1.translate(offset.x, offset.y); at2.translate(offset.x, offset.y); at3.translate(offset.x, offset.y); @@ -251,7 +251,7 @@ public abstract class TextGridStyle extends StyleBase { node.setHorizontalAlignment(2, row, (byte) getAlignment(2).ordinal()); node.setHorizontalAlignment(3, row, (byte) getAlignment(3).ordinal()); } - + Alignment[] verticalAlignments = result.getVerticalAlignments(); if(verticalAlignments != null) { node.setVerticalAlignment(1, row, (byte) verticalAlignments[0].ordinal()); @@ -266,11 +266,13 @@ public abstract class TextGridStyle extends StyleBase { node.setZIndex(3000); org.simantics.common.color.Color color = result.getColor(); - java.awt.Color awtColor = color != null ? Colors.awt(color) : Color.DARK_GRAY; + Color awtColor = color != null ? Colors.awt(color) : Color.DARK_GRAY; + Color bgColor = getBackgroundColor(); + Font font = getFont(); - setTextNodeData(node, 1, row, value, FONT, awtColor, BACKGROUND_COLOR); - setTextNodeData(node, 2, row, value2, result.getPending(), FONT, awtColor, BACKGROUND_COLOR); - setTextNodeData(node, 3, row, value3, FONT, awtColor, BACKGROUND_COLOR); + setTextNodeData(node, 1, row, value, font, awtColor, bgColor); + setTextNodeData(node, 2, row, value2, result.getPending(), font, awtColor, bgColor); + setTextNodeData(node, 3, row, value3, font, awtColor, bgColor); node.setEditable(1, row, false); node.setForceEventListening(2, row, true); @@ -309,7 +311,7 @@ public abstract class TextGridStyle extends StyleBase { node.setInputValidator(2, row, validator); node.setTranslator(translator); - + node.setRVI(2, row, rvi); postProcessNode(node, row); @@ -336,6 +338,14 @@ public abstract class TextGridStyle extends StyleBase { node.setPending(x, y, pending); } + protected Font getFont() { + return FONT; + } + + protected Color getBackgroundColor() { + return BACKGROUND_COLOR; + } + protected Alignment getAlignment(int column) { switch(column) { case 1: return Alignment.TRAILING;