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


Java Diagram类代码示例

本文整理汇总了Java中net.sourceforge.plantuml.core.Diagram的典型用法代码示例。如果您正苦于以下问题:Java Diagram类的具体用法?Java Diagram怎么用?Java Diagram使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: generateImage

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException {
	if (blocks.size() == 0) {
		noStartumlFound(os, fileFormatOption);
		return null;
	}
	for (BlockUml b : blocks) {
		final Diagram system = b.getDiagram();
		final int nbInSystem = system.getNbImages();
		if (numImage < nbInSystem) {
			// final CMapData cmap = new CMapData();
			final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
			if (imageData.containsCMapData()) {
				return system.getDescription().getDescription() + "\n" + imageData.getCMapData("plantuml");
			}
			return system.getDescription().getDescription();
		}
		numImage -= nbInSystem;
	}
	Log.error("numImage is too big = " + numImage);
	return null;

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

示例2: generateDiagramDescription

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public DiagramDescription generateDiagramDescription(OutputStream os, int numImage,
		FileFormatOption fileFormatOption) throws IOException {
	if (blocks.size() == 0) {
		noStartumlFound(os, fileFormatOption);
		return null;
	}
	for (BlockUml b : blocks) {
		final Diagram system = b.getDiagram();
		final int nbInSystem = system.getNbImages();
		if (numImage < nbInSystem) {
			// final CMapData cmap = new CMapData();
			final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
			if (imageData.containsCMapData()) {
				return ((DiagramDescriptionImpl) system.getDescription()).withCMapData(imageData
						.getCMapData("plantuml"));
			}
			return system.getDescription();
		}
		numImage -= nbInSystem;
	}
	Log.error("numImage is too big = " + numImage);
	return null;

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

示例3: getGeneratedImages

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public List<GeneratedImage> getGeneratedImages() throws IOException {
	Log.info("Reading file: " + file);

	final List<GeneratedImage> result = new ArrayList<GeneratedImage>();

	for (BlockUml blockUml : builder.getBlockUmls()) {
		final File suggested = outputFile;

		final Diagram system = blockUml.getDiagram();
		OptionFlags.getInstance().logData(file, system);

		for (File f : PSystemUtils.exportDiagrams(system, suggested, fileFormatOption)) {
			final String desc = "[" + file.getName() + "] " + system.getDescription();
			final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml);
			result.add(generatedImage);
		}

	}

	Log.info("Number of image(s): " + result.size());

	return Collections.unmodifiableList(result);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:24,代码来源:SourceFileReader2.java

示例4: create

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public static MDADiagram create(String uml) {
	List<BlockUml> blocks = new SourceStringReader(uml).getBlocks();
	if (blocks.size() == 0) {
		uml = "@startuml\n" + uml + "\[email protected]";
		blocks = new SourceStringReader(uml).getBlocks();
		if (blocks.size() == 0) {
			return null;
		}
	}
	final BlockUml block = blocks.get(0);
	final Diagram diagram = block.getDiagram();
	if (diagram instanceof ClassDiagram) {
		return new MDADiagramImpl((ClassDiagram) diagram);
	}
	return null;
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:17,代码来源:MDADiagramImpl.java

示例5: exportDiagrams

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public static List<File> exportDiagrams(Diagram system, File suggestedFile, FileFormatOption fileFormatOption)
		throws IOException {
	if (system instanceof UmlDiagram) {
		final ISkinParam skinParam = ((UmlDiagram) system).getSkinParam();
		fileFormatOption = fileFormatOption.withSvgLinkTarget(skinParam.getSvgLinkTarget());
	}
	if (system instanceof NewpagedDiagram) {
		return exportDiagramsNewpaged((NewpagedDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof SequenceDiagram) {
		return exportDiagramsSequence((SequenceDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof CucaDiagram) {
		return exportDiagramsCuca((CucaDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof ActivityDiagram3) {
		return exportDiagramsActivityDiagram3((ActivityDiagram3) system, suggestedFile, fileFormatOption);
	}
	return exportDiagramsDefault(system, suggestedFile, fileFormatOption);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:21,代码来源:PSystemUtils.java

示例6: exportDiagramsDefault

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
static private List<File> exportDiagramsDefault(Diagram system, File suggestedFile, FileFormatOption fileFormat)
		throws IOException {
	if (suggestedFile.exists() && suggestedFile.isDirectory()) {
		throw new IllegalArgumentException("File is a directory " + suggestedFile);
	}
	OutputStream os = null;
	try {
		if (canFileBeWritten(suggestedFile) == false) {
			return Collections.emptyList();
		}
		os = new BufferedOutputStream(new FileOutputStream(suggestedFile));
		// system.exportDiagram(os, null, 0, fileFormat);
		system.exportDiagram(os, 0, fileFormat);
	} finally {
		if (os != null) {
			os.close();
		}
	}
	return Arrays.asList(suggestedFile);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:21,代码来源:PSystemUtils.java

示例7: generateImage

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException {
	if (blocks.size() == 0) {
		noStartumlFound(os, fileFormatOption);
		return null;
	}
	for (BlockUml b : blocks) {
		final Diagram system = b.getDiagram();
		final int nbInSystem = system.getNbImages();
		if (numImage < nbInSystem) {
			//final CMapData cmap = new CMapData();
			final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
			if (imageData.containsCMapData()) {
				return system.getDescription().getDescription() + "\n" + imageData.getCMapData("plantuml");
			}
			return system.getDescription().getDescription();
		}
		numImage -= nbInSystem;
	}
	Log.error("numImage is too big = " + numImage);
	return null;

}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:23,代码来源:SourceStringReader.java

示例8: generateDiagramDescription

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public DiagramDescription generateDiagramDescription(OutputStream os, int numImage, FileFormatOption fileFormatOption)
		throws IOException {
	if (blocks.size() == 0) {
		noStartumlFound(os, fileFormatOption);
		return null;
	}
	for (BlockUml b : blocks) {
		final Diagram system = b.getDiagram();
		final int nbInSystem = system.getNbImages();
		if (numImage < nbInSystem) {
			// final CMapData cmap = new CMapData();
			final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
			if (imageData.containsCMapData()) {
				return ((DiagramDescriptionImpl) system.getDescription()).withCMapData(imageData
						.getCMapData("plantuml"));
			}
			return system.getDescription();
		}
		numImage -= nbInSystem;
	}
	Log.error("numImage is too big = " + numImage);
	return null;

}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:25,代码来源:SourceStringReader.java

示例9: checkSyntaxFair

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public static SyntaxResult checkSyntaxFair(String source) {
	final SyntaxResult result = new SyntaxResult();
	final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source,
			Collections.<String> emptyList());

	final Diagram system = sourceStringReader.getBlocks().get(0).getDiagram();
	result.setCmapData(system.hasUrl());
	if (system instanceof UmlDiagram) {
		result.setUmlDiagramType(((UmlDiagram) system).getUmlDiagramType());
		result.setDescription(system.getDescription().getDescription());
	} else if (system instanceof PSystemError) {
		result.setError(true);
		final PSystemError sys = (PSystemError) system;
		result.setErrorLinePosition(sys.getHigherErrorPosition());
		for (ErrorUml er : sys.getErrorsUml()) {
			result.addErrorText(er.getError());
		}
		result.setSystemError(sys);
		result.setSuggest(sys.getSuggest());
	} else {
		result.setDescription(system.getDescription().getDescription());
	}
	return result;
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:25,代码来源:SyntaxChecker.java

示例10: getGeneratedImages

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public List<GeneratedImage> getGeneratedImages() throws IOException {
	Log.info("Reading file: " + file);

	final List<GeneratedImage> result = new ArrayList<GeneratedImage>();

	for (BlockUml blockUml : builder.getBlockUmls()) {
		final File suggested = outputFile;

		final Diagram system = blockUml.getDiagram();
		OptionFlags.getInstance().logData(file, system);

		for (File f : PSystemUtils.exportDiagrams(system, suggested, fileFormatOption)) {
			final String desc = "[" + file.getName() + "] " + system.getDescription();
			final GeneratedImage generatedImage = new GeneratedImage(f, desc, blockUml);
			result.add(generatedImage);
		}

	}

	Log.info("Number of image(s): " + result.size());

	return Collections.unmodifiableList(result);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:24,代码来源:SourceFileReader2.java

示例11: exportDiagrams

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public static List<File> exportDiagrams(Diagram system, File suggestedFile, FileFormatOption fileFormatOption)
		throws IOException {
	if (system instanceof NewpagedDiagram) {
		return exportDiagramsNewpaged((NewpagedDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof SequenceDiagram) {
		return exportDiagramsSequence((SequenceDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof CucaDiagram) {
		return exportDiagramsCuca((CucaDiagram) system, suggestedFile, fileFormatOption);
	}
	if (system instanceof ActivityDiagram3) {
		return exportDiagramsActivityDiagram3((ActivityDiagram3) system, suggestedFile, fileFormatOption);
	}
	return exportDiagramsDefault(system, suggestedFile, fileFormatOption);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:17,代码来源:PSystemUtils.java

示例12: createPSystem

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
final public Diagram createPSystem(final List<CharSequence2> strings2) {

		final List<PSystemFactory> factories = getAllFactories();

		final DiagramType type = DiagramType.getTypeFromArobaseStart(strings2.get(0).toString2());

		final UmlSource umlSource = new UmlSource(strings2, type == DiagramType.UML);
		final DiagramType diagramType = umlSource.getDiagramType();
		final List<PSystemError> errors = new ArrayList<PSystemError>();
		for (PSystemFactory systemFactory : factories) {
			if (diagramType != systemFactory.getDiagramType()) {
				continue;
			}
			final Diagram sys = systemFactory.createSystem(umlSource);
			if (isOk(sys)) {
				return sys;
			}
			errors.add((PSystemError) sys);
		}

		final PSystemError err = PSystemError.merge(errors);
		// if (OptionFlags.getInstance().isQuiet() == false) {
		// err.print(System.err);
		// }
		return err;

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

示例13: logData

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public void logData(File file, Diagram system) {
	final String warnOrError = system.getWarningOrError();
	if (warnOrError == null) {
		return;
	}
	synchronized (logDataInitized) {
		if (logData == null && logDataInitized.get() == false) {
			final String s = GraphvizUtils.getenvLogData();
			if (s != null) {
				setLogData(new File(s));
			}
			logDataInitized.set(true);
		}

		if (logData == null) {
			return;
		}
		// final PSystemError systemError = (PSystemError) system;
		PrintStream ps = null;
		try {
			ps = new PrintStream(new FileOutputStream(logData, true));
			ps.println("Start of " + file.getName());
			ps.println(warnOrError);
			ps.println("End of " + file.getName());
			ps.println();
		} catch (FileNotFoundException e) {
			Log.error("Cannot open " + logData);
			e.printStackTrace();
		} finally {
			if (ps != null) {
				ps.close();
			}
		}
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:36,代码来源:OptionFlags.java

示例14: lineErrorRaw

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public int lineErrorRaw() {
	final Diagram system = blockUml.getDiagram();
	if (system instanceof PSystemError) {
		return ((PSystemError) system).getHigherErrorPosition() + blockUml.getStartLine();
	}
	return -1;
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:8,代码来源:GeneratedImageImpl.java

示例15: checkSyntaxFair

import net.sourceforge.plantuml.core.Diagram; //导入依赖的package包/类
public static SyntaxResult checkSyntaxFair(String source) {
	final SyntaxResult result = new SyntaxResult();
	final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source,
			Collections.<String> emptyList());

	final List<BlockUml> blocks = sourceStringReader.getBlocks();
	if (blocks.size() == 0) {
		result.setError(true);
		result.setErrorLinePosition(lastLineNumber(source));
		result.addErrorText("No @enduml found");
		result.setSuggest(Arrays.asList("Did you mean:", "@enduml"));
		return result;
	}

	final Diagram system = blocks.get(0).getDiagram();
	result.setCmapData(system.hasUrl());
	if (system instanceof UmlDiagram) {
		result.setUmlDiagramType(((UmlDiagram) system).getUmlDiagramType());
		result.setDescription(system.getDescription().getDescription());
	} else if (system instanceof PSystemError) {
		result.setError(true);
		final PSystemError sys = (PSystemError) system;
		result.setErrorLinePosition(sys.getHigherErrorPosition());
		result.setLineLocation(sys.getLineLocation());
		for (ErrorUml er : sys.getErrorsUml()) {
			result.addErrorText(er.getError());
		}
		result.setSystemError(sys);
		result.setSuggest(sys.getSuggest());
	} else {
		result.setDescription(system.getDescription().getDescription());
	}
	return result;
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:35,代码来源:SyntaxChecker.java


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