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


Java SourceStringReader.generateImage方法代码示例

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


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

示例1: generateUMLStateMachine

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void generateUMLStateMachine(File outputDir, StateMachineType stateMachine,
    STErrorListener errorListener) throws IOException {
  StringWriter stringWriter = new StringWriter();
  NoIndentWriter writer = new NoIndentWriter(stringWriter);

  ST stStates = stGroup.getInstanceOf("stateMachine");
  stStates.add("stateMachine", stateMachine);
  stStates.write(writer, errorListener);

  String umlString = stringWriter.toString();

  SourceStringReader reader = new SourceStringReader(umlString);
  File outputFile = new File(outputDir, String.format("%s.png", stateMachine.getName()));
  FileOutputStream png = new FileOutputStream(outputFile);
  String desc = reader.generateImage(png);
}
 
开发者ID:FIXTradingCommunity,项目名称:fix-orchestra,代码行数:17,代码来源:ImgGenerator.java

示例2: generateUMLSequence

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void generateUMLSequence(File outputDir, MessageType message, FlowType flow,
    List<ResponseType> responseList, STErrorListener errorListener) throws IOException {
  StringWriter stringWriter = new StringWriter();
  NoIndentWriter writer = new NoIndentWriter(stringWriter);

  ST stSequence = stGroup.getInstanceOf("sequence");
  stSequence.add("message", message);
  stSequence.add("flow", flow);
  stSequence.write(writer, errorListener);
  generateResponses(responseList, writer, errorListener);
  ST stEnd = stGroup.getInstanceOf("sequenceEnd");
  stEnd.add("message", message);
  stEnd.write(writer, errorListener);

  String umlString = stringWriter.toString();

  SourceStringReader reader = new SourceStringReader(umlString);
  File outputFile =
      new File(outputDir, String.format("%s-%s.png", message.getName(), message.getScenario()));
  FileOutputStream png = new FileOutputStream(outputFile);
  String desc = reader.generateImage(png);
}
 
开发者ID:FIXTradingCommunity,项目名称:fix-orchestra,代码行数:23,代码来源:ImgGenerator.java

示例3: serialize

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
@Override
public void serialize(VerbatimNode node, Printer printer) {
    Type type = Type.getByName(node.getType());

    String formatted = type.wrap(node.getText());
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    SourceStringReader reader = new SourceStringReader(formatted);
    String desc;
    try {
        desc = reader.generateImage(baos, type.getFormatOption());
    } catch (IOException e) {
        throw new GeneratorException("Could not generate uml for node " + node, e);
    }
    final String rendered = type.render(baos.toByteArray(), desc);
    printer.print(rendered);
}
 
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:17,代码来源:PlantUmlVerbatimSerializer.java

示例4: processImage

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void processImage(String fileName) throws IOException {
	if (fileName.startsWith("/")) {
		throw new IllegalArgumentException();
	}
	final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
	final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	final FileFormat format = FileFormat.PNG;
	final DiagramDescription desc = sourceStringReader.generateDiagramDescription(baos,
			new FileFormatOption(format));
	final String pngFileName = format.changeName(fileName, 0);
	final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
	synchronized (this) {
		outgoing.remove(pngFileName);
		outgoing.remove(errorFileName);
		if (desc != null && desc.getDescription() != null) {
			outgoing.put(pngFileName, baos.toByteArray());
			if (desc.getDescription().startsWith("(Error)")) {
				final ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
				sourceStringReader.generateImage(errBaos, new FileFormatOption(FileFormat.ATXT));
				errBaos.close();
				outgoing.put(errorFileName, errBaos.toByteArray());
			}
		}
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:26,代码来源:FtpConnexion.java

示例5: applyOnFixtures

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
@Override
public String applyOnFixtures(List<FixtureCallResult> fixtureCallResults, String... parameters) {
    String plantUml = plantUmlSequenceDiagramGenerator.getPlantUmlScript(fixtureCallResults);

    SourceStringReader reader = new SourceStringReader(plantUml);
    final ByteArrayOutputStream os = new ByteArrayOutputStream();


    try {
        reader.generateImage(os, new FileFormatOption(FileFormat.SVG));
        os.close();
        return new String(os.toByteArray());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:slezier,项目名称:SimpleFunctionalTest,代码行数:17,代码来源:HtmlSequenceDiagram.java

示例6: createSvg

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
private String createSvg(String plantUmlMarkup) {
    SourceStringReader reader = new SourceStringReader(plantUmlMarkup);
    final ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
        reader.generateImage(os, new FileFormatOption(SVG));
        os.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    return new String(os.toByteArray());
}
 
开发者ID:bodar,项目名称:yatspec,代码行数:13,代码来源:SequenceDiagramGenerator.java

示例7: unitConversionSkill

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
@Test
public void unitConversionSkill() throws IOException {
    reset(factService);
    final Skill skill = skillRepo.get("unitConversion");
    final String uml = skill.renderUml();
    log.info("UML:\n{}", uml);

    final SourceStringReader reader = new SourceStringReader(uml);
    final File tempFile = new File(FileUtils.getTempDirectory(), "lumen_skill_unitConversion.png");
    final String generated = reader.generateImage(tempFile);
    log.info("Generated UML Activity Diagram {} to {}", generated, tempFile);
}
 
开发者ID:lumenrobot,项目名称:lumen,代码行数:13,代码来源:SkillUmlTest.java

示例8: storeDiagram

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
private void storeDiagram(String source, String fileName) throws IOException, FileNotFoundException {
    SourceStringReader reader = new SourceStringReader(source);
    final ByteArrayOutputStream os = new ByteArrayOutputStream();
    // Write the first image to "os"
    reader.generateImage(os, new FileFormatOption(FileFormat.SVG));
    os.close();
    FileOutputStream fos = new FileOutputStream(fileName);

    reader.generateImage(fos, new FileFormatOption(FileFormat.PNG));
    fos.close();
}
 
开发者ID:PayU-Tech,项目名称:Ratel,代码行数:12,代码来源:DiagramGenerator.java

示例9: processImage

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void processImage(String fileName) throws IOException {
	if (fileName.startsWith("/")) {
		throw new IllegalArgumentException();
	}
	final String pngFileName = getFutureFileName(fileName);
	boolean done = false;
	try {
		final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		final FileFormat format = getFileFormat();
		final DiagramDescription desc = sourceStringReader.generateDiagramDescription(baos, new FileFormatOption(
				format));
		final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
		synchronized (this) {
			outgoing.remove(pngFileName);
			futureOutgoing.remove(pngFileName);
			outgoing.remove(errorFileName);
			if (desc != null && desc.getDescription() != null) {
				outgoing.put(pngFileName, baos.toByteArray());
				done = true;
				if (desc.getDescription().startsWith("(Error)")) {
					final ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
					sourceStringReader.generateImage(errBaos, new FileFormatOption(FileFormat.ATXT));
					errBaos.close();
					outgoing.put(errorFileName, errBaos.toByteArray());
				}
			}
		}
	} finally {
		if (done == false) {
			outgoing.put(pngFileName, new byte[0]);
		}
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:35,代码来源:FtpConnexion.java

示例10: run

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void run() {
	try {
		final String uml = runInternal();
		Log.println("UML=" + uml);
		final SourceStringReader s = new SourceStringReader(uml);
		s.generateImage(os, new FileFormatOption(FileFormat.ATXT));
		os.close();
		br.close();
	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:14,代码来源:AcceptTelnetClient.java

示例11: generatePNG

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void generatePNG(String output) throws IOException {
    try {
    	OutputStream       png    = new FileOutputStream  (output);
    	SourceStringReader reader = new SourceStringReader(this.toString());
    	String desc = reader.generateImage(png);
    	png.close();
	} 
    catch ( Exception e) { e.printStackTrace(); }
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:10,代码来源:EMFModelPlantUMLSerializer.java

示例12: render

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
public void render(final List<TracingEvent> messages) {
    try {
        final OutputStream png = new FileOutputStream("out.png");
        String source = "@startuml\n";
        for (final TracingEvent message : messages) {
            // TODO use renderers and remove asXXXMessage methods
            switch (message.getTraceType()) {
                case ENTRY:
                    source += message.asCallMessage()+"\n";
                    break;
                case EXIT:
                    source += message.asExitMessage()+"\n";
                    break;
                case EXCEPTION:
                    source += message.getTarget().getName() + " -> " + message.getSource().getName() + " : <color:red>throws" + "(" + Arrays.deepToString(message.getArgs()) + ")</color>"+"\n";
                    break;
            }
        }

        source += "@enduml\n";

        final SourceStringReader reader = new SourceStringReader(source);
        reader.generateImage(png);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:jensnerche,项目名称:TraceToPlantUml,代码行数:28,代码来源:RenderToPng.java

示例13: generateImage

import net.sourceforge.plantuml.SourceStringReader; //导入方法依赖的package包/类
@Override
protected void generateImage(File pngFile, NamedBlockNode named) throws Exception {
    log.debug("About to generated PlantUML diagram as PNG files {}", pngFile.getAbsolutePath());

    OutputStream png = new FileOutputStream(pngFile);
    String source = named.getBody();

    SourceStringReader reader = new SourceStringReader(source);
    String desc = reader.generateImage(png);

    log.info("PlantUML diagram generated as PNG files {} (description: {})", pngFile.getAbsolutePath(), desc);
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:13,代码来源:PlantUMLToHtmlPlugin.java


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