Skip to content

Commit

Permalink
Fixing package names
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed May 16, 2024
1 parent bcdb474 commit 8d8d720
Show file tree
Hide file tree
Showing 23 changed files with 169 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,18 @@
* <h2>Summary</h2>
* <p>
* Provides classes for dealing with
* {@link javax.faces.application.FacesMessage}s
* {@link jakarta.faces.application.FacesMessage}s
* </p>
* <h2>MessageProducer</h2>
* <p>
* Provides methods for simplified, {@link java.util.ResourceBundle}-based
* creating / setting of {@link javax.faces.application.FacesMessage}s. Provided
* creating / setting of {@link jakarta.faces.application.FacesMessage}s. Provided
* classes are:
* </p>
* <ul>
* <li>{@link de.cuioss.jsf.api.application.message.MessageProducer}: Defines
* methods for creating / setting of Jsf-messages</li>
* <li>{@link de.cuioss.jsf.api.application.message.MessageProducerImpl}:
* Default implementation, needs to be configured within faces-config</li>
* <li>{@link de.cuioss.jsf.api.application.message.MessageProducerAccessor}:
* Accessor for concrete instances of
* {@link de.cuioss.jsf.api.application.message.MessageProducer}. Assumes a
* configured bean under the name of
* {@link de.cuioss.jsf.api.application.message.MessageProducerImpl#BEAN_NAME}</li>
* </ul>
* <h3>Configuration faces-config</h3>
*
* <pre>
* {@code <managed-bean>
* <managed-bean-name>messageProducer</managed-bean-name>
* <managed-bean-class>de.cuioss.jsf.api.application.message.MessageProducerImpl</managed-bean-class>
* <managed-bean-scope>request</managed-bean-scope>
* <managed-property>
* <property-name>resourceBundle</property-name>
* <value>#(msgs)</value>
* </managed-property>
* </managed-bean>}
* </pre>
*
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
/**
* @deprecated use CuiBeanManager instead
*
* <h2>Summary</h2>
* <p>
* The accessors provide a common way to access runtime
* {@link javax.faces.bean.ManagedBean} instances in a more
* object-oriented way. See
* {@link de.cuioss.jsf.api.common.accessor.ManagedAccessor} and
* {@link de.cuioss.jsf.api.common.accessor.ManagedBeanAccessor} for
* details.
* </p>
* <p>
* The {@link de.cuioss.jsf.api.common.accessor.ConverterAccessor}
* is a specialized variant used for accessing concrete
* {@link javax.faces.convert.Converter} instances.
* </p>
*
* @author Oliver Wolff
*
* <h2>Summary</h2>
* <p>
* {@link de.cuioss.jsf.api.common.accessor.ManagedAccessor}
* </p>
* <p>
* The {@link de.cuioss.jsf.api.common.accessor.ConverterAccessor}
* is a specialized variant used for accessing concrete
* {@link jakarta.faces.convert.Converter} instances.
* </p>
*/
package de.cuioss.jsf.api.common.accessor;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,18 @@
*/
package de.cuioss.jsf.api.components.base;

import de.cuioss.jsf.api.components.css.StyleClassBuilder;
import de.cuioss.jsf.api.components.partial.*;
import jakarta.faces.component.StateHelper;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.html.HtmlOutputText;
import jakarta.faces.context.FacesContext;

import de.cuioss.jsf.api.components.css.StyleClassBuilder;
import de.cuioss.jsf.api.components.partial.ComponentBridge;
import de.cuioss.jsf.api.components.partial.ComponentStyleClassProvider;
import de.cuioss.jsf.api.components.partial.ComponentStyleClassProviderImpl;
import de.cuioss.jsf.api.components.partial.TitleProvider;
import de.cuioss.jsf.api.components.partial.TitleProviderImpl;
import lombok.experimental.Delegate;

/**
* <p>
* Base class for creating CuiComponents that are based on on simple
* span-element, The default renderer is "javax.faces.Text". It acts as
* span-element, The default renderer is "jakarta.faces.Text". It acts as
* {@link ComponentBridge}.
* </p>
* <h2>Attributes</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Decorators are new type of attached objects, similar to
* {@link javax.faces.convert.Converter} {@link javax.faces.validator.Validator}
* and {@link javax.faces.component.behavior.ClientBehavior}. Actual they are
* similar to {@link javax.faces.component.behavior.ClientBehavior} except that
* {@link jakarta.faces.convert.Converter} {@link jakarta.faces.validator.Validator}
* and {@link jakarta.faces.component.behavior.ClientBehavior}.
* Actually they are similar to {@link jakarta.faces.component.behavior.ClientBehavior} except that
* they do not react on a client interaction but decorate some other component.
*
* @author Oliver Wolff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* <h2>Summary</h2> Provides common helper classes / utilities that can be used
* <h2>Summary</h2>
* Provides common helper classes / utilities that can be used
* for the creation of partial html-trees. The central class is
* {@link de.cuioss.jsf.api.components.html.HtmlTreeBuilder} with a number of
* fluent-style methods for creating the trees. A typical using-code is
*
* <pre>
*{@code
* {@code
* new HtmlTreeBuilder().withNode(Node.DIV).withTextContent("Some Text Child");
* }
* </pre>
*
* The result can directly passed to a
* {@link javax.faces.context.ResponseWriter} in order to integrate with the
* creation of {@link javax.faces.render.Renderer}
* <p>
* The result can be directly passed to a
* {@link jakarta.faces.context.ResponseWriter} in order to integrate with the
* creation of {@link jakarta.faces.render.Renderer}
*
* @author Oliver Wolff
*
*/
package de.cuioss.jsf.api.components.html;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <ul>
* <li>Use the standard-methods like {@link TitleProvider#setTitleKey(String)} as usual</li>
* <li>The {@link jakarta.faces.render.Renderer must call {@link TitleProvider#resolveAndStoreTitle()} </li>
* <li>Finally the {@link javax.faces.render.Renderer} must call {@link #writeTitleToParent()}</li>
* <li>Finally the {@link jakarta.faces.render.Renderer} must call {@link #writeTitleToParent()}</li>
* </ul>
* See {@link BaseCuiCommandButton} for usage
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
* <h2>Summary</h2>
* <p>
* Provides common helper classes / utilities that can be used for the creation
* of {@link javax.faces.component.UIComponent} and
* {@link javax.faces.render.Renderer}
* of {@link jakarta.faces.component.UIComponent} and
* {@link jakarta.faces.render.Renderer}
* </p>
*
* @author Oliver Wolff
*
*/
package de.cuioss.jsf.api.components;
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
package de.cuioss.jsf.api.components.renderer;

import static de.cuioss.tools.string.MoreStrings.isEmpty;

import java.io.IOException;

import de.cuioss.jsf.api.components.util.ComponentWrapper;
import de.cuioss.tools.logging.CuiLogger;
import de.cuioss.tools.string.MoreStrings;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.ValueHolder;
import jakarta.faces.component.behavior.ClientBehavior;
Expand All @@ -27,23 +26,23 @@
import jakarta.faces.convert.ConverterException;
import jakarta.faces.render.Renderer;

import de.cuioss.jsf.api.components.util.ComponentWrapper;
import de.cuioss.tools.logging.CuiLogger;
import de.cuioss.tools.string.MoreStrings;
import java.io.IOException;

import static de.cuioss.tools.string.MoreStrings.isEmpty;

/**
* Base class for renderer that use {@link DecoratingResponseWriter} in order to
* simplify usage. The actual implementor must implement at least one of
* doEncodeBegin or doEncodeEnd
*
* @author Oliver Wolff
* @param <T> identifying the concrete component to be rendered, at least
* {@link UIComponent}
* @author Oliver Wolff
*/
public class BaseDecoratorRenderer<T extends UIComponent> extends Renderer {

private static final String JAVAX_FACES_SOURCE = "javax.faces.source";
private static final String JAVAX_FACES_BEHAVIOR_EVENT = "javax.faces.behavior.event";
private static final String JAVAX_FACES_SOURCE = "jakarta.faces.source";
private static final String JAVAX_FACES_BEHAVIOR_EVENT = "jakarta.faces.behavior.event";
private static final CuiLogger log = new CuiLogger(BaseDecoratorRenderer.class);
private final boolean renderChildren;

Expand All @@ -58,6 +57,33 @@ public BaseDecoratorRenderer(final boolean renderChildren) {
this.renderChildren = renderChildren;
}

/**
* @param behaviorSourceId value could be missing
* @param componentClientId value which should be checked
* @return true, if the ID given in <code>behaviorSourceId</code> is supposed to
* come from the component with <code>componentClientId</code>
*/
protected static boolean isFromBehaviorSource(final String behaviorSourceId, final String componentClientId) {
return !MoreStrings.isEmpty(behaviorSourceId) && behaviorSourceId.equals(componentClientId);
}

/**
* Simple helper method that strips on prefixes from possible dom-event-names
*
* @param domEventName maybe null or empty
* @return in case of the given event starts with "on", e.g. "onclick" it
* returns the token after on "on" in the example, this would be "click"
*/
public static String fixDomeEventName(final String domEventName) {
if (isEmpty(domEventName)) {
return domEventName;
}
if (domEventName.startsWith("on")) {
return domEventName.substring(2);
}
return domEventName;
}

/**
* This component always take care on rendering its children
*/
Expand All @@ -75,8 +101,8 @@ public void encodeBegin(final FacesContext context, final UIComponent component)
return;
}
@SuppressWarnings("unchecked") // owolff Should not be a problem because
// the cast is safe because of the
// typing
// the cast is safe because of the
// typing
final var typedComponent = (T) component;
doEncodeBegin(context, new DecoratingResponseWriter<>(context, typedComponent), typedComponent);
}
Expand All @@ -92,8 +118,8 @@ public void encodeChildren(final FacesContext context, final UIComponent compone
return;
}
@SuppressWarnings("unchecked") // owolff Should not be a problem because
// the cast is safe because of the
// typing
// the cast is safe because of the
// typing
final var typedComponent = (T) component;
doEncodeChildren(context, new DecoratingResponseWriter<>(context, typedComponent), typedComponent);
}
Expand All @@ -107,16 +133,16 @@ public void encodeEnd(final FacesContext context, final UIComponent component) t
return;
}
@SuppressWarnings("unchecked") // owolff Should not be a problem because
// the cast is safe because of the
// typing
// the cast is safe because of the
// typing
final var typedComponent = (T) component;
doEncodeEnd(context, new DecoratingResponseWriter<>(context, typedComponent), typedComponent);
}

@Override
@SuppressWarnings("unchecked") // owolff Should not be a problem because
// the cast is safe because of the
// typing
// the cast is safe because of the
// typing
public void decode(final FacesContext context, final UIComponent component) {
// Checks the contract
super.decode(context, component);
Expand All @@ -131,7 +157,7 @@ public void decode(final FacesContext context, final UIComponent component) {

@Override
public Object getConvertedValue(final FacesContext context, final UIComponent component,
final Object submittedValue) {
final Object submittedValue) {
final var valueExpression = component.getValueExpression("value");
Converter<?> converter = null;
if (component instanceof ValueHolder holder) {
Expand All @@ -140,7 +166,7 @@ public Object getConvertedValue(final FacesContext context, final UIComponent co
if (null == converter && null != valueExpression) {
final Class<?> converterType = valueExpression.getType(context.getELContext());
if (null == converterType || Object.class == converterType || converterType == String.class
&& null != context.getApplication().createConverter(String.class)) {
&& null != context.getApplication().createConverter(String.class)) {
return submittedValue;
}
try {
Expand Down Expand Up @@ -190,16 +216,6 @@ protected void decodeClientBehavior(final FacesContext context, final ComponentW
}
}

/**
* @param behaviorSourceId value could be missing
* @param componentClientId value which should be checked
* @return true, if the ID given in <code>behaviorSourceId</code> is supposed to
* come from the component with <code>componentClientId</code>
*/
protected static boolean isFromBehaviorSource(final String behaviorSourceId, final String componentClientId) {
return !MoreStrings.isEmpty(behaviorSourceId) && behaviorSourceId.equals(componentClientId);
}

/**
* The actual method of the renderer to be implemented as replacement for
* {@link Renderer#encodeBegin(FacesContext, UIComponent)}. The default
Expand All @@ -214,7 +230,7 @@ protected static boolean isFromBehaviorSource(final String behaviorSourceId, fin
* @throws IOException occurs on interrupted I/O operations
*/
protected void doEncodeBegin(final FacesContext context, final DecoratingResponseWriter<T> writer,
final T component) throws IOException {
final T component) throws IOException {
// NOOP if not overridden by subclass
}

Expand All @@ -232,7 +248,7 @@ protected void doEncodeBegin(final FacesContext context, final DecoratingRespons
* @throws IOException occurs on interrupted I/O operations
*/
protected void doEncodeChildren(final FacesContext context, final DecoratingResponseWriter<T> writer,
final T component) throws IOException {
final T component) throws IOException {
for (final UIComponent child : component.getChildren()) {
if (child.isRendered()) {
child.encodeAll(context);
Expand All @@ -254,7 +270,7 @@ protected void doEncodeChildren(final FacesContext context, final DecoratingResp
* @throws IOException occurs on interrupted I/O operations
*/
protected void doEncodeEnd(final FacesContext context, final DecoratingResponseWriter<T> writer, final T component)
throws IOException {
throws IOException {
// NOOP if not overridden by subclass
}

Expand All @@ -272,21 +288,4 @@ protected void doEncodeEnd(final FacesContext context, final DecoratingResponseW
protected void doDecode(final FacesContext context, final ComponentWrapper<T> componentWrapper) {
// NOOP if not overridden by subclass
}

/**
* Simple helper method that strips on prefixes from possible dom-event-names
*
* @param domEventName may be null or empty
* @return in case of the given event starts with "on", e.g. "onclick" it
* returns the token after on "on" in the example this would be "click"
*/
public static final String fixDomeEventName(final String domEventName) {
if (isEmpty(domEventName)) {
return domEventName;
}
if (domEventName.startsWith("on")) {
return domEventName.substring(2);
}
return domEventName;
}
}
Loading

0 comments on commit 8d8d720

Please sign in to comment.