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 2007/02/17 09:50:30 UTC
svn commit: r508738 - in
/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago:
component/UIButtonCommand.java taglib/component/ButtonTag.java
taglib/component/ButtonTagDeclaration.java
Author: bommel
Date: Sat Feb 17 00:50:30 2007
New Revision: 508738
URL: http://svn.apache.org/viewvc?view=rev&rev=508738
Log:
(TOBAGO-264) A markup attribute for button would be nice
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIButtonCommand.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIButtonCommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIButtonCommand.java?view=auto&rev=508738
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIButtonCommand.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIButtonCommand.java Sat Feb 17 00:50:30 2007
@@ -0,0 +1,58 @@
+package org.apache.myfaces.tobago.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;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: Feb 17, 2007
+ * Time: 8:53:17 AM
+ */
+public class UIButtonCommand extends UICommand implements SupportsMarkup {
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ButtonCommand";
+
+ private String[] markup;
+
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ super.restoreState(context, values[0]);
+
+ markup = (String[]) values[1];
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[2];
+ values[0] = super.saveState(context);
+ values[1] = markup;
+ return values;
+ }
+
+ public String[] getMarkup() {
+ if (markup != null) {
+ return markup;
+ }
+ return ComponentUtil.getMarkupBinding(getFacesContext(), this);
+ }
+
+ public void setMarkup(String[] markup) {
+ this.markup = markup;
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java?view=diff&rev=508738&r1=508737&r2=508738
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTag.java Sat Feb 17 00:50:30 2007
@@ -47,7 +47,7 @@
private String tip;
private String defaultCommand;
private String target;
-
+ private String markup;
@Override
protected void setProperties(UIComponent component) {
@@ -57,6 +57,7 @@
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
ComponentUtil.setStringProperty(component, ATTR_TARGET, target);
ComponentUtil.setBooleanProperty(component, ATTR_DEFAULT_COMMAND, defaultCommand);
+ ComponentUtil.setMarkup(component, markup);
}
@Override
@@ -67,6 +68,7 @@
tip = null;
defaultCommand = null;
target = null;
+ markup = null;
}
public String getAccessKey() {
@@ -116,6 +118,10 @@
public void setTarget(String target) {
this.target = target;
+ }
+
+ public void setMarkup(String markup) {
+ this.markup = markup;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java?view=diff&rev=508738&r1=508737&r2=508738
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java Sat Feb 17 00:50:30 2007
@@ -30,6 +30,7 @@
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
import org.apache.myfaces.tobago.taglib.decl.HasTarget;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
/*
* Created by IntelliJ IDEA.
@@ -44,11 +45,11 @@
@Tag(name = "button", tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
@BodyContentDescription(anyTagOf = "facestag")
@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UICommand",
+ uiComponent = "org.apache.myfaces.tobago.component.UIButtonCommand",
rendererType = "Button")
public interface ButtonTagDeclaration extends AbstractCommandTagDeclaration,
HasIdBindingAndRendered, HasLabelAndAccessKey, HasImage,
IsDisabled, HasCommandType,
- IsDefaultCommand, HasDeprecatedWidth, HasTip, IsInline, HasTarget {
+ IsDefaultCommand, HasDeprecatedWidth, HasTip, IsInline, HasTarget, HasMarkup {
}