added more Attributes getter and setter with descriptions and corresponding Enums(unfinished)
This commit is contained in:
parent
2d232a4c71
commit
6237f1aa5f
@ -8,6 +8,9 @@ public class ModuleComment extends ModuleGeneric {
|
||||
@Override
|
||||
public StringBuilder build() {
|
||||
StringBuilder output = new StringBuilder();
|
||||
if (!singleLine){
|
||||
output.append("\n");
|
||||
}
|
||||
output
|
||||
.append("<!--")
|
||||
.append(comment)
|
||||
|
@ -1,7 +1,9 @@
|
||||
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;
|
||||
@ -12,16 +14,18 @@ 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 globalAttributeDataPrefix; //used with dataValue
|
||||
protected String globalAttributeDataName; //used with dataValue
|
||||
protected String globalAttributeDataValue; //used with dataPrefix
|
||||
protected String globalAttributeDir;
|
||||
protected GlobalAttributeDirEnum globalAttributeDir;
|
||||
protected GlobalAttributeDraggableEnum globalAttributeDraggable;
|
||||
protected String globalAttributeEnterkeyhint;
|
||||
protected GlobalAttributeEnterkeyhintEnum globalAttributeEnterkeyhint;
|
||||
protected boolean globalAttributeHidden;
|
||||
protected String globalAttributeId;
|
||||
protected boolean globalAttributeInert;
|
||||
@ -404,8 +408,18 @@ public class ModuleGeneric {
|
||||
}
|
||||
}
|
||||
|
||||
if (contentText != null){
|
||||
if (!singleLine){
|
||||
buildString.append("\n");
|
||||
}
|
||||
buildString.append(contentText);
|
||||
}
|
||||
|
||||
if (!singleLine){
|
||||
buildString.append("\n");
|
||||
}
|
||||
buildString
|
||||
.append("\n</")
|
||||
.append("</")
|
||||
.append(tag.getTag())
|
||||
.append(">");
|
||||
return buildString;
|
||||
|
@ -1,25 +1,45 @@
|
||||
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;
|
||||
}
|
||||
@ -42,69 +62,214 @@ public class ModuleTag extends ModuleGeneric {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param classAttribute
|
||||
*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;
|
||||
}
|
||||
|
||||
public void setDataPrefixAttribute(String dataPrefixAttribute){
|
||||
this.globalAttributeDataPrefix = dataPrefixAttribute;
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
public String getDataPrefixAttribute(){
|
||||
return globalAttributeDataPrefix;
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public void setDirAttribute(String dirAttribute){
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public String getDirAttribute(){
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public void setEnterkeyhintAttribute(String enterkeyhintAttribute){
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public String getEnterkeyhintAttribute(){
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -5,11 +5,11 @@ public enum GlobalAttributeDraggableEnum {
|
||||
FALSE("false"),
|
||||
AUTO("auto");
|
||||
|
||||
private String attribute;
|
||||
public String getAttribute(){
|
||||
return this.attribute;
|
||||
private String value;
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
private GlobalAttributeDraggableEnum(String attribute){
|
||||
this.attribute = attribute;
|
||||
private GlobalAttributeDraggableEnum(String value){
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user