Java Code Examples for org.stringtemplate.v4.StringRenderer

The following examples show how to use org.stringtemplate.v4.StringRenderer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 2
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 3
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 4
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 5
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length() >0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 6
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 7
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 8
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 9
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 10
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 11
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 12
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 13
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length() >0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 14
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 15
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 16
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":"+st.debugState.newSTEvent.getLine();
        return "<html><b>"+StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 17
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 18
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>" +
            StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 19
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState !=null && st.debugState.addAttrEvents !=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 20
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>" +
            StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 21
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 22
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>"+
               StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 23
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 24
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>" +
            StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 25
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 26
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>" +
            StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 27
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 28
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label =
            st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
            st.debugState.newSTEvent.getLine();
        return "<html><b>" +
               StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}
 
Example 29
public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {
    Map<String, Object> attrs = st.getAttributes();
    if ( attrs==null ) return;
    for (String a : attrs.keySet()) {
        String descr;
        if ( st.debugState!=null && st.debugState.addAttrEvents!=null ) {
            List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);
            StringBuilder locations = new StringBuilder();
            int i = 0;
            if ( events!=null ) {
                for (AddAttributeEvent ae : events) {
                    if ( i>0 ) locations.append(", ");
                    locations.append(ae.getFileName()+":"+ae.getLine());
                    i++;
                }
            }
            if ( locations.length()>0 ) {
                descr = a+" = "+attrs.get(a)+" @ "+locations.toString();
            }
            else {
                descr = a+" = "+attrs.get(a);
            }
        }
        else {
            descr = a+" = "+attrs.get(a);
        }
        if ( !names.add(a) ) {
            StringBuilder builder = new StringBuilder();
            builder.append("<html><font color=\"gray\">");
            builder.append(StringRenderer.escapeHTML(descr));
            builder.append("</font></html>");
            descr = builder.toString();
        }
        node.addChild(new StringTree(descr));
    }
}
 
Example 30
Source Project: codebuff   Source File: JTreeSTModel.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String toString() {
    ST st = event.scope.st;
    if ( st.isAnonSubtemplate() ) return "{...}";
    if ( st.debugState!=null && st.debugState.newSTEvent!=null ) {
        String label = st.toString()+" @ "+st.debugState.newSTEvent.getFileName()+":" +
                       st.debugState.newSTEvent.getLine();
        return "<html><b>"+
               StringRenderer.escapeHTML(label)+"</b></html>";
    }
    else {
        return st.toString();
    }
}