You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mb...@apache.org on 2007/04/07 16:16:53 UTC
svn commit: r526438 - in /myfaces/core/branches/jsf12/api/src:
main/java-templates/javax/faces/component/UIGraphicTemplate.java
test/java/javax/faces/component/UIGraphicTest.java
Author: mbr
Date: Sat Apr 7 07:16:53 2007
New Revision: 526438
URL: http://svn.apache.org/viewvc?view=rev&rev=526438
Log:
url/value property handling fixed
Added:
myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java (with props)
Modified:
myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIGraphicTemplate.java
Modified: myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIGraphicTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIGraphicTemplate.java?view=diff&rev=526438&r1=526437&r2=526438
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIGraphicTemplate.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIGraphicTemplate.java Sat Apr 7 07:16:53 2007
@@ -27,42 +27,21 @@
{
private static final String URL_PROPERTY = "url";
private static final String VALUE_PROPERTY = "value";
-
+
/**/ public String getFamily() { return null;}
-
- /**
- * @deprecated Use getValueExpression instead
- */
- @Override
- public ValueBinding getValueBinding(String name)
+
+ /**///setUrl
+ public void setUrl(String url)
{
- if (URL_PROPERTY.equals(name))
- {
- return super.getValueBinding(VALUE_PROPERTY);
- }
- else
- {
- return super.getValueBinding(name);
- }
+ setValue(url);
}
-
- /**
- * @deprecated Use setValueExpression instead
- */
- @Override
- public void setValueBinding(String name,
- ValueBinding binding)
+
+ /**///getUrl
+ public String getUrl()
{
- if (URL_PROPERTY.equals(name))
- {
- super.setValueBinding(VALUE_PROPERTY, binding);
- }
- else
- {
- super.setValueBinding(name, binding);
- }
+ return (String)getValue();
}
-
+
@Override
public ValueExpression getValueExpression(String name)
{
Added: myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java?view=auto&rev=526438
==============================================================================
--- myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java (added)
+++ myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java Sat Apr 7 07:16:53 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package javax.faces.component;
+
+import static org.testng.Assert.*;
+
+import javax.el.ValueExpression;
+import javax.faces.el.ValueBinding;
+
+import org.easymock.classextension.EasyMock;
+import org.testng.annotations.Test;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("deprecation")
+public class UIGraphicTest
+{
+
+ @Test
+ public void testUrlValue()
+ {
+ UIGraphic graphic = new UIGraphic();
+ graphic.setValue("xxx");
+ assertEquals(graphic.getUrl(), "xxx");
+ graphic.setUrl("xyz");
+ assertEquals(graphic.getValue(), "xyz");
+ }
+
+ @Test
+ public void testUrlValueExpression()
+ {
+ UIGraphic graphic = new UIGraphic();
+ ValueExpression expression = EasyMock.createMock(ValueExpression.class);
+ graphic.setValueExpression("url", expression);
+ assertSame(graphic.getValueExpression("value"), expression);
+
+ expression = EasyMock.createMock(ValueExpression.class);
+ graphic.setValueExpression("value", expression);
+ assertSame(graphic.getValueExpression("url"), expression);
+ }
+
+ @Test
+ public void testUrlValueBinding()
+ {
+ UIGraphic graphic = new UIGraphic();
+ ValueBinding binding = EasyMock.createMock(ValueBinding.class);
+ graphic.setValueBinding("url", binding);
+ assertSame(graphic.getValueBinding("value"), binding);
+
+ binding = EasyMock.createMock(ValueBinding.class);
+ graphic.setValueBinding("value", binding);
+ assertSame(graphic.getValueBinding("url"), binding);
+ }
+}
Propchange: myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/branches/jsf12/api/src/test/java/javax/faces/component/UIGraphicTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision