1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-31 23:50:49 +00:00
plantuml/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java

135 lines
5.1 KiB
Java
Raw Normal View History

2013-12-10 19:36:50 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2019-01-16 18:34:41 +00:00
* (C) Copyright 2009-2020, Arnaud Roques
2013-12-10 19:36:50 +00:00
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
2013-12-10 19:36:50 +00:00
*
2017-03-15 19:13:31 +00:00
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
2013-12-10 19:36:50 +00:00
* 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.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.descdiagram;
import java.util.ArrayList;
import java.util.List;
2019-06-26 19:24:49 +00:00
import net.sourceforge.plantuml.ISkinSimple;
2018-03-09 21:37:34 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
2019-06-26 19:24:49 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
2018-03-09 21:37:34 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandEndPackage;
2015-04-07 18:18:37 +00:00
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.command.CommandPage;
import net.sourceforge.plantuml.command.CommandRankDir;
2020-09-30 20:57:58 +00:00
import net.sourceforge.plantuml.command.PSystemCommandFactory;
2020-02-18 21:24:31 +00:00
import net.sourceforge.plantuml.command.note.CommandFactoryNote;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
2017-07-03 17:59:53 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandArchimate;
2018-10-21 19:44:14 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandArchimateMultilines;
2013-12-10 19:36:50 +00:00
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;
2020-09-30 20:57:58 +00:00
public class DescriptionDiagramFactory extends PSystemCommandFactory {
2013-12-10 19:36:50 +00:00
2019-06-26 19:24:49 +00:00
private final ISkinSimple skinParam;
public DescriptionDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
2013-12-10 19:36:50 +00:00
@Override
public DescriptionDiagram createEmptyDiagram() {
2019-06-26 19:24:49 +00:00
return new DescriptionDiagram(skinParam);
2013-12-10 19:36:50 +00:00
}
@Override
protected List<Command> createCommands() {
2021-05-14 08:42:57 +00:00
final List<Command> cmds = new ArrayList<>();
2013-12-10 19:36:50 +00:00
2015-04-07 18:18:37 +00:00
cmds.add(new CommandFootboxIgnored());
cmds.add(new CommandNamespaceSeparator());
2013-12-10 19:36:50 +00:00
cmds.add(new CommandRankDir());
cmds.add(new CommandNewpage(this));
2019-04-21 20:40:01 +00:00
addCommonCommands1(cmds);
2013-12-10 19:36:50 +00:00
cmds.add(new CommandPage());
cmds.add(new CommandLinkElement());
2018-03-09 21:37:34 +00:00
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
2013-12-10 19:36:50 +00:00
//
cmds.add(new CommandPackageWithUSymbol());
cmds.add(new CommandEndPackage());
2020-02-18 21:24:31 +00:00
final CommandFactoryNote factoryNoteCommand = new CommandFactoryNote();
2015-09-06 17:28:59 +00:00
cmds.add(factoryNoteCommand.createMultiLine(false));
2013-12-10 19:36:50 +00:00
2020-11-21 17:33:24 +00:00
final CommandFactoryNoteOnLink factoryNoteOnLinkCommand = new CommandFactoryNoteOnLink();
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
2020-02-18 21:24:31 +00:00
final CommandFactoryNoteOnEntity factoryNoteOnEntityCommand = new CommandFactoryNoteOnEntity("desc",
2019-06-26 19:24:49 +00:00
new RegexOr("ENTITY", //
new RegexLeaf("[\\p{L}0-9_.]+"), //
new RegexLeaf("\\(\\)[%s]*[\\p{L}0-9_.]+"), //
new RegexLeaf("\\(\\)[%s]*[%g][^%g]+[%g]"), //
new RegexLeaf("\\[[^\\]*]+[^\\]]*\\]"), //
new RegexLeaf("\\((?!\\*\\))[^\\)]+\\)"), //
new RegexLeaf(":[^:]+:"), //
new RegexLeaf("[%g][^%g]+[%g]") //
2013-12-10 19:36:50 +00:00
));
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
cmds.add(factoryNoteCommand.createSingleLine());
cmds.add(new CommandUrl());
cmds.add(new CommandCreateElementFull());
2015-07-11 09:32:49 +00:00
cmds.add(new CommandCreateElementMultilines(0));
cmds.add(new CommandCreateElementMultilines(1));
2013-12-10 19:36:50 +00:00
2015-09-06 17:28:59 +00:00
cmds.add(factoryNoteOnEntityCommand.createMultiLine(true));
cmds.add(factoryNoteOnEntityCommand.createMultiLine(false));
cmds.add(factoryNoteCommand.createMultiLine(false));
2013-12-10 19:36:50 +00:00
2018-03-09 21:37:34 +00:00
// cmds.add(new CommandHideShowSpecificClass());
2016-01-09 12:15:40 +00:00
2017-07-03 17:59:53 +00:00
cmds.add(new CommandArchimate());
2018-10-21 19:44:14 +00:00
cmds.add(new CommandArchimateMultilines());
2018-05-21 19:15:19 +00:00
cmds.add(new CommandCreateDomain());
2017-07-03 17:59:53 +00:00
2013-12-10 19:36:50 +00:00
return cmds;
}
}