Package eu.bandm.tools.doctypes.xhtml
Class Util
java.lang.Object
eu.bandm.tools.doctypes.xhtml.Util
Collection of frequently used xhtml construction utilities,
plus frequently used HTTP response generation methods.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name accorsing to Java charset conventionstatic final String
static final String
static final Element_br
static final Element_hr
static final Element_block_content[]
static final Element_p.Content[]
static final Element_td
static final Element_td.Content[]
static final Element_table
static final Element_tr.Choice_1_Alt_2
static final String
static final String
static final Element_td.Content
static final Element_a
The button to check the CSSstatic final Element_a
The button to check the HTMLstatic final String
Name accorsing to emacs implementation -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Element_a
Arriving link target with @name/@id, @class and pure text contents.static Element_a
Arriving link target with @name/@id, @class, pure text contents and a tooltip text.static Element_form
form
(Element_form_content[] contents, String actionUrl, @Opt String encodings, Element_form.Attr_method.Value method) Makes one "form" element.
"get" is default for method.
"@target" is not supported, since not allowed in "strict".static Element_input
hidden_input
(String key, String value) Construct a hidden xhtml "input" element with @name=@id=key parameter, and the given constant value.static Element_select
input_select
(String id, boolean multiple, boolean active, int displaySize, String[] values, String[] shown, @Opt String onchange, Set<String> selected) FIXME Element_optgroup missingstatic Element_a
Jump to target with @href, and for the text contents take the plain link address.static Element_a
jumpNCC
(String xhref, @Opt String cls, Element_a.Content... contents) Jump to target with @href, @class and structured contents.static Element_a
Jump to target with @href, @class and pure text contents.static Element_a
Jump to target with @href, @class, pure text contents and tooltip.static Element_p.Content
Wrap text for use in a Element_p.static Element_p.Content
Create a xhtml "span" element with plain text content and a given "css class" and wraps it for use in a Element_p.static void
sendBack_file
(File data, String mimetype, OutputStream out) Send a file back to the sockets output channel.static void
static void
sendDocumentAsHttpAnswer
(OutputStream out, Document_html doc, String encoding) static Element_span
Create a xhtml "span" element with plain text content and a given css class.static Element_span
spanCStyle
(String text, String styles) Create a xhtml "span" element with plain text content and direct "css style" values.static Element_span
Create a xhtml "span" element with an @id, plain text content and a given "css class".static Element_button
text_button
(String text, String command, boolean submitNotReset, boolean isActive) Makes one html-button with simple text as its visible surface.static Element_textarea
Makes one "text area" element.static Document_html
wrap_document
(Element_head head, Element_body body) static Element_head
xhtml_head
(String title, @Opt String encoding, @Opt String favicon, @Opt List<String> jses, @Opt List<String> csses, @Opt List<Element_link> links, @Opt Map<String, String> metas, @Opt List<Element_meta> metas2) Creates an Xhtml1.0Element_head
according to the syntax<!ELEMENT head ((script | style | meta | link | object)*, ((title, %head.misc;, (base, %head.misc;)?) | (base, %head.misc;, (title, %head.misc;)))) >
-
Field Details
-
element_hr
-
element_br
-
emptyTable
-
emptyElementTd
-
emptyElementTdContents
-
emptyElementPContents
-
spaceElementTdContent
-
emptyBlockContent
-
emptyTdInTr
-
xemacs_utf_8
Name accorsing to emacs implementation- See Also:
-
charset_utf_8
Name accorsing to Java charset convention- See Also:
-
http_utf_8
- See Also:
-
contentType_xhtml_
- See Also:
-
contentType_xhtml_utf8
- See Also:
-
prefixLocalJumpTarget
- See Also:
-
valid_xhtm1_1_0_transitional
The button to check the HTML -
valid_css_2_1
The button to check the CSS
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
spanCStyle
Create a xhtml "span" element with plain text content and direct "css style" values. -
spanCC
Create a xhtml "span" element with plain text content and a given css class. -
spanNCC
Create a xhtml "span" element with an @id, plain text content and a given "css class". -
anchorNCC
Arriving link target with @name/@id, @class and pure text contents. Content text may not be ==null, but may be empty. -
anchorNCCT
public static Element_a anchorNCCT(String xname, @Opt @Opt String cls, String text, @Opt @Opt String tooltip) Arriving link target with @name/@id, @class, pure text contents and a tooltip text. Content text may not be ==null, but may be empty.- Throws:
IllegalArgumentException
- when attribute value for id/name is not a valid name token. (all other attributes text, name, class, have no constraints.)
-
jumpN
Jump to target with @href, and for the text contents take the plain link address. -
jumpNCC
Jump to target with @href, @class and pure text contents. "NCC" means "name, class and contents".- Parameters:
xhref
- the complete text which specifies the jump target
-
jumpNCC
Jump to target with @href, @class and structured contents. "NCC" means "name, class and contents". -
jumpNCCT
public static Element_a jumpNCCT(String xhref, @Opt @Opt String cls, String text, @Opt @Opt String tooltip) Jump to target with @href, @class, pure text contents and tooltip. -
pText
Create a xhtml "span" element with plain text content and a given "css class" and wraps it for use in a Element_p. -
pText
Wrap text for use in a Element_p. -
input_select
public static Element_select input_select(String id, boolean multiple, boolean active, int displaySize, String[] values, String[] shown, @Opt @Opt String onchange, Set<String> selected) FIXME Element_optgroup missing- Parameters:
id
- used for @id and @namemultiple
- whether more than one input can be selected, copied to @multipleactive
- whether input field is active or grayed outdisplaySize
- size of the shown section, use ==1 for a drop-down boxvalues
- pure text which is returned as value in case of selectshown
- pure text which is SHOWN for the items on the screen; values and shown must be in sync.onchange
- pure text, what to do in case of value editing; mostly a ecma-script call. (not clear whether an editing action or a real value change triggers this command, may depend on the browser's implementation, see https://developer.mozilla.org/en-US/docs/Web/Events/change (and the html specs(?))selected
- the item or items which are initially selected.
-
text_button
public static Element_button text_button(String text, String command, boolean submitNotReset, boolean isActive) Makes one html-button with simple text as its visible surface. Attributes @id=@name=@value are set by parameter "command". Is of flavor "submit" and is active, as controlled by the boolean arguments.
In the HTTP request (defined by "form.@action") the submit-button with "@name=XX" will be encoded by appearing in the HTTP-header's parameter list.
Must be contained (indirectly) in a "form" element. -
textarea
public static Element_textarea textarea(@Opt @Opt String contents, int rows, int cols, String id, boolean active, boolean editable) Makes one "text area" element. FIXME @wrap fehlt -
form
public static Element_form form(Element_form_content[] contents, String actionUrl, @Opt @Opt String encodings, @Opt Element_form.Attr_method.Value method) Makes one "form" element.
"get" is default for method.
"@target" is not supported, since not allowed in "strict".- Parameters:
encodings
- is copied to @accept and are the mime types accepted by an upload
-
xhtml_head
public static Element_head xhtml_head(String title, @Opt @Opt String encoding, @Opt @Opt String favicon, @Opt @Opt List<String> jses, @Opt @Opt List<String> csses, @Opt @Opt List<Element_link> links, @Opt @Opt Map<String, String> metas, @Opt @Opt List<Element_meta> metas2) Creates an Xhtml1.0Element_head
according to the syntax<!ELEMENT head ((script | style | meta | link | object)*, ((title, %head.misc;, (base, %head.misc;)?) | (base, %head.misc;, (title, %head.misc;)))) >
- Parameters:
title
- is used as contents of Element_title AND is duplicated to meta "DC.title"encoding
- ALWAYS a "meta http_equiv content-type"Element_meta
is generated. The encoding defaults to utf-8.favicon
- creates a specialElement_link
ASSUME that file name extension == mime type!jses
- make specializedElement_link
objects from file position / url only.csses
- make specializedElement_link
objects from file position / url only.links
- pre-factoredElement_link
objects to be inserted, with @rel, @type and @href attributes.metas
- key/value pairs create aElement_meta
with@http-equiv==@name
and@value
set accordingly, see https://www.w3.org/TR/html401/ 7.4.4metas2
- pre-factoredElement_meta
objects to be inserted.
-
wrap_document
-
sendDocumentAsHttpAnswer
-
sendDocumentAsHttpAnswer
-
sendBack_file
Send a file back to the sockets output channel. Wrap it only into a "OK" http resonse header. This method is needed for "static" files, like ".css", etc.- Throws:
IOException
-