You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/09/21 16:13:42 UTC
svn commit: r1761781 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/...
Author: lofwyr
Date: Wed Sep 21 16:13:42 2016
New Revision: 1761781
URL: http://svn.apache.org/viewvc?rev=1761781&view=rev
Log:
TOBAGO-1604: "inline" attribute for tc:form
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFormBase.java
- copied, changed from r1761671, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FormTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BarRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRendererBase.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandsRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java Wed Sep 21 16:13:42 2016
@@ -19,84 +19,9 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.util.AjaxUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
-import java.util.Iterator;
-
-public abstract class AbstractUIForm extends UIForm {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractUIForm.class);
+public abstract class AbstractUIForm extends AbstractUIFormBase {
public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Form";
- @Override
- public void processDecodes(final FacesContext facesContext) {
-
- // Process this component first
- // to know the active actionId
- // for the following children
- decode(facesContext);
-
- final Iterator kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- final UIComponent kid = (UIComponent) kids.next();
- kid.processDecodes(facesContext);
- }
- }
-
- @Override
- public void setSubmitted(final boolean b) {
- super.setSubmitted(b);
-
- // set submitted for all subforms
- for (final AbstractUIForm subForm : ComponentUtils.findSubForms(this)) {
- subForm.setSubmitted(b);
- }
- }
-
- @Override
- public void processValidators(final FacesContext facesContext) {
- // if we're not the submitted form, only process subforms.
- if (LOG.isDebugEnabled()) {
- LOG.debug("processValidators for form: {}", getClientId(facesContext));
- }
- if (isSubmitted() || AjaxUtils.isAjaxRequest(facesContext)) {
- // Process all facets and children of this component
- final Iterator kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- final UIComponent kid = (UIComponent) kids.next();
- kid.processValidators(facesContext);
- }
- } else {
- for (final AbstractUIForm subForm : ComponentUtils.findSubForms(this)) {
- subForm.processValidators(facesContext);
- }
- }
- }
-
- @Override
- public void processUpdates(final FacesContext facesContext) {
- // if we're not the submitted form, only process subforms.
- if (LOG.isDebugEnabled()) {
- LOG.debug("processUpdates for form: {}", getClientId(facesContext));
- }
- if (isSubmitted() || AjaxUtils.isAjaxRequest(facesContext)) {
- // Process all facets and children of this component
- final Iterator kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- final UIComponent kid = (UIComponent) kids.next();
- kid.processUpdates(facesContext);
- }
- } else {
- for (final AbstractUIForm subForm : ComponentUtils.findSubForms(this)) {
- subForm.processUpdates(facesContext);
- }
- }
- }
+ public abstract boolean isInline();
}
Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFormBase.java (from r1761671, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFormBase.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFormBase.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java&r1=1761671&r2=1761781&rev=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFormBase.java Wed Sep 21 16:13:42 2016
@@ -29,11 +29,9 @@ import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
import java.util.Iterator;
-public abstract class AbstractUIForm extends UIForm {
+public abstract class AbstractUIFormBase extends UIForm {
- private static final Logger LOG = LoggerFactory.getLogger(AbstractUIForm.class);
-
- public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Form";
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractUIFormBase.class);
@Override
public void processDecodes(final FacesContext facesContext) {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java Wed Sep 21 16:13:42 2016
@@ -32,7 +32,7 @@ import javax.faces.context.FacesContext;
import java.io.IOException;
import java.util.Iterator;
-public abstract class AbstractUIPage extends AbstractUIForm implements Visual {
+public abstract class AbstractUIPage extends AbstractUIFormBase implements Visual {
private static final Logger LOG = LoggerFactory.getLogger(AbstractUIPage.class);
@@ -142,7 +142,7 @@ public abstract class AbstractUIPage ext
}
if (command != null) {
- final AbstractUIForm form = ComponentUtils.findForm(command);
+ final AbstractUIFormBase form = ComponentUtils.findForm(command);
form.setSubmitted(true);
if (LOG.isTraceEnabled()) {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FormTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FormTagDeclaration.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FormTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FormTagDeclaration.java Wed Sep 21 16:13:42 2016
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasId;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsInline;
import javax.faces.component.UIForm;
@@ -41,13 +42,5 @@ import javax.faces.component.UIForm;
componentFamily = UIForm.COMPONENT_FAMILY,
rendererType = RendererTypes.FORM,
allowedChildComponenents = "ALL")
-public interface FormTagDeclaration extends HasBinding, HasId {
-
- /**
- *
-
- @TagAttribute
- @UIComponentTagAttribute(type = "java.lang.String")
- void setNotFor(String notFor);
- */
+public interface FormTagDeclaration extends HasBinding, HasId, IsInline {
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Wed Sep 21 16:13:42 2016
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.TransientStateHolder;
import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
+import org.apache.myfaces.tobago.internal.component.AbstractUIFormBase;
import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
@@ -194,10 +195,10 @@ public final class ComponentUtils {
}
- public static AbstractUIForm findForm(UIComponent component) {
+ public static AbstractUIFormBase findForm(UIComponent component) {
while (component != null) {
- if (component instanceof AbstractUIForm) {
- return (AbstractUIForm) component;
+ if (component instanceof AbstractUIFormBase) {
+ return (AbstractUIFormBase) component;
}
component = component.getParent();
}
@@ -377,8 +378,8 @@ public final class ComponentUtils {
public static boolean isInActiveForm(UIComponent component) {
while (component != null) {
- if (component instanceof AbstractUIForm) {
- final AbstractUIForm form = (AbstractUIForm) component;
+ if (component instanceof AbstractUIFormBase) {
+ final AbstractUIFormBase form = (AbstractUIFormBase) component;
if (form.isSubmitted()) {
return true;
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml Wed Sep 21 16:13:42 2016
@@ -35,7 +35,7 @@
<tc:link image="image/feather-leaf.png" label="Tobago Demo" id="brand" link="/"/>
</f:facet>
- <tc:form id="header">
+ <tc:form id="header" inline="true">
<tc:commands id="commands">
@@ -99,7 +99,7 @@
</tc:form>
<tc:flowLayout textAlign="right">
- <tc:form>
+ <tc:form inline="true">
<tc:in placeholder="Search"/>
<tc:button defaultCommand="true" omit="true" label="go">
<tc:dataAttribute name="alert-text"
@@ -107,7 +107,7 @@
</tc:button>
</tc:form>
- <tc:form id="navbtns">
+ <tc:form id="navbtns" inline="true">
<tc:button immediate="true" id="previous"
image="fa-angle-left"
action="#{navigationState.gotoPrevious}"
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java Wed Sep 21 16:13:42 2016
@@ -104,6 +104,7 @@ public enum BootstrapClass implements Cs
COL_XS_12("col-xs-12"),
CONTAINER("container"),
CONTAINER_FLUID("container-fluid"),
+ D_INLINE("d-inline"),
DISABLED("disabled"),
DROPDOWN("dropdown"),
DROPDOWN_ITEM("dropdown-item"),
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BarRenderer.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BarRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BarRenderer.java Wed Sep 21 16:13:42 2016
@@ -21,7 +21,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.UIBar;
-import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
+import org.apache.myfaces.tobago.internal.component.AbstractUIFormBase;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.Icons;
@@ -93,7 +93,7 @@ public class BarRenderer extends Rendere
private void collectItemsToEncode(final UIComponent component, List<UIComponent> result) {
for (UIComponent child : component.getChildren()) {
if (child.isRendered()) {
- if (child instanceof AbstractUIForm) {
+ if (child instanceof AbstractUIFormBase) {
collectItemsToEncode(child, result);
} else {
result.add(child);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRendererBase.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRendererBase.java Wed Sep 21 16:13:42 2016
@@ -23,7 +23,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UICommands;
import org.apache.myfaces.tobago.internal.component.AbstractUIButton;
import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
-import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
+import org.apache.myfaces.tobago.internal.component.AbstractUIFormBase;
import org.apache.myfaces.tobago.internal.util.AccessKeyLogger;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.RendererBase;
@@ -157,7 +157,7 @@ public abstract class CommandRendererBas
final boolean defaultCommand = ComponentUtils.getBooleanAttribute(command, Attributes.defaultCommand);
if (defaultCommand) {
- final AbstractUIForm form = ComponentUtils.findAncestor(command, AbstractUIForm.class);
+ final AbstractUIFormBase form = ComponentUtils.findAncestor(command, AbstractUIFormBase.class);
writer.writeAttribute(DataAttributes.DEFAULT, form.getClientId(facesContext), false);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandsRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandsRenderer.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandsRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandsRenderer.java Wed Sep 21 16:13:42 2016
@@ -20,7 +20,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
import org.apache.myfaces.tobago.internal.component.AbstractUICommands;
-import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
+import org.apache.myfaces.tobago.internal.component.AbstractUIFormBase;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -53,7 +53,7 @@ public class CommandsRenderer extends Re
for (UIComponent child : component.getChildren()) {
if (child.isRendered()) {
- if (child instanceof AbstractUIForm) { // XXX hack! TBD: How to walk through the children, or do that in JS?
+ if (child instanceof AbstractUIFormBase) { // XXX hack! TBD: How to walk through the children, or do that in JS?
encodeChildren(facesContext, child);
} else {
// fixme: only a temporary workaround
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java?rev=1761781&r1=1761780&r2=1761781&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java Wed Sep 21 16:13:42 2016
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -36,16 +37,19 @@ public class FormRenderer extends Render
final AbstractUIForm form = (AbstractUIForm) component;
final TobagoResponseWriter writer = getResponseWriter(facesContext);
final String clientId = form.getClientId(facesContext);
+ final boolean inline = form.isInline();
- writer.startElement(HtmlElements.SPAN);
+ writer.startElement(HtmlElements.DIV);
writer.writeIdAttribute(clientId);
- writer.writeClassAttribute(TobagoClass.FORM);;
+ writer.writeClassAttribute(
+ TobagoClass.FORM,
+ inline ? BootstrapClass.D_INLINE : null);;
}
@Override
public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
final TobagoResponseWriter writer = getResponseWriter(facesContext);
- writer.endElement(HtmlElements.SPAN);
+ writer.endElement(HtmlElements.DIV);
}
}