diff --git a/src/main/java/com/jwebmp/core/base/ajax/AjaxResponse.java b/src/main/java/com/jwebmp/core/base/ajax/AjaxResponse.java index f200147..4a5da16 100644 --- a/src/main/java/com/jwebmp/core/base/ajax/AjaxResponse.java +++ b/src/main/java/com/jwebmp/core/base/ajax/AjaxResponse.java @@ -119,7 +119,7 @@ protected Set getFeatureQueries() Set list = new LinkedHashSet<>(); getFeatures().forEach(feature -> { - feature.preConfigure(); + feature.toString(); list.add(feature.renderJavascript() .toString()); }); diff --git a/src/main/java/com/jwebmp/core/base/html/interfaces/GlobalChildren.java b/src/main/java/com/jwebmp/core/base/html/interfaces/GlobalChildren.java index 5b4e219..f8cfae3 100644 --- a/src/main/java/com/jwebmp/core/base/html/interfaces/GlobalChildren.java +++ b/src/main/java/com/jwebmp/core/base/html/interfaces/GlobalChildren.java @@ -16,7 +16,7 @@ */ package com.jwebmp.core.base.html.interfaces; -import com.jwebmp.core.base.interfaces.*; +import com.jwebmp.core.base.interfaces.CastableComponent; /** * Defines the general interface for components that is allowed on most components @@ -26,10 +26,8 @@ * @since 2014/10/26 */ -public interface GlobalChildren { - void init(); - - void preConfigure(); +public interface GlobalChildren +{ boolean isConfigured(); @@ -42,7 +40,8 @@ public interface GlobalChildren { * * @return */ - default CastableComponent cast() { + default CastableComponent cast() + { return (CastableComponent) this; } diff --git a/src/main/java/com/jwebmp/core/base/html/interfaces/LifeCycle.java b/src/main/java/com/jwebmp/core/base/html/interfaces/LifeCycle.java index bb176c2..fb36afd 100644 --- a/src/main/java/com/jwebmp/core/base/html/interfaces/LifeCycle.java +++ b/src/main/java/com/jwebmp/core/base/html/interfaces/LifeCycle.java @@ -5,33 +5,23 @@ */ public interface LifeCycle { - /** - * Initializes - */ - void init(); + /** + * Is Configured + * + * @return if it is configured + */ - /** - * Preconfigures - */ - void preConfigure(); + boolean isConfigured(); - /** - * Is Configured - * - * @return if it is configured - */ + /** + * If it is initialized + * + * @return if the component has been initialized + */ + boolean isInitialized(); - boolean isConfigured(); - - /** - * If it is initialized - * - * @return if the component has been initialized - */ - boolean isInitialized(); - - /** - * What happens on destroy - */ - void destroy(); + /** + * What happens on destroy + */ + void destroy(); } diff --git a/src/main/java/com/jwebmp/core/base/interfaces/IComponentBase.java b/src/main/java/com/jwebmp/core/base/interfaces/IComponentBase.java index 227977d..24c5179 100644 --- a/src/main/java/com/jwebmp/core/base/interfaces/IComponentBase.java +++ b/src/main/java/com/jwebmp/core/base/interfaces/IComponentBase.java @@ -29,167 +29,163 @@ * @since 2016/09/26 */ public interface IComponentBase> - extends Cloneable, Serializable + extends Cloneable, Serializable { - /** - * Clones this component and assigns a new ID - *

- * - * @return The cloned component - */ - J cloneComponent(); - - /** - * Gets the ID of this component - *

- * - * @return The ID of this component - */ - String getID(); - - /** - * Returns the ID with the # in the front of it - *

- * - * @param jQueryHolder Anything - *

- * @return An ID starting with # - */ - String getID(boolean jQueryHolder); - - /** - * Returns the component rendering for JQuery string Requires the rendering for component is set - *

- * - * @return $(' # x '). - */ - String getJQueryID(); - - /** - * Returns the new line character according to Running Environment - *

- * - * @return A new line if is in development mode - */ - String getNewLine(); - - /** - * Returns a map of user defined properties for this component - * - * @return - */ - Map getProperties(); - - /** - * returns a new StringSuilder of the raw text with the specific tab counts - *

- * - * @param tabCounts

- * @return - */ - StringBuilder getText(int tabCounts); - - /** - * If this component is already configured - * - * @return - */ - boolean isConfigured(); - - /** - * Specifies whether or not to render this component in a Production/QA fashion - *

- * - * @return If this component will render in production mode - */ - boolean isTiny(); - - /** - * Run-Once on creation Executes a piece of code before running any rendering. Marks the component as configured - */ - void preConfigure(); - - /** - * If this component is already configured - * - * @param configured - * @return - */ - J setConfigured(boolean configured); - - /** - * Sets the ID of this component - *

- * - * @param id The ID - * @return - */ - J setID(String id); - - /** - * Sets this components user defined properties - * - * @param properties - * @return - */ - J setProperties(Map properties); - - /** - * Appends the text to the raw text - * - * @param text - * @return - */ - @SuppressWarnings("unchecked") - default J appendText(String text) - { - setText(getText(0) + text); - return (J) this; - } - - /** - * Sets this components Raw Text - *

- * - * @param text The text to display as Raw Text - * @return - */ - J setText(String text); - - /** - * Sets this components Raw Text - *

- * - * @param text The text to display as Raw Text - * @return - */ - J setText(StringBuilder text); - - /** - * If this component will render as tiny HTML. Global override value - *

- * - * @param tiny Set if this component must render as tiny HTML. Does not affect CSS or JavaScript rendering - * @return - */ - J setTiny(boolean tiny); - - /** - * Returns if this component is needing refresh on next Ajax call - *

- * - * @return true if going to be touched - */ - boolean isTouched(); - - /** - * Mark this component as needing refresh to the Ajax Controller - *

- * - * @param touched Whether or not to update on next ajax call - * @return - */ - J setTouched(boolean touched); - - ComponentTypes getComponentType(); + /** + * Clones this component and assigns a new ID + *

+ * + * @return The cloned component + */ + J cloneComponent(); + + /** + * Gets the ID of this component + *

+ * + * @return The ID of this component + */ + String getID(); + + /** + * Returns the ID with the # in the front of it + *

+ * + * @param jQueryHolder Anything + *

+ * @return An ID starting with # + */ + String getID(boolean jQueryHolder); + + /** + * Returns the component rendering for JQuery string Requires the rendering for component is set + *

+ * + * @return $(' # x '). + */ + String getJQueryID(); + + /** + * Returns the new line character according to Running Environment + *

+ * + * @return A new line if is in development mode + */ + String getNewLine(); + + /** + * Returns a map of user defined properties for this component + * + * @return + */ + Map getProperties(); + + /** + * returns a new StringSuilder of the raw text with the specific tab counts + *

+ * + * @param tabCounts

+ * @return + */ + StringBuilder getText(int tabCounts); + + /** + * If this component is already configured + * + * @return + */ + boolean isConfigured(); + + /** + * Specifies whether or not to render this component in a Production/QA fashion + *

+ * + * @return If this component will render in production mode + */ + boolean isTiny(); + + + /** + * If this component is already configured + * + * @param configured + * @return + */ + J setConfigured(boolean configured); + + /** + * Sets the ID of this component + *

+ * + * @param id The ID + * @return + */ + J setID(String id); + + /** + * Sets this components user defined properties + * + * @param properties + * @return + */ + J setProperties(Map properties); + + /** + * Appends the text to the raw text + * + * @param text + * @return + */ + @SuppressWarnings("unchecked") + default J appendText(String text) + { + setText(getText(0) + text); + return (J) this; + } + + /** + * Sets this components Raw Text + *

+ * + * @param text The text to display as Raw Text + * @return + */ + J setText(String text); + + /** + * Sets this components Raw Text + *

+ * + * @param text The text to display as Raw Text + * @return + */ + J setText(StringBuilder text); + + /** + * If this component will render as tiny HTML. Global override value + *

+ * + * @param tiny Set if this component must render as tiny HTML. Does not affect CSS or JavaScript rendering + * @return + */ + J setTiny(boolean tiny); + + /** + * Returns if this component is needing refresh on next Ajax call + *

+ * + * @return true if going to be touched + */ + boolean isTouched(); + + /** + * Mark this component as needing refresh to the Ajax Controller + *

+ * + * @param touched Whether or not to update on next ajax call + * @return + */ + J setTouched(boolean touched); + + ComponentTypes getComponentType(); } diff --git a/src/main/java/com/jwebmp/core/base/interfaces/IComponentHTMLBase.java b/src/main/java/com/jwebmp/core/base/interfaces/IComponentHTMLBase.java index 661862c..4f8a0af 100644 --- a/src/main/java/com/jwebmp/core/base/interfaces/IComponentHTMLBase.java +++ b/src/main/java/com/jwebmp/core/base/interfaces/IComponentHTMLBase.java @@ -24,9 +24,14 @@ * @author GedMarc * @since Sep 26, 2016 */ -@SuppressWarnings({"UnusedReturnValue", "MissingClassJavaDoc"}) +@SuppressWarnings({"UnusedReturnValue", + "MissingClassJavaDoc"}) public interface IComponentHTMLBase> { + // StringBuilder getHtml(); + + //void clearHtmlCache(); + /** * Returns this tag *

@@ -78,7 +83,7 @@ public interface IComponentHTMLBase> * * @return A string of the html tag */ - + String toTinyString(); /** @@ -95,7 +100,7 @@ public interface IComponentHTMLBase> * @param newLineForRawText If there should be a new line for raw text * @return Always this object */ - + J setNewLineForRawText(boolean newLineForRawText); /** diff --git a/src/main/java/com/jwebmp/core/base/interfaces/IComponentHierarchyBase.java b/src/main/java/com/jwebmp/core/base/interfaces/IComponentHierarchyBase.java index d701518..6076422 100644 --- a/src/main/java/com/jwebmp/core/base/interfaces/IComponentHierarchyBase.java +++ b/src/main/java/com/jwebmp/core/base/interfaces/IComponentHierarchyBase.java @@ -25,6 +25,7 @@ import com.jwebmp.core.htmlbuilder.javascript.events.interfaces.IEvent; import com.jwebmp.core.services.IPage; +import java.util.List; import java.util.Map; import java.util.Set; @@ -46,8 +47,8 @@ public interface IComponentHierarchyBase> T wrap( T component); + + > T wrap(T component); /** * Takes all children and embeds them into the current children hierarchy @@ -58,8 +59,8 @@ public interface IComponentHierarchyBase> T embed( T component); + + > T embed(T component); /** * Add a new child to this component @@ -78,7 +79,7 @@ public interface IComponentHierarchyBase getChildren(); + List getChildren(); /** * Get an array list of all children and their children recursively Includes this object @@ -285,7 +286,7 @@ public interface IComponentHierarchyBase className, Enum... classNames); + J removeClass(Enum className, Enum... classNames); /** * Enumeration to remove @@ -293,7 +294,7 @@ public interface IComponentHierarchyBase className); + boolean removeClass(Enum className); /** * Sets the ID and adds the attribute to the global set @@ -358,7 +359,7 @@ public interface IComponentHierarchyBase> T findChild( Class childType); + > T findChild(Class childType); /** * Returns a property of the first child in the current child chain @@ -385,6 +386,8 @@ public interface IComponentHierarchyBase getConfigurations(); + /** * Adds a custom configuration component to this object for rendering instructions * @@ -399,5 +402,10 @@ public interface IComponentHierarchyBase getConfigurations(Class configurationType); + Set getConfigurations(Class configurationType, boolean childrenHierarchy); + + default Set getConfigurations(Class configurationType) + { + return getConfigurations(configurationType, false); + } } diff --git a/src/main/java/com/jwebmp/core/databind/IAfterRenderComplete.java b/src/main/java/com/jwebmp/core/databind/IAfterRenderComplete.java new file mode 100644 index 0000000..1b1c242 --- /dev/null +++ b/src/main/java/com/jwebmp/core/databind/IAfterRenderComplete.java @@ -0,0 +1,9 @@ +package com.jwebmp.core.databind; + +import com.guicedee.guicedinjection.interfaces.IDefaultService; +import com.jwebmp.core.base.interfaces.IComponentHierarchyBase; + +public interface IAfterRenderComplete> extends IDefaultService +{ + void process(IComponentHierarchyBase componentHierarchyBase); +} diff --git a/src/main/java/com/jwebmp/core/databind/IConfiguration.java b/src/main/java/com/jwebmp/core/databind/IConfiguration.java index 145f79a..a72a738 100644 --- a/src/main/java/com/jwebmp/core/databind/IConfiguration.java +++ b/src/main/java/com/jwebmp/core/databind/IConfiguration.java @@ -1,5 +1,10 @@ package com.jwebmp.core.databind; +import java.lang.annotation.Annotation; + public interface IConfiguration { + Object value(); + + Class annotationType(); } diff --git a/src/main/java/com/jwebmp/core/databind/IOnComponentAdded.java b/src/main/java/com/jwebmp/core/databind/IOnComponentAdded.java index 922f6df..2a25859 100644 --- a/src/main/java/com/jwebmp/core/databind/IOnComponentAdded.java +++ b/src/main/java/com/jwebmp/core/databind/IOnComponentAdded.java @@ -9,8 +9,8 @@ public interface IOnComponentAdded> extends IDefa /** * intercepts the html render and provides a return value on whether children should be rendered * - * @param component - * @return + * @param component The component being added + * @param parent The parent being added to */ void onComponentAdded(IComponentHierarchyBase parent, IComponentHierarchyBase component); } diff --git a/src/main/java/com/jwebmp/core/htmlbuilder/javascript/JavaScriptPart.java b/src/main/java/com/jwebmp/core/htmlbuilder/javascript/JavaScriptPart.java index 135fd3d..94ab8a4 100644 --- a/src/main/java/com/jwebmp/core/htmlbuilder/javascript/JavaScriptPart.java +++ b/src/main/java/com/jwebmp/core/htmlbuilder/javascript/JavaScriptPart.java @@ -47,7 +47,9 @@ * @author mmagon * @since 2014/07/09 */ -@SuppressWarnings({"MissingClassJavaDoc", "unused", "unchecked"}) +@SuppressWarnings({"MissingClassJavaDoc", + "unused", + "unchecked"}) @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonIgnoreProperties(ignoreUnknown = true) @Log @@ -410,7 +412,7 @@ public boolean isInitialized() /** * Method init ... */ - public void init() + protected void init() { //No configuration needed } @@ -418,7 +420,7 @@ public void init() /** * Method preConfigure ... */ - public void preConfigure() + protected void preConfigure() { //No configuration needed }