myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] 01/02: clean up
Date Wed, 21 Oct 2020 11:18:30 GMT
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit d50fa553dd2e4e60338f004bdeae1afcc52a579b
Author: Udo Schnurpfeil <udo.schnurpfeil@irian.eu>
AuthorDate: Wed Oct 21 12:53:47 2020 +0200

    clean up
    
    * using explicit methods instead of static utils
---
 .../tobago/internal/component/AbstractUIInput.java |  6 ++++
 .../component/AbstractUISelectBoolean.java         |  6 ++++
 .../component/AbstractUISelectManyBase.java        |  7 ++++
 .../component/AbstractUISelectOneBase.java         |  6 ++++
 .../tobago/internal/component/AbstractUIStars.java | 37 +---------------------
 .../internal/renderkit/renderer/InRenderer.java    |  2 +-
 .../internal/renderkit/renderer/RangeRenderer.java |  2 +-
 .../renderer/SelectBooleanCheckboxRenderer.java    |  2 +-
 .../renderer/SelectManyCheckboxRenderer.java       |  2 +-
 .../renderer/SelectManyListboxRenderer.java        |  6 ++--
 .../renderer/SelectManyShuttleRenderer.java        | 14 ++++----
 .../renderer/SelectOneChoiceRenderer.java          |  2 +-
 .../renderer/SelectOneListboxRenderer.java         |  2 +-
 .../SelectOneRadioInsideCommandRenderer.java       |  1 -
 .../renderkit/renderer/SelectOneRadioRenderer.java |  2 +-
 .../internal/renderkit/renderer/SheetRenderer.java |  9 ++++--
 .../internal/renderkit/renderer/StarsRenderer.java |  2 +-
 .../renderkit/renderer/TextareaRenderer.java       |  2 +-
 .../renderkit/renderer/TreeIndentRenderer.java     |  1 -
 .../taglib/component/StarsTagDeclaration.java      |  4 ++-
 .../tobago/internal/util/HtmlRendererUtils.java    | 14 --------
 .../myfaces/tobago/renderkit/RendererBase.java     | 21 ++++++++++--
 .../apache/myfaces/tobago/util/ComponentUtils.java |  8 +++++
 23 files changed, 81 insertions(+), 77 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
index 1381aa5..7e7c7cf 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
@@ -45,6 +45,12 @@ public abstract class AbstractUIInput extends javax.faces.component.UIInput
 
   public abstract boolean isReadonly();
 
+  public boolean isError() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    return !isValid()
+        || !facesContext.getMessageList(getClientId(facesContext)).isEmpty();
+  }
+
   @Override
   public String getFieldId(final FacesContext facesContext) {
     return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBoolean.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBoolean.java
index 9fa149e..718d2bc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBoolean.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBoolean.java
@@ -70,6 +70,12 @@ public abstract class AbstractUISelectBoolean extends UISelectBoolean
 
   public abstract boolean isReadonly();
 
+  public boolean isError() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    return !isValid()
+        || !facesContext.getMessageList(getClientId(facesContext)).isEmpty();
+  }
+
   public abstract boolean isFocus();
 
   public abstract Integer getTabIndex();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBase.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBase.java
index fe2a46e..f3c9073 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBase.java
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.component.Visual;
 
 import javax.faces.component.UISelectMany;
 import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
 import java.util.Collection;
 
 /**
@@ -51,6 +52,12 @@ public abstract class AbstractUISelectManyBase extends UISelectMany
 
   public abstract boolean isReadonly();
 
+  public boolean isError() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    return !isValid()
+        || !facesContext.getMessageList(getClientId(facesContext)).isEmpty();
+  }
+
   public abstract boolean isFocus();
 
   @Override
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneBase.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneBase.java
index 069350a..f942aa6 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneBase.java
@@ -62,6 +62,12 @@ public abstract class AbstractUISelectOneBase extends javax.faces.component.UISe
 
   public abstract boolean isDisabled();
 
+  public boolean isError() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    return !isValid()
+        || !facesContext.getMessageList(getClientId(facesContext)).isEmpty();
+  }
+
   public abstract boolean isFocus();
 
   public abstract Integer getTabIndex();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIStars.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIStars.java
index 67ddc8c..ac34eab 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIStars.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIStars.java
@@ -19,14 +19,6 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import org.apache.myfaces.tobago.component.SupportFieldId;
-import org.apache.myfaces.tobago.component.SupportsLabelLayout;
-import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-
-import javax.faces.component.UIInput;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.faces.context.FacesContext;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.ComponentSystemEvent;
 import javax.faces.event.ListenerFor;
@@ -34,14 +26,11 @@ import javax.faces.event.PreRenderComponentEvent;
 import javax.swing.BoundedRangeModel;
 
 @ListenerFor(systemEventClass = PreRenderComponentEvent.class)
-public abstract class AbstractUIStars extends UIInput
-    implements SupportFieldId, SupportsLabelLayout, Visual, ClientBehaviorHolder {
+public abstract class AbstractUIStars extends AbstractUIInput {
 
   private int rangeValue;
   private int rangeMax;
 
-  private transient boolean nextToRenderIsLabel;
-
   @Override
   public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
 
@@ -73,18 +62,10 @@ public abstract class AbstractUIStars extends UIInput
     }
   }
 
-  public abstract boolean isFocus();
-
-  public abstract boolean isReadonly();
-
-  public abstract boolean isDisabled();
-
   public abstract Integer getMax();
 
   public abstract Double getPlaceholder();
 
-  public abstract Integer getTabIndex();
-
   public int getRangeValue() {
     return rangeValue;
   }
@@ -92,20 +73,4 @@ public abstract class AbstractUIStars extends UIInput
   public int getRangeMax() {
     return rangeMax;
   }
-
-  @Override
-  public String getFieldId(final FacesContext facesContext) {
-    return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
-  }
-
-  @Override
-  public boolean isNextToRenderIsLabel() {
-    return nextToRenderIsLabel;
-  }
-
-  @Override
-  public void setNextToRenderIsLabel(final boolean nextToRenderIsLabel) {
-    this.nextToRenderIsLabel = nextToRenderIsLabel;
-  }
-
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
index d925ef7..4d87e70 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
@@ -143,7 +143,7 @@ public class InRenderer<T extends AbstractUIIn> extends MessageLayoutRendererBas
         component.getCustomClass());
 
     writer.writeAttribute(HtmlAttributes.REQUIRED, required);
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
     writeAdditionalAttributes(facesContext, writer, component);
 
     writer.endElement(HtmlElements.INPUT);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RangeRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RangeRenderer.java
index 3a43596..af3fb7f 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RangeRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RangeRenderer.java
@@ -87,7 +87,7 @@ public class RangeRenderer<T extends AbstractUIRange> extends MessageLayoutRende
         BootstrapClass.FORM_CONTROL,
         component.getCustomClass());
 
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
 
     writer.endElement(HtmlElements.INPUT);
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
index 8a554d5..0f2fce2 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
@@ -107,7 +107,7 @@ public class SelectBooleanCheckboxRenderer<T extends AbstractUISelectBooleanChec
     writer.writeAttribute(HtmlAttributes.READONLY, component.isReadonly());
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
     writer.writeAttribute(HtmlAttributes.REQUIRED, component.isRequired());
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
     writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
     writer.endElement(HtmlElements.INPUT);
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
index 55546e8..f82fa5e 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
@@ -101,7 +101,7 @@ public class SelectManyCheckboxRenderer<T extends AbstractUISelectManyCheckbox>
         writer.writeAttribute(HtmlAttributes.READONLY, readonly);
         writer.writeAttribute(HtmlAttributes.REQUIRED, required);
         if (first) {
-          HtmlRendererUtils.renderFocus(id, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+          renderFocus(id, component.isFocus(), component.isError(), facesContext, writer);
           first = false;
         }
         writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListboxRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListboxRenderer.java
index 149d6ab..cd2f141 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListboxRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListboxRenderer.java
@@ -68,7 +68,7 @@ public class SelectManyListboxRenderer<T extends AbstractUISelectManyListbox>
ex
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
     writer.writeAttribute(HtmlAttributes.READONLY, readonly);
     writer.writeAttribute(HtmlAttributes.REQUIRED, component.isRequired());
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
     writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
 
     writer.writeClassAttribute(
@@ -84,8 +84,8 @@ public class SelectManyListboxRenderer<T extends AbstractUISelectManyListbox>
ex
     final Object[] values = component.getSelectedValues();
     final String[] submittedValues = getSubmittedValues(component);
 
-    HtmlRendererUtils.renderSelectItems(component, TobagoClass.SELECT_MANY_LISTBOX__OPTION,
items, values, submittedValues,
-        writer, facesContext);
+    HtmlRendererUtils.renderSelectItems(
+        component, TobagoClass.SELECT_MANY_LISTBOX__OPTION, items, values, submittedValues,
writer, facesContext);
   }
 
   @Override
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
index 4c01a67..07c38fc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
@@ -94,8 +94,9 @@ public class SelectManyShuttleRenderer<T extends AbstractUISelectManyShuttle>
ex
 
     final Object[] values = component.getSelectedValues();
     final String[] submittedValues = getSubmittedValues(component);
-    HtmlRendererUtils.renderSelectItems(component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION,
items, values, submittedValues,
-        false, writer, facesContext);
+    HtmlRendererUtils.renderSelectItems(
+        component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION, items, values, submittedValues,
false, writer,
+        facesContext);
 
     writer.endElement(HtmlElements.SELECT);
     writer.startElement(HtmlElements.DIV);
@@ -130,8 +131,9 @@ public class SelectManyShuttleRenderer<T extends AbstractUISelectManyShuttle>
ex
         BootstrapClass.FORM_CONTROL);
     writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
     writer.writeAttribute(HtmlAttributes.SIZE, size);
-    HtmlRendererUtils.renderSelectItems(component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION,
items, values, submittedValues,
-        true, writer, facesContext);
+    HtmlRendererUtils.renderSelectItems(
+        component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION, items, values, submittedValues,
true, writer,
+        facesContext);
 
     writer.endElement(HtmlElements.SELECT);
     writer.startElement(HtmlElements.SELECT);
@@ -141,8 +143,8 @@ public class SelectManyShuttleRenderer<T extends AbstractUISelectManyShuttle>
ex
     writer.writeNameAttribute(clientId);
     writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
     writer.writeAttribute(HtmlAttributes.REQUIRED, component.isRequired());
-    HtmlRendererUtils.renderSelectItems(component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION,
items, values, submittedValues,
-        writer, facesContext);
+    HtmlRendererUtils.renderSelectItems(
+        component, TobagoClass.SELECT_MANY_SHUTTLE__OPTION, items, values, submittedValues,
writer, facesContext);
     writer.endElement(HtmlElements.SELECT);
   }
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceRenderer.java
index 6c2e888..3a2cd06 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceRenderer.java
@@ -74,7 +74,7 @@ public class SelectOneChoiceRenderer<T extends AbstractUISelectOneChoice>
extend
     if (title != null) {
       writer.writeAttribute(HtmlAttributes.TITLE, title, true);
     }
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
 
     HtmlRendererUtils.renderSelectItems(component, TobagoClass.SELECT_ONE_CHOICE__OPTION,
items, component.getValue(),
         (String) component.getSubmittedValue(), writer, facesContext);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java
index db28aa4..d258e3b 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java
@@ -66,7 +66,7 @@ public class SelectOneListboxRenderer<T extends AbstractUISelectOneListbox>
exte
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
     writer.writeAttribute(HtmlAttributes.READONLY, component.isReadonly());
     writer.writeAttribute(HtmlAttributes.REQUIRED, component.isRequired());
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
 
     writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
index 6c0a0d3..cae0b6d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.CssItem;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 
-import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
index 8a9867d..60ccb89 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
@@ -101,7 +101,7 @@ public class SelectOneRadioRenderer<T extends AbstractUISelectOneRadio>
extends
         writer.writeAttribute(HtmlAttributes.READONLY, readonly);
         writer.writeAttribute(HtmlAttributes.REQUIRED, required);
         if (first) {
-          HtmlRendererUtils.renderFocus(id, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+          renderFocus(id, component.isFocus(), component.isError(), facesContext, writer);
           first = false;
         }
         writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
index 669c2d2..9fa03e3 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
@@ -348,7 +348,8 @@ public class SheetRenderer<T extends AbstractUISheet> extends RendererBase<T>
{
 
     final List<Integer> expandedValue = component.isTreeModel() ? new ArrayList<>()
: null;
 
-    encodeTableBody(facesContext, component, writer, sheetId, selectable, columnWidths, selectedRows,
columns, autoLayout,
+    encodeTableBody(
+        facesContext, component, writer, sheetId, selectable, columnWidths, selectedRows,
columns, autoLayout,
         expandedValue);
 
     if (component.isPagingVisible()) {
@@ -424,7 +425,8 @@ public class SheetRenderer<T extends AbstractUISheet> extends RendererBase<T>
{
             BootstrapClass.PAGINATION);
         if (component.isShowDirectLinksArrows()) {
           final boolean disabled = component.isAtBeginning();
-          encodeLink(facesContext, component, application, disabled, SheetAction.first, null,
Icons.STEP_BACKWARD, null);
+          encodeLink(
+              facesContext, component, application, disabled, SheetAction.first, null, Icons.STEP_BACKWARD,
null);
           encodeLink(facesContext, component, application, disabled, SheetAction.prev, null,
Icons.BACKWARD, null);
         }
         encodeDirectPagingLinks(facesContext, application, component);
@@ -449,7 +451,8 @@ public class SheetRenderer<T extends AbstractUISheet> extends RendererBase<T>
{
             BootstrapClass.PAGINATION);
         if (component.isShowPageRangeArrows()) {
           final boolean disabled = component.isAtBeginning();
-          encodeLink(facesContext, component, application, disabled, SheetAction.first, null,
Icons.STEP_BACKWARD, null);
+          encodeLink(
+              facesContext, component, application, disabled, SheetAction.first, null, Icons.STEP_BACKWARD,
null);
           encodeLink(facesContext, component, application, disabled, SheetAction.prev, null,
Icons.BACKWARD, null);
         }
         writer.startElement(HtmlElements.LI);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/StarsRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/StarsRenderer.java
index 677c250..f7b307a 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/StarsRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/StarsRenderer.java
@@ -94,7 +94,7 @@ public class StarsRenderer<T extends AbstractUIStars> extends MessageLayoutRende
     writer.writeAttribute(HtmlAttributes.READONLY, readonly);
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
     writer.writeAttribute(HtmlAttributes.REQUIRED, required);
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
     writer.writeAttribute(HtmlAttributes.TABINDEX, component.getTabIndex());
     writer.writeAttribute(HtmlAttributes.TITLE, title, true);
     writer.endElement(HtmlElements.INPUT);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
index 29e17e0..c0fddf8 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
@@ -127,7 +127,7 @@ public class TextareaRenderer<T extends AbstractUITextarea> extends
MessageLayou
       writer.writeAttribute(HtmlAttributes.PATTERN, pattern, true);
     }
 
-    HtmlRendererUtils.renderFocus(clientId, component.isFocus(), ComponentUtils.isError(component),
facesContext, writer);
+    renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
 
     final String placeholder = component.getPlaceholder();
     if (!disabled && !readonly && StringUtils.isNotBlank(placeholder)) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
index 75045ed..38a6e45 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
@@ -32,7 +32,6 @@ import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
-import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StarsTagDeclaration.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StarsTagDeclaration.java
index 74cce07..8b09c72 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StarsTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StarsTagDeclaration.java
@@ -27,8 +27,10 @@ import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.ClientBehaviors;
 import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasAccessKey;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasConverter;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasConverterMessage;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasHelp;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabelLayout;
@@ -70,7 +72,7 @@ import javax.faces.component.UIInput;
 
 public interface StarsTagDeclaration extends HasIdBindingAndRendered, HasConverter, HasConverterMessage,
IsDisabled,
     IsFocus, HasTabIndex, HasLabel, HasLabelLayout, IsReadonly, IsRequired, HasRequiredMessage,
HasTip,
-    HasValidator, HasValidatorMessage, HasValue, HasValueChangeListener, IsVisual {
+    HasValidator, HasValidatorMessage, HasValue, HasValueChangeListener, IsVisual, HasAccessKey,
HasHelp {
 
   /**
    * The current value of this component. May be a java.lang.Number or a javax.swing.BoundedRangeModel
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java
index cbf68ba..e7b2990 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.Tags;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.context.Markup;
-import org.apache.myfaces.tobago.context.TobagoContext;
 import org.apache.myfaces.tobago.internal.component.AbstractUIStyle;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.css.Icons;
@@ -54,23 +53,10 @@ public final class HtmlRendererUtils {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  private static final String FOCUS_KEY = HtmlRendererUtils.class.getName() + ".FocusId";
-
   private HtmlRendererUtils() {
     // to prevent instantiation
   }
 
-  public static void renderFocus(
-      final String clientId, final boolean focus, final boolean error, final FacesContext
facesContext,
-      final TobagoResponseWriter writer) throws IOException {
-    final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
-    if (!requestMap.containsKey(FOCUS_KEY)
-        && (clientId.equals(TobagoContext.getInstance(facesContext).getFocusId())
|| focus || error)) {
-      requestMap.put(FOCUS_KEY, Boolean.TRUE);
-      writer.writeAttribute(HtmlAttributes.AUTOFOCUS, true);
-    }
-  }
-
   public static String getRendererName(final FacesContext facesContext, final UIComponent
component) {
     final String rendererType = component.getRendererType();
     return rendererType.substring(0, 1).toLowerCase(Locale.ENGLISH) + rendererType.substring(1);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
index 6e2f4b5..80dc3cf 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
@@ -20,6 +20,7 @@
 package org.apache.myfaces.tobago.renderkit;
 
 import org.apache.myfaces.tobago.component.ClientBehaviors;
+import org.apache.myfaces.tobago.context.TobagoContext;
 import org.apache.myfaces.tobago.internal.behavior.EventBehavior;
 import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
 import org.apache.myfaces.tobago.internal.component.AbstractUIEvent;
@@ -27,6 +28,7 @@ import org.apache.myfaces.tobago.internal.component.AbstractUIReload;
 import org.apache.myfaces.tobago.internal.renderkit.Collapse;
 import org.apache.myfaces.tobago.internal.renderkit.Command;
 import org.apache.myfaces.tobago.internal.renderkit.CommandMap;
+import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.internal.util.RenderUtils;
 import org.apache.myfaces.tobago.internal.webapp.TobagoResponseWriterWrapper;
 import org.apache.myfaces.tobago.renderkit.html.CustomAttributes;
@@ -60,6 +62,8 @@ public abstract class RendererBase<T extends UIComponent> extends
Renderer {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+  private static final String FOCUS_KEY = HtmlRendererUtils.class.getName() + ".FocusId";
+
   // begin of "redefine" the method signatur (generics): UIComponent -> T
 
   @Override
@@ -99,9 +103,10 @@ public abstract class RendererBase<T extends UIComponent> extends
Renderer {
   }
 
   @Override
-  public Object getConvertedValue(final FacesContext facesContext, final UIComponent component,
final Object submittedValue)
+  public Object getConvertedValue(
+      final FacesContext facesContext, final UIComponent component, final Object submittedValue)
       throws ConverterException {
-    return getConvertedValueInternal(facesContext, (T)component, submittedValue);
+    return getConvertedValueInternal(facesContext, (T) component, submittedValue);
   }
 
   public Object getConvertedValueInternal(
@@ -118,7 +123,6 @@ public abstract class RendererBase<T extends UIComponent> extends
Renderer {
     }
   }
 
-
 // end of "redefine"
 
   protected String getCurrentValue(final FacesContext facesContext, final T component) {
@@ -143,6 +147,17 @@ public abstract class RendererBase<T extends UIComponent> extends
Renderer {
     }
   }
 
+  public static void renderFocus(
+      final String clientId, final boolean focus, final boolean error, final FacesContext
facesContext,
+      final TobagoResponseWriter writer) throws IOException {
+    final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+    if (!requestMap.containsKey(FOCUS_KEY)
+        && (clientId.equals(TobagoContext.getInstance(facesContext).getFocusId())
|| focus || error)) {
+      requestMap.put(FOCUS_KEY, Boolean.TRUE);
+      writer.writeAttribute(HtmlAttributes.AUTOFOCUS, true);
+    }
+  }
+
   protected TobagoResponseWriter getResponseWriter(final FacesContext facesContext) {
     final ResponseWriter writer = facesContext.getResponseWriter();
     if (writer instanceof TobagoResponseWriter) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
index 9632865..49e6343 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
@@ -427,12 +427,20 @@ public final class ComponentUtils {
     return max;
   }
 
+  /**
+   * @deprecated since 5.0.0
+   */
+  @Deprecated
   public static boolean isError(final UIInput uiInput) {
     final FacesContext facesContext = FacesContext.getCurrentInstance();
     return !uiInput.isValid()
         || facesContext.getMessages(uiInput.getClientId(facesContext)).hasNext();
   }
 
+  /**
+   * @deprecated since 5.0.0
+   */
+  @Deprecated
   public static boolean isError(final UIComponent component) {
     if (component instanceof AbstractUIInput) {
       return isError((AbstractUIInput) component);


Mime
View raw message