diff --git a/src/main/java/net/themusicinnoise/vaccalc/VacCalc.java b/src/main/java/net/themusicinnoise/vaccalc/VacCalc.java index 2e2415d..0639507 100644 --- a/src/main/java/net/themusicinnoise/vaccalc/VacCalc.java +++ b/src/main/java/net/themusicinnoise/vaccalc/VacCalc.java @@ -52,6 +52,21 @@ public class VacCalc extends JFrame { appMenu.add(exitItem); menuBar.add(appMenu); JMenu helpMenu = new JMenu("Help"); + JMenuItem manualItem = new JMenuItem("Usage Manual"); + manualItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ev) { + BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("manual.html"))); + String manualText = br.lines().collect(Collectors.joining()); + JEditorPane textArea = new JEditorPane("text/html", manualText); + textArea.setEditable(false); + JFrame manualFrame = new JFrame("VacCalc Manual"); + manualFrame.getContentPane().add(new JScrollPane(textArea)); + manualFrame.setSize(500, 500); + manualFrame.setVisible(true); + } + }); + helpMenu.add(manualItem); JMenuItem aboutItem = new JMenuItem("About"); aboutItem.addActionListener(new ActionListener() { @Override diff --git a/src/main/resources/manual.html b/src/main/resources/manual.html new file mode 100644 index 0000000..c69e72e --- /dev/null +++ b/src/main/resources/manual.html @@ -0,0 +1,59 @@ + +

VacCalc Manual

+
+

VacCalc assigns points to each day on the basis of the rules found in a + file which is imported via the “VacCalc > Import points” menu item. This + file must be written manually. What follows are descriptions on how to write + this file.

+

Rules

+

There are a total of four different kinds of rules possible: default, + date, day-of-week, and month. Rules are applied with a priority for the last + defined rule, with the exception of the default rule which is only used if + no other rule applies.

+

Default Rule

+

Definition: default points

+

The default rule establishes the default point value for every day of the + year. E.g. default 1.0 sets the default points to + 1.0. +

Date Rule

+

Definition: YYYY-MM-DD points

+

A date rule specifies the points which a specific date has. E.g. + 2026-12-24 0.5 would set Christmas Eve (December + 24th) of 2026 to 0.5 points

+

Day-Of-Week Rule

+

Definition: dow=day points

+

A day-of-week rule specifies the points for all days of the year which + coincide with a particular day of the week. This day of the week is + specified using the three-letter format, such as Fri for + Friday. E.g. dow=Fri 0.8 would set all Fridays of the year to + 0.8 points.

+

Month Rule

+

Definition: m=month points

+

A month rule establishes the same points for every day of a given month. + E.g. m=Aug 0.8 sets all the days of the month of August to + 0.8 points. +

Zero Point Rules

+

Rules that have zero points allocated to them (i.e. 0.0) are + considered free days, and as such are disabled. This could be + assigned to days such as Christmas or the Weekends (Saturday and + Sunday).

+

Comments

+

Definition: # comment

+

Comments are supported in single lines starting with the # + character. Everything after that is ignored by the parser.

+

Example

+ + default 1.0
+ dow=Fri 0.825
+ m=Jul 0.825
+ m=Aug 0.825
+ 2026-12-24 0.5
+ 2026-12-31 0.5
+
+ # Weekends and Holidays
+ dow=Sun 0.0
+ dow=Sat 0.0
+ 2026-01-01 0.0
+ 2026-12-25 0.0 +
+