
| Key: |
ICE-1865
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Radu Andrei Tanasa
|
| Votes: |
3
|
| Watchers: |
4
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
OS: Windows; Browser: All;
|
|
| ICEsoft Forum Reference: |
http://www.icefaces.org/JForum/posts/list/5517.page
|
| Workaround Exists: |
Yes
|
| Workaround Description: |
Although the fix doesn't seem to be very difficult, we refrained from altering the icefaces jar so we created our own SelectInputDateRenderer.java which subclasses icefaces' SelectInputDateRenderer.java. There we overroad the public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException method. Here is the code:
<code>
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
throws IOException {
super.encodeEnd(facesContext, uiComponent);
DOMContext domContext = DOMContext.attachDOMContext(facesContext, uiComponent);
SelectInputDate selectInputDate = (SelectInputDate)uiComponent;
Node rootNode = domContext.getRootNode();
Element inputNode = (Element)rootNode.getFirstChild();
Element calendarButton = (Element)inputNode.getNextSibling();
if (selectInputDate.isDisabled()) {
inputNode.setAttribute(HTML.DISABLED_ATTR, "true");
}
if (selectInputDate.isDisabled()) {
calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
}
}
</code>
Although the fix doesn't seem to be very difficult, we refrained from altering the icefaces jar so we created our own SelectInputDateRenderer.java which subclasses icefaces' SelectInputDateRenderer.java. There we overroad the public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException method. Here is the code:
<code>
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
throws IOException {
super.encodeEnd(facesContext, uiComponent);
DOMContext domContext = DOMContext.attachDOMContext(facesContext, uiComponent);
SelectInputDate selectInputDate = (SelectInputDate)uiComponent;
Node rootNode = domContext.getRootNode();
Element inputNode = (Element)rootNode.getFirstChild();
Element calendarButton = (Element)inputNode.getNextSibling();
if (selectInputDate.isDisabled()) {
inputNode.setAttribute(HTML.DISABLED_ATTR, "true");
}
if (selectInputDate.isDisabled()) {
calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
}
}
</code>
|
|
Hi. I found a most intriguing issue. The <ice:selectInputDate> seems to ignore the disabled attribute. I've taken a look in the generated html code and the generated <input> indeed has no disabled attribute. The fix is easy I think. I took a look in icefaces' source code and found out that the disabled attribute is not taken into consideration: com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer, method public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException; The simplest thing in my opinion would be to do the following:
<code>
Element dateText = domContext.createElement(HTML.INPUT_ELEM);
dateText.setAttribute(HTML.VALUE_ATTR, selectInputDate.formatDate((Date)selectInputDate.getValue()));
dateText.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_INPUTTEXT);
dateText.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_INPUTTEXT);
dateText.setAttribute(HTML.CLASS_ATTR, selectInputDate.getCalendarInputClass());
dateText.setAttribute(HTML.ONFOCUS_ATTR, "setFocus('');");
dateText.setAttribute("onkeypress", this.ICESUBMIT);
dateText.setAttribute(HTML.ONBLUR_ATTR, this.ICESUBMITPARTIAL);
//my code
if (selectInputDate.isDisabled()) {
dateText.setAttribute(HTML.DISABLED_ATTR, "true");
}
if (selectInputDate.getAutocomplete() != null) {
dateText.setAttribute("autocomplete", selectInputDate.getAutocomplete());
}
// extract the popupdate format and use it as a tooltip
String tooltip = selectInputDate.getPopupDateFormat();
dateText.setAttribute(HTML.TITLE_ATTR, "Date Format: " + tooltip);
root.appendChild(dateText);
Element calendarButton = domContext.createElement(HTML.INPUT_ELEM);
calendarButton.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_BUTTON);
calendarButton.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_BUTTON);
calendarButton.setAttribute(HTML.TYPE_ATTR, "image");
//my code
if (selectInputDate.isDisabled()) {
calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
}
</code>
|
|
Description
|
Hi. I found a most intriguing issue. The <ice:selectInputDate> seems to ignore the disabled attribute. I've taken a look in the generated html code and the generated <input> indeed has no disabled attribute. The fix is easy I think. I took a look in icefaces' source code and found out that the disabled attribute is not taken into consideration: com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer, method public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException; The simplest thing in my opinion would be to do the following:
<code>
Element dateText = domContext.createElement(HTML.INPUT_ELEM);
dateText.setAttribute(HTML.VALUE_ATTR, selectInputDate.formatDate((Date)selectInputDate.getValue()));
dateText.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_INPUTTEXT);
dateText.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_INPUTTEXT);
dateText.setAttribute(HTML.CLASS_ATTR, selectInputDate.getCalendarInputClass());
dateText.setAttribute(HTML.ONFOCUS_ATTR, "setFocus('');");
dateText.setAttribute("onkeypress", this.ICESUBMIT);
dateText.setAttribute(HTML.ONBLUR_ATTR, this.ICESUBMITPARTIAL);
//my code
if (selectInputDate.isDisabled()) {
dateText.setAttribute(HTML.DISABLED_ATTR, "true");
}
if (selectInputDate.getAutocomplete() != null) {
dateText.setAttribute("autocomplete", selectInputDate.getAutocomplete());
}
// extract the popupdate format and use it as a tooltip
String tooltip = selectInputDate.getPopupDateFormat();
dateText.setAttribute(HTML.TITLE_ATTR, "Date Format: " + tooltip);
root.appendChild(dateText);
Element calendarButton = domContext.createElement(HTML.INPUT_ELEM);
calendarButton.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_BUTTON);
calendarButton.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_BUTTON);
calendarButton.setAttribute(HTML.TYPE_ATTR, "image");
//my code
if (selectInputDate.isDisabled()) {
calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
}
</code> |
Show » |
|