Author: yradtsevich
Date: 2008-10-10 11:25:59 -0400 (Fri, 10 Oct 2008)
New Revision: 10777
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
Log:
Bug fix
https://jira.jboss.org/jira/browse/JBIDE-2856.
Part 2.
Added support of custom button icons and 'disabled' attribute in RichFaces Combo
Box.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css 2008-10-10
14:37:12 UTC (rev 10776)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css 2008-10-10
15:25:59 UTC (rev 10777)
@@ -72,7 +72,7 @@
border-top-color: #C4C0B9;
}
-input.rich-combobox-button-icon-inactive {
+input.rich-combobox-button-icon-inactive, input.rich-combobox-button-icon-disabled {
background: transparent none no-repeat scroll center;
cursor: pointer;
}
@@ -81,6 +81,10 @@
background-image: url(down.gif);
}
+input.rich-combobox-button-icon-disabled {
+ background-image: url(down-disabled.gif);
+}
+
.rich-combobox-strut {
border: 1px solid #C0C0C0;
margin: 0pt;
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java 2008-10-10
15:25:59 UTC (rev 10777)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces;
+
+import org.w3c.dom.Element;
+
+/**
+ * A wrapper of DOM Element that can extract its attributes as objects of different
types.
+ * The methods of the class never throw exceptions. In case if parsing is impossible
they
+ * always return a correct value.
+ *
+ * @author yradtsevich
+ * @see Element
+ */
+public class AttributeMap {
+ private Element element;
+
+ public AttributeMap(Element element) {
+ this.element = element;
+ }
+
+ /**
+ * A wrapper of <code>ComponentUtil.getAttribute(sourceElement,
attributeName)</code>
+ *
+ * @param attributeName attribute name
+ * @return <code>ComponentUtil.getAttribute(sourceElement,
attributeName)</code>
+ *
+ * @see ComponentUtil
+ */
+ public String getString(String attributeName) {
+ return ComponentUtil.getAttribute(element, attributeName);
+ }
+
+ /**
+ * Returns Boolean representation of the attribute.
+ *
+ * @param attributeName attribute name
+ * @return attribute value.
+ * <code>Boolean.TRUE</code>, if the attribute equals "true",
+ * <code>Boolean.False</code>, if the attribute equals "false",
+ * <code>null</code> otherwise.
+ */
+ public Boolean getBoolean(String attributeName) {
+ String attribute = element.getAttribute(attributeName);
+
+ Boolean ret;
+
+ if ("true".equals(attribute)) {
+ ret = Boolean.TRUE;
+ } else if ("false".equals(attribute)) {
+ ret = Boolean.FALSE;
+ } else {
+ ret = null;
+ }
+
+ return ret;
+ }
+
+ public boolean isBlank(String attributeName) {
+ String value = getString(attributeName);
+ return ComponentUtil.isBlank(value);
+ }
+}
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-10-10
14:37:12 UTC (rev 10776)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-10
15:25:59 UTC (rev 10777)
@@ -12,12 +12,12 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
-
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.jboss.tools.jsf.vpe.richfaces.AttributeMap;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
@@ -28,6 +28,7 @@
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -38,13 +39,21 @@
/**
- * The Class RichFacesComboBox2Template.
+ * The Class RichFacesComboBoxTemplate.
*
* @author Eugene Stherbin
*/
public class RichFacesComboBoxTemplate extends AbstractEditableRichFacesTemplate
implements VpeToggableTemplate {
- /** CSS_FILE_NAME. */
+ private static final String BUTTON_ICON_CLASSES_DISABLED =
"rich-combobox-font-inactive rich-combobox-button-icon-disabled
rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES = "rich-combobox-font-inactive
rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
+ private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
+ private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
+ private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
+ private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+
+ /** CSS_FILE_NAME. */
private static final String CSS_FILE_NAME = "comboBox/comboBox.css";
//$NON-NLS-1$
/** The Constant DEFAULT_ALIGN. */
@@ -74,8 +83,8 @@
/** The Constant RICH_COMBOBOX_INPUT_CELL_STYLE. */
private static final String RICH_COMBOBOX_INPUT_CELL_STYLE =
"rich-combobox-inputCell"; //$NON-NLS-1$
- /** The Constant SECOND_INPUT. */
- private static final String SECOND_INPUT = "secondInput"; //$NON-NLS-1$
+ /** The Constant BUTTON_BACKGROUND. */
+ private static final String BUTTON_BACKGROUND = "buttonBackground";
//$NON-NLS-1$
/** The Constant STYLE_EXT. */
private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
@@ -89,7 +98,8 @@
private static final String ZERO_STRING = "0"; //$NON-NLS-1$
/** The source align. */
- private String sourceAlign;
+ // Commented because of not working alignment in RichFaces implementation
+ // private String sourceAlign;
/** The source button style. */
private String sourceButtonStyle;
@@ -133,7 +143,13 @@
/** Source button icon **/
private String sourceButtonIcon;
+
+ private String sourceButtonIconInactive;
+
+ private String sourceButtonIconDisabled;
+ private boolean disabled;
+
/**
* The Constructor.
*/
@@ -186,11 +202,16 @@
rootDiv.setAttribute(HTML.ATTR_STYLE,
HTML.STYLE_PARAMETER_WIDTH+Constants.COLON+sourceWidth);
final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
- comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+ // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+
//comboBoxDiv.setAttribute(HTML.ATTR_CLASS,
styleClasess.get("secondDiv")); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv"));
//$NON-NLS-1$
+ secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV));
//$NON-NLS-1$
String secondDivSubStyle = "; position: {0}; z-index: {1} ;";
//$NON-NLS-1$
+
if (isToggle) {
secondDivSubStyle = MessageFormat.format(secondDivSubStyle,
"relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
@@ -202,15 +223,15 @@
secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH +
Constants.COLON + this.sourceListWidth
+ Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
- thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdDiv"));
//$NON-NLS-1$
+ thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH +
Constants.COLON + this.sourceWidth
+ "; z-index: 1;"); //$NON-NLS-1$
- final nsIDOMElement firstInput = visualDocument.createElement(HTML.TAG_INPUT);
- firstInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- firstInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get("firstInput")
+ Constants.WHITE_SPACE + sourceInputClass); //$NON-NLS-1$
- firstInput.setAttribute("autocomplete", "off"); //$NON-NLS-1$
//$NON-NLS-2$
- firstInput.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+
Constants.COLON + calculateWithForDiv(this.sourceWidth, 17) + Constants.SEMICOLON
+ final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
+ textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ textField.setAttribute(HTML.ATTR_CLASS, styleClasess.get(TEXT_FIELD) +
Constants.WHITE_SPACE + sourceInputClass); //$NON-NLS-1$
+ textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$
//$NON-NLS-2$
+ textField.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+
Constants.COLON + calculateWithForDiv(this.sourceWidth, 17) + Constants.SEMICOLON
+ sourceInputStyle);
String value = null;
if (ComponentUtil.isNotBlank(this.sourceDefaultLabel)) {
@@ -220,33 +241,49 @@
}
if (value != null) {
- firstInput.setAttribute(RichFaces.ATTR_VALUE, value);
+ textField.setAttribute(RichFaces.ATTR_VALUE, value);
}
- final nsIDOMElement secondInput = visualDocument.createElement(HTML.TAG_INPUT);
- secondInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- secondInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_INPUT));
- secondInput.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
-
secondInput.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR,
String.valueOf(0));
+ final nsIDOMElement buttonBackground =
visualDocument.createElement(HTML.TAG_INPUT);
+ buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ if (disabled) {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED); //$NON-NLS-1$
+ } else {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$
+ }
+
+ buttonBackground.setAttribute(HTML.ATTR_CLASS,
styleClasess.get(BUTTON_BACKGROUND));
+ buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+
buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR,
String.valueOf(0));
if (this.sourceButtonStyle != null) {
- secondInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
}
//
- final nsIDOMElement thirdInput = visualDocument.createElement(HTML.TAG_INPUT);
- thirdInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
;
- thirdInput.setAttribute(HTML.ATTR_CLASS,
styleClasess.get("thirdInput")); //$NON-NLS-1$
- thirdInput.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- thirdInput.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR,
String.valueOf(0));
+ buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON));
//$NON-NLS-1$
+ buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR,
String.valueOf(0));
if (this.sourceButtonStyle != null) {
- thirdInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
}
-
-// if (ComponentUtil.isNotBlank(this.sourceButtonIcon) &&
(this.sourceButtonIcon != IMAGE_NAME_DOWN)) {
-// thirdInput.setAttribute(HTML.ATTR_STYLE,
thirdInput.getAttribute(HTML.ATTR_STYLE) + " ; background-image: url("
-// + this.sourceButtonIcon + ")");
-// }
+ String actualSourceButton;
+ if (disabled) {
+ actualSourceButton = sourceButtonIconDisabled;
+ } else if (isToggle) {
+ actualSourceButton = sourceButtonIcon;
+ } else {
+ actualSourceButton = sourceButtonIconInactive;
+ }
+
+ if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton
!= IMAGE_NAME_DOWN)) {
+ String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton,
pageContext, true);
+ buttonIconPath = buttonIconPath.replace('\\', '/');
+ String style = "background-image: url(" + buttonIconPath + ")";
//$NON-NLS-1$ //$NON-NLS-2$
+ buttonIcon.setAttribute(HTML.ATTR_STYLE,
buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
+ }
final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
forthEmptyDiv.setAttribute(HTML.ATTR_CLASS,
styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH +
Constants.COLON
@@ -260,9 +297,9 @@
if (isToggle) {
comboBoxDiv.appendChild(createToogleDiv(pageContext, source, visualDocument));
}
- thirdDiv.appendChild(firstInput);
- thirdDiv.appendChild(secondInput);
- thirdDiv.appendChild(thirdInput);
+ thirdDiv.appendChild(textField);
+ thirdDiv.appendChild(buttonBackground);
+ thirdDiv.appendChild(buttonIcon);
thirdDiv.appendChild(forthEmptyDiv);
final VpeCreationData creationData = new VpeCreationData(rootDiv);
@@ -287,7 +324,7 @@
thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, this.sourceListStyle +
Constants.SEMICOLON
+ " z-index: 3; position: absolute; visibility: visible; top: 16px;
left: 0px;"); //$NON-NLS-1$
- thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS,
styleClasess.get("thirdEmptyDiv") + " " + this.sourceListClass);
//$NON-NLS-1$ //$NON-NLS-2$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_EMPTY_DIV) +
" " + this.sourceListClass); //$NON-NLS-1$ //$NON-NLS-2$
thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, "z-index: 3; position: absolute;
visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
@@ -567,12 +604,12 @@
* Inits the default classes.
*/
private void initDefaultClasses() {
- styleClasess.put("secondDiv", "rich-combobox-font
rich-combobox"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("thirdDiv", "rich-combobox-font
rich-combobox-shell"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("thirdEmptyDiv", "rich-combobox-list-cord");
//$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("firstInput", "rich-combobox-font-disabled
rich-combobox-input-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(SECOND_INPUT, "rich-combobox-font-inactive
rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
- styleClasess.put("thirdInput", "rich-combobox-font-inactive
rich-combobox-button-icon-inactive rich-combobox-button-inactive"); //$NON-NLS-1$
//$NON-NLS-2$
+ styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox");
//$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell");
//$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord");
//$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled
rich-combobox-input-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(BUTTON_BACKGROUND, "rich-combobox-font-inactive
rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$ //$NON-NLS-2$
styleClasess.put("forthEmptyDiv", "rich-combobox-strut
rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -602,24 +639,31 @@
* @param source the source
*/
private void prepareData(Element source) {
- this.sourceAlign = source.getAttribute(RichFaces.ATTR_ALIGN);
- if (ComponentUtil.isBlank(this.sourceAlign)) {
- this.sourceAlign = DEFAULT_ALIGN;
- }
- this.sourceListWidth = source.getAttribute(RichFaces.ATTR_LIST_WIDTH);
+ AttributeMap attributeMap = new AttributeMap(source);
- if (ComponentUtil.isBlank(this.sourceListWidth)) {
- this.sourceListWidth = DEFAULT_LIST_WIDTH;
+ // Commented because of not working alignment in RichFaces implementation
+ // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
+ // this.sourceAlign = DEFAULT_ALIGN;
+ // } else {
+ // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
+ // }
+
+ if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
+ this.sourceListWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ this.sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
}
- this.sourceListHeight = source.getAttribute(RichFaces.ATTR_LIST_HEIGHT);
-
- this.sourceWidth = source.getAttribute(RichFaces.ATTR_WIDTH);
+ this.sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
- 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;
+ if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
+ this.sourceWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ this.sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
+
+ if(this.sourceListWidth == DEFAULT_LIST_WIDTH) {
+ this.sourceListWidth = this.sourceWidth;
+ }
}
if (ComponentUtil.isNotBlank(this.sourceWidth) && (this.sourceWidth !=
DEFAULT_LIST_WIDTH)) {
@@ -633,26 +677,29 @@
}
}
- this.sourceDefaultLabel = ComponentUtil.getAttribute(source,
"defaultLabel"); //$NON-NLS-1$
- this.sourceValue = ComponentUtil.getAttribute(source, RichFaces.ATTR_VALUE);
+ this.sourceDefaultLabel = attributeMap.getString("defaultLabel");
//$NON-NLS-1$
+ this.sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
- this.sourceButtonStyle = ComponentUtil.getAttribute(source,
"buttonStyle"); //$NON-NLS-1$
+ this.sourceButtonStyle = attributeMap.getString("buttonStyle");
//$NON-NLS-1$
- final String sourceStyleClasess = ComponentUtil.getAttribute(source,
RichFaces.ATTR_STYLE_CLASS);
+ final String sourceStyleClasess =
attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
- styleClasess.put("secondDiv",
styleClasess.get("secondDiv") + " " + sourceStyleClasess);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " +
sourceStyleClasess); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- this.sourceStyle = ComponentUtil.getAttribute(source, HTML.ATTR_STYLE);
- this.sourceInputStyle = ComponentUtil.getAttribute(source,
"inputStyle"); //$NON-NLS-1$
- this.sourceInputClass = ComponentUtil.getAttribute(source,
"inputClass"); //$NON-NLS-1$
- this.sourceListClass = ComponentUtil.getAttribute(source, "listClass");
//$NON-NLS-1$
- this.sourceListStyle = ComponentUtil.getAttribute(source, "listStyle");
//$NON-NLS-1$
- this.sourceItemClass = ComponentUtil.getAttribute(source, "itemClass");
//$NON-NLS-1$
+ this.sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
+ this.sourceInputStyle = attributeMap.getString("inputStyle");
//$NON-NLS-1$
+ this.sourceInputClass = attributeMap.getString("inputClass");
//$NON-NLS-1$
+ this.sourceListClass = attributeMap.getString("listClass");
//$NON-NLS-1$
+ this.sourceListStyle = attributeMap.getString("listStyle");
//$NON-NLS-1$
+ this.sourceItemClass = attributeMap.getString("itemClass");
//$NON-NLS-1$
- this.sourceButtonIcon = ComponentUtil.getAttribute(source,
"buttonIcon"); //$NON-NLS-1$
-
+ this.sourceButtonIcon = attributeMap.getString(BUTTON_ICON); //$NON-NLS-1$
+ this.sourceButtonIconInactive =
attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
+ this.sourceButtonIconDisabled =
attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
+ this.disabled = (attributeMap.getBoolean("disabled") == Boolean.TRUE);
//$NON-NLS-1$
+
if(ComponentUtil.isBlank(this.sourceButtonIcon)){
this.sourceButtonIcon = IMAGE_NAME_DOWN;
}
@@ -764,7 +811,6 @@
*/
public void stopToggling(Node sourceNode) {
isToggle = false;
-
}
/**
@@ -775,8 +821,11 @@
* @param toggleId the toggle id
*/
public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
- isToggle = !isToggle;
+ if (disabled) {
+ isToggle = false;
+ } else {
+ isToggle = !isToggle;
+ }
}
-
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-10
14:37:12 UTC (rev 10776)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-10
15:25:59 UTC (rev 10777)
@@ -18,5 +18,35 @@
<f:selectItem itemValue="suggestion 4" />
<f:selectItem itemValue="suggestion 5" />
</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any
Value"
+ buttonIconInactive="../../pictures/clickme.gif"
+ style="width:250px" id="comboBox-JBIDE-2856-buttonIconInactive">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any
Value" disabled="true"
+ style="width:250px" id="comboBox-JBIDE-2856-disabled">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any
Value" disabled="true"
+ buttonIconDisabled="../../pictures/clickme.gif"
+ style="width:250px" id="comboBox-JBIDE-2856-buttonIconDisabled">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml 2008-10-10
14:37:12 UTC (rev 10776)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml 2008-10-10
15:25:59 UTC (rev 10777)
@@ -1,22 +1,86 @@
<tests>
<test id="comboBox">
<DIV STYLE="width: 150px;">
- <DIV ALIGN="left" CLASS="rich-combobox-font rich-combobox"
- STYLE="position: static; z-index: 0; width: 250px;">
- <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width:
150px; z-index: 1;">
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
- AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any
Value" />
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-inactive rich-combobox-button-background
rich-combobox-button-inactive"
- READONLY="true" VPE-USER-TOGGLE-ID="0" />
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive
rich-combobox-button-inactive"
- READONLY="true" VPE-USER-TOGGLE-ID="0" />
- <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width:
140px;">
- Struts</DIV>
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position:
static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width:
150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select
Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE=""
/>
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE=""
/>
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width:
140px;">
+ Struts</DIV>
+ </DIV>
</DIV>
</DIV>
</DIV>
</test>
+ <test id="comboBox-JBIDE-2856-buttonIconInactive">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position:
static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width:
150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select
Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE=""
/>
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font"
STYLE="width: 140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
+ <test id="comboBox-JBIDE-2856-disabled">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position:
static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width:
150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select
Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE=""
/>
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-disabled
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width:
140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
+ <test id="comboBox-JBIDE-2856-buttonIconDisabled">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position:
static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width:
150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select
Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE=""
/>
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-disabled
rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width:
140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-10-10
14:37:12 UTC (rev 10776)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-10-10
15:25:59 UTC (rev 10777)
@@ -95,12 +95,11 @@
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- nsIDOMElement divOne = (nsIDOMElement)
elements.get(4).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ nsIDOMElement divOne = (nsIDOMElement)
elements.get(5).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
assertTrue("Style classes should be contains
",divOne.getAttribute(HTML.ATTR_CLASS).contains("rich-combobox-font
rich-combobox")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Default style should be contains " + width,
divOne.getAttribute(HTML.ATTR_STYLE).indexOf(width) > 1); //$NON-NLS-1$
assertTrue("Default style should be contains " + width,
divOne.getAttribute(HTML.ATTR_STYLE).contains("width")); //$NON-NLS-1$
//$NON-NLS-2$
// Check input
-
return rst;
}
@@ -128,9 +127,8 @@
*/
public void testComboBoxWithAttributes() throws PartInitException, Throwable {
final nsIDOMElement rst = baseTableCheck(COMPONENTS_COMBO_WITH_ATTR_TEMPLATE,
_250PX);
-
+
checkValueInInput(rst, SELECT_ANY_VALUE);
-
}
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-10
14:37:12 UTC (rev 10776)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-10
15:25:59 UTC (rev 10777)
@@ -137,5 +137,4 @@
iTransferable.getAnyTransferData(aFlavor, aData, aDataLen);
return aData[0];
}
-
}