Author: kono
Date: 2011-09-26 11:49:24 -0700 (Mon, 26 Sep 2011)
New Revision: 26967
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
Log:
fixes #379 Font sizes are set correctly after changing font face.
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2011-09-26 18:37:47 UTC (rev 26966)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2011-09-26 18:49:24 UTC (rev 26967)
@@ -81,6 +81,7 @@
String m_toolTipText = null;
private LineType lineType;
+ private Float fontSize =
DVisualLexicon.EDGE_LABEL_FONT_SIZE.getDefault().floatValue();
// Visual Properties used in this node view.
private final VisualLexicon lexicon;
@@ -843,24 +844,16 @@
}
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
+ @Override
public Font getFont() {
synchronized (m_view.m_lock) {
return m_view.m_edgeDetails.labelFont(m_inx, 0);
}
}
-
- /**
- * DOCUMENT ME!
- *
- * @param font
- * DOCUMENT ME!
- */
- public void setFont(Font font) {
+
+
+ @Override
+ public void setFont(final Font font) {
synchronized (m_view.m_lock) {
m_view.m_edgeDetails.overrideLabelFont(m_inx, 0, font);
m_view.m_contentChanged = true;
@@ -1453,9 +1446,15 @@
} else if (vp == DVisualLexicon.EDGE_TOOLTIP) {
setToolTip(value.toString());
} else if (vp == DVisualLexicon.EDGE_LABEL_FONT_FACE) {
- setFont((Font) value);
+ final Font newFont = ((Font)
value).deriveFont(fontSize);
+ setFont(newFont);
} else if (vp == DVisualLexicon.EDGE_LABEL_FONT_SIZE) {
- setFont(getFont().deriveFont(((Integer)
value).floatValue()));
+ float newSize = ((Number) value).floatValue();
+ if (newSize != this.fontSize) {
+ final Font newFont =
getFont().deriveFont(newSize);
+ setFont(newFont);
+ fontSize = newSize;
+ }
} else if (vp == MinimalVisualLexicon.EDGE_LABEL_COLOR) {
setTextPaint((Paint) value);
} else if (vp == MinimalVisualLexicon.EDGE_VISIBLE) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.