Improvements to Ajax pickers - better default height and overridable height property on associated JSF components

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-12-13 15:34:40 +00:00
parent 3ec7abd1c0
commit a3054cbb97
6 changed files with 79 additions and 7 deletions

View File

@@ -66,6 +66,9 @@ public abstract class BaseAjaxItemPicker extends UIInput
/** True for single select mode, false for multi-select mode */
protected Boolean singleSelect;
/** Height style override for picker selector area */
protected String height = null;
protected static int ACTION_DONE = 0;
protected static int ACTION_CANCEL = 1;
@@ -93,6 +96,7 @@ public abstract class BaseAjaxItemPicker extends UIInput
this.singleSelect = (Boolean)values[2];
this.initialSelectionId = (String)values[3];
this.disabled = (Boolean)values[4];
this.height = (String)values[5];
}
/**
@@ -106,7 +110,8 @@ public abstract class BaseAjaxItemPicker extends UIInput
this.label,
this.singleSelect,
this.initialSelectionId,
this.disabled};
this.disabled,
this.height};
return (values);
}
@@ -301,8 +306,19 @@ public abstract class BaseAjaxItemPicker extends UIInput
out.write(" </div>");
// container for item selection
out.write(" <div>");
out.write(" <div id='" + divId + "-ajax-wait' class='pickerAjaxWait'></div>");
out.write(" <div id='" + divId + "-results-list' class='pickerResultsList'></div>");
out.write(" <div id='" + divId + "-ajax-wait' class='pickerAjaxWait'");
String height = getHeight();
if (height != null)
{
out.write(" style='height:" + height + "'");
}
out.write("></div>");
out.write(" <div id='" + divId + "-results-list' class='pickerResultsList'");
if (height != null)
{
out.write(" style='height:" + height + "'");
}
out.write("></div>");
out.write(" </div>");
out.write(" </div>");
// controls (OK & Cancel buttons etc.)
@@ -440,6 +456,28 @@ public abstract class BaseAjaxItemPicker extends UIInput
{
this.singleSelect = singleSelect;
}
/**
* @return Returns the height.
*/
public String getHeight()
{
ValueBinding vb = getValueBinding("height");
if (vb != null)
{
this.height = (String)vb.getValue(getFacesContext());
}
return this.height;
}
/**
* @param height The height to set.
*/
public void setHeight(String height)
{
this.height = height;
}
// ------------------------------------------------------------------------------

View File

@@ -53,6 +53,9 @@ public abstract class AjaxItemSelectorTag extends HtmlComponentTag
/** Whether the component is disabled */
private String disabled;
/** the height */
private String height;
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
@@ -78,6 +81,7 @@ public abstract class AjaxItemSelectorTag extends HtmlComponentTag
setStringProperty(component, "label", this.label);
setBooleanProperty(component, "singleSelect", this.singleSelect);
setBooleanProperty(component, "disabled", this.disabled);
setStringProperty(component, "height", this.height);
}
/**
@@ -92,6 +96,7 @@ public abstract class AjaxItemSelectorTag extends HtmlComponentTag
this.singleSelect = null;
this.initialSelection = null;
this.disabled = null;
this.height = null;
}
/**
@@ -144,4 +149,14 @@ public abstract class AjaxItemSelectorTag extends HtmlComponentTag
{
this.disabled = disabled;
}
/**
* Set the height
*
* @param height the height
*/
public void setHeight(String height)
{
this.height = height;
}
}