Compare commits

...

11 Commits

16 changed files with 937 additions and 114 deletions

View File

@ -1,6 +1,6 @@
package main;
public enum htmlTagsEnum {
public enum HtmlTagsEnum {
//TestTag is only for testing, it is not a valid Html Tag!
TESTTAG("testtag"),
ABBREVIATION("abb"),
@ -28,6 +28,7 @@ public enum htmlTagsEnum {
HEADLINE4("h4"),
HEADLINE5("h5"),
HEADLINE6("h6"),
HTML("html"),
INPUT("input"),
INTERNETFRAME("iframe"),
INSERT("insert"),
@ -68,7 +69,7 @@ public enum htmlTagsEnum {
return this.tag;
}
private htmlTagsEnum(String tag){
private HtmlTagsEnum(String tag){
this.tag = tag;
}
}

View File

@ -1,7 +1,11 @@
package main;
import main.htmlSites.SiteGeneric;
public class Main {
public static void main(String[] args) {
SiteGeneric site = new SiteGeneric();
site.setIDAttribute("1");
System.out.println(site.build());
}
}

View File

@ -1,19 +0,0 @@
package main;
public class html {
public String htmlContentModule(htmlTagsEnum tag, String content){
return "<"+tag.getTag()+">\n"+content+"\n</"+tag.getTag()+">\n";
}
public String htmlInlineModule(htmlTagsEnum tag, String content){
return "<"+tag.getTag()+">"+content+"</"+tag.getTag()+">\n";
}
public String customContentModule(String tag, String content){
return "<"+tag+">\n"+content+"\n</"+tag+">\n";
}
public String customInlineModule(String tag, String content){
return "<"+tag+">"+content+"</"+tag+">\n";
}
}

View File

@ -0,0 +1,20 @@
package main.htmlModules;
public class ModuleComment extends ModuleGeneric {
public ModuleComment(String comment){
this.comment = comment;
}
@Override
public StringBuilder build() {
StringBuilder output = new StringBuilder();
if (!singleLine){
output.append("\n");
}
output
.append("<!--")
.append(comment)
.append("-->");
return output;
}
}

View File

@ -0,0 +1,427 @@
package main.htmlModules;
import main.HtmlTagsEnum;
import main.htmlModules.attributeEnums.GlobalAttributeDirEnum;
import main.htmlModules.attributeEnums.GlobalAttributeDraggableEnum;
import main.htmlModules.attributeEnums.GlobalAttributeEnterkeyhintEnum;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ModuleGeneric {
protected HtmlTagsEnum tag = null;
protected String comment;
protected List<ModuleGeneric> content = new ArrayList<>();
protected String contentText;
protected boolean singleLine;
//Global Attributes-------------------------------------------------------------------------------------------------
protected char globalAttributeAccesskey;
protected String globalAttributeClass;
protected Boolean globalAttributeContenteditable;
protected String globalAttributeDataName; //used with dataValue
protected String globalAttributeDataValue; //used with dataPrefix
protected GlobalAttributeDirEnum globalAttributeDir;
protected GlobalAttributeDraggableEnum globalAttributeDraggable;
protected GlobalAttributeEnterkeyhintEnum globalAttributeEnterkeyhint;
protected boolean globalAttributeHidden;
protected String globalAttributeId;
protected boolean globalAttributeInert;
protected Enum globalAttributeInputmethod;
protected Enum globalAttributeLang;
protected boolean globalAttributePopover; //used with id & needs popovertarget on another tag
protected Boolean globalAttributeSpellcheck;
protected HashMap globalAttributeStyle;
protected int globalAttributeTabindex;
protected String globalAttributeTitle;
protected Boolean globalAttributeTranslate;
//Event Attributes--------------------------------------------------------------------------------------------------
//Window
protected String windowEventAttributeOnafterprint;
protected String windowEventAttributeOnbeforeprint;
protected String windowEventAttributeOnbeforeunload;
protected String windowEventAttributeOnerror;
protected String windowEventAttributeOnhashchange;
protected String windowEventAttributeOnload;
protected String windowEventAttributeOnmessage;
protected String windowEventAttributeOnoffline;
protected String windowEventAttributeOnonline;
protected String windowEventAttributeOnpagehide;
protected String windowEventAttributeOnpageshow;
protected String windowEventAttributeOnpopstate;
protected String windowEventAttributeOnresize;
protected String windowEventAttributeOnstorage;
protected String windowEventAttributeOnunload;
//Form
protected String formEventAttributeOnblur;
protected String formEventAttributeOnchange;
protected String formEventAttributeOncontextmenu;
protected String formEventAttributeOnfocus;
protected String formEventAttributeOninput;
protected String formEventAttributeOninvalid;
protected String formEventAttributeOnreset;
protected String formEventAttributeOnsearch;
protected String formEventAttributeOnselect;
protected String formEventAttributeOnsubmit;
//Keyboard
protected String keyboardEventAttributeOnkeydown;
protected String keyboardEventAttributeOnkeypress;
protected String keyboardEventAttributeOnkeyup;
//Mouse
protected String mouseEventAttributeOnclick;
protected String mouseEventAttributeOndblclick;
protected String mouseEventAttributeOnmousedown;
protected String mouseEventAttributeOnmousemove;
protected String mouseEventAttributeOnmouseout;
protected String mouseEventAttributeOnmouseover;
protected String mouseEventAttributeOnmouseup;
protected String mouseEventAttributeOnwheel;
//Drag
protected String dragEventAttributeOndrag;
protected String dragEventAttributeOndragend;
protected String dragEventAttributeOndragenter;
protected String dragEventAttributeOndragleave;
protected String dragEventAttributeOndragover;
protected String dragEventAttributeOndragstart;
protected String dragEventAttributeOndrop;
protected String dragEventAttributeOnscroll;
//Clipboard
protected String clipboardEventAttributeOncopy;
protected String clipboardEventAttributeOncut;
protected String clipboardEventAttributeOnpaste;
//Media
protected String mediaEventAttributeOnabort;
protected String mediaEventAttributeOncanplay;
protected String mediaEventAttributeOncanplaythrough;
protected String mediaEventAttributeOncuechange;
protected String mediaEventAttributeOndurationchange;
protected String mediaEventAttributeOnemptied;
protected String mediaEventAttributeOnended;
protected String mediaEventAttributeOnerror;
protected String mediaEventAttributeOnloadeddata;
protected String mediaEventAttributeOnloadedmetadata;
protected String mediaEventAttributeOnloadstart;
protected String mediaEventAttributeOnpause;
protected String mediaEventAttributeOnplaying;
protected String mediaEventAttributeOnprogress;
protected String mediaEventAttributeOnratechange;
protected String mediaEventAttributeOnseeked;
protected String mediaEventAttributeOnseeking;
protected String mediaEventAttributeOnstalled;
protected String mediaEventAttributeOnsuspend;
protected String mediaEventAttributeOntimeupdate;
protected String mediaEventAttributeOnvolumechange;
protected String mediaEventAttributeOnwaiting;
//Misc
protected String miscEventAttributeOntoggle;
//Specific Attributes-----------------------------------------------------------------------------------------------
//<a>
protected String aAttributeDownload;
protected String aAttributeHref;
protected Enum aAttributeHreflang;
protected String aAttributeMedia;
protected String aAttributePing;
protected Enum aAttributeReferrerpolicy;
protected Enum aAttributeRel;
protected Enum aAttributeTarget;
protected Enum aAttributeType;
//<area>
protected String areaAttributeAlt;
protected String areaAttributeCoords;
protected String areaAttributeDownload;
protected String areaAttributeHref;
protected Enum areaAttributeHreflang;
protected String areaAttributeMedia; //Enums
protected Enum areaAttributeReferrerpolicy;
protected Enum areaAttributeRel;
protected Enum areaAttributeShape;
protected String areaAttributeTarget; //and Enum
protected Enum areaAttributeType;
//<audio>
protected boolean audioAttributeAutoplay;
protected boolean audioAttributeControls;
protected boolean audioAttributeLoop;
protected boolean audioAttributeMuted;
protected Enum audioAttributePreload;
protected String audioAttributeSrc;
//<base>
protected String baseAttributeHref;
protected Enum baseAttributeTarget;
//<blockquote>
protected String blockquoteAttributeCite;
//<button>
protected boolean buttonAttributeAutofocus;
protected boolean buttonAttributeDisabled;
protected String buttonAttributeForm;
protected String buttonAttributeFormaction;
protected Enum buttonAttributeFormenctype;
protected Enum buttonAttributeFormmethod;
protected boolean buttonAttributeFormnovalidate;
protected String buttonAttributeFormtarget; //and Enum
protected String buttonAttributePopovertarget;
protected Enum buttonAttributePopovertargetaction;
protected String buttonAttributeName;
protected Enum buttonAttributeType;
protected String buttonAttributeValue;
//<canvas>
protected int canvasAttributeHeight;
protected int canvasAttributeWidth;
//<col>
protected int colAttributeSpan;
//<colgroup>
protected int colgroupAttributeSpan;
//<del>
protected String delAttributeCite;
protected String delAttributeDatetime;
//<details>
protected boolean detailsAttributeOpen;
//<embed>
protected int embedAttributeHeight;
protected String embedAttributeSrc;
protected Enum embedAttributeType;
protected int embedAttributeWidth;
//<fieldset>
protected boolean fieldsetAttributeDisabled;
protected String fieldsetAttributeForm;
protected String fieldsetAttributeName;
//<form>
protected String formAttributeAcceptcharset;
protected String formAttributeAction;
protected Enum formAttributeAutocomplete;
protected Enum formAttributeEnctype;
protected Enum formAttributeMethod;
protected String formAttributeName;
protected boolean formAttributeNovalidate;
protected Enum formAttributeRel;
protected String formAttributeTarget; //and Enum
//<iframe>
protected String iframeAttributeAllow;
protected boolean iframeAttributeAllowfullscreen;
protected boolean iframeAttributeAllowpaymentrequest;
protected int iframeAttributeHeight;
protected Enum iframeAttributeLoading;
protected String iframeAttributeName;
protected Enum iframeAttributeReferrerpolicy;
protected Enum iframeAttributeSandbox;
protected String iframeAttributeSrc;
protected String iframeAttributeSrcdoc;
protected int iframeAttributeWidth;
//<img>
protected String imgAttributeAlt;
protected Enum imgAttributeCrossorigin;
protected int imgAttributeHeight;
protected boolean imgAttributeIsmap;
protected Enum imgAttributeLoading;
protected String imgAttributeLongdesc;
protected Enum imgAttributeReferrerpolicy;
protected String imgAttributeSizes;
protected String imgAttributeSrc;
protected String imgAttributeSrcset;
protected String imgAttributeUsemap;
protected int imgAttributeWidth;
//<input>
protected String inputAttributeAccept; //used with type="file" //custom or Enum
protected String inputAttributeAlt; //used with type="image"
protected Enum inputAttributeAutocomplete; //Enum
protected Boolean inputAttributeAutofocus;
protected boolean inputAttributeChecked; //used with type="checkbox" or type="radio"
protected boolean inputAttributeDirname; //used with name="<value>" -> dirname="<value.dir>"
protected boolean inputAttributeDisabled;
protected String inputAttributeForm; //needs formID
protected String inputAttributeFormaction; //used with type="submit" or type="image"
protected Enum inputAttributeFormenctype; //used with type="submit" or type="image"
protected Enum inputAttributeFormmethod; //used with type="submit" or type="image"
protected boolean inputAttributeFormnovalidate; //used with type="submit"
protected Enum inputAttributeFormtarget; //or custom //use with type="submit" or type="image"
protected int inputAttributeHeight; //used with type="image"
protected String inputAttributeList; //used with datalist and same as datalist id
protected String inputAttributeMax; //number or date
protected int inputAttributeMaxlength;
protected String inputAttributeMin; //number or date
protected int inputAttributeMinlength;
protected boolean inputAttributeMultiple;
protected String inputAttributeName;
protected String inputAttributePattern;
protected String inputAttributePlaceholder;
protected String inputAttributePopovertarget; //needs id with the same name & popover on another tag
protected Enum inputAttributePopovertargetaction;
protected boolean inputAttributeReadOnly;
protected boolean inputAttributeRequired;
protected int inputAttributeSize;
protected String inputAttributeSrc;
protected String inputAttributeStep;
protected Enum inputAttributeType;
protected String inputAttributeValue;
protected int inputAttributeWidth;
//<ins>
protected String insAttributeCite;
protected String insAttributeDatetime;
//<label>
protected String labelAttributeFor;
protected String labelAttributeForm;
//<li>
protected int liAttributeValue;
//<link>
protected Enum linkAttributeCrossorigin;
protected String linkAttributeHref;
protected Enum linkAttributeHreflang;
protected String linkAttributeMedia;
protected Enum linkAttributeReferrerpolicy;
protected Enum linkAttributeRel;
protected String linkAttributeSizes;
protected String linkAttributeTitle;
protected Enum linkAttributeType;
//<map>
protected String mapAttributeName;
//<meta>
protected String metaAttributeCharset;
protected String metaAttributeContent;
protected Enum metaAttributeHttpequiv;
protected Enum metaAttributeName;
//<meter>
protected String meterAttributeFrom;
protected int meterAttributeHigh;
protected int meterAttributeLow;
protected int meterAttributeMax;
protected int meterAttributeMin;
protected int meterAttributeOptimum;
protected int meterAttributeValue;
//<object>
protected String objectAttributeData;
protected String objectAttributeForm;
protected int objectAttributeHeight;
protected String objectAttributeName;
protected Enum objectAttributeType;
protected boolean objectAttributeTypemustmatch;
protected String objectAttributeUsemap;
protected int objectAttributeWidth;
//<ol>
protected boolean olAttributeReversed;
protected int olAttributeStart;
protected Enum olAttributeType;
//<optgroup>
protected boolean optgroupAttributeDisabled;
protected String optgroupAttributeLabel;
//<option>
protected boolean optionAttributeDisabled;
protected String optionAttributeLabel;
protected boolean optionAttributeSelected;
protected String optionAttributeValue;
//<output>
protected String outputAttributeFor;
protected String outputAttributeForm;
protected String outputAttributeName;
//<param>
protected String paramAttributeName;
protected String paramAttributeValue;
//<progress>
protected int progressAttributeMax;
protected int progressAttributeValue;
//<q>
protected String qAttributeCite;
//<script>
protected boolean scriptAttributeAsync;
protected Enum scriptAttributeCrossorigin;
protected boolean scriptAttributeDefer;
protected String scriptAttributeIntegrity;
protected Boolean scriptAttributeNomodule;
protected Enum scriptAttributeReferrerpolicy;
protected String scriptAttributeSrc;
protected Enum scriptAttributetype;
//<select>
protected boolean selectAttributeAutofocus;
protected boolean selectAttributeDisabled;
protected String selectAttributeForm;
protected boolean selectAttributeMultiple;
protected String selectAttributeName;
protected boolean selectAttributeRequired;
protected int selectAttributeSize;
//<source>
protected String sourceAttributeMedia;
protected String sourceAttributeSizes;
protected String sourceAttributeSrc;
protected String sourceAttributeSrcset;
protected Enum sourceAttributeType;
//<style>
protected String styleAttributeMedia;
protected Enum styleAttributeType;
//<td>
protected int tdAttributeColspan;
protected String tdAttributeHeaders;
protected int tdAttributeRowspan;
//<th>
protected String thAttributeAbbr;
protected int thAttributeColspan;
protected String thAttributeHeaders;
protected int thAttributeRowspan;
protected Enum thAttributeScope;
//<textarea>
protected boolean textareaAttributeAutofocus;
protected int textareaAttributeCols;
protected String textareaAttributeDirname;
protected boolean textareaAttributeDisabled;
protected String textareaAttributeForm;
protected int textareaAttributeMaxlength;
protected String textareaAttributeName;
protected String textareaAttributePlaceholder;
protected boolean textareaAttributeReadonly;
protected boolean textareaAttributeRequired;
protected int textareaAttributeRows;
protected Boolean textareaAttributeWrap;
//<time>
protected String timeAttributeDatetime;
//<track>
protected boolean trackAttributeDefault;
protected Enum trackAttributeKind;
protected String trackAttributeLabel;
protected String trackAttributeSrc;
protected Enum trackAttributeSrclang;
//<video>
protected boolean videoAttributeAutoplay;
protected boolean videoAttributeControls;
protected int videoAttributeHeight;
protected boolean videoAttributeLoop;
protected boolean videoAttributeMuted;
protected String videoAttributePoster;
protected Enum videoAttributePreload;
protected String videoAttributeSrc;
protected int videoAttributeWidth;
public StringBuilder build(){
StringBuilder buildString = new StringBuilder();
buildString
.append("\n<")
.append(tag.getTag())
.append(globalAttributeId != null ? " id=\"" + globalAttributeId +"\"" : "")
.append(">");
for (ModuleGeneric moduleGeneric : content) {
if(moduleGeneric instanceof ModuleComment moduleComment){
buildString.append(moduleComment.build());
}else{
buildString.append(moduleGeneric.build());
}
}
if (contentText != null){
if (!singleLine){
buildString.append("\n");
}
buildString.append(contentText);
}
if (!singleLine){
buildString.append("\n");
}
buildString
.append("</")
.append(tag.getTag())
.append(">");
return buildString;
}
}

View File

@ -0,0 +1,292 @@
package main.htmlModules;
import main.HtmlTagsEnum;
import main.htmlModules.attributeEnums.GlobalAttributeDirEnum;
import main.htmlModules.attributeEnums.GlobalAttributeDraggableEnum;
import main.htmlModules.attributeEnums.GlobalAttributeEnterkeyhintEnum;
public class ModuleTag extends ModuleGeneric {
public ModuleTag(){
}
/**
* Adds a module into current module's content.
* @param module A new module
*/
public void addModule(ModuleGeneric module){
content.add(module);
}
/**
* Adds a Comment into current modules content.
* @param comment String of comment
*/
public void addComment(String comment){
content.add(new ModuleComment(comment));
}
/**
* Sets the Tag for the current module.
* @param tag sets Tag of the current module
* @see HtmlTagsEnum HtmlTagsEnum -> For list of possible Tags
*/
public void setTag(HtmlTagsEnum tag) {
this.tag = tag;
}
/**
* Gets the Tag from the current module
* @return gets Tag of current module
* @see HtmlTagsEnum HtmlTagsEnum -> For list of possible Tags
*/
public HtmlTagsEnum getTag() {
return tag;
}
/**
* The Accesskey-Attribute specifies a hotkey/shortcut key to activate or select an element.
* @param accesskeyAttribute single character (letter or digit)
*/
public void setAccesskeyAttribute(char accesskeyAttribute){
this.globalAttributeAccesskey = accesskeyAttribute;
}
/**
* The Accesskey-Attribute specifies a hotkey/shortcut key to activate or select an element.
* @return Single character (letter or digit)
*/
public char getAccesskeyAttribute(){
return globalAttributeAccesskey;
}
/**
*The Class-Attribute is used to assign a classname to be used with either StyleSheets or JavaScript.
* @param classAttribute String which should be used with StyleSheets or JS.
*/
public void setClassAttribute(String classAttribute){
this.globalAttributeClass = classAttribute;
}
/**
* The Class-Attribute is used to assign a classname to be used with either StyleSheets or JavaScript.
* @return String which is set to be used with StyleSheets or JS.
*/
public String getClassAttribute(){
return globalAttributeClass;
}
/**
* The Contenteditable-Attribute specifies of an element is editable or not.
* @param contenteditableAttribute <br>
* "true" -> editable <br>
* "false" -> not editable <br>
* "null" or not set at all -> inherits state from parent (default false)
*/
public void setContenteditableAttribute(Boolean contenteditableAttribute){
this.globalAttributeContenteditable = contenteditableAttribute;
}
/**
* The Contenteditable-Attribute specifies of an element is editable or not.
* @return "true" -> editable <br>
* "false" -> not editable <br>
* "null" -> not set at all, inherits state from parent (default false)
*/
public Boolean getContenteditableAttribute(){
return globalAttributeContenteditable;
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @param dataNameAttribute Name of set data after the prefix "data-*"
* @param dataValueAttribute Value of set data
* @see #setDataNameAttribute(String) setDataNameAttribute(String) -> For setting Name only
* @see #setDataValueAttribute(String) setDataValueAttribute(String) -> For setting Value only
*/
public void setDataAttribute(String dataNameAttribute, String dataValueAttribute){
setDataNameAttribute(dataNameAttribute);
setDataValueAttribute(dataValueAttribute);
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @return The full attribute String with Prefix, Name and Value (data-<name>="<value>")
* @see #getDataNameAttribute() getDataNameAttribute() -> For getting Name only
* @see #getDataValueAttribute() getDataValueAttribute() -> For getting Value only
*/
public String getDataAttribute(){
return "data-"+globalAttributeDataName+"=\""+globalAttributeDataValue+"\"";
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @param dataNameAttribute Name of data after the prefix "data-*"
* @see #setDataAttribute(String, String) setDataAttribute(String, String) -> For setting Name and Value
* @see #setDataValueAttribute(String) setDataValueAttribute(String) -> For setting Value only
*/
public void setDataNameAttribute(String dataNameAttribute){
this.globalAttributeDataName = dataNameAttribute;
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @return Name of set data after the prefix "data-*"
* @see #getDataAttribute() getDataAttribute() -> For getting the whole String
* @see #getDataValueAttribute() getDataValueAttribute() -> For getting Value only
*/
public String getDataNameAttribute(){
return globalAttributeDataName;
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @param dataValueAttribute Value of data
* @see #setDataAttribute(String, String) setDataAttribute(String, String) -> For setting Name and Value
* @see #setDataNameAttribute(String) setDataNameAttribute(String) -> For setting Value only
*/
public void setDataValueAttribute(String dataValueAttribute){
this.globalAttributeDataValue = dataValueAttribute;
}
/**
* The Data-Attribute is used to embed custom data without the need of a database call. <br>
* Consists out of a Name and a Value.
* @return Value of set data
* @see #getDataAttribute() getDataAttribute() -> For getting the whole String
* @see #getDataNameAttribute() getDataNameAttribute() -> For getting Name only
*/
public String getDataValueAttribute(){
return globalAttributeDataValue;
}
/**
* The Dir-Attribute specifies the direction of text.
* @param dirAttribute <br>
* "ltr" -> left to right <br>
* "rtl" -> right to left <br>
* "auto" -> if unknown (lets the browser figure it out) <br>
* "null" -> not set
* @see GlobalAttributeDirEnum
*/
public void setDirAttribute(GlobalAttributeDirEnum dirAttribute){
this.globalAttributeDir = dirAttribute;
}
/**
* The Dir-Attribute specifies the direction of text.
* @return "ltr" -> left to right <br>
* "rtl" -> right to left <br>
* "auto" -> if unknown (lets the browser figure it out)<br>
* "null" -> not set
* @see GlobalAttributeDirEnum
*/
public GlobalAttributeDirEnum getDirAttribute(){
return globalAttributeDir;
}
/**
* The Draggable-Attribute specifies if an element is draggable. <br>
* Often used for Drag-and-Drop operations. <br>
* Links and images are draggable by default.
* @param draggableAttribute <br>
* "true" -> draggable <br>
* "false" -> not draggable <br>
* "auto" -> browser default <br>
* "null" -> not set
* @see GlobalAttributeDraggableEnum
*/
public void setDraggableAttribute(GlobalAttributeDraggableEnum draggableAttribute){
this.globalAttributeDraggable = draggableAttribute;
}
/**
* The Draggable-Attribute specifies if an element is draggable. <br>
* Often used for Drag-and-Drop operations. <br>
* Links and images are draggable by default.
* @return "true" -> draggable <br>
* "false" -> not draggable <br>
* "auto" -> browser default <br>
* "null" -> not set
* @see GlobalAttributeDraggableEnum
*/
public GlobalAttributeDraggableEnum getDraggableAttribute(){
return globalAttributeDraggable;
}
/**
* The Enterkeyhint-Attribute changes the text that is appearing on the enter key of a virtual keyboard.
* @param enterkeyhintAttribute <br>
* "done"<br>
* "enter"<br>
* "go"<br>
* "next"<br>
* "previous"<br>
* "search"<br>
* "send"<br>
* "null" -> not set
* @see GlobalAttributeEnterkeyhintEnum
*/
public void setEnterkeyhintAttribute(GlobalAttributeEnterkeyhintEnum enterkeyhintAttribute){
this.globalAttributeEnterkeyhint = enterkeyhintAttribute;
}
/**
* The Enterkeyhint-Attribute changes the text that is appearing on the enter key of a virtual keyboard.
* @return "done"<br>
* "enter"<br>
* "go"<br>
* "next"<br>
* "previous"<br>
* "search"<br>
* "send"<br>
* "null" -> not set
* @see GlobalAttributeEnterkeyhintEnum
*/
public GlobalAttributeEnterkeyhintEnum getEnterkeyhintAttribute(){
return globalAttributeEnterkeyhint;
}
/**
* The Hidden-Attribute specifies that an element is hidden if set.<br>
* This could later be altered via JS.
* @param hiddenAttribute <br>
* "true" -> element is hidden<br>
* "false" (default) -> element is not hidden
*/
public void setHiddenAttribute(boolean hiddenAttribute){
this.globalAttributeHidden = hiddenAttribute;
}
/**
* The Hidden-Attribute specifies that an element is hidden if set.<br>
* This could later be altered via JS.
* @return "true" -> element is hidden<br>
* "false" (default) -> element is not hidden
*/
public boolean getHiddenAttribute(){
return globalAttributeHidden;
}
public void setIDAttribute(String idAttribute) {
this.globalAttributeId = idAttribute;
}
public String getIDAttribute() {
return globalAttributeId;
}
public void setInertAttribute(boolean inertAttribute){
this.globalAttributeInert = inertAttribute;
}
public boolean getInertAttribute(){
return globalAttributeInert;
}
}

View File

@ -0,0 +1,15 @@
package main.htmlModules.attributeEnums;
public enum GlobalAttributeDirEnum {
LTR("ltr"),
RTL("rtl"),
AUTO("auto");
private String value;
public String getValue(){
return this.value;
}
private GlobalAttributeDirEnum(String value){
this.value = value;
}
}

View File

@ -0,0 +1,15 @@
package main.htmlModules.attributeEnums;
public enum GlobalAttributeDraggableEnum {
TRUE("true"),
FALSE("false"),
AUTO("auto");
private String value;
public String getValue(){
return this.value;
}
private GlobalAttributeDraggableEnum(String value){
this.value = value;
}
}

View File

@ -0,0 +1,19 @@
package main.htmlModules.attributeEnums;
public enum GlobalAttributeEnterkeyhintEnum {
DONE("done"),
ENTER("enter"),
GO("go"),
NEXT("next"),
PREVIOUS("previous"),
SEARCH("search"),
SEND("send");
private String value;
public String getValue(){
return this.value;
}
private GlobalAttributeEnterkeyhintEnum(String value){
this.value = value;
}
}

View File

@ -0,0 +1,10 @@
package main.htmlModules.tags;
import main.HtmlTagsEnum;
import main.htmlModules.ModuleTag;
public class ModuleBody extends ModuleTag {
public ModuleBody(){
setTag(HtmlTagsEnum.BODY);
}
}

View File

@ -0,0 +1,11 @@
package main.htmlModules.tags;
import main.HtmlTagsEnum;
import main.htmlModules.ModuleTag;
public class ModuleDiv extends ModuleTag {
public ModuleDiv(){
setTag(HtmlTagsEnum.DIV);
}
}

View File

@ -0,0 +1,10 @@
package main.htmlModules.tags;
import main.HtmlTagsEnum;
import main.htmlModules.ModuleTag;
public class ModuleHTML extends ModuleTag {
public ModuleHTML(){
setTag(HtmlTagsEnum.HTML);
}
}

View File

@ -0,0 +1,10 @@
package main.htmlModules.tags;
import main.HtmlTagsEnum;
import main.htmlModules.ModuleTag;
public class ModuleHead extends ModuleTag {
public ModuleHead(){
setTag(HtmlTagsEnum.HEAD);
}
}

View File

@ -0,0 +1,41 @@
package main.htmlSites;
import main.htmlModules.tags.ModuleBody;
import main.htmlModules.tags.ModuleHead;
import main.htmlModules.ModuleTag;
import main.HtmlTagsEnum;
public class SiteGeneric extends ModuleTag {
ModuleHead head;
ModuleBody body;
public SiteGeneric(){
this(new ModuleHead(),new ModuleBody());
}
public SiteGeneric(ModuleHead head){
this(head ,new ModuleBody());
}
public SiteGeneric(ModuleBody body){
this(new ModuleHead(),body);
}
SiteGeneric(ModuleHead head, ModuleBody body){
this.head = head;
this.body = body;
setTag(HtmlTagsEnum.HTML);
addModule(this.head);
addModule(this.body);
}
@Override
public StringBuilder build() {
StringBuilder buildString = new StringBuilder();
buildString
.append("<!DOCTYPE html>")
.append(super.build());
return buildString;
}
}

View File

@ -1,6 +1,6 @@
package test;
import main.htmlTagsEnum;
import main.HtmlTagsEnum;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -9,63 +9,63 @@ public class htmlTagsEnumTest {
@Test
void htmlTagsEnumTagsTest(){
assertEquals(htmlTagsEnum.ABBREVIATION.getTag(),"abb");
assertEquals(htmlTagsEnum.ADDRESS.getTag(),"address");
assertEquals(htmlTagsEnum.ARTICLE.getTag(),"article");
assertEquals(htmlTagsEnum.ASIDE.getTag(),"aside");
assertEquals(htmlTagsEnum.BLINK.getTag(),"blink");
assertEquals(htmlTagsEnum.BIDIRECTIONALTEXTOVERRIDE.getTag(),"bdo");
assertEquals(htmlTagsEnum.BODY.getTag(),"body");
assertEquals(htmlTagsEnum.BOLD.getTag(),"b");
assertEquals(htmlTagsEnum.BREAK.getTag(),"br");
assertEquals(htmlTagsEnum.CANVAS.getTag(),"canvas");
assertEquals(htmlTagsEnum.CODE.getTag(),"code");
assertEquals(htmlTagsEnum.DELETE.getTag(),"delete");
assertEquals(htmlTagsEnum.DIV.getTag(),"div");
assertEquals(htmlTagsEnum.FIGURE.getTag(),"figure");
assertEquals(htmlTagsEnum.FIGURECAPTION.getTag(),"figcaption");
assertEquals(htmlTagsEnum.FOOTER.getTag(),"footer");
assertEquals(htmlTagsEnum.FORM.getTag(),"form");
assertEquals(htmlTagsEnum.HEAD.getTag(),"head");
assertEquals(htmlTagsEnum.HEADER.getTag(),"header");
assertEquals(htmlTagsEnum.HEADLINE1.getTag(),"h1");
assertEquals(htmlTagsEnum.HEADLINE2.getTag(),"h2");
assertEquals(htmlTagsEnum.HEADLINE3.getTag(),"h3");
assertEquals(htmlTagsEnum.HEADLINE4.getTag(),"h4");
assertEquals(htmlTagsEnum.HEADLINE5.getTag(),"h5");
assertEquals(htmlTagsEnum.HEADLINE6.getTag(),"h6");
assertEquals(htmlTagsEnum.INPUT.getTag(),"input");
assertEquals(htmlTagsEnum.INSERT.getTag(),"insert");
assertEquals(htmlTagsEnum.INTERNETFRAME.getTag(),"iframe");
assertEquals(htmlTagsEnum.ITALICS.getTag(),"i");
assertEquals(htmlTagsEnum.KEYGEN.getTag(),"keygen");
assertEquals(htmlTagsEnum.LINK.getTag(),"a");
assertEquals(htmlTagsEnum.LISTITEM.getTag(),"li");
assertEquals(htmlTagsEnum.LISTORDERED.getTag(),"ol");
assertEquals(htmlTagsEnum.LISTUNORDERED.getTag(),"ul");
assertEquals(htmlTagsEnum.MAIN.getTag(),"main");
assertEquals(htmlTagsEnum.MARQUEE.getTag(),"marquee");
assertEquals(htmlTagsEnum.MENU.getTag(),"menu");
assertEquals(htmlTagsEnum.META.getTag(),"meta");
assertEquals(htmlTagsEnum.NAVIGATION.getTag(),"nav");
assertEquals(htmlTagsEnum.PARAGRAPH.getTag(),"p");
assertEquals(htmlTagsEnum.PRETAG.getTag(),"pretag");
assertEquals(htmlTagsEnum.RUBY.getTag(),"ruby");
assertEquals(htmlTagsEnum.RUBYPARENTHESIS.getTag(),"rp");
assertEquals(htmlTagsEnum.RUBYTEXT.getTag(),"rt");
assertEquals(htmlTagsEnum.SCRIPT.getTag(),"script");
assertEquals(htmlTagsEnum.SECTION.getTag(),"section");
assertEquals(htmlTagsEnum.SMALL.getTag(),"small");
assertEquals(htmlTagsEnum.SPAN.getTag(),"span");
assertEquals(htmlTagsEnum.STRIKE.getTag(),"s");
assertEquals(htmlTagsEnum.TABLE.getTag(),"table");
assertEquals(htmlTagsEnum.TABLECOLUM.getTag(),"td");
assertEquals(htmlTagsEnum.TABLECOLUMNTITLE.getTag(),"th");
assertEquals(htmlTagsEnum.TABLEROW.getTag(),"tr");
assertEquals(htmlTagsEnum.TEXTAREA.getTag(),"textarea");
assertEquals(htmlTagsEnum.TITLE.getTag(),"title");
assertEquals(htmlTagsEnum.UNDERLINE.getTag(),"u");
assertEquals(htmlTagsEnum.VARIABLE.getTag(),"var");
assertEquals(htmlTagsEnum.WANTEDBREAK.getTag(),"wbr");
assertEquals(HtmlTagsEnum.ABBREVIATION.getTag(),"abb");
assertEquals(HtmlTagsEnum.ADDRESS.getTag(),"address");
assertEquals(HtmlTagsEnum.ARTICLE.getTag(),"article");
assertEquals(HtmlTagsEnum.ASIDE.getTag(),"aside");
assertEquals(HtmlTagsEnum.BLINK.getTag(),"blink");
assertEquals(HtmlTagsEnum.BIDIRECTIONALTEXTOVERRIDE.getTag(),"bdo");
assertEquals(HtmlTagsEnum.BODY.getTag(),"body");
assertEquals(HtmlTagsEnum.BOLD.getTag(),"b");
assertEquals(HtmlTagsEnum.BREAK.getTag(),"br");
assertEquals(HtmlTagsEnum.CANVAS.getTag(),"canvas");
assertEquals(HtmlTagsEnum.CODE.getTag(),"code");
assertEquals(HtmlTagsEnum.DELETE.getTag(),"delete");
assertEquals(HtmlTagsEnum.DIV.getTag(),"div");
assertEquals(HtmlTagsEnum.FIGURE.getTag(),"figure");
assertEquals(HtmlTagsEnum.FIGURECAPTION.getTag(),"figcaption");
assertEquals(HtmlTagsEnum.FOOTER.getTag(),"footer");
assertEquals(HtmlTagsEnum.FORM.getTag(),"form");
assertEquals(HtmlTagsEnum.HEAD.getTag(),"head");
assertEquals(HtmlTagsEnum.HEADER.getTag(),"header");
assertEquals(HtmlTagsEnum.HEADLINE1.getTag(),"h1");
assertEquals(HtmlTagsEnum.HEADLINE2.getTag(),"h2");
assertEquals(HtmlTagsEnum.HEADLINE3.getTag(),"h3");
assertEquals(HtmlTagsEnum.HEADLINE4.getTag(),"h4");
assertEquals(HtmlTagsEnum.HEADLINE5.getTag(),"h5");
assertEquals(HtmlTagsEnum.HEADLINE6.getTag(),"h6");
assertEquals(HtmlTagsEnum.INPUT.getTag(),"input");
assertEquals(HtmlTagsEnum.INSERT.getTag(),"insert");
assertEquals(HtmlTagsEnum.INTERNETFRAME.getTag(),"iframe");
assertEquals(HtmlTagsEnum.ITALICS.getTag(),"i");
assertEquals(HtmlTagsEnum.KEYGEN.getTag(),"keygen");
assertEquals(HtmlTagsEnum.LINK.getTag(),"a");
assertEquals(HtmlTagsEnum.LISTITEM.getTag(),"li");
assertEquals(HtmlTagsEnum.LISTORDERED.getTag(),"ol");
assertEquals(HtmlTagsEnum.LISTUNORDERED.getTag(),"ul");
assertEquals(HtmlTagsEnum.MAIN.getTag(),"main");
assertEquals(HtmlTagsEnum.MARQUEE.getTag(),"marquee");
assertEquals(HtmlTagsEnum.MENU.getTag(),"menu");
assertEquals(HtmlTagsEnum.META.getTag(),"meta");
assertEquals(HtmlTagsEnum.NAVIGATION.getTag(),"nav");
assertEquals(HtmlTagsEnum.PARAGRAPH.getTag(),"p");
assertEquals(HtmlTagsEnum.PRETAG.getTag(),"pretag");
assertEquals(HtmlTagsEnum.RUBY.getTag(),"ruby");
assertEquals(HtmlTagsEnum.RUBYPARENTHESIS.getTag(),"rp");
assertEquals(HtmlTagsEnum.RUBYTEXT.getTag(),"rt");
assertEquals(HtmlTagsEnum.SCRIPT.getTag(),"script");
assertEquals(HtmlTagsEnum.SECTION.getTag(),"section");
assertEquals(HtmlTagsEnum.SMALL.getTag(),"small");
assertEquals(HtmlTagsEnum.SPAN.getTag(),"span");
assertEquals(HtmlTagsEnum.STRIKE.getTag(),"s");
assertEquals(HtmlTagsEnum.TABLE.getTag(),"table");
assertEquals(HtmlTagsEnum.TABLECOLUM.getTag(),"td");
assertEquals(HtmlTagsEnum.TABLECOLUMNTITLE.getTag(),"th");
assertEquals(HtmlTagsEnum.TABLEROW.getTag(),"tr");
assertEquals(HtmlTagsEnum.TEXTAREA.getTag(),"textarea");
assertEquals(HtmlTagsEnum.TITLE.getTag(),"title");
assertEquals(HtmlTagsEnum.UNDERLINE.getTag(),"u");
assertEquals(HtmlTagsEnum.VARIABLE.getTag(),"var");
assertEquals(HtmlTagsEnum.WANTEDBREAK.getTag(),"wbr");
}
}

View File

@ -1,33 +0,0 @@
package test;
import main.html;
import main.htmlTagsEnum;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
class htmlTest {
html html = new main.html();
@Test
void htmlContentModuleTest() {
assertEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.PRETAG,"content"));
}
@Test
void htmlInlineModuleTest() {
assertEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.PRETAG,"content"));
}
@Test
void customContentModuleTest() {
assertEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("testtag","content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("testtag","fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("pretag","content"));
}
}