Author: estherbin
Date: 2008-07-24 09:42:39 -0400 (Thu, 24 Jul 2008)
New Revision: 9268
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
Log:
Fix some from
https://jira.jboss.org/jira/browse/JBIDE-2430 issue.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-24
13:31:06 UTC (rev 9267)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-24
13:42:39 UTC (rev 9268)
@@ -39,7 +39,6 @@
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
-// TODO: Auto-generated Javadoc
/**
* The Class RichFacesComboBox2Template.
*
@@ -82,6 +81,8 @@
/** The Constant STYLE_EXT. */
private static final String STYLE_EXT = "richFacesComboBox";
+
+ private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE=18;
/** The style clasess. */
private Map<String, String> styleClasess = new HashMap<String,
String>();
@@ -130,6 +131,10 @@
/** The source item class. */
private String sourceItemClass;
+
+
+ /** Source button icon **/
+ private String sourceButtonIcon;
/**
* The Constructor.
@@ -287,7 +292,16 @@
final nsIDOMElement scrollDiv =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll");
- scrollDiv.setAttribute(HTML.ATTR_STYLE, "height: 54px; width: " +
calculateWithForDiv(sourceListWidth, 2));
+ final List<Element> items =
ComponentUtil.getSelectItems(source.getChildNodes());
+ int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
+
+ if((items!=null) && (items.size() > 1)){
+ defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
+ }
+
+ final String listHeight = ComponentUtil.isNotBlank(this.sourceListHeight) ?
this.sourceListHeight : String.valueOf(defaultHeight)
+ + "px";
+ scrollDiv.setAttribute(HTML.ATTR_STYLE, "height: "+listHeight+";
width: " + calculateWithForDiv(sourceListWidth, 2));
final List<Element> selectItems =
ComponentUtil.getSelectItems(source.getChildNodes());
@@ -581,11 +595,14 @@
if (ComponentUtil.isBlank(this.sourceListWidth)) {
this.sourceListWidth = DEFAULT_LIST_WIDTH;
}
- this.sourceListHeight = source.getAttribute("");
+ this.sourceListHeight = source.getAttribute("listHeight");
+
this.sourceWidth = source.getAttribute("width");
if (ComponentUtil.isBlank(this.sourceWidth)) {
this.sourceWidth = DEFAULT_LIST_WIDTH;
+ }else if(ComponentUtil.isNotBlank(this.sourceWidth) &&
(this.sourceListWidth == DEFAULT_LIST_WIDTH)){
+ this.sourceListWidth = this.sourceWidth;
}
this.sourceDefaultLabel = ComponentUtil.getAttribute(source,
"defaultLabel");
@@ -605,6 +622,8 @@
this.sourceListClass = ComponentUtil.getAttribute(source,
"listClass");
this.sourceListStyle = ComponentUtil.getAttribute(source,
"listStyle");
this.sourceItemClass = ComponentUtil.getAttribute(source,
"itemClass");
+
+ this.sourceButtonIcon = ComponentUtil.getAttribute(source,
"buttonIcon");
}