if ((lnode.getNode().getElement() instanceof ConnectionInitialization) ||
(lnode.getNode().getElement() instanceof LocalVariableStatement)) {
Shape shape = (Shape)((Node)lnode.getNode());
DecorationNode decorationNode = (DecorationNode)shape.getChildren().get(0);
if ((lnode.getNode().getElement() instanceof ConnectionInitialization) && (decorationNode.isVisible() == true)) {
Node nodeCI = (Node)lnode.getNode();
Edge e = (Edge)nodeCI.getSourceEdges().get(0);
e.setVisible(false);
decorationNode.setVisible(false);
/*
//RGB to Integer
System.out.println("original shape line color: " + shape.getLineColor());
FigureUtilities fu = new FigureUtilities();
RGB rgb = new RGB(255,255,255); // White Color (255,255,255)
int rgbInt = fu.RGBToInteger(rgb);
System.out.println("RGB to Integer: " + rgbInt);
*/
//White Line -> RGB(255,255,255) to Integer = 16777215
shape.setLineColor(16777215);
//System.out.println("REDUCE - CI is NOT Visible");
}
if ((lnode.getNode().getElement() instanceof LocalVariableStatement) && (decorationNode.isVisible() == true)) {
// 1.LocalVariableStatement
Node nodeLVS = (Node)lnode.getNode();
if (!nodeLVS.getChildren().isEmpty()) {
// 2.LocalVariableStatement
Node nodeSecondLVS = (Node)nodeLVS.getChildren().get(0);
//System.out.println("nodeSecondLVS: " + nodeSecondLVS.getElement());
if ((nodeSecondLVS.getElement() instanceof LocalVariableStatement) && (!nodeSecondLVS.getChildren().isEmpty())) {
// 1. LocalVariable
Node nodeLV = (Node)nodeSecondLVS.getChildren().get(0);
//System.out.println("nodeLV: " + nodeLV.getElement());
if ((nodeLV.getElement() instanceof LocalVariable) && (nodeLV.getChildren().size() == 2)) {
//2. & 3. LocalVariable
Node nodeFirstChildLV = (Node)nodeLV.getChildren().get(0);
Node nodeSecondChildLV = (Node)nodeLV.getChildren().get(1);
//System.out.println("nodeFirstChildLV: " + nodeFirstChildLV.getElement());
//System.out.println("nodeSecondChildLV: " + nodeSecondChildLV.getElement());
if ((nodeFirstChildLV.getElement() instanceof LocalVariable) && (nodeFirstChildLV.getChildren().isEmpty()) &&
(nodeSecondChildLV.getElement() instanceof LocalVariable) && (nodeSecondChildLV.getChildren().isEmpty())) {
if (!nodeLV.getSourceEdges().isEmpty()) {
Edge e = (Edge)nodeLV.getSourceEdges().get(0);
e.setVisible(false);
}
if (!nodeLV.getTargetEdges().isEmpty()) {
Edge e = (Edge)nodeLV.getTargetEdges().get(0);
e.setVisible(false);
}
decorationNode.setVisible(false);
//White Line -> RGB(255,255,255) to Integer = 16777215
shape.setLineColor(16777215);
//System.out.println("REDUCE - LVS is NOT Visible");
}
}
}
}
}
}
}
//SET POSITION
ListIterator li = lnodes.listIterator();
int freeLeftPosition = DISTANCE_X;
int freeSecondLeftPosition = DISTANCE_X;
int freeTopPosition = DISTANCE_Y;
boolean isFirst = true;
while (li.hasNext()) {
ILayoutNode lnode = (ILayoutNode)li.next();
if (lnode.getNode().getElement() instanceof ExpressionStatement ) {
Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
bounds.setX(0);
bounds.setY(0);
lnode.getNode().setLayoutConstraint(bounds);
}
if ((lnode.getNode().getElement() instanceof ConnectionInitialization) ||
(lnode.getNode().getElement() instanceof LocalVariableStatement)) {
//Check of freeTopPosition
if (freeTopPosition < lnode.getHeight()) {
freeTopPosition = lnode.getHeight();
}
Shape shape = (Shape)((Node)lnode.getNode());
DecorationNode decorationNode = (DecorationNode)shape.getChildren().get(0);
if ((lnode.getNode().getElement() instanceof LocalVariableStatement) && (decorationNode.isVisible() == true)) {
Node nodeLVS = (Node)lnode.getNode();
Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
// set X position
if (isFirst == true) {
bounds.setX(freeLeftPosition);