You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/11/15 11:27:30 UTC
svn commit: r1035212 - 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: bommel
Date: Mon Nov 15 10:27:30 2010
New Revision: 1035212
URL: http://svn.apache.org/viewvc?rev=1035212&view=rev
Log:
(TOBAGO-941) UIBox supports collapsible attribute
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/BoxTagDeclaration.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java?rev=1035212&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java Mon Nov 15 10:27:30 2010
@@ -0,0 +1,48 @@
+package org.apache.myfaces.tobago.internal.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.faces.context.FacesContext;
+
+public abstract class AbstractUIBox extends AbstractUIPanel {
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ if (isCollapsed()) {
+ decode(context);
+ } else {
+ super.processDecodes(context);
+ }
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ if (!isCollapsed()) {
+ super.processValidators(context);
+ }
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ if (!isCollapsed()) {
+ super.processUpdates(context);
+ }
+ }
+
+ public abstract boolean isCollapsed();
+}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/BoxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/BoxTagDeclaration.java?rev=1035212&r1=1035211&r2=1035212&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/BoxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/BoxTagDeclaration.java Mon Nov 15 10:27:30 2010
@@ -26,6 +26,7 @@ import org.apache.myfaces.tobago.interna
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.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsCollapsible;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutContainer;
@@ -35,7 +36,7 @@ import org.apache.myfaces.tobago.interna
@Tag(name = "box")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIBox",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanel",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIBox",
componentType = "org.apache.myfaces.tobago.Box",
rendererType = RendererTypes.BOX,
facets = {
@@ -46,5 +47,6 @@ import org.apache.myfaces.tobago.interna
public interface BoxTagDeclaration
extends HasIdBindingAndRendered, IsGridLayoutComponent, IsGridLayoutContainer, HasMarkup, HasCurrentMarkup,
- HasLabel {
+ HasLabel, IsCollapsible {
+
}
Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java?rev=1035212&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java Mon Nov 15 10:27:30 2010
@@ -0,0 +1,30 @@
+package org.apache.myfaces.tobago.internal.taglib.declaration;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+public interface IsCollapsible {
+ /**
+ * Flag indicating whether or not this component is collapsed.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
+ void setCollapsed(String rendered);
+}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java?rev=1035212&r1=1035211&r2=1035212&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java Mon Nov 15 10:27:30 2010
@@ -18,6 +18,7 @@ package org.apache.myfaces.tobago.render
*/
import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.UIBox;
import org.apache.myfaces.tobago.component.UIMenuBar;
import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.layout.Measure;
@@ -26,6 +27,7 @@ import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import java.io.IOException;
public abstract class BoxRendererBase extends LayoutComponentRendererBase {
@@ -45,8 +47,31 @@ public abstract class BoxRendererBase ex
return offsetTop;
}
+ @Override
+ public Measure getMinimumHeight(FacesContext facesContext, Configurable component) {
+ if (component instanceof UIBox && ((UIBox) component).isCollapsed()) {
+ return getOffsetTop(facesContext, component);
+ }
+ return super.getMinimumHeight(facesContext, component);
+ }
+
+ @Override
+ public Measure getMaximumHeight(FacesContext facesContext, Configurable component) {
+ if (component instanceof UIBox && ((UIBox) component).isCollapsed()) {
+ return getOffsetTop(facesContext, component);
+ }
+ return super.getMaximumHeight(facesContext, component);
+ }
+
protected UIMenuBar getMenuBarFacet(UIComponent component) {
return (UIMenuBar) component.getFacet(Facets.MENUBAR);
}
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ if (component instanceof UIBox && ((UIBox) component).isCollapsed()) {
+ return;
+ }
+ super.encodeChildren(facesContext, component);
+ }
}