}
public void generateJsonForForceLayout(String prefix, PrintWriter pw,
VWorkspace vWorkspace) {
VWorksheet vWorksheet = vWorkspace.getViewFactory()
.getVWorksheetByWorksheetId(worksheetId);
List<String> hNodeIdList = vWorksheet.getHeaderVisibleLeafNodes();
String alignmentId = AlignmentManager.Instance().constructAlignmentId(
vWorkspace.getWorkspace().getId(), vWorksheet.getWorksheetId());
JSONObject topObj = new JSONObject();
try {
topObj.put(GenericJsonKeys.updateType.name(),
AlignmentSVGVisualizationUpdate.class.getSimpleName());
topObj.put(JsonKeys.alignmentId.name(), alignmentId);
topObj.put(JsonKeys.worksheetId.name(), worksheetId);
/*** Add the nodes and the links from the Steiner tree ***/
JSONArray nodesArr = new JSONArray();
JSONArray anchorsArr = new JSONArray();
JSONArray linksArr = new JSONArray();
JSONArray edgeLinksArr = new JSONArray();
HashMap<Node, Integer> verticesIndex = new HashMap<Node, Integer>();
HashMap<String, ColumnNode> columnNodes = new HashMap<>();
if (alignmentGraph != null
&& alignmentGraph.vertexSet().size() != 0) {
Set<Node> nodes = alignmentGraph.vertexSet();
for (Node node : nodes) {
if (node instanceof ColumnNode) {
columnNodes.put(((ColumnNode) node).getHNodeId(),
(ColumnNode) node);
}
}
}
HTable headers = vWorksheet.getWorksheet().getHeaders();
for (int columnNum = 0; columnNum < hNodeIdList.size(); columnNum++) {
String hNodeId = hNodeIdList.get(columnNum);
ColumnNode node = columnNodes.get(hNodeId);
JSONObject anchorObj;
HNode hNode = headers.getHNode(hNodeId, true);