Hi BJ Tenney,

>>
        We have recently upgraded from ULC 6.0.3 to ULC 2008-b3.  We had
to make a few minor changes, but nothing major.  However, when we call
setValueAt on the client, it is not pumping the events to the client
immediately from a cell editor. 
>>

The default delivery mode for model update event is
UlcEventConstants.DEFERRED_MODE. Earlier it was SYNCHRONOUS. 
This means that the event will be sent when the next roundtrip is
initiated from the client. This should be there in migration notes in one
of the previous release notes. Just add the following line to your code:
  
ClientContext.setModelUpdateMode(scrollableTable_.getModel(),
UlcEventConstants.SYNCHRONOUS_MODE);

>>>
        (When writing these classes originally, we couldn't get all of the
functionality we needed using ULC editors/renderers, so they were written
using Swing renderers/editors.  I now maintain this code, but I'm not sure
what functionality we needed that wasn't available.)
>>>

I think you should review your code and get rid of unnecessary extensions
leading to simplification. Make a small pilot of the feature and see if it
meets all requirements without extension.

Thanks and regards,

Janak

-----------------------------------------
Janak Mulani

email: [email protected]
url: http://www.canoo.com <http://www.canoo.com/> 

Beyond AJAX - Java Rich Internet Applications

http://www.canoo.com/ulc
----------------------------------------- 

 



________________________________

        From: [email protected]
[mailto:[email protected]] On Behalf Of BJ Tenney
        Sent: Monday, January 25, 2010 11:56 PM
        To: [email protected]
        Subject: [ULC-developer] client side editor calls setValueAt, but
not invoked on server
        
        
        We have recently upgraded from ULC 6.0.3 to ULC 2008-b3.  We had
to make a few minor changes, but nothing major.  However, when we call
setValueAt on the client, it is not pumping the events to the client
immediately from a cell editor.
        
        (When writing these classes originally, we couldn't get all of the
functionality we needed using ULC editors/renderers, so they were written
using Swing renderers/editors.  I now maintain this code, but I'm not sure
what functionality we needed that wasn't available.)
        
        Here is the scenario, we have a table which contains schedule
information for employees.  when you select a cell we begin editing that
cell.  we setup the cell editors as the table is being created: 
        
        
        public class WFMUITable extends UITable {
        
        ...
        private JTable table ;
        ...
        private void setCellEditor() {
        JTextField textField = new JTextField();
        
table.getColumnModel().getColumn(WeeklyTableModel.SUN_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.MON_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.TUE_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.WED_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.THU_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.FRI_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        
table.getColumnModel().getColumn(WeeklyTableModel.SAT_COLUMN).setCellEdito
r(new WFMUITableCellEditor(this, textField));
        }
        ...
        }
        
        
        The editor then registers a keyboard action for the text field:
        
        
        public class WFMUITableCellEditor extends DefaultCellEditor {
        
        
        public WFMUITable uiTable;
        public JTextField text;
        public String textStr;
        public WFMUITableCellEditor(WFMUITable uiTable, JTextField text){
        super(text);
        this.uiTable = uiTable;
        this.text = text;
        text.setBorder(BorderFactory.createMatteBorder(1, 2, 1, 1,
Color.red));
        text.addKeyListener(new WeeklyUITableCellKeyListener(uiTable));
        setTextTabListeners(text);
        }
                private void setTextTabListeners(JTextField text2) {
        text.registerKeyboardAction(new ActionListener(){ //<-- register
action when the tab key is pressed
        public void actionPerformed(ActionEvent arg0) {
        uiTable.setNextFieldToEdit(text.getText());
        uiTable.tabKeyPressed = true;
        }
        },KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), 0);
        }
        
        
        public Component getTableCellEditorComponent(JTable table, Object
value, boolean isSelected, int row, int column) {
        table.repaint();
        if(uiTable.empIDs != null && uiTable.uniqueEmpIds[row] != -1) {
        textStr = value.toString();
        text.setText(textStr);
        text.selectAll();
        text.revalidate();
        text.repaint();
        text.requestFocus();
        uiTable.editMode = true;
        uiTable.updateMode(true);
        } else {
        return null;
        }
        return text;
        }

        When the "Tab" key is pressed, it calls the method in our table
class which calls "setValueAt" on the table:

        public class WFMUITable extends UITable {
        
        ...
        private JTable table ;
        ...
        public void setNextFieldToEdit(String value) {  
        currRow = table.getSelectedRow();  
        currCol = table.getSelectedColumn();  
        valueValidCount = 0;  
        System.out.println("setNextFieldToEdit: table "+ currRow + " " +
currCol + " value "+ value);  
        table.requestFocus();  
        table.setValueAt(value, currRow, currCol);  //<-- Not being called
on the server side
        System.out.println("table.setValueAt() called");  
        }
        
        ...
        }

        I am seeing the above System.out's in the java console, but the
table models "setValueAt" method is not being called until I either leave
the page or click on a different cell with the mouse.  I searched through
the Jira issues, but was unable to find any information as to why this may
be happening.  As I originally stated, this started happening when we
upgraded to a newer version (the latest at the time we did our upgrade.)
but works fine when we go back to version 6.0.3.

        Please let me know if you need any more information.
        Thanks.

        BJ Tenney
        ---------------------
        Java Developer
        Tomax Corporation
        [email protected]

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to