当前位置: 首页>>代码示例>>Java>>正文


Java StringTemplate.setAttribute方法代码示例

本文整理汇总了Java中org.antlr.stringtemplate.StringTemplate.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java StringTemplate.setAttribute方法的具体用法?Java StringTemplate.setAttribute怎么用?Java StringTemplate.setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.antlr.stringtemplate.StringTemplate的用法示例。


在下文中一共展示了StringTemplate.setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEntityEventType

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
private void createEntityEventType(ActionScriptType entityEventType,
        FlexScaffoldMetadata flexScaffoldMetadata) {
    ActionScriptType entityType = ActionScriptMappingUtils
            .toActionScriptType(flexScaffoldMetadata.getEntity());
    StringTemplate entityEventTemplate = this.templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_event");
    entityEventTemplate.setAttribute("entityEventType", entityEventType);
    entityEventTemplate.setAttribute("entityType", entityType);
    entityEventTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    String relativePath = entityEventType.getFullyQualifiedTypeName()
            .replace('.', File.separatorChar) + ".as";
    String fileIdentifier = getPathResolver().getIdentifier(
            LogicalPath.getInstance(Path.ROOT, ""),
            "src/main/flex/" + relativePath);
    getFileManager().createOrUpdateTextFileIfRequired(fileIdentifier,
            entityEventTemplate.toString(), true);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:20,代码来源:FlexUIMetadataProvider.java

示例2: buildListViewDocument

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
private Document buildListViewDocument(
        FlexScaffoldMetadata flexScaffoldMetadata,
        List<FieldMetadata> elegibleFields) {
    ActionScriptType entityType = ActionScriptMappingUtils
            .toActionScriptType(flexScaffoldMetadata.getEntity());
    StringTemplate listViewTemplate = this.templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_list_view");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);
    listViewTemplate.setAttribute("fields", elegibleFields);

    try {
        ByteArrayInputStream stream = new ByteArrayInputStream(
                listViewTemplate.toString().getBytes("UTF-8"));
        return XmlUtils.getDocumentBuilder().parse(stream);
    }
    catch (Exception e) {
        throw new IllegalStateException(
                "Failed to build list view document", e);
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:23,代码来源:FlexUIMetadataProvider.java

示例3: buildFormDocument

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
private Document buildFormDocument(
        FlexScaffoldMetadata flexScaffoldMetadata,
        List<FieldMetadata> elegibleFields) {
    ActionScriptType entityType = ActionScriptMappingUtils
            .toActionScriptType(flexScaffoldMetadata.getEntity());
    StringTemplate listViewTemplate = this.templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);
    listViewTemplate.setAttribute("fields", wrapFields(elegibleFields));
    Set<RelatedTypeWrapper> relatedTypes = findRelatedTypes(
            flexScaffoldMetadata, elegibleFields);
    listViewTemplate.setAttribute("relatedTypes", relatedTypes);
    listViewTemplate.setAttribute("labelFields",
            calculateLabelFields(relatedTypes));
    try {
        ByteArrayInputStream stream = new ByteArrayInputStream(
                listViewTemplate.toString().getBytes("UTF-8"));
        return XmlUtils.getDocumentBuilder().parse(stream);
    }
    catch (Exception e) {
        throw new IllegalStateException(
                "Failed to build list view document", e);
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:27,代码来源:FlexUIMetadataProvider.java

示例4: toString

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public String toString() {
	line = 0;
	column = 0;
	if ( offendingToken!=null ) {
		line = offendingToken.getLine();
		column = offendingToken.getColumn();
	}
	// TODO: actually set the right Grammar instance to get the filename
	// TODO: have to update all v2 grammar files for this. or use errormanager and tool to get the current grammar
	if (g != null) {
		file = g.getFileName();
	}
	StringTemplate st = getMessageTemplate();
	if ( arg!=null ) {
		st.setAttribute("arg", arg);
	}
	return super.toString(st);
}
 
开发者ID:Sable,项目名称:mclab-core,代码行数:19,代码来源:GrammarSyntaxMessage.java

示例5: getDOT

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
/** Return a String containing a DOT description that, when displayed,
   *  will show the incoming state machine visually.  All nodes reachable
   *  from startState will be included.
   */
  public String getDOT(State startState) {
      // The output DOT graph for visualization
StringTemplate dot = null;
markedStates = new HashSet();
      if ( startState instanceof DFAState ) {
          dot = stlib.getInstanceOf("org/antlr/tool/templates/dot/dfa");
	dot.setAttribute("startState",
			Utils.integer(startState.stateNumber));
	dot.setAttribute("useBox",
					 Boolean.valueOf(Tool.internalOption_ShowNFConfigsInDFA));
	walkCreatingDFADOT(dot, (DFAState)startState);
      }
      else {
          dot = stlib.getInstanceOf("org/antlr/tool/templates/dot/nfa");
	dot.setAttribute("startState",
			Utils.integer(startState.stateNumber));
	walkRuleNFACreatingDOT(dot, startState);
      }
dot.setAttribute("rankdir", rankdir);
      return dot.toString();
  }
 
开发者ID:Sable,项目名称:mclab-core,代码行数:26,代码来源:DOTGenerator.java

示例6: toString

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public String toString() {
	line = 0;
	column = 0;
	if ( offendingToken!=null ) {
		line = offendingToken.getLine();
		column = offendingToken.getColumn();
	}
	if ( g!=null ) {
		file = g.getFileName();
	}
	StringTemplate st = getMessageTemplate();
	if ( arg!=null ) {
		st.setAttribute("arg", arg);
	}
	if ( arg2!=null ) {
		st.setAttribute("arg2", arg2);
	}
	return super.toString(st);
}
 
开发者ID:Sable,项目名称:mclab-core,代码行数:20,代码来源:GrammarSemanticsMessage.java

示例7: toString

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public String toString() {
	GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode();
	line = decisionASTNode.getLine();
	column = decisionASTNode.getColumn();
	String fileName = probe.dfa.nfa.grammar.getFileName();
	if ( fileName!=null ) {
		file = fileName;
	}

	StringTemplate st = getMessageTemplate();
	st.setAttribute("targetRules", targetRules);
	st.setAttribute("alt", alt);
	st.setAttribute("callSiteStates", callSiteStates);

	List labels =
		probe.getSampleNonDeterministicInputSequence(sampleBadState);
	String input = probe.getInputSequenceDisplay(labels);
	st.setAttribute("input", input);

	return super.toString(st);
}
 
开发者ID:Sable,项目名称:mclab-core,代码行数:22,代码来源:RecursionOverflowMessage.java

示例8: main

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public void main(HttpExchange exchange) throws Exception
{
	StringTemplate st = templates.getInstanceOf("templates/main");
	st.setAttribute("version", new Version(config).getDeployedVersion());
	st.setAttribute("managerversion", config.getManagerDetails().getFullVersion());
	st.setAttribute("timeout", (Boolean.getBoolean(Utils.DEBUG_FLAG) ? 9999999 : 5000));
	st.setAttribute("tab_index", getIntParameterValue(exchange, "tab_index", 0));

	HttpExchangeUtils.respondHtmlMessage(exchange, 200, st.toString());
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:PagesHandler.java

示例9: versions

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public void versions(HttpExchange exchange) throws Exception
{
	SortedSet<WebVersion> allVersions = new Version(config).getVersions();
	WebVersion deployedVersion = new Version(config).getDeployedVersion();

	Set<WebVersion> newer = allVersions.headSet(deployedVersion);
	Set<WebVersion> older = allVersions.tailSet(deployedVersion);
	older.remove(deployedVersion);

	StringTemplate st = templates.getInstanceOf("templates/versions");
	st.setAttribute("newer", newer);
	st.setAttribute("older", older);
	st.setAttribute("current", Collections.singleton(deployedVersion));
	HttpExchangeUtils.respondHtmlMessage(exchange, 200, st.toString());
}
 
开发者ID:equella,项目名称:Equella,代码行数:16,代码来源:PagesHandler.java

示例10: progress

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
public void progress(HttpExchange exchange) throws IOException
{
	final String URI = "/pages/progress/";
	final String ajaxId = exchange.getRequestURI().toString().substring(URI.length());

	StringTemplate st = templates.getInstanceOf("templates/progress");
	st.setAttribute("ajaxId", ajaxId);
	HttpExchangeUtils.respondHtmlMessage(exchange, 200, st.toString());
}
 
开发者ID:equella,项目名称:Equella,代码行数:10,代码来源:PagesHandler.java

示例11: testFormWithTextFieldNoValidations

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
@Test
public void testFormWithTextFieldNoValidations() throws SAXException,
        IOException {
    ActionScriptType entityType = new ActionScriptType("com.foo.Person");
    StringTemplate listViewTemplate = templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    List<FieldMetadata> elegibleFields = new ArrayList<FieldMetadata>();
    FieldMetadata field = new FieldMetadataBuilder("MID:person#1",
            Modifier.PRIVATE, new JavaSymbolName("name"),
            JavaType.STRING_OBJECT, null).build();
    elegibleFields.add(field);
    listViewTemplate.setAttribute("fields",
            FlexUIMetadataProvider.wrapFields(elegibleFields));

    String result = listViewTemplate.toString();
    log.debug(result);

    assertFalse(result.contains("mx:StringValidator"));
    assertTrue(result.contains("s:TextInput"));

    ByteArrayInputStream stream = new ByteArrayInputStream(
            result.getBytes("UTF-8"));
    XmlUtils.getDocumentBuilder().parse(stream);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:29,代码来源:FormTemplateTests.java

示例12: testFormWithTextFieldSingleValidation

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
@Test
public void testFormWithTextFieldSingleValidation() throws SAXException,
        IOException {
    ActionScriptType entityType = new ActionScriptType("com.foo.Person");
    StringTemplate listViewTemplate = templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    List<FieldMetadata> elegibleFields = new ArrayList<FieldMetadata>();
    AnnotationMetadataBuilder annotation = new AnnotationMetadataBuilder(
            new JavaType("javax.validation.constraints.NotNull"),
            Collections.EMPTY_LIST);
    FieldMetadata field = new FieldMetadataBuilder("MID:person#1",
            Modifier.PRIVATE, Collections.singletonList(annotation),
            new JavaSymbolName("name"), JavaType.STRING_OBJECT).build();
    elegibleFields.add(field);
    listViewTemplate.setAttribute("fields",
            FlexUIMetadataProvider.wrapFields(elegibleFields));

    String result = listViewTemplate.toString();
    log.debug(result);

    assertTrue(result.contains("mx:StringValidator"));
    assertTrue(result.contains("s:TextInput"));

    ByteArrayInputStream stream = new ByteArrayInputStream(
            result.getBytes("UTF-8"));
    XmlUtils.getDocumentBuilder().parse(stream);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:32,代码来源:FormTemplateTests.java

示例13: testFormWithTextFieldMultipleValidations

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
@Test
public void testFormWithTextFieldMultipleValidations() throws SAXException,
        IOException {
    ActionScriptType entityType = new ActionScriptType("com.foo.Person");
    StringTemplate listViewTemplate = templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    List<FieldMetadata> elegibleFields = new ArrayList<FieldMetadata>();
    AnnotationMetadataBuilder annotation1 = new AnnotationMetadataBuilder(
            new JavaType("javax.validation.constraints.NotNull"),
            Collections.EMPTY_LIST);
    List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
    attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), 2));
    AnnotationMetadataBuilder annotation2 = new AnnotationMetadataBuilder(
            new JavaType("javax.validation.constraints.Size"), attrs);
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
    annotations.add(annotation1);
    annotations.add(annotation2);
    FieldMetadata field = new FieldMetadataBuilder("MID:person#1",
            Modifier.PRIVATE, annotations, new JavaSymbolName("name"),
            JavaType.STRING_OBJECT).build();
    elegibleFields.add(field);
    listViewTemplate.setAttribute("fields",
            FlexUIMetadataProvider.wrapFields(elegibleFields));

    String result = listViewTemplate.toString();
    log.debug(result);

    assertTrue(result.contains("mx:StringValidator"));
    assertTrue(result.contains("s:TextInput"));

    ByteArrayInputStream stream = new ByteArrayInputStream(
            result.getBytes("UTF-8"));
    XmlUtils.getDocumentBuilder().parse(stream);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:39,代码来源:FormTemplateTests.java

示例14: testFormWithNumberFieldNoValidations

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
@Test
public void testFormWithNumberFieldNoValidations() throws SAXException,
        IOException {
    ActionScriptType entityType = new ActionScriptType("com.foo.Person");
    StringTemplate listViewTemplate = templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    List<FieldMetadata> elegibleFields = new ArrayList<FieldMetadata>();
    FieldMetadata field = new FieldMetadataBuilder("MID:person#1",
            Modifier.PRIVATE, new JavaSymbolName("age"),
            JavaType.INT_OBJECT, null).build();
    elegibleFields.add(field);
    listViewTemplate.setAttribute("fields",
            FlexUIMetadataProvider.wrapFields(elegibleFields));

    String result = listViewTemplate.toString();
    log.debug(result);

    assertFalse(result.contains("mx:NumberValidator"));
    assertTrue(result.contains("s:TextInput"));

    ByteArrayInputStream stream = new ByteArrayInputStream(
            result.getBytes("UTF-8"));
    XmlUtils.getDocumentBuilder().parse(stream);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:29,代码来源:FormTemplateTests.java

示例15: testFormWithNumberFieldSingleValidation

import org.antlr.stringtemplate.StringTemplate; //导入方法依赖的package包/类
@Test
public void testFormWithNumberFieldSingleValidation() throws SAXException,
        IOException {
    ActionScriptType entityType = new ActionScriptType("com.foo.Person");
    StringTemplate listViewTemplate = templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_form");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);

    List<FieldMetadata> elegibleFields = new ArrayList<FieldMetadata>();
    AnnotationMetadataBuilder annotation = new AnnotationMetadataBuilder(
            new JavaType("javax.validation.constraints.NotNull"),
            Collections.EMPTY_LIST);
    FieldMetadata field = new FieldMetadataBuilder("MID:person#1",
            Modifier.PRIVATE, Collections.singletonList(annotation),
            new JavaSymbolName("age"), JavaType.INT_OBJECT).build();
    elegibleFields.add(field);
    listViewTemplate.setAttribute("fields",
            FlexUIMetadataProvider.wrapFields(elegibleFields));

    String result = listViewTemplate.toString();
    log.debug(result);

    assertTrue(result.contains("mx:NumberValidator"));
    assertTrue(result.contains("s:TextInput"));

    ByteArrayInputStream stream = new ByteArrayInputStream(
            result.getBytes("UTF-8"));
    XmlUtils.getDocumentBuilder().parse(stream);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:32,代码来源:FormTemplateTests.java


注:本文中的org.antlr.stringtemplate.StringTemplate.setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。