1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Fix UGraphic hierarchy

This commit is contained in:
Arnaud Roques 2023-03-12 12:41:34 +01:00
parent 5febaa9aeb
commit 9c62daa35d
24 changed files with 63 additions and 773 deletions

View File

@ -74,7 +74,6 @@ import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
import net.sourceforge.plantuml.font.PSystemListFontsFactory;
import net.sourceforge.plantuml.gitlog.GitDiagramFactory;
import net.sourceforge.plantuml.hcl.HclDiagramFactory;
import net.sourceforge.plantuml.help.HelpFactory;
import net.sourceforge.plantuml.jcckit.PSystemJcckitFactory;
import net.sourceforge.plantuml.jsondiagram.JsonDiagramFactory;
import net.sourceforge.plantuml.klimt.creole.legacy.PSystemCreoleFactory;
@ -237,18 +236,20 @@ public class PSystemBuilder {
factories.add(new PSystemXearthFactory());
}
// ::done
factories.add(new GanttDiagramFactory());
factories.add(new FlowDiagramFactory());
// factories.add(new PSystemTreeFactory(DiagramType.JUNGLE));
// factories.add(new PSystemCuteFactory(DiagramType.CUTE));
// ::comment when __CORE__
factories.add(new PSystemDedicationFactory());
// ::done
factories.add(new TimingDiagramFactory());
// ::comment when __CORE__
factories.add(new HelpFactory());
factories.add(new WireDiagramFactory());
// ::done
factories.add(new JsonDiagramFactory());
factories.add(new GitDiagramFactory());
// ::comment when __CORE__

View File

@ -66,11 +66,13 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
}
public UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
copy(defaultBackground, colorMapper, stringBounder, new BrailleGrid(QUANTA));
super(stringBounder);
copy(defaultBackground, colorMapper, new BrailleGrid(QUANTA));
register();
}
private UGraphicBraille(UGraphicBraille other) {
super(other.getStringBounder());
copy(other);
register();
}

View File

@ -1,78 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelp extends SingleLineCommand2<Help> {
// ::remove folder when __CORE__
public CommandHelp() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelp.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>General help");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" There are some other help command:");
diagram.add("* help types");
diagram.add("* help keywords");
diagram.add("* help preprocessors");
diagram.add("* help colors");
diagram.add("* help font");
diagram.add("* help skinparams");
diagram.add("* help themes");
return CommandExecutionResult.ok();
}
}

View File

@ -1,75 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.klimt.color.HColorSet;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelpColor extends SingleLineCommand2<Help> {
public CommandHelpColor() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpColor.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("colors?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on colors");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible colors are :");
for (String type : HColorSet.instance().names()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,77 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import java.awt.GraphicsEnvironment;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelpFont extends SingleLineCommand2<Help> {
public CommandHelpFont() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpFont.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("fonts?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on font");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible font on your system are :");
final String name[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (String n : name) {
diagram.add("* " + n);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,75 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelpKeyword extends SingleLineCommand2<Help> {
public CommandHelpKeyword() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpKeyword.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("keywords?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on keywords");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible keywords are :");
for (String type : new LanguageDescriptor().getKeyword()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,75 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.SkinParam;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelpSkinparam extends SingleLineCommand2<Help> {
public CommandHelpSkinparam() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpSkinparam.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("skinparams?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on skinparam");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible skinparam are :");
for (String type : SkinParam.getPossibleValues()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,88 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2021, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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: Matthew Leather
*
*
*/
package net.sourceforge.plantuml.help;
import java.io.IOException;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.theme.ThemeUtils;
import net.sourceforge.plantuml.utils.LineLocation;
import net.sourceforge.plantuml.utils.Log;
public class CommandHelpTheme extends SingleLineCommand2<Help> {
// ::remove folder when __HAXE__
public CommandHelpTheme() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpTheme.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("themes?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on themes");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible themes are :");
try {
for (String theme : ThemeUtils.getAllThemeNames()) {
diagram.add("* " + theme);
}
} catch (IOException e) {
final String message = "Unexpected error listing themes: " + e.getMessage();
Log.error(message);
Logme.error(e);
return CommandExecutionResult.error(message);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,75 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandHelpType extends SingleLineCommand2<Help> {
public CommandHelpType() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandHelpType.class.getName(), RegexLeaf.start(), //
new RegexLeaf("help"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("types?"), RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(Help diagram, LineLocation location, RegexResult arg) {
diagram.add("<b>Help on types");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add(
"You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible types are :");
for (String type : new LanguageDescriptor().getType()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -1,103 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.atmp.ImageBuilder;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.klimt.LineBreakStrategy;
import net.sourceforge.plantuml.klimt.creole.CreoleMode;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.klimt.creole.Sheet;
import net.sourceforge.plantuml.klimt.creole.SheetBlock1;
import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.klimt.font.UFont;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.skin.UmlDiagramType;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
public class Help extends UmlDiagram {
private final List<CharSequence> lines = new ArrayList<>();
public DiagramDescription getDescription() {
return new DiagramDescription("(Help)");
}
public Help(UmlSource source) {
super(source, UmlDiagramType.HELP, null);
}
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption).annotations(false);
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormat)
throws IOException {
final Display display = Display.create(lines);
final UFont font = UFont.serif(16);
final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
final Sheet sheet = getSkinParam().sheet(fontConfiguration, HorizontalAlignment.LEFT, CreoleMode.FULL)
.createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
return createImageBuilder(fileFormat).drawable(sheetBlock).write(os);
}
public void add(CharSequence line) {
this.lines.add(line);
}
@Override
public ClockwiseTopRightBottomLeft getDefaultMargins() {
return ClockwiseTopRightBottomLeft.same(0);
}
@Override
protected TextBlock getTextBlock() {
throw new UnsupportedOperationException();
}
}

View File

@ -1,63 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* 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.help;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource;
public class HelpFactory extends PSystemCommandFactory {
@Override
public Help createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new Help(source);
}
@Override
protected void initCommandsList(List<Command> cmds) {
cmds.add(new CommandHelp());
cmds.add(new CommandHelpColor());
cmds.add(new CommandHelpFont());
cmds.add(new CommandHelpKeyword());
cmds.add(new CommandHelpSkinparam());
cmds.add(new CommandHelpType());
cmds.add(new CommandHelpTheme());
}
}

View File

@ -63,25 +63,27 @@ public abstract class AbstractCommonUGraphic implements UGraphic {
private HColor color = HColors.none();
private boolean enlargeClip = false;
private /*final*/ StringBounder stringBounder;
private final StringBounder stringBounder;
private UTranslate translate = UTranslate.none();
private /*final*/ ColorMapper colorMapper;
private /* final */ ColorMapper colorMapper;
private UClip clip;
private /*final*/ HColor defaultBackground;
private /* final */ HColor defaultBackground;
public void basicCopy(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
protected AbstractCommonUGraphic(StringBounder stringBounder) {
this.stringBounder = stringBounder;
}
public void basicCopy(HColor defaultBackground, ColorMapper colorMapper) {
this.colorMapper = colorMapper;
this.defaultBackground = Objects.requireNonNull(defaultBackground);
this.stringBounder = stringBounder;
}
protected void basicCopy(AbstractCommonUGraphic other) {
this.defaultBackground = Objects.requireNonNull(other.defaultBackground);
this.enlargeClip = other.enlargeClip;
this.colorMapper = other.colorMapper;
this.stringBounder = other.stringBounder;
this.translate = other.translate;
this.clip = other.clip;
@ -94,7 +96,6 @@ public abstract class AbstractCommonUGraphic implements UGraphic {
protected abstract AbstractCommonUGraphic copyUGraphic();
@Override
public HColor getDefaultBackground() {
return defaultBackground;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.klimt.drawing;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import net.atmp.SpecialText;
import net.sourceforge.plantuml.activitydiagram3.ftile.CenteredText;
@ -67,10 +66,10 @@ import net.sourceforge.plantuml.klimt.shape.URectangle;
import net.sourceforge.plantuml.klimt.shape.UText;
public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
private /*final*/ O graphic;
private /*final*/ MinMaxMutable minmax;
private /* final */ O graphic;
private /* final */ MinMaxMutable minmax;
// It would be nice to do something like this but not sure how:
// Map<Class<SHAPE>, UDriver<SHAPE, O>>
@ -78,9 +77,12 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
// https://stackoverflow.com/questions/416540/java-map-with-values-limited-by-keys-type-parameter
private final Map<Class<? extends UShape>, UDriver<?, O>> drivers = new HashMap<>();
public void copy(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, O graphic) {
basicCopy(defaultBackground, colorMapper, stringBounder);
// super(Objects.requireNonNull(defaultBackground), colorMapper, stringBounder);
protected AbstractUGraphic(StringBounder stringBounder) {
super(stringBounder);
}
public void copy(HColor defaultBackground, ColorMapper colorMapper, O graphic) {
basicCopy(defaultBackground, colorMapper);
this.graphic = graphic;
this.minmax = MinMaxMutable.getEmpty(true);
}
@ -91,7 +93,6 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
this.minmax = other.minmax;
}
protected final O getGraphicObject() {
return graphic;
}

View File

@ -53,11 +53,13 @@ public class UGraphicNull extends AbstractUGraphic<String> implements EnsureVisi
}
private UGraphicNull(UGraphicNull other) {
super(FileFormat.PNG.getDefaultStringBounder());
copy(other);
}
public UGraphicNull() {
copy(HColors.BLACK, ColorMapper.IDENTITY, FileFormat.PNG.getDefaultStringBounder(), "foo");
super(FileFormat.PNG.getDefaultStringBounder());
copy(HColors.BLACK, ColorMapper.IDENTITY, "foo");
}
@Override

View File

@ -80,13 +80,14 @@ public class UGraphicDebug extends AbstractCommonUGraphic implements ClipContain
@Override
protected AbstractCommonUGraphic copyUGraphic() {
final UGraphicDebug result = new UGraphicDebug(this, output, scaleFactor, dim, svgLinkTarget, hoverPathColorRGB, seed,
preserveAspectRatio);
final UGraphicDebug result = new UGraphicDebug(this, output, scaleFactor, dim, svgLinkTarget, hoverPathColorRGB,
seed, preserveAspectRatio);
return result;
}
private UGraphicDebug(UGraphicDebug other, List<String> output, double scaleFactor, XDimension2D dim,
String svgLinkTarget, String hoverPathColorRGB, long seed, String preserveAspectRatio) {
super(other.getStringBounder());
basicCopy(other);
this.output = output;
this.scaleFactor = scaleFactor;
@ -99,7 +100,8 @@ public class UGraphicDebug extends AbstractCommonUGraphic implements ClipContain
public UGraphicDebug(double scaleFactor, XDimension2D dim, String svgLinkTarget, String hoverPathColorRGB,
long seed, String preserveAspectRatio) {
basicCopy(HColors.WHITE, ColorMapper.IDENTITY, new StringBounderDebug());
super(new StringBounderDebug());
basicCopy(HColors.WHITE, ColorMapper.IDENTITY);
this.output = new ArrayList<>();
this.scaleFactor = scaleFactor;
this.dim = dim;

View File

@ -67,6 +67,7 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
}
protected UGraphicEps(UGraphicEps other) {
super(other.getStringBounder());
copy(other);
this.strategyTOBEREMOVED = other.strategyTOBEREMOVED;
register();
@ -74,7 +75,8 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
public UGraphicEps(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder,
EpsStrategy strategy) {
copy(defaultBackground, colorMapper, stringBounder, strategy.creatEpsGraphics());
super(stringBounder);
copy(defaultBackground, colorMapper, strategy.creatEpsGraphics());
this.strategyTOBEREMOVED = strategy;
register();
}

View File

@ -112,6 +112,7 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
}
private UGraphicG2d(UGraphicG2d other) {
super(other.getStringBounder());
copy(other);
// ::comment when __CORE__
this.hasAffineTransform = other.hasAffineTransform;
@ -141,7 +142,8 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
// StringBounder stringBounder, Graphics2D g2d,
// double dpiFactor, double dx, double dy, FileFormat format) {
// ::done
copy(defaultBackground, colorMapper, stringBounder, g2d);
super(stringBounder);
copy(defaultBackground, colorMapper, g2d);
this.format = format;
this.dpiFactor = dpiFactor;
if (dpiFactor != 1.0)

View File

@ -56,7 +56,8 @@ public class UGraphicHtml5 extends AbstractUGraphic<Html5Drawer> implements Clip
}
public UGraphicHtml5(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
copy(defaultBackground, colorMapper, stringBounder, new Html5Drawer());
super(stringBounder);
copy(defaultBackground, colorMapper, new Html5Drawer());
registerDriver(URectangle.class, new DriverRectangleHtml5(this));
// registerDriver(UText.class, new DriverTextEps(imDummy, this, strategy));
ignoreShape(UText.class);

View File

@ -51,12 +51,14 @@ import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UText;
public class DriverTextSvg implements UDriver<UText, SvgGraphics> {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
private final StringBounder stringBounder;
private final ClipContainer clipContainer;
public DriverTextSvg(StringBounder stringBounder, ClipContainer clipContainer) {
if (stringBounder == null)
System.err.println("stringBounder=" + stringBounder);
this.stringBounder = stringBounder;
this.clipContainer = clipContainer;
}

View File

@ -60,9 +60,9 @@ import net.sourceforge.plantuml.klimt.shape.UText;
import net.sourceforge.plantuml.url.Url;
public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipContainer {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
private /* final */ boolean textAsPath;
private final boolean textAsPath;
private /* final */ SvgOption option;
public double dpiFactor() {
@ -71,21 +71,21 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
@Override
protected AbstractCommonUGraphic copyUGraphic() {
final UGraphicSvg result = new UGraphicSvg();
final UGraphicSvg result = new UGraphicSvg(getStringBounder(), textAsPath);
result.copy(this);
result.textAsPath = this.textAsPath;
result.option = this.option;
return result;
}
private UGraphicSvg() {
private UGraphicSvg(StringBounder stringBounder, boolean textAsPath) {
super(stringBounder);
this.textAsPath = textAsPath;
register();
}
public static UGraphicSvg build(SvgOption option, boolean textAsPath, long seed, StringBounder stringBounder) {
final UGraphicSvg result = new UGraphicSvg();
result.copy(option.getBackcolor(), option.getColorMapper(), stringBounder, new SvgGraphics(seed, option));
result.textAsPath = textAsPath;
final UGraphicSvg result = new UGraphicSvg(stringBounder, textAsPath);
result.copy(option.getBackcolor(), option.getColorMapper(), new SvgGraphics(seed, option));
result.option = option;
return result;
}

View File

@ -61,7 +61,8 @@ public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements Clip
public UGraphicTikz(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, double scale,
boolean withPreamble) {
copy(defaultBackground, colorMapper, stringBounder, new TikzGraphics(scale, withPreamble, colorMapper));
super(stringBounder);
copy(defaultBackground, colorMapper, new TikzGraphics(scale, withPreamble, colorMapper));
register();
}
@ -72,6 +73,7 @@ public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements Clip
}
private UGraphicTikz(UGraphicTikz other) {
super(other.getStringBounder());
copy(other);
register();
}

View File

@ -40,7 +40,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import net.sourceforge.plantuml.asciiart.TextStringBounder;
import net.sourceforge.plantuml.asciiart.TranslatedCharArea;
import net.sourceforge.plantuml.asciiart.UmlCharArea;
import net.sourceforge.plantuml.asciiart.UmlCharAreaImpl;
@ -49,6 +48,7 @@ import net.sourceforge.plantuml.klimt.UShape;
import net.sourceforge.plantuml.klimt.color.ColorMapper;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.AbstractCommonUGraphic;
import net.sourceforge.plantuml.klimt.drawing.debug.StringBounderDebug;
import net.sourceforge.plantuml.klimt.font.FontStyle;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UImage;
@ -56,7 +56,7 @@ import net.sourceforge.plantuml.klimt.shape.UText;
import net.sourceforge.plantuml.security.SecurityUtils;
public class UGraphicTxt extends AbstractCommonUGraphic implements ClipContainer {
// ::remove folder when __HAXE__
// ::remove folder when __HAXE__
// ::remove folder when __CORE__
private final UmlCharArea charArea;
@ -68,12 +68,14 @@ public class UGraphicTxt extends AbstractCommonUGraphic implements ClipContainer
}
private UGraphicTxt(UGraphicTxt other) {
super(other.getStringBounder());
basicCopy(other);
this.charArea = other.charArea;
}
public UGraphicTxt() {
basicCopy(HColors.BLACK, ColorMapper.IDENTITY, new TextStringBounder());
super(new StringBounderDebug());
basicCopy(HColors.BLACK, ColorMapper.IDENTITY);
this.charArea = new UmlCharAreaImpl();
}

View File

@ -62,7 +62,8 @@ public class UGraphicVdx extends AbstractUGraphic<VisioGraphics> implements Clip
}
public UGraphicVdx(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
copy(defaultBackground, colorMapper, stringBounder, new VisioGraphics());
super(stringBounder);
copy(defaultBackground, colorMapper, new VisioGraphics());
register();
}
@ -73,6 +74,7 @@ public class UGraphicVdx extends AbstractUGraphic<VisioGraphics> implements Clip
}
private UGraphicVdx(UGraphicVdx other) {
super(other.getStringBounder());
copy(other);
register();
}

View File

@ -1,23 +0,0 @@
package net.sourceforge.plantuml.help;
import static net.sourceforge.plantuml.test.PlantUmlTestUtils.exportDiagram;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
class HelpTest {
@Test
public void test_help_themes() throws Exception {
final String output = exportDiagram(
"@startuml",
"help themes",
"@enduml"
).asString();
assertThat(output)
.startsWith("Help on themes")
.contains("bluegray", "hacker");
}
}