[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui/tag ...
Stan Silvert
ssilvert at jboss.com
Wed Aug 9 16:30:10 EDT 2006
User: ssilvert
Date: 06/08/09 16:30:10
Modified: src/ui/org/jboss/seam/ui/tag LinkTag.java
UIComponentTagBase.java
Added: src/ui/org/jboss/seam/ui/tag CommandButtonTag.java
HtmlCommandButtonTagBase.java
HtmlCommandLinkTag.java
Log:
Add support for action params. See http://jira.jboss.com/jira/browse/JBSEAM-329
Revision Changes Path
1.5 +46 -5 jboss-seam/src/ui/org/jboss/seam/ui/tag/LinkTag.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LinkTag.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/tag/LinkTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- LinkTag.java 10 Jun 2006 15:22:59 -0000 1.4
+++ LinkTag.java 9 Aug 2006 20:30:10 -0000 1.5
@@ -1,7 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.seam.ui.tag;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.webapp.UIComponentTag;
+import org.jboss.seam.actionparam.ActionParamValueBinding;
import org.jboss.seam.ui.HtmlLink;
@@ -30,7 +56,7 @@
{
super.setProperties(component);
setStringProperty(component, "view", view);
- setStringProperty(component, "action", action);
+ setActionOnComponent(component);
setValueBinding(component, "taskInstance", taskInstance);
setStringProperty(component, "buttonClass", buttonClass);
setStringProperty(component, "linkStyle", linkStyle);
@@ -39,6 +65,21 @@
setStringProperty(component, "fragment", fragment);
}
+ private void setActionOnComponent(UIComponent component)
+ {
+ if (action == null) return;
+
+ if (isValueReference(action))
+ {
+ ValueBinding vb = new ActionParamValueBinding(FacesContext.getCurrentInstance(), action);
+ component.setValueBinding("action", vb);
+ }
+ else
+ {
+ component.getAttributes().put("action", action);
+ }
+ }
+
public void setAction(String action)
{
this.action = action;
1.2 +5 -4 jboss-seam/src/ui/org/jboss/seam/ui/tag/UIComponentTagBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIComponentTagBase.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/tag/UIComponentTagBase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- UIComponentTagBase.java 10 Jun 2006 15:22:59 -0000 1.1
+++ UIComponentTagBase.java 9 Aug 2006 20:30:10 -0000 1.2
@@ -33,11 +33,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.actionparam.ActionParamMethodBinding;
import org.jboss.seam.ui.JSF;
/**
- * @author Manfred Geiler (latest modification by $Author: gavin $)
- * @version $Revision: 1.1 $ $Date: 2005-05-11 12:45:06 -0400 (Wed, 11 May
+ * @author Manfred Geiler (latest modification by $Author: ssilvert $)
+ * @version $Revision: 1.2 $ $Date: 2005-05-11 12:45:06 -0400 (Wed, 11 May
* 2005) $
*/
public abstract class UIComponentTagBase extends UIComponentTag
@@ -321,7 +322,7 @@
MethodBinding mb;
if (isValueReference(action))
{
- mb = context.getApplication().createMethodBinding(action, null);
+ mb = new ActionParamMethodBinding(context, action);
} else
{
mb = new SimpleActionMethodBinding(action);
1.1 date: 2006/08/09 20:30:10; author: ssilvert; state: Exp;jboss-seam/src/ui/org/jboss/seam/ui/tag/CommandButtonTag.java
Index: CommandButtonTag.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.jboss.seam.ui.tag;
import javax.faces.component.html.HtmlCommandButton;
/**
* @author Manfred Geiler (latest modification by $Author: ssilvert $)
* @author Martin Marinschek
* @version $Revision: 1.1 $ $Date: 2006/08/09 20:30:10 $
*/
public class CommandButtonTag
extends HtmlCommandButtonTagBase
{
public String getComponentType()
{
return HtmlCommandButton.COMPONENT_TYPE;
}
public String getRendererType()
{
return "javax.faces.Button";
}
}
1.1 date: 2006/08/09 20:30:10; author: ssilvert; state: Exp;jboss-seam/src/ui/org/jboss/seam/ui/tag/HtmlCommandButtonTagBase.java
Index: HtmlCommandButtonTagBase.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.jboss.seam.ui.tag;
import org.jboss.seam.ui.JSF;
import org.jboss.seam.ui.HTML;
import javax.faces.component.UIComponent;
/**
* @author Manfred Geiler (latest modification by $Author: ssilvert $)
* @author Martin Marinschek
* @version $Revision: 1.1 $ $Date: 2006/08/09 20:30:10 $
*/
public abstract class HtmlCommandButtonTagBase
extends HtmlComponentTagBase
{
//private static final Log log = LogFactory.getLog(HtmlCommandButtonTag.class);
// UIComponent attributes --> already implemented in UIComponentTagBase
// user role attributes --> already implemented in UIComponentTagBase
// HTML universal attributes --> already implemented in HtmlComponentTagBase
// HTML event handler attributes --> already implemented in HtmlComponentTagBase
// HTML input attributes relevant for command-button
private String _accesskey;
private String _alt;
private String _disabled;
private String _onblur;
private String _onchange;
private String _onfocus;
private String _onselect;
private String _size;
private String _tabindex;
private String _type;
// UICommand attributes
private String _action;
private String _immediate;
private String _actionListener;
// HtmlCommandButton attributes
private String _image;
public void release() {
super.release();
_accesskey=null;
_alt=null;
_disabled=null;
_onblur=null;
_onchange=null;
_onfocus=null;
_onselect=null;
_size=null;
_tabindex=null;
_type=null;
_action=null;
_immediate=null;
_actionListener=null;
_image=null;
}
protected void setProperties(UIComponent component)
{
super.setProperties(component);
setStringProperty(component, HTML.ACCESSKEY_ATTR, _accesskey);
setStringProperty(component, HTML.ALT_ATTR, _alt);
setBooleanProperty(component, HTML.DISABLED_ATTR, _disabled);
setStringProperty(component, HTML.ONBLUR_ATTR, _onblur);
setStringProperty(component, HTML.ONCHANGE_ATTR, _onchange);
setStringProperty(component, HTML.ONFOCUS_ATTR, _onfocus);
setStringProperty(component, HTML.ONSELECT_ATTR, _onselect);
setStringProperty(component, HTML.SIZE_ATTR, _size);
setStringProperty(component, HTML.TABINDEX_ATTR, _tabindex);
setStringProperty(component, HTML.TYPE_ATTR, _type);
setActionProperty(component, _action);
setActionListenerProperty(component, _actionListener);
setBooleanProperty(component, JSF.IMMEDIATE_ATTR, _immediate);
setStringProperty(component, JSF.IMAGE_ATTR, _image);
}
public void setAccesskey(String accesskey)
{
_accesskey = accesskey;
}
public void setAlt(String alt)
{
_alt = alt;
}
public void setDisabled(String disabled)
{
_disabled = disabled;
}
public void setOnblur(String onblur)
{
_onblur = onblur;
}
public void setOnchange(String onchange)
{
_onchange = onchange;
}
public void setOnfocus(String onfocus)
{
_onfocus = onfocus;
}
public void setOnselect(String onselect)
{
_onselect = onselect;
}
public void setSize(String size)
{
_size = size;
}
public void setTabindex(String tabindex)
{
_tabindex = tabindex;
}
public void setType(String type)
{
_type = type;
}
public void setAction(String action)
{
_action = action;
}
public void setImmediate(String immediate)
{
_immediate = immediate;
}
public void setImage(String image)
{
_image = image;
}
public void setActionListener(String actionListener)
{
_actionListener = actionListener;
}
}
1.1 date: 2006/08/09 20:30:10; author: ssilvert; state: Exp;jboss-seam/src/ui/org/jboss/seam/ui/tag/HtmlCommandLinkTag.java
Index: HtmlCommandLinkTag.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.jboss.seam.ui.tag;
import javax.faces.component.html.HtmlCommandLink;
/**
* @author Manfred Geiler (latest modification by $Author: ssilvert $)
* @author Martin Marinschek
* @version $Revision: 1.1 $ $Date: 2006/08/09 20:30:10 $
*/
public class HtmlCommandLinkTag
extends HtmlCommandLinkTagBase
{
public String getComponentType()
{
return HtmlCommandLink.COMPONENT_TYPE;
}
public String getRendererType()
{
return "javax.faces.Link";
}
}
More information about the jboss-cvs-commits
mailing list