mirror of
https://github.com/octoleo/plantuml.git
synced 2024-06-05 10:00:47 +00:00
124 lines
4.6 KiB
Java
124 lines
4.6 KiB
Java
|
/* ========================================================================
|
||
|
* PlantUML : a free UML diagram generator
|
||
|
* ========================================================================
|
||
|
*
|
||
|
* (C) Copyright 2009-2013, Arnaud Roques
|
||
|
*
|
||
|
* Project Info: http://plantuml.sourceforge.net
|
||
|
*
|
||
|
* This file is part of PlantUML.
|
||
|
*
|
||
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||
|
* under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* PlantUML distributed in the hope that it will be useful, but
|
||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||
|
* License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||
|
* USA.
|
||
|
*
|
||
|
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||
|
* in the United States and other countries.]
|
||
|
*
|
||
|
* Original Author: Arnaud Roques
|
||
|
*
|
||
|
* Revision $Revision: 7920 $
|
||
|
*
|
||
|
*/
|
||
|
package net.sourceforge.plantuml.descdiagram;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
import net.sourceforge.plantuml.AbstractPSystem;
|
||
|
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
|
||
|
import net.sourceforge.plantuml.command.Command;
|
||
|
import net.sourceforge.plantuml.command.CommandEndPackage;
|
||
|
import net.sourceforge.plantuml.command.CommandPackage;
|
||
|
import net.sourceforge.plantuml.command.CommandPage;
|
||
|
import net.sourceforge.plantuml.command.CommandRankDir;
|
||
|
import net.sourceforge.plantuml.command.UmlDiagramFactory;
|
||
|
import net.sourceforge.plantuml.command.note.FactoryNoteCommand;
|
||
|
import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand;
|
||
|
import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand;
|
||
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||
|
import net.sourceforge.plantuml.command.regex.RegexOr;
|
||
|
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementFull;
|
||
|
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementMultilines;
|
||
|
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||
|
import net.sourceforge.plantuml.descdiagram.command.CommandNewpage;
|
||
|
import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol;
|
||
|
|
||
|
public class DescriptionDiagramFactory extends UmlDiagramFactory {
|
||
|
|
||
|
@Override
|
||
|
public DescriptionDiagram createEmptyDiagram() {
|
||
|
return new DescriptionDiagram();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected List<Command> createCommands() {
|
||
|
final List<Command> cmds = new ArrayList<Command>();
|
||
|
|
||
|
cmds.add(new CommandRankDir());
|
||
|
cmds.add(new CommandNewpage(this));
|
||
|
addCommonCommands(cmds);
|
||
|
|
||
|
cmds.add(new CommandPage());
|
||
|
cmds.add(new CommandLinkElement());
|
||
|
//
|
||
|
cmds.add(new CommandPackageWithUSymbol());
|
||
|
cmds.add(new CommandPackage());
|
||
|
cmds.add(new CommandEndPackage());
|
||
|
// addCommand(new CommandNamespace());
|
||
|
// addCommand(new CommandEndNamespace());
|
||
|
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
|
||
|
cmds.add(factoryNoteCommand.createMultiLine());
|
||
|
|
||
|
final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexOr(
|
||
|
"ENTITY", //
|
||
|
new RegexLeaf("[\\p{L}0-9_.]+"), //
|
||
|
new RegexLeaf("\\(\\)\\s*[\\p{L}0-9_.]+"), //
|
||
|
new RegexLeaf("\\(\\)\\s*\"[^\"]+\""), //
|
||
|
new RegexLeaf("\\[[^\\]*]+[^\\]]*\\]"), //
|
||
|
new RegexLeaf("\\((?!\\*\\))[^\\)]+\\)"), //
|
||
|
new RegexLeaf(":[^:]+:"), //
|
||
|
new RegexLeaf("\"[^\"]+\"") //
|
||
|
));
|
||
|
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
|
||
|
|
||
|
cmds.add(factoryNoteCommand.createSingleLine());
|
||
|
cmds.add(new CommandUrl());
|
||
|
// addCommand(new CommandCreateComponent2());
|
||
|
cmds.add(new CommandCreateElementFull());
|
||
|
cmds.add(new CommandCreateElementMultilines());
|
||
|
// addCommand(new CommandCreateElementTyped());
|
||
|
// addCommand(new CommandCreateCircleInterface());
|
||
|
// addCommand(new CommandCreateActorInComponent());
|
||
|
|
||
|
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||
|
cmds.add(factoryNoteCommand.createMultiLine());
|
||
|
|
||
|
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
|
||
|
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
|
||
|
cmds.add(factoryNoteOnLinkCommand.createMultiLine());
|
||
|
|
||
|
return cmds;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String checkFinalError(AbstractPSystem system) {
|
||
|
if (system instanceof DescriptionDiagram) {
|
||
|
((DescriptionDiagram) system).applySingleStrategy();
|
||
|
}
|
||
|
return super.checkFinalError(system);
|
||
|
}
|
||
|
|
||
|
}
|