From e23d7e56fc72192d0ef57d2f213c863816e0c576 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Tue, 11 Apr 2023 19:57:58 +0200 Subject: [PATCH] fix: minor issues https://github.com/plantuml/plantuml/issues/1367 https://github.com/plantuml/plantuml/issues/1389 --- src/net/sourceforge/plantuml/ErrorStatus.java | 1 - .../plantuml/klimt/color/HColorGradient.java | 5 +++++ .../plantuml/project/GanttDiagram.java | 12 ++++++++++++ .../project/draw/TimeHeaderCalendar.java | 4 ++++ .../plantuml/project/lang/SubjectDayAsDate.java | 17 ++++++++++++++--- .../sourceforge/plantuml/version/Version.java | 2 +- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/net/sourceforge/plantuml/ErrorStatus.java b/src/net/sourceforge/plantuml/ErrorStatus.java index 0f60b13db..176e39be6 100644 --- a/src/net/sourceforge/plantuml/ErrorStatus.java +++ b/src/net/sourceforge/plantuml/ErrorStatus.java @@ -51,7 +51,6 @@ public class ErrorStatus { // public synchronized void goNoData() { // this.noData = true; - // // } public synchronized void goWithError() { diff --git a/src/net/sourceforge/plantuml/klimt/color/HColorGradient.java b/src/net/sourceforge/plantuml/klimt/color/HColorGradient.java index d0aa0d585..ab94e92ed 100644 --- a/src/net/sourceforge/plantuml/klimt/color/HColorGradient.java +++ b/src/net/sourceforge/plantuml/klimt/color/HColorGradient.java @@ -95,4 +95,9 @@ public class HColorGradient extends HColor { return color1.toColor(mapper); } + @Override + public HColor opposite() { + return color1.opposite(); + } + } diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index 611f9dc57..3690ed306 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -674,6 +674,11 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit return openClose.getStartingDay(); } + public Day getEndingDate() { + initMinMax(); + return max; + } + public int daysInWeek() { return openClose.daysInWeek(); } @@ -772,6 +777,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit nameDays.put(day, name); } + public Day getToday() { + if (today == null) + this.today = Day.today(); + + return today; + } + public void setTodayColors(CenterBorderColor colors) { if (today == null) this.today = Day.today(); diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java index 2ef6751fd..fcfba52e1 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java @@ -111,6 +111,10 @@ public abstract class TimeHeaderCalendar extends TimeHeader { } } + + if (pending != null) + pending.draw(ug, height); + } } diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java b/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java index 917827f9b..9394b889e 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java @@ -75,8 +75,18 @@ public class SubjectDayAsDate implements Subject { } private Day resultE(GanttDiagram system, RegexResult arg) { - final int day = Integer.parseInt(arg.get("ECOUNT", 0)); - return system.getStartingDate().addDays(day); + final String type = arg.get("ETYPE", 0).toUpperCase(); + final String operation = arg.get("EOPERATION", 0); + int day = Integer.parseInt(arg.get("ECOUNT", 0)); + if ("-".equals(operation)) + day = -day; + if ("D".equals(type)) + return system.getStartingDate().addDays(day); + if ("T".equals(type)) + return system.getToday().addDays(day); + if ("E".equals(type)) + return system.getEndingDate().addDays(day); + throw new IllegalStateException(); } public Collection getSentences() { @@ -138,7 +148,8 @@ public class SubjectDayAsDate implements Subject { private IRegex toRegexE() { return new RegexConcat( // - new RegexLeaf("[dD]\\+"), // + new RegexLeaf("ETYPE", "([dDtTeE])"), // + new RegexLeaf("EOPERATION", "([-+])"), // new RegexLeaf("ECOUNT", "([\\d]+)") // ); } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 1cb800c7a..00a1674d5 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -82,7 +82,7 @@ public class Version { } public static int beta() { - final int beta = 3; + final int beta = 4; return beta; }