Skip to content

Commit

Permalink
Add BlueImp Gallery and FileUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
GedMarc committed Mar 4, 2024
1 parent 171e962 commit 70e7e5d
Showing 1 changed file with 131 additions and 143 deletions.
274 changes: 131 additions & 143 deletions src/main/java/com/jwebmp/core/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.jwebmp.core.base.html.interfaces.GlobalFeatures;
import com.jwebmp.core.base.interfaces.IComponentHierarchyBase;
import com.jwebmp.core.base.servlets.enumarations.ComponentTypes;
import com.jwebmp.core.base.servlets.interfaces.IFeature;
import com.jwebmp.core.htmlbuilder.javascript.JavaScriptPart;
import jakarta.validation.constraints.NotNull;

Expand All @@ -28,165 +29,152 @@
/**
* Container Class for Features. Splits from the hierarchy
*
* @param <O>
* Any options associated with this feature
* @param <J>
* This Class
*
* @param <O> Any options associated with this feature
* @param <J> This Class
* @author GedMarc
* @since 23 Apr 2016
*/
@SuppressWarnings("MissingClassJavaDoc")
public abstract class Feature<F extends GlobalFeatures, O extends JavaScriptPart<?>, J extends Feature<F, O, J>>
extends ComponentFeatureBase<F, J>
implements GlobalFeatures
extends ComponentFeatureBase<F, J>
implements GlobalFeatures, IFeature<F, J>
{
/**
* The options object associated with this feature
*/
/**
* The options object associated with this feature
*/

private O options;
private O options;

/**
* Constructs a feature that can be used with all components, but the name is fixed, so only the first one will ever exist....
* Don't use this
*/
public Feature()
{
this("No Name Feature");
}
/**
* Constructs a feature that can be used with all components, but the name is fixed, so only the first one will ever exist....
* Don't use this
*/
public Feature()
{
this("No Name Feature");
}

/**
* Constructs a feature that can be used with all components
*
* @param name
* The unique name of the feature
*/
public Feature(String name)
{
super(ComponentTypes.Feature);
setName(name);
}
/**
* Constructs a feature that can be used with all components
*
* @param name The unique name of the feature
*/
public Feature(String name)
{
super(ComponentTypes.Feature);
setName(name);
}

/**
* Constructs a feature that can be used with all components
*
* @param name
* The unique name and component for the feature
* @param component
* The given component
*/
public Feature(String name, IComponentHierarchyBase<?,?> component)
{
super(ComponentTypes.Feature);
setName(name);
super.setComponent(component);
}
/**
* Constructs a feature that can be used with all components
*
* @param name The unique name and component for the feature
* @param component The given component
*/
public Feature(String name, IComponentHierarchyBase<?, ?> component)
{
super(ComponentTypes.Feature);
setName(name);
super.setComponent(component);
}

/**
* Adds a query to builder
*
* @param query
* Adds a query as a string builder
*
* @return Always this class
*/
public J addQuery(String query)
{
StringBuilder sb = new StringBuilder(query);
return super.addQuery(sb);
}
/**
* Adds a query to builder
*
* @param query Adds a query as a string builder
* @return Always this class
*/
public J addQuery(String query)
{
StringBuilder sb = new StringBuilder(query);
return super.addQuery(sb);
}

/**
* Method hashCode ...
*
* @return int
*/
@Override
public int hashCode()
{
return getName().hashCode();
}
/**
* Method hashCode ...
*
* @return int
*/
@Override
public int hashCode()
{
return getName().hashCode();
}

/**
* Method equals ...
*
* @param obj
* of type Object
*
* @return boolean
*/
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || getClass() != obj.getClass())
{
return false;
}
if (!super.equals(obj))
{
return false;
}
Feature<?, ?, ?> feature = (Feature<?, ?, ?>) obj;
return Objects.equals(getName(), feature.getName());
}
/**
* Method equals ...
*
* @param obj of type Object
* @return boolean
*/
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || getClass() != obj.getClass())
{
return false;
}
if (!super.equals(obj))
{
return false;
}
Feature<?, ?, ?> feature = (Feature<?, ?, ?>) obj;
return Objects.equals(getName(), feature.getName());
}

/**
* Returns any client side options available with this component
*
* @return The options object that is nullable
*
* @see com.jwebmp.core.base.ComponentFeatureBase#getOptions()
*/
@Override
public O getOptions()
{
return options;
}
/**
* Returns any client side options available with this component
*
* @return The options object that is nullable
* @see com.jwebmp.core.base.ComponentFeatureBase#getOptions()
*/
@Override
public O getOptions()
{
return options;
}

/**
* Use Add Query to add a query to the container
*/
@Override
protected abstract void assignFunctionsToComponent();
/**
* Use Add Query to add a query to the container
*/
@Override
protected abstract void assignFunctionsToComponent();

/**
* Returns any hierarchal assigned component
*
* @param component
* The component to use
*
* @return This component
*
* @see com.jwebmp.core.base.ComponentFeatureBase#setComponent(IComponentHierarchyBase)
*/
@NotNull
@Override
public J setComponent(IComponentHierarchyBase<?,?> component)
{
if (getComponent() != null)
{
getComponent().asFeatureBase().getFeatures().remove(this);
}
return super.setComponent(component);
}
/**
* Returns any hierarchal assigned component
*
* @param component The component to use
* @return This component
* @see com.jwebmp.core.base.ComponentFeatureBase#setComponent(IComponentHierarchyBase)
*/
@NotNull
@Override
public J setComponent(IComponentHierarchyBase<?, ?> component)
{
if (getComponent() != null)
{
getComponent().asFeatureBase()
.getFeatures()
.remove(this);
}
return super.setComponent(component);
}

/**
* Sets the options object
*
* @param options
* The options object
*/
@SuppressWarnings("unchecked")
@NotNull
public J setOptions(O options)
{
this.options = options;
return (J) this;
}
/**
* Sets the options object
*
* @param options The options object
*/
@SuppressWarnings("unchecked")
@NotNull
public J setOptions(O options)
{
this.options = options;
return (J) this;
}

}

0 comments on commit 70e7e5d

Please sign in to comment.