You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/10/17 20:13:03 UTC
svn commit: r1399368 -
/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java
Author: chathuri
Date: Wed Oct 17 18:13:03 2012
New Revision: 1399368
URL: http://svn.apache.org/viewvc?rev=1399368&view=rev
Log:
increase the width of nodes when the node header font is bold
Modified:
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java
Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java?rev=1399368&r1=1399367&r2=1399368&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java Wed Oct 17 18:13:03 2012
@@ -235,15 +235,19 @@ public abstract class NodeGUI implements
* @param g
*/
protected void calculatePositions(Graphics g) {
+ Font oldFont = g.getFont();
+ g.setFont(new Font(oldFont.getFontName(),Font.BOLD,oldFont.getSize()));
FontMetrics fm = g.getFontMetrics();
+
this.headHeight = fm.getHeight() + TEXT_GAP_Y * 2;
int maxNumPort = Math.max(getNode().getOutputPorts().size(), getNode().getInputPorts().size());
this.dimension.height = Math.max(this.headHeight + PORT_INITIAL_GAP + PORT_GAP * maxNumPort, MINIMUM_HEIGHT);
- this.dimension.width = Math.max(MINIMUM_WIDTH, fm.stringWidth(getNode().getID()) + TEXT_GAP_X * 2);
+ this.dimension.width = Math.max(MINIMUM_WIDTH, fm.stringWidth(getNode().getID()) + TEXT_GAP_X * 5);
/* Calculates the position of ports */
setPortPositions();
+ g.setFont(oldFont);
}
/**
@@ -405,9 +409,8 @@ public abstract class NodeGUI implements
// Text
g.setColor(TEXT_COLOR);
-
Font oldFont = g.getFont();
- g.setFont(new Font(oldFont.getFontName(),Font.PLAIN,oldFont.getSize()));
+ g.setFont(new Font(oldFont.getFontName(),Font.BOLD,oldFont.getSize()));
Rectangle2D bounds = g.getFontMetrics().getStringBounds(headerText, g);
g.drawString(headerText, (int)(shape.getBounds().getX() + (shape.getBounds().getWidth()-bounds.getWidth())/2),
(int)(shape.getBounds().getY() + (shape.getBounds().getHeight()+bounds.getHeight())/2));
@@ -454,7 +457,7 @@ public abstract class NodeGUI implements
/**
* @param workflowName
- * @param failed
+ * @param state
*/
public void setToken(String workflowName, NodeState state) {
List<DataPort> inputPorts = getNode().getInputPorts();