plantuml/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java

132 lines
5.4 KiB
Java
Raw Normal View History

2013-12-10 19:36:50 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2022-03-07 19:33:46 +00:00
* (C) Copyright 2009-2023, 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.List;
2022-09-20 20:35:41 +00:00
import java.util.Map;
2013-12-10 19:36:50 +00:00
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.CommandRankDir;
2022-01-28 21:45:34 +00:00
import net.sourceforge.plantuml.command.CommonCommands;
2022-02-10 18:16:18 +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;
2021-05-23 15:35:13 +00:00
import net.sourceforge.plantuml.core.UmlSource;
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;
2023-01-09 19:13:37 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandTogether;
2022-07-27 13:51:02 +00:00
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateJson;
2022-08-26 16:00:28 +00:00
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateJsonSingleLine;
2022-07-27 13:51:02 +00:00
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
2013-12-10 19:36:50 +00:00
2020-09-30 20:57:58 +00:00
public class DescriptionDiagramFactory extends PSystemCommandFactory {
2013-12-10 19:36:50 +00:00
@Override
2022-09-20 20:35:41 +00:00
public DescriptionDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
2022-09-18 17:08:06 +00:00
return new DescriptionDiagram(source, skinParam);
2013-12-10 19:36:50 +00:00
}
@Override
2022-12-16 16:20:14 +00:00
protected void initCommandsList(List<Command> cmds) {
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));
2022-01-28 21:45:34 +00:00
CommonCommands.addCommonCommands1(cmds);
2013-12-10 19:36:50 +00:00
cmds.add(new CommandLinkElement());
2018-03-09 21:37:34 +00:00
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
2023-01-09 19:13:37 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandPackageWithUSymbol());
2023-01-09 19:13:37 +00:00
cmds.add(new CommandTogether());
2013-12-10 19:36:50 +00:00
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));
2022-01-28 21:45:34 +00:00
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", //
2021-05-23 15:35:13 +00:00
new RegexLeaf("[%pLN_.]+"), //
new RegexLeaf("\\(\\)[%s]*[%pLN_.]+"), //
2019-06-26 19:24:49 +00:00
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
2022-07-27 13:51:02 +00:00
cmds.add(new CommandCreateMap());
cmds.add(new CommandCreateJson());
2022-08-26 16:00:28 +00:00
cmds.add(new CommandCreateJsonSingleLine());
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());
2013-12-10 19:36:50 +00:00
}
}