1 package de.lathanda.eos.config;
3 import java.text.MessageFormat;
4 import java.util.Collection;
5 import java.util.TreeMap;
8 private TreeMap<String, HelpPage> pages =
new TreeMap<>();
9 public Help(String
id, String label, String tooltip, String description, Collection<LangModule> modules, TreeMap<String, LangClass> classes, Collection<LangHelp> helpEntries) {
15 page.
html = MessageFormat.format(BODY, label, description);
16 pages.put(page.
id, page);
20 pagem.
title = lm.label;
23 pagem.
html = MessageFormat.format(BODY, lm.label, lm.description);
24 pages.put(pagem.
id, pagem);
29 pageh.
title = lh.title;
32 pageh.
html = MessageFormat.format(BODY, lh.title, lh.description);
33 pages.put(pageh.
id, pageh);
40 pagec.
title = lc.label;
42 StringBuilder usage=
new StringBuilder();
46 usage.append(MessageFormat.format(USAGE, lcu.id, lm.getFullSignature()));
52 usage.append(MessageFormat.format(USAGE, lcu.id, lp.getFullSignature()));
57 StringBuilder inherited =
new StringBuilder();
58 while (lc.pid !=
null && !lc.pid.isEmpty()) {
59 if (!inherited.isEmpty()) {
60 inherited.append(
", ");
62 inherited.append(MessageFormat.format(LINK, pcls, classes.get(pcls).label));
64 StringBuilder methods =
new StringBuilder();
66 methods.append(MessageFormat.format(METHOD,lm.getFullSignature(), lm.description));
68 methods.append(MessageFormat.format(PARAMETER, lpa.
name, lpa.
type, classes.get(lpa.
type).label, lpa.
description));
71 StringBuilder properties =
new StringBuilder();
73 properties.append(MessageFormat.format(PROPERTY, lp.label, lp.type, classes.get(lp.type).label, lp.description));
75 pagec.
html = MessageFormat.format(CLASS_BODY,
77 MessageFormat.format(INHERITED, inherited),
79 MessageFormat.format(METHODS, methods),
80 MessageFormat.format(PROPERTIES, properties),
81 MessageFormat.format(USAGES, lc.label, usage.toString())
100 private final static String BODY =
"<html><head>{0}</head><body><h1>{0}</h1>{1}</body></html>";
101 private final static String CLASS_BODY =
"<html><head>{0}</head><body><h1>{0}</h1>{1}{2}{3}{4}</body></html>";
102 private final static String INHERITED =
"<p>Die Klasse {0} besitzt alle Methoden und Attribute der Klassen {1}.</p>";
103 private final static String USAGES =
"<p>{0} wird verwendet von </p><p><ul>{1}</ul></p>";
104 private final static String METHODS =
"<h2>Methoden</h2><p>{0}</p>";
105 private final static String METHOD =
"<h3>{0}</h3><p>{1}</p>";
106 private final static String PARAMETER =
"<h4>{0}:<a href=\"{1}\">{2}</a></h4><p>{3}</p>";
107 private final static String PROPERTIES =
"<h2>Attribute</h2><p>{0}</p>";
108 private final static String PROPERTY =
"<h3>{0}:<a href=\"{1}\">{2}</a></h3><p>{3}</p>";
109 private final static String USAGE =
"<li><a href=\"{0}\">{1}</a></li>";
110 private final static String LINK =
"<a href=\"{0}\">{1}</a>";
Help(String id, String label, String tooltip, String description, Collection< LangModule > modules, TreeMap< String, LangClass > classes, Collection< LangHelp > helpEntries)
TreeMap< String, HelpPage > getHelpPages()
HelpPage getHelpPage(String id)