![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.timingdiagram.command.CommandNoteLong Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.timingdiagram.command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.Trim;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.creole.Display;
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.timingdiagram.Player;
import net.sourceforge.plantuml.timingdiagram.TimeTick;
import net.sourceforge.plantuml.timingdiagram.TimingDiagram;
import net.sourceforge.plantuml.utils.BlocLines;
import net.sourceforge.plantuml.utils.Position;
public class CommandNoteLong extends CommandMultilines2 {
public CommandNoteLong() {
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE, Trim.BOTH);
}
@Override
public String getPatternEnd() {
return "^end[%s]?note$";
}
@Override
protected CommandExecutionResult executeNow(final TimingDiagram diagram, BlocLines lines)
throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final String code = line0.get("CODE", 0);
final Player player = diagram.getPlayer(code);
if (player == null) {
return CommandExecutionResult.error("Unkown \"" + code + "\"");
}
final Display note = lines.toDisplay();
final TimeTick now = diagram.getNow();
// final Colors colors = color().getColor(arg,
// diagram.getSkinParam().getIHtmlColorSet());
player.addNote(now, note, Position.fromString(line0.get("POSITION", 0)));
return CommandExecutionResult.ok();
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandNoteLong.class.getName(), RegexLeaf.start(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("note"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("POSITION", "(top|bottom)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("of"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE", CommandTimeMessage.PLAYER_CODE), //
RegexLeaf.spaceZeroOrMore(), RegexLeaf.end());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy