1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-16 23:22:24 +00:00
plantuml/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java

158 lines
6.6 KiB
Java
Raw Normal View History

2010-11-15 20:35:36 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2016-01-09 12:15:40 +00:00
* (C) Copyright 2009-2017, Arnaud Roques
2010-11-15 20:35:36 +00:00
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
2010-11-15 20:35:36 +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
*
2010-11-15 20:35:36 +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
2013-12-10 19:36:50 +00:00
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
2010-11-15 20:35:36 +00:00
* 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
2013-12-10 19:36:50 +00:00
*
2010-11-15 20:35:36 +00:00
*
*/
package net.sourceforge.plantuml.classdiagram;
2013-12-10 19:36:50 +00:00
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.UmlDiagramType;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
2015-04-07 18:18:37 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClass;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
2015-04-07 18:18:37 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2.Mode;
2011-08-08 17:48:29 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandDiamondAssociation;
2018-03-09 21:37:34 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass;
2016-03-06 16:47:34 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificStereotype;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandImport;
2015-04-07 18:18:37 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandLayoutNewLine;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkLollipop;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
2018-03-09 21:37:34 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.classdiagram.command.CommandStereotype;
import net.sourceforge.plantuml.classdiagram.command.CommandUrl;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.command.Command;
2010-11-15 20:35:36 +00:00
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.CommandNamespace;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.command.CommandPackage;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.command.CommandPackageEmpty;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.command.CommandPage;
2013-12-10 19:36:50 +00:00
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;
2015-05-31 18:56:03 +00:00
import net.sourceforge.plantuml.command.note.FactoryTipOnEntityCommand;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.command.regex.RegexLeaf;
2017-10-07 09:46:53 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementMultilines;
2016-01-30 12:20:07 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandNewpage;
2017-10-07 09:46:53 +00:00
import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol;
2016-01-09 12:15:40 +00:00
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject;
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines;
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
public class ClassDiagramFactory extends UmlDiagramFactory {
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
@Override
public ClassDiagram createEmptyDiagram() {
return new ClassDiagram();
2010-11-15 20:35:36 +00:00
}
@Override
2013-12-10 19:36:50 +00:00
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<Command>();
2015-04-07 18:18:37 +00:00
cmds.add(new CommandFootboxIgnored());
2013-12-10 19:36:50 +00:00
addCommonCommands(cmds);
cmds.add(new CommandRankDir());
2016-01-30 12:20:07 +00:00
cmds.add(new CommandNewpage(this));
2018-03-09 21:37:34 +00:00
// cmds.add(new CommandHideShowSpecificStereotype());
2013-12-10 19:36:50 +00:00
cmds.add(new CommandPage());
cmds.add(new CommandAddMethod());
2018-03-09 21:37:34 +00:00
cmds.add(new CommandHideShow2());
cmds.add(new CommandRemoveRestore());
2018-06-12 20:50:45 +00:00
cmds.add(new CommandCreateClassMultilines());
cmds.add(new CommandCreateEntityObjectMultilines());
2013-12-10 19:36:50 +00:00
cmds.add(new CommandCreateClass());
2016-01-09 12:15:40 +00:00
cmds.add(new CommandCreateEntityObject());
2015-04-07 18:18:37 +00:00
cmds.add(new CommandAllowMixing());
cmds.add(new CommandLayoutNewLine());
2013-12-10 19:36:50 +00:00
cmds.add(new CommandPackage());
cmds.add(new CommandEndPackage());
cmds.add(new CommandPackageEmpty());
2017-10-07 09:46:53 +00:00
cmds.add(new CommandPackageWithUSymbol());
2018-06-12 20:50:45 +00:00
cmds.add(new CommandCreateElementFull2(Mode.NORMAL_KEYWORD));
cmds.add(new CommandCreateElementFull2(Mode.WITH_MIX_PREFIX));
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
cmds.add(factoryNoteCommand.createSingleLine());
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandNamespace());
cmds.add(new CommandStereotype());
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandLinkClass(UmlDiagramType.CLASS));
cmds.add(new CommandLinkLollipop(UmlDiagramType.CLASS));
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandImport());
2015-06-07 10:23:10 +00:00
2015-05-31 18:56:03 +00:00
final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand(new RegexLeaf(
2017-04-05 17:37:42 +00:00
"ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([%g][^%g]+[%g]|[^%s]+)"));
2015-09-06 17:28:59 +00:00
cmds.add(factoryTipOnEntityCommand.createMultiLine(true));
cmds.add(factoryTipOnEntityCommand.createMultiLine(false));
2015-05-31 18:56:03 +00:00
2013-12-10 19:36:50 +00:00
final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand(new RegexLeaf(
2015-04-07 18:18:37 +00:00
"ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])"));
2013-12-10 19:36:50 +00:00
cmds.add(factoryNoteOnEntityCommand.createSingleLine());
cmds.add(new CommandUrl());
2010-11-15 20:35:36 +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));
2015-05-31 18:56:03 +00:00
2013-12-10 19:36:50 +00:00
final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand();
cmds.add(factoryNoteOnLinkCommand.createSingleLine());
2015-09-06 17:28:59 +00:00
cmds.add(factoryNoteOnLinkCommand.createMultiLine(false));
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandDiamondAssociation());
2011-08-08 17:48:29 +00:00
2018-03-09 21:37:34 +00:00
// cmds.add(new CommandHideShowSpecificClass());
2011-08-08 17:48:29 +00:00
2013-12-10 19:36:50 +00:00
cmds.add(new CommandNamespaceSeparator());
2010-11-15 20:35:36 +00:00
2017-10-07 09:46:53 +00:00
cmds.add(new CommandCreateElementMultilines(0));
cmds.add(new CommandCreateElementMultilines(1));
2013-12-10 19:36:50 +00:00
return cmds;
2010-11-15 20:35:36 +00:00
}
}