Readonly Textbox in Table

Hi all,

I have a databound table on a page, and one of its columns is set to Textbox. I just noticed that if I set true theReadonly property of the Textbox, theText value of the Textbox never changes and the very first record is printed on the page for every record. Is this a bug or what?

Thanks in advance.

[343 byte] By [Eke_nya] at [2007-11-26 15:42:04]
# 1
Hi There,Yes this is a known issue. The bug id is 6453374. The bug seems to have been fixed in Visual web Pack. But there is no workaround mentioned for Creator2u1.ThanksK
kish@suna at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 2
Hi,I downloaded Netbeans and VWP and run the very same program on Netbeans VWP, but it seems the bug hasn't been solved even in VWP.Thanks
Eke_nya at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 3
Hi There,Can you please provide the exact steps to reproduce this problem. It says its fixed but fix is not verified, so maybe it didnt fix all cases, I can enter a new bug on your behalf once you send me the steps.ThanksK
kish@suna at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 4

<?xml version="1.0" encoding="UTF-8"?>

<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">

<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

<f:view>

<ui:page binding="#{restricted$admin$Classes.page1}" id="page1">

<ui:html binding="#{restricted$admin$Classes.html1}" id="html1">

<ui:head binding="#{restricted$admin$Classes.head1}" id="head1">

<ui:link binding="#{restricted$admin$Classes.link1}" id="link1" url="/resources/stylesheet.css"/>

</ui:head>

<ui:body binding="#{restricted$admin$Classes.body1}" id="body1">

<ui:form binding="#{restricted$admin$Classes.form1}" id="form1">

<ui:table augmentTitle="false" binding="#{restricted$admin$Classes.table1}" id="table1" title="Tan&#305;ml&#305; Dersler" width="636">

<f:facet name="actionsTop">

<ui:panelGroup binding="#{restricted$admin$Classes.groupPanel1}" id="groupPanel1">

<ui:button action="#{restricted$admin$Classes.addClass_action}" binding="#{restricted$admin$Classes.addClass}"

id="addClass" text="Ekle"/>

<ui:button action="#{restricted$admin$Classes.cancelClass_action}" binding="#{restricted$admin$Classes.cancelClass}"

id="cancelClass" text="&#304;ptal"/>

<ui:button action="#{restricted$admin$Classes.saveClass_action}" binding="#{restricted$admin$Classes.saveClass}"

id="saveClass" text="Kaydet"/>

</ui:panelGroup>

</f:facet>

<script><![CDATA[

/* -- Functions for Table Preferences Panel -- */

/*

* Toggle the table preferences panel open or closed

*/

function togglePreferencesPanel() {

var table = document.getElementById("form1:table1");

table.toggleTblePreferencesPanel();

}

/* -- Functions for Filter Panel -- */

/*

* Return true if the filter menu has actually changed,

* so the corresponding event should be allowed to continue.

*/

function filterMenuChanged() {

var table = document.getElementById("form1:table1");

return table.filterMenuChanged();

}

/*

* Toggle the custom filter panel (if any) open or closed.

*/

function toggleFilterPanel() {

var table = document.getElementById("form1:table1");

return table.toggleTableFilterPanel();

}

/* -- Functions for Table Actions -- */

/*

* Initialize all rows of the table when the state

* of selected rows changes.

*/

function initAllRows() {

var table = document.getElementById("form1:table1");

table.initAllRows();

}

/*

* Set the selected state for the given row groups

* displayed in the table. This functionality requires

* the 'selectId' of the tableColumn to be set.

*

* @param rowGroupId HTML element id of the tableRowGroup component

* @param selected Flag indicating whether components should be selected

*/

function selectGroupRows(rowGroupId, selected) {

var table = document.getElementById("form1:table1");

table.selectGroupRows(rowGroupId, selected);

}

/*

* Disable all table actions if no rows have been selected.

*/

function disableActions() {

// Determine whether any rows are currently selected

var table = document.getElementById("form1:table1");

var disabled = (table.getAllSelectedRowsCount() > 0) ? false : true;

// Set disabled state for top actions

document.getElementById("form1:table1:tableActionsTop:deleteTop").setDisabled(disabled);

// Set disabled state for bottom actions

document.getElementById("form1:table1:tableActionsBottom:deleteBottom").setDisabled(disabled);

}]]></script>

<ui:tableRowGroup binding="#{restricted$admin$Classes.tableRowGroup1}" emptyDataMsg="Herhangi bir kay&#305;t bulunamad&#305;"

id="tableRowGroup1" rows="10" sourceData="#{restricted$admin$Classes.classesDataProvider}" sourceVar="currentRow">

<ui:tableColumn binding="#{restricted$admin$Classes.tableColumn1}" headerText="Ders Kodu" id="tableColumn1">

<ui:staticText binding="#{restricted$admin$Classes.staticText1}" id="staticText1"

text="#{currentRow.value['classes.class_id']}" visible="#{!restricted$admin$Classes.visible}"/>

<ui:staticText binding="#{restricted$admin$Classes.staticText2}" id="staticText2"

style="color: red; font-weight: bolder" text="Yeni" visible="#{restricted$admin$Classes.visible}"/>

</ui:tableColumn>

<ui:tableColumn binding="#{restricted$admin$Classes.tableColumn2}" headerText="Ders Ad&#305;" id="tableColumn2">

<ui:textField binding="#{restricted$admin$Classes.textField1}" id="textField1" readOnly="true" text="#{currentRow.value['classes.class_name']}"/>

</ui:tableColumn>

<ui:tableColumn binding="#{restricted$admin$Classes.tableColumn3}" headerText="Zorunlu/Se鏼eli" id="tableColumn3">

<ui:dropDown binding="#{restricted$admin$Classes.dropDown1}" id="dropDown1"

items="#{restricted$admin$Classes.objectArrayDataProvider1.array}" selected="#{currentRow.value['classes.compulsory_elective']}"/>

</ui:tableColumn>

<ui:tableColumn binding="#{restricted$admin$Classes.tableColumn4}" headerText="Ders Saati" id="tableColumn4" width="246">

<ui:textField binding="#{restricted$admin$Classes.textField2}" id="textField2" text="#{currentRow.value['classes.hours']}"/>

</ui:tableColumn>

<ui:tableColumn binding="#{restricted$admin$Classes.tableColumn5}" headerText="Karne S&#305;ras&#305;" id="tableColumn5">

<ui:textField binding="#{restricted$admin$Classes.textField3}" id="textField3" text="#{currentRow.value['classes.karne_rownumber']}"/>

</ui:tableColumn>

</ui:tableRowGroup>

</ui:table>

<ui:messageGroup binding="#{restricted$admin$Classes.messageGroup1}" id="messageGroup1"/>

</ui:form>

</ui:body>

</ui:html>

</ui:page>

</f:view>

</jsp:root>

The readonly attribute of ui:textfield whose id textfield1 is set to true. The tableRowGroup is bound to a CachedRowSetDataProvider. When I run the program, I got the wrong data as I mentioned earlier. In addition, I downloaded the source code of Sun Web UI Components Design-Time Support, that is webui.jar, and debugged the program. What I noticed is that getReadOnlyComponent method of Field class is the source of the bug since the method getFacet(READONLY_FACET); of the code below returns the very first component so the value of the ReadOnly textfield for each row is the very first data read from the database.

// Readonly value

public UIComponent getReadOnlyComponent(FacesContext context) {

if(DEBUG) log("getListLabelComponent()");

String id = getId();

// Check if the page author has defined a label facet

UIComponent textComponent = getFacet(READONLY_FACET); //NOI18N

// If the page author has not defined a label facet,

// check if the page author specified a label.

if(textComponent == null) {

textComponent = createText(getReadOnlyValueString(context)); //NOI18N

} else if(DEBUG) {

log("\tFound facet."); //NOI18N

}

return textComponent;

}

Eke_nya at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 5
Hi There,Thanks for the info, I'll update the bug with this info.ThanksK
kish@suna at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 6
Hi There,see this http://www.netbeans.org/issues/show_bug.cgi?id=95025ThanksK
kish@suna at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 7
I'm trying to enabled or disabled a textfield in a row after append a new one but i can't do it.You can disable the textfield for all the rows setting: getTextFieldoftherow().setDisabled(false);
gesioninga at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...
# 8

> I'm trying to enabled or disabled a textfield in a

> row after append a new one but i can't do it.

> You can disable the textfield for all the rows

> setting:

>

> getTextFieldoftherow().setDisabled(false);

Sorry: getTextFieldoftherow().setDisabled(true)

:)

gesioninga at 2007-7-8 22:00:47 > top of Java-index,Development Tools,Java Tools...