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/01/17 20:37:17 UTC
svn commit: r497135 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
theme/scarborough/src/main/java/org/apa...
Author: bommel
Date: Wed Jan 17 11:37:16 2007
New Revision: 497135
URL: http://svn.apache.org/viewvc?view=rev&rev=497135
Log:
(TOBAGO-244) Allow non modal popups
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=497135&r1=497134&r2=497135
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Wed Jan 17 11:37:16 2007
@@ -77,6 +77,7 @@
public static final String ATTR_MARGIN_LEFT = "marginLeft";
public static final String ATTR_MARGIN_RIGHT = "marginRight";
public static final String ATTR_MARGIN_TOP = "marginTop";
+ public static final String ATTR_MODAL = "modal";
public static final String ATTR_LAYOUT_ORDER = "layoutOrder";
//public static final String ATTR_LAYOUT_TABLE_STYLE = "layoutTableStyle";
public static final String ATTR_LAYOUT_WIDTH = "layoutWidth";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java?view=diff&rev=497135&r1=497134&r2=497135
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java Wed Jan 17 11:37:16 2007
@@ -21,6 +21,10 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.TobagoConstants;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LEFT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TOP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
@@ -40,6 +44,7 @@
private String left;
private String top;
private boolean activated;
+ private Boolean modal;
public void setActivated(boolean activated) {
this.activated = activated;
@@ -128,13 +133,14 @@
}
public Object saveState(FacesContext context) {
- Object[] saveState = new Object[6];
+ Object[] saveState = new Object[7];
saveState[0] = super.saveState(context);
saveState[1] = width;
saveState[2] = height;
saveState[3] = left;
saveState[4] = top;
saveState[5] = activated;
+ saveState[6] = modal;
return saveState;
}
@@ -146,10 +152,19 @@
left = (String) values[3];
top = (String) values[4];
activated = (Boolean) values[5];
+ modal = (Boolean) values[6];
}
public String getWidth() {
- return width;
+ if (width != null) {
+ return width;
+ }
+ ValueBinding vb = getValueBinding(ATTR_WIDTH);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
}
public void setWidth(String width) {
@@ -157,7 +172,15 @@
}
public String getHeight() {
- return height;
+ if (height != null) {
+ return height;
+ }
+ ValueBinding vb = getValueBinding(ATTR_HEIGHT);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
}
public void setHeight(String height) {
@@ -165,7 +188,15 @@
}
public String getLeft() {
- return left;
+ if (left != null) {
+ return left;
+ }
+ ValueBinding vb = getValueBinding(ATTR_LEFT);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
}
public void setLeft(String left) {
@@ -173,11 +204,35 @@
}
public String getTop() {
- return top;
+ if (top != null) {
+ return top;
+ }
+ ValueBinding vb = getValueBinding(ATTR_TOP);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
}
public void setTop(String top) {
this.top = top;
+ }
+
+ public boolean isModal() {
+ if (modal != null) {
+ return modal;
+ }
+ ValueBinding vb = getValueBinding(TobagoConstants.ATTR_MODAL);
+ if (vb != null) {
+ return (Boolean.TRUE.equals(vb.getValue(getFacesContext())));
+ } else {
+ return true;
+ }
+ }
+
+ public void setModal(boolean modal) {
+ this.modal = modal;
}
private void addToPage() {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java?view=diff&rev=497135&r1=497134&r2=497135
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java Wed Jan 17 11:37:16 2007
@@ -19,7 +19,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LEFT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MODAL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TOP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import org.apache.myfaces.tobago.component.ComponentUtil;
@@ -34,7 +34,7 @@
private String height;
private String left;
private String top;
- private String reset;
+ private String modal;
public String getComponentType() {
return UIPopup.COMPONENT_TYPE;
@@ -46,6 +46,7 @@
height = null;
left = null;
top = null;
+ modal = null;
}
protected void setProperties(UIComponent component) {
@@ -54,7 +55,8 @@
ComponentUtil.setStringProperty(component, ATTR_HEIGHT, height);
ComponentUtil.setStringProperty(component, ATTR_LEFT, left);
ComponentUtil.setStringProperty(component, ATTR_TOP, top);
- ComponentUtil.setBooleanProperty(component, ATTR_POPUP_RESET, reset);
+ ComponentUtil.setBooleanProperty(component, ATTR_MODAL, modal);
+
}
public void setWidth(String width) {
@@ -73,8 +75,8 @@
this.top = top;
}
- public void setReset(String reset) {
- this.reset = reset;
+ public void setModal(String modal) {
+ this.modal = modal;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java?view=diff&rev=497135&r1=497134&r2=497135
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java Wed Jan 17 11:37:16 2007
@@ -48,11 +48,7 @@
void setTop(String top);
@TagAttribute
- @UIComponentTagAttribute()
- /**
- * Flag indicating that the rendered value should set to false after rendering.
- * This is for rendering a popup which contains no server actions
- * and is closed on client side.
- */
- void setReset(String reset);
+ @UIComponentTagAttribute(type = {"java.lang.Boolean"}, defaultValue = "true")
+ void setModal(String modal);
+
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java?view=diff&rev=497135&r1=497134&r2=497135
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java Wed Jan 17 11:37:16 2007
@@ -64,8 +64,8 @@
UIPopup component = (UIPopup) uiComponent;
final String clientId = component.getClientId(facesContext);
final String contentDivId = clientId + CONTENT_ID_POSTFIX;
- final String left = component.getLeft();
- final String top = component.getTop();
+ //final String left = component.getLeft();
+ //final String top = component.getTop();
final StringBuilder contentStyle = new StringBuilder();
if (component.getWidth() != null) {
@@ -78,30 +78,31 @@
contentStyle.append(component.getHeight());
contentStyle.append("; ");
}
- contentStyle.append("left: ");
- contentStyle.append(left != null ? left : "100");
- contentStyle.append("; ");
- contentStyle.append("top: ");
- contentStyle.append(top != null ? top : "50");
- contentStyle.append("; ");
-
- writer.startElement(HtmlConstants.DIV, component);
- writer.writeIdAttribute(clientId);
- writer.writeComponentClass();
- writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.popupBlink('" + clientId + "')", null);
- if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
- String bgImage = ResourceManagerUtil.getImageWithPath(facesContext, "image/popupBg.png");
- writer.writeAttribute(HtmlAttributes.STYLE, "background: none; "
- + "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
+ //contentStyle.append("left: ");
+ //contentStyle.append(left);
+ //contentStyle.append("; ");
+ //contentStyle.append("top: ");
+ //contentStyle.append(top);
+ //contentStyle.append("; ");
+ if (component.isModal()) {
+ writer.startElement(HtmlConstants.DIV, component);
+ writer.writeIdAttribute(clientId);
+ writer.writeComponentClass();
+ writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.popupBlink('" + clientId + "')", null);
+ if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
+ String bgImage = ResourceManagerUtil.getImageWithPath(facesContext, "image/popupBg.png");
+ writer.writeAttribute(HtmlAttributes.STYLE, "background: none; "
+ + "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
+ bgImage + "', sizingMethod='scale');", null); }
- writer.endElement(HtmlConstants.DIV);
- if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
- writer.startElement(HtmlConstants.IFRAME, component);
- writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + HtmlConstants.IFRAME);
- writer.writeClassAttribute("tobago-popup-iframe tobago-popup-none");
- writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), null);
- writer.writeAttribute(HtmlAttributes.SRC, "javascript:false;", null);
- writer.endElement(HtmlConstants.IFRAME);
+ writer.endElement(HtmlConstants.DIV);
+ if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
+ writer.startElement(HtmlConstants.IFRAME, component);
+ writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + HtmlConstants.IFRAME);
+ writer.writeClassAttribute("tobago-popup-iframe tobago-popup-none");
+ writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), null);
+ writer.writeAttribute(HtmlAttributes.SRC, "javascript:false;", null);
+ writer.endElement(HtmlConstants.IFRAME);
+ }
}
writer.startElement(HtmlConstants.DIV, component);
writer.writeIdAttribute(contentDivId);