public class HTMLWordTables extends java.lang.Object
HTMLWordTables - Documentation.
This class generates the HTML CSS z-index-based tables that are used by java-script. Java-script utilizes the z-index axis to generate popup windows which contain Mandarin Chinese, English, and even Spanish Translations. Specifically, the tables generally contain:
- 繁体字 (Traditional-Chinese, Hong Kong, Taiwan, Southern China - Optional)
- 简体中文 (Standard-Chinese Simplified Characters
- 拼音罗马 (Romanization)
Static (Functional) API: The methods in this class are all
(100%)defined with the Java Key-Word / Key-Concept
'static'. Furthermore, there is no way to obtain an instance of this class, because there are no
private) constructors. Java's Spring-Boot, MVC feature is *not* utilized because it flies directly in the face of the light-weight data-classes philosophy. This has many advantages over the rather ornate Component Annotations (
@Component, @Service, @AutoWired, etc... 'Java Beans') syntax:
- The methods here use the key-word
'static'which means (by implication) that there is no internal-state. Without any 'internal state' there is no need for constructors in the first place! (This is often the complaint by MVC Programmers).
'Static'(Functional-Programming) API expects to use fewer data-classes, and light-weight data-classes, making it easier to understand and to program.
Vectorized HTMLdata-model allows more user-control over HTML parse, search, update & scrape. Also, memory management, memory leakage, and the Java Garbage Collector ought to be intelligible through the 'reuse' of the standard JDK
class Vectorfor storing HTML Web-Page data.
The power that
object-oriented programmingextends to a user is (mostly) limited to data-representation. Thinking of "Services" as "Objects" (Spring-MVC, 'Java Beans') is somewhat 'over-applying' the
Object OrientedProgramming Model. Like most classes in the
Java-HTML JAR Library, this class backtracks to a more C-Styled
Functional Programming Model(no Objects) - by re-using (quite profusely) the key-word
staticwith all of its methods, and by sticking to Java's well-understood
Internal-State: A user may click on this class' source code (see link below) to view any and all internally defined fields class. A cursory inspection of the code would prove that this class has precisely zero internally defined global fields (Spaghetti). All variables used by the methods in this class are local fields only, and therefore this class ought to be though of as
All Methods Static Methods Concrete Methods Modifier and Type Method
getHTMLVocabTable(String tableClass, String tableID, boolean setNoDisplay, Vector<String> simpWords, Vector<String> pronWords, Vector<String> tradWords, Vector<String> englWords, Vector<String> espaWords)
toHTML(String simpSentence, String englSentence, String espaSentence, String tableClass, String tableID, String onClickListener)
public static java.lang.String toHTML(java.lang.String simpSentence, java.lang.String englSentence, java.lang.String espaSentence, java.lang.String tableClass, java.lang.String tableID, java.lang.String onClickListener)Builds a simple, short HTML version of the Chinese-Simplified / English / Spanish sentence DIV
simpSentence- This may be a single word, a complete phrase, sentence, or even a paragraph of simplified Mandarin Chinese scraped from a web-site like Gov.CN. If this parameter is null, an exception will be thrown.
englSentence- This is intended to be the English-Translated version of the Simplified-Chinese sentence. If this parameter is null, the output HTML-table will have one less / fewer row included.
espaSentence- This is supposed to be the Spanish-translated version of the Simplified-Chinese sentence. If this parameter is null, the output HTML-table will have one less / fewer row included.
tableClass- If this table needs a CSS-Class selector, pass it here.
tableID- If this table requires a CSS-ID selector, pass it here.
onClickListener- This is a string of the form "callbackFuntion(params);" It is inserted into the <TABLE on_click="INSERTED-STRING-HERE"> tag
- An Table-HTML string. Note: The Vocabulary tables *ARE NOT* included. This only includes the English, Spanish & Chinese sentences.
java.lang.NullPointerException- If simpSentence is null.
- Exact Method Body:
public static java.lang.String getHTMLVocabTable (java.lang.String tableClass, java.lang.String tableID, boolean setNoDisplay, java.util.Vector<java.lang.String> simpWords, java.util.Vector<java.lang.String> pronWords, java.util.Vector<java.lang.String> tradWords, java.util.Vector<java.lang.String> englWords, java.util.Vector<java.lang.String> espaWords)The purpose of this method is to generate the "Pop Up" vocabulary table as HTML
tableClass- This contains the HTML-tag "class" String. It is included in the HTML <TABLE CLASS="INSERT-TEXT-HERE> String
tableID- This contains the HTML-tag "id" String. It is included in the HTML <TABLE ID="INSERT-TEXT-HERE"> String
setNoDisplay- When this variable is TRUE, a CSS tag is added to the opening <TABLE> tag, indicating:
STYLE="display: none;"- which ensures that this vocabulary table remains hidden.
simpWords- A Vector of simplified chinese character-words. This parameter may not be null.
pronWords- A Parallel Vector of the pronunciation of this input Simplified Mandarin words. Can be left out / null.
tradWords- Parallel Vector. Traditional-Chinese Characters. May be null.
englWords- Parallel Vector. English Words. Can be null.
espaWords- Parallel Vector. Chinese in Spanish. Also may be null.
- returns the Vocabulary Table as an HTML String of <TABLE>Vocab-Rows</TABLE>
java.lang.NullPointerException- If simpWords is null.
- Exact Method Body: