private void createCriteriaNode(String keyWord, ICriteria crit, DisplayNode child) { node.addChildNode(child); child.displayNodeList.add(DisplayNodeFactory.createDisplayNode(child, keyWord)); setIndentLevel(this.indentLevel + 1); beginClause(child, this.indentLevel); child.addChildNode(DisplayNodeFactory.createDisplayNode(child, crit, indentLevel)); }
@Override public void visitNode(ILanguageObject obj) { if (obj == null) { append(DisplayNodeConstants.UNDEFINED); return; } if ((obj instanceof IExpressionSymbol && !(obj instanceof IAggregateSymbol))) { IQueryService queryService = ModelerCore.getTeiidQueryService(); ISQLStringVisitor delegate = queryService.getCallbackSQLStringVisitor(this); obj.acceptVisitor(delegate); return; } // turn off indenting for nested commands int childIndent = indentLevel; if ((node.languageObject instanceof ISubqueryContainer || node.languageObject instanceof IExpressionStatement) && obj instanceof ICommand) { childIndent = -1; } DisplayNode child = DisplayNodeFactory.createDisplayNode(node, obj, childIndent); node.addChildNode(child); }
private static int calculateLeafNodes( DisplaySentence sentence, List featureNames, String ntFeatureName, Graphics g, int inner_term_height, int graph_terminalstart) { DisplayNode tnode; String fname; String wert; FontMetrics fm = g.getFontMetrics(); int x_position = GraphConstants.treeHorizontalMargin; for (int i = 0; i < sentence.getDisplayLeafNodeSize(); i++) { tnode = sentence.getDisplayLeafNode(i); if (tnode.isVisible()) { int maxbreite = 0; if (tnode instanceof NT_Node) { // Sonderbehandlung der implodierten Knoten if (tnode instanceof DisplayNT_Node) { maxbreite = fm.stringWidth(tnode.getNode().getFeature(ntFeatureName)); } } else { int fcount = 0; int breite; for (int j = 0; j < featureNames.size(); j++) { fname = (String) featureNames.get(j); wert = tnode.getNode().getFeature(fname); if (wert == null) { wert = ""; } Font leafFont = UtilitiesCollection.chooseFont(GraphConstants.leafFont, wert); g.setFont(leafFont); fm = g.getFontMetrics(leafFont); fcount++; if (fcount <= GraphConstants.treeTerminalFeatures) { breite = fm.stringWidth(wert); if (maxbreite < breite) { maxbreite = breite; } } } // for } int preferred = maxbreite; if (preferred > GraphConstants.leafMaxWidth) { preferred = GraphConstants.leafMaxWidth; } if (preferred < GraphConstants.leafMinWidth) { preferred = GraphConstants.leafMinWidth; } tnode.setLeftX(x_position); tnode.setX(x_position + (preferred / 2)); addLockedPosition(tnode.getX()); tnode.setWidth(preferred); if (tnode instanceof DisplayNT_Node) { tnode.setHeight(GraphConstants.nodeHeight); } else { tnode.setHeight(inner_term_height); } x_position += (preferred + GraphConstants.leafGapX); tnode.setY(graph_terminalstart); } } // T-Nodes x_position += (-GraphConstants.leafGapX + GraphConstants.treeHorizontalMargin); return x_position; }