Author: abelevich
Date: 2011-01-14 07:09:00 -0500 (Fri, 14 Jan 2011)
New Revision: 21018
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
RF-10096 Inline default values: input components III
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2011-01-14
11:59:55 UTC (rev 21017)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -47,7 +47,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
- @Attribute(defaultValue="InplaceState.ready")
+ @Attribute()
public abstract InplaceState getState();
@Attribute
@@ -62,7 +62,7 @@
@Attribute(defaultValue="true")
public abstract boolean isSaveOnBlur();
- @Attribute(defaultValue="false")
+ @Attribute()
public abstract boolean isShowControls();
@Attribute
@@ -80,7 +80,7 @@
@Attribute
public abstract String getListClass();
- @Attribute(defaultValue="click")
+ @Attribute()
public abstract String getEditEvent();
@Attribute(events=@EventName("inputclick"))
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14
11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -24,7 +24,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
- @Attribute(defaultValue="false")
+ @Attribute()
public abstract boolean isEnableManualInput();
@Attribute(defaultValue="true")
@@ -33,13 +33,13 @@
@Attribute(defaultValue="true")
public abstract boolean isShowButton();
- @Attribute(defaultValue="20px")
+ @Attribute()
public abstract String getMinListHeight();
- @Attribute(defaultValue="100px")
+ @Attribute()
public abstract String getMaxListHeight();
- @Attribute(defaultValue="auto")
+ @Attribute()
public abstract String getListHeight();
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2011-01-14
11:59:55 UTC (rev 21017)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -34,10 +34,10 @@
public abstract class AbstractSelectComponent extends UISelectOne {
- @Attribute(defaultValue="200px")
+ @Attribute()
public abstract String getListWidth();
- @Attribute(defaultValue="100px")
+ @Attribute()
public abstract String getListHeight();
@Attribute
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-14
11:59:55 UTC (rev 21017)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -211,7 +211,7 @@
}
protected String getEditEvent(UIComponent component) {
- String value = ((AbstractInplaceInput) component).getEditEvent();
+ String value = ((InplaceComponent) component).getEditEvent();
if (value == null || "".equals(value)) {
value = "click";
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-01-14
11:59:55 UTC (rev 21017)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -32,6 +32,7 @@
import org.richfaces.component.AbstractInplaceSelect;
import org.richfaces.component.InplaceComponent;
+import org.richfaces.renderkit.util.HtmlDimensions;
/**
* @author Anton Belevich
@@ -88,13 +89,29 @@
public String getListWidth(UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect)component;
- String width = select.getListWidth();
+ String width = getListWidth(select);
return (width != null && width.trim().length() != 0) ? ("width:
" + width) : "";
}
+ protected String getListWidth(AbstractInplaceSelect select) {
+ String width = HtmlDimensions.formatSize(select.getListWidth());
+ if (width == null || width.length() == 0) {
+ width = "200px";
+ }
+ return width;
+ }
+
+ protected String getListHeight(AbstractInplaceSelect select) {
+ String height = HtmlDimensions.formatSize(select.getListHeight());
+ if (height == null || height.length() == 0) {
+ height = "100px";
+ }
+ return height;
+ }
+
public String getListHeight(UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect)component;
- String height = select.getListHeight();
+ String height = getListHeight(select);
return (height != null && height.trim().length() != 0) ? ("height:
" + height) : "";
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2011-01-14
11:59:55 UTC (rev 21017)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2011-01-14
12:09:00 UTC (rev 21018)
@@ -32,6 +32,7 @@
import org.richfaces.component.AbstractSelect;
import org.richfaces.component.AbstractSelectComponent;
+import org.richfaces.renderkit.util.HtmlDimensions;
/**
* @author abelevich
@@ -65,26 +66,58 @@
public String getListWidth(UIComponent component) {
AbstractSelect select = (AbstractSelect)component;
- String width = select.getListWidth();
+ String width = getListWidth(select);
return (width != null && width.trim().length() != 0) ? ("width:
" + width) : "";
}
+ protected String getMinListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getMinListHeight());
+ if (height == null || height.length() == 0) {
+ height = "20px";
+ }
+ return height;
+ }
+
+ protected String getMaxListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getMaxListHeight());
+ if (height == null || height.length() == 0) {
+ height = "100px";
+ }
+ return height;
+ }
+
+ protected String getListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getListHeight());
+ if (height == null || height.length() == 0) {
+ height = "auto";
+ }
+ return height;
+ }
+
+ protected String getListWidth(AbstractSelect select) {
+ String width = HtmlDimensions.formatSize(select.getListWidth());
+ if (width == null || width.length() == 0) {
+ width = "200px";
+ }
+ return width;
+ }
+
public String encodeHeightAndWidth(UIComponent component) {
AbstractSelect select = (AbstractSelect)component;
- String height = select.getListHeight();
+ String height = getListHeight(select);
if(!"auto".equals(height)) {
height = (height != null && height.trim().length() != 0) ?
("height: " + height) : "";
} else {
- String minHeight = select.getMinListHeight();
+ String minHeight = getMinListHeight(select);
minHeight = (minHeight != null && minHeight.trim().length() != 0) ?
("min-height: " + minHeight) : "";
- String maxHeight = select.getMaxListHeight();
+ String maxHeight = getMaxListHeight(select);
maxHeight = (maxHeight != null && maxHeight.trim().length() != 0) ?
("max-height: " + maxHeight) : "";
height = concatStyles(minHeight, maxHeight);
}
- String width = select.getListWidth();
+ String width = getListWidth(select);
width = (width != null && width.trim().length() != 0) ? ("width:
" + width) : "";
return concatStyles(height, width);
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-14 11:59:55
UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-14 12:09:00
UTC (rev 21018)
@@ -104,7 +104,8 @@
<cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-is-c-s',
component.attributes['changedStateClass'])}"/>
<cdk:scriptOption name="editCss"
value="#{concatClasses('rf-is-e-s',
component.attributes['editStateClass'])}"/>
<cdk:scriptOption name="selectItemCss"
value="#{concatClasses('rf-is-sel',
component.attributes['selectItemClass'])}"/>
- <cdk:scriptOption attributes="editEvent state defaultLabel saveOnBlur
showControls openOnEdit saveOnSelect inputWidth" />
+ <cdk:scriptOption name="editEvent"
value="#{getEditEvent(component)}"/>
+ <cdk:scriptOption attributes="state defaultLabel saveOnBlur showControls
openOnEdit saveOnSelect inputWidth" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceSelect("#{clientId}", #{toScriptArgs(options)});