Author: abelevich
Date: 2011-01-18 10:40:18 -0500 (Tue, 18 Jan 2011)
New Revision: 21057
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPopupPanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
trunk/ui/output/ui/src/main/templates/popupPanel.template.xml
Log:
RF-10097 Inline default values: output components I
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPopupPanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPopupPanel.java 2011-01-18
15:12:23 UTC (rev 21056)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPopupPanel.java 2011-01-18
15:40:18 UTC (rev 21057)
@@ -53,16 +53,16 @@
@Attribute
public abstract int getWidth();
- @Attribute
+ @Attribute(defaultValue = "0")
public abstract int getMinHeight();
- @Attribute
+ @Attribute(defaultValue = "0")
public abstract int getMinWidth();
- @Attribute
+ @Attribute(defaultValue = "0")
public abstract int getMaxHeight();
- @Attribute
+ @Attribute(defaultValue = "0")
public abstract int getMaxWidth();
@Attribute
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2011-01-18
15:12:23 UTC (rev 21056)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2011-01-18
15:40:18 UTC (rev 21057)
@@ -113,18 +113,16 @@
}
}
- if (panel.getMinHeight() != -1) {
- if (panel.getMinHeight() < SIZE) {
- throw new FacesException("Attribbute minWidth should be greater then
10px");
- }
-
- }
-
- if (panel.getMinWidth() != -1) {
+ if (panel.getMinWidth() != 0) {
if (panel.getMinWidth() < SIZE) {
throw new FacesException("Attribbute minHeight should be greater
then 10px");
}
+ }
+ if (panel.getMinHeight() != 0) {
+ if (panel.getMinHeight() < SIZE) {
+ throw new FacesException("Attribbute minWidth should be greater then
10px");
+ }
}
}
@@ -188,8 +186,6 @@
return result;
}
-
-
private Map<String, Object> prepareVisualOptions(Object value,
AbstractPopupPanel panel) {
if (null == value) {
return new HashMap<String, Object>();
@@ -226,20 +222,4 @@
}
return topProperty;
}
-
- protected int getMaxWidthOrDefault(UIComponent component) {
- int maxWidth = ((AbstractPopupPanel) component).getMaxWidth();
- if (maxWidth == 0) {
- maxWidth = Integer.MAX_VALUE;
- }
- return maxWidth;
- }
-
- protected int getMaxHeightOrDefault(UIComponent component) {
- int maxHeight = ((AbstractPopupPanel) component).getMaxHeight();
- if (maxHeight == 0) {
- maxHeight = Integer.MAX_VALUE;
- }
- return maxHeight;
- }
}
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2011-01-18
15:12:23 UTC (rev 21056)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2011-01-18
15:40:18 UTC (rev 21057)
@@ -31,10 +31,10 @@
}
var defaultOptions = {
- width:-1,
- height:-1,
- minWidth:-1,
- minHeight:-1,
+ width:0,
+ height:0,
+ minWidth:0,
+ minHeight:0,
modal:true,
moveable:true,
resizeable: false,
@@ -280,39 +280,35 @@
var eContentElt = this.getContentElement();
if (!this.options.autosized) {
- if (options.width && options.width == -1)
+ if (options.width && options.width == 0)
options.width = 300;
- if (options.height && options.height == -1)
+ if (options.height && options.height == 0)
options.height = 200;
}
- if (options.width && options.width != -1) {
+ if (options.width && options.width != 0) {
if (this.currentMinWidth > options.width) {
options.width = this.currentMinWidth;
}
- if (options.width > this.maxWidth) {
+ if (this.maxWidth && options.width > this.maxWidth) {
options.width = this.maxWidth;
}
$(richfaces.getDomElement(eContentElt)).css('width', options.width +
(/px/.test(options.width) ? '' : 'px'));
this.shadowDiv.css('width', options.width + (/px/.test(options.width) ?
'' : 'px'));
this.scrollerDiv.css('width', options.width + (/px/.test(options.width) ?
'' : 'px'));
-
-
}
- if (options.height && options.height != -1) {
+ if (options.height && options.height != 0) {
if (this.currentMinHeight > options.height) {
options.height = this.currentMinHeight;
}
- if (options.height > this.maxHeight) {
+ if (this.maxHeigh && options.height > this.maxHeight) {
options.height = this.maxHeight;
}
$(richfaces.getDomElement(eContentElt)).css('height', options.height +
(/px/.test(options.height) ? '' : 'px'));
this.shadowDiv.css('height', options.height + (/px/.test(options.height) ?
'' : 'px'));
var headerHeight = $(richfaces.getDomElement(this.markerId
+"_header"))[0] ? $(richfaces.getDomElement(this.markerId
+"_header"))[0].clientHeight : 0;
this.scrollerDiv.css('height', options.height - headerHeight +
(/px/.test(options.height) ? '' : 'px'));
-
-
}
var eIframe;
if (this.options.overlapEmbedObjects && !this.iframe) {
Modified: trunk/ui/output/ui/src/main/templates/popupPanel.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/popupPanel.template.xml 2011-01-18 15:12:23 UTC
(rev 21056)
+++ trunk/ui/output/ui/src/main/templates/popupPanel.template.xml 2011-01-18 15:40:18 UTC
(rev 21057)
@@ -75,9 +75,7 @@
<cdk:scriptObject name="options">
<cdk:scriptOption name="left"
value="#{getLeftOrDefault(component)}"/>
<cdk:scriptOption name="top"
value="#{getTopOrDefault(component)}"/>
- <cdk:scriptOption name="maxWidth"
value="#{getMaxWidthOrDefault(component)}"/>
- <cdk:scriptOption name="maxHeight"
value="#{getMaxHeightOrDefault(component)}"/>
- <cdk:scriptOption attributes="width height minWidth minHeight moveable
followByScroll zindex shadowDepth shadowOpacity domElementAttachment show keepVisualState
autosized resizeable modal overlapEmbedObjects visualOptions " />
+ <cdk:scriptOption attributes="minHeight minWidth maxHeight maxWidth
width height moveable followByScroll zindex shadowDepth shadowOpacity domElementAttachment
show keepVisualState autosized resizeable modal overlapEmbedObjects visualOptions "
/>
<cdk:scriptOption attributes="onshow onhide onresize onmove onbeforeshow
onbeforehide" wrapper="eventHandler"/>
</cdk:scriptObject>
@@ -89,7 +87,5 @@
</script>
</div>
-
-
</cc:implementation>
</cdk:root>
\ No newline at end of file
Show replies by date