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 2014/03/31 16:45:30 UTC
svn commit: r1583339 - in /myfaces/tobago/branches/tobago-1.0.x:
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
Author: lofwyr
Date: Mon Mar 31 14:45:30 2014
New Revision: 1583339
URL: http://svn.apache.org/r1583339
Log:
TOBAGO-1382: New attribute "name" for <tc:object>
Modified:
myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTag.java
myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTag.java?rev=1583339&r1=1583338&r2=1583339&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTag.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTag.java Mon Mar 31 14:45:30 2014
@@ -19,16 +19,18 @@
package org.apache.myfaces.tobago.taglib.component;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SRC;
import org.apache.myfaces.tobago.component.ComponentUtil;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_NAME;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SRC;
public class ObjectTag extends TobagoTag implements ObjectTagDeclaration {
private String src;
+ private String name;
public String getComponentType() {
return UIOutput.COMPONENT_TYPE;
@@ -37,6 +39,7 @@ public class ObjectTag extends TobagoTag
protected void setProperties(UIComponent component) {
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_SRC, src);
+ ComponentUtil.setStringProperty(component, ATTR_NAME, name);
}
@@ -44,6 +47,7 @@ public class ObjectTag extends TobagoTag
public void release() {
super.release();
src = null;
+ name = null;
}
public String getSrc() {
@@ -53,4 +57,12 @@ public class ObjectTag extends TobagoTag
public void setSrc(String src) {
this.src = src;
}
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java?rev=1583339&r1=1583338&r2=1583339&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java Mon Mar 31 14:45:30 2014
@@ -26,19 +26,25 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-/*
- * Date: 02.04.2006
- * Time: 15:58:16
- */
@Tag(name = "object", bodyContent = BodyContent.EMPTY)
@UIComponentTag(
uiComponent = "javax.faces.component.UIOutput",
rendererType = "Object", isComponentAlreadyDefined = true)
public interface ObjectTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered {
+
/**
* URI to object source
*/
- @TagAttribute()
- @UIComponentTagAttribute()
+ @TagAttribute
+ @UIComponentTagAttribute
void setSrc(String src);
+
+ /**
+ * Name of the element.
+ * If not set the id will be used as name. The id in JSF normally contains colons.
+ * This doesn't work in Internet Explorer 9 and lower when using window.open(src, target).
+ */
+ @TagAttribute
+ @UIComponentTagAttribute
+ void setName(String name);
}
Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java?rev=1583339&r1=1583338&r2=1583339&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java Mon Mar 31 14:45:30 2014
@@ -31,6 +31,7 @@ import javax.faces.context.FacesContext;
import java.io.IOException;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SRC;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_NAME;
public class ObjectRenderer extends LayoutableRendererBase {
public void encodeEnd(FacesContext facesContext, UIComponent component)
@@ -38,8 +39,13 @@ public class ObjectRenderer extends Layo
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
writer.startElement(HtmlConstants.IFRAME, component);
writer.writeAttribute(HtmlAttributes.FRAMEBORDER, "0", false);
- writer.writeIdAttribute(component.getClientId(facesContext));
- writer.writeNameAttribute(component.getClientId(facesContext));
+ final String clientId = component.getClientId(facesContext);
+ writer.writeIdAttribute(clientId);
+ String name = (String) component.getAttributes().get(ATTR_NAME);
+ if (name == null) {
+ name = clientId;
+ }
+ writer.writeNameAttribute(name);
Object src = component.getAttributes().get(ATTR_SRC);
if (src != null) {
writer.writeAttribute(HtmlAttributes.SRC, String.valueOf(src), true);