Author: abelevich
Date: 2011-01-20 04:41:18 -0500 (Thu, 20 Jan 2011)
New Revision: 21106
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/templates/dropdownmenu.template.xml
trunk/ui/output/ui/src/main/templates/popupPanel.template.xml
trunk/ui/output/ui/src/main/templates/progressBar.template.xml
Log:
RF-10097 Inline default values: output components I
- added default value to templates.
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-20
09:01:13 UTC (rev 21105)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPopupPanel.java 2011-01-20
09:41:18 UTC (rev 21106)
@@ -59,19 +59,19 @@
@Attribute(defaultValue = "-1")
public abstract int getMinWidth();
- @Attribute(defaultValue = "" + Integer.MAX_VALUE)
+ @Attribute
public abstract int getMaxHeight();
- @Attribute(defaultValue = "" + Integer.MAX_VALUE)
+ @Attribute
public abstract int getMaxWidth();
- @Attribute(defaultValue = "auto")
+ @Attribute
public abstract String getTop();
- @Attribute(defaultValue = "auto")
+ @Attribute
public abstract String getLeft();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isShow();
public abstract void setShow(boolean show);
@@ -79,22 +79,22 @@
@Attribute(defaultValue = "true")
public abstract boolean isMoveable();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isAutosized();
@Attribute(defaultValue = "true")
public abstract boolean isModal();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isKeepVisualState();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isOverlapEmbedObjects();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isResizeable();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isTrimOverlayedElements();
@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-20
09:01:13 UTC (rev 21105)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2011-01-20
09:41:18 UTC (rev 21106)
@@ -37,6 +37,9 @@
private static final int SIZE = 10;
private static final String STATE_OPTION_SUFFIX = "StateOption_";
+ private static final String DEFAULT_LEFT = "auto";
+ private static final String DEFAULT_TOP = "auto";
+
//TODO nick - use enums
private static final Set<String> ALLOWED_ATTACHMENT_OPTIONS = new
HashSet<String>();
static {
@@ -185,8 +188,6 @@
return result;
}
-
-
private Map<String, Object> prepareVisualOptions(Object value,
AbstractPopupPanel panel) {
if (null == value) {
return new HashMap<String, Object>();
@@ -207,4 +208,20 @@
+ "] must be instance of Map or String, but its type is " +
value.getClass().getSimpleName());
}
}
+
+ protected String getLeftOrDefault(UIComponent component) {
+ String leftProperty = ((AbstractPopupPanel) component).getLeft();
+ if (leftProperty == null || leftProperty.length() == 0) {
+ leftProperty = DEFAULT_LEFT;
+ }
+ return leftProperty;
+ }
+
+ protected String getTopOrDefault(UIComponent component) {
+ String topProperty = ((AbstractPopupPanel) component).getTop();
+ if (topProperty == null || topProperty.length() == 0) {
+ topProperty = DEFAULT_TOP;
+ }
+ return topProperty;
+ }
}
Modified: trunk/ui/output/ui/src/main/templates/dropdownmenu.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/dropdownmenu.template.xml 2011-01-20 09:01:13
UTC (rev 21105)
+++ trunk/ui/output/ui/src/main/templates/dropdownmenu.template.xml 2011-01-20 09:41:18
UTC (rev 21106)
@@ -50,10 +50,10 @@
<script type="text/javascript">
<cdk:scriptObject name="options">
- <cdk:scriptOption name="direction"
value="#{getDirection(component).getValue()}"/>
- <cdk:scriptOption name="jointPoint"
value="#{getJointPoint(component).getValue()}"/>
- <cdk:scriptOption name="showEvent"
value="#{getShowEvent(component)}"/>
- <cdk:scriptOption name="mode"
value="#{getMode(component)}"/>
+ <cdk:scriptOption name="direction"
value="#{getDirection(component).getValue()}" defaultValue="AA"/>
+ <cdk:scriptOption name="jointPoint"
value="#{getJointPoint(component).getValue()}" defaultValue="AA"/>
+ <cdk:scriptOption name="showEvent"
value="#{getShowEvent(component)}" defaultValue="click"/>
+ <cdk:scriptOption name="mode"
value="#{getMode(component)}" defaultValue="server"/>
<cdk:scriptOption attributes="hideDelay showEvent showDelay
horizontalOffset verticalOffset" />
<cdk:scriptOption attributes="onshow onhide ongroupshow
ongrouphide onitemclick" wrapper="eventHandler"/>
</cdk:scriptObject>
Modified: trunk/ui/output/ui/src/main/templates/popupPanel.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/popupPanel.template.xml 2011-01-20 09:01:13 UTC
(rev 21105)
+++ trunk/ui/output/ui/src/main/templates/popupPanel.template.xml 2011-01-20 09:41:18 UTC
(rev 21106)
@@ -73,9 +73,11 @@
</div>
<cdk:scriptObject name="options">
- <cdk:scriptOption attributes="width height minWidth minHeight
maxWidth maxHeight moveable followByScroll left top zindex shadowDepth shadowOpacity
domElementAttachment show keepVisualState autosized resizeable modal overlapEmbedObjects
visualOptions " />
- <cdk:scriptOption attributes="onshow onhide onresize onmove
onbeforeshow onbeforehide" wrapper="eventHandler"/>
- </cdk:scriptObject>
+ <cdk:scriptOption name="left"
value="#{getLeftOrDefault(component)}" defaultValue="auto"/>
+ <cdk:scriptOption name="top"
value="#{getTopOrDefault(component)}" defaultValue="auto"/>
+ <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>
<script type="text/javascript">
new RichFaces.ui.PopupPanel(#{toScriptArgs(clientId, options)});
@@ -85,7 +87,5 @@
</script>
</div>
-
-
</cc:implementation>
</cdk:root>
\ No newline at end of file
Modified: trunk/ui/output/ui/src/main/templates/progressBar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2011-01-20 09:01:13 UTC
(rev 21105)
+++ trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2011-01-20 09:41:18 UTC
(rev 21106)
@@ -37,8 +37,8 @@
<script type="text/javascript">
<cdk:scriptObject name="options">
<cdk:scriptOption name="submitFunction"
value="#{getSubmitFunction(facesContext, component)}" />
- <cdk:scriptOption name="minValue"
value="#{getMinValueOrDefault(component)}" />
- <cdk:scriptOption name="maxValue"
value="#{getMaxValueOrDefault(component)}" />
+ <cdk:scriptOption name="minValue"
value="#{getMinValueOrDefault(component)}" defaultValue="0"/>
+ <cdk:scriptOption name="maxValue"
value="#{getMaxValueOrDefault(component)}" defaultValue="100"/>
<cdk:scriptOption attributes="interval enabled value onfinish
resource" />
</cdk:scriptObject>
Show replies by date