GWT Property Grid Readonly

In my case I want to set the property grid to read only mode.
How I can do that?

  1. Readonly. Can't copy.

    Just add the editor event listener of the property panel, and on doBeforeEdit, set to always return false;
    LTCInfoGrid.addEditorGridListener(new EditorGridListenerAdapter(){
    @Override
    public boolean doBeforeEdit(GridPanel grid, Record record, String field, Object value, int rowIndex, int colIndex) {
    return super.doBeforeEdit(grid, record, field, value, rowIndex, colIndex);
    }
    )};

  2. Read only. Can copy & modified but reset the changes.

    Add the listener to editor listener, on doValidateEdit, set to always return false

    LTCInfoGrid.addEditorGridListener(new EditorGridListenerAdapter(){

    @Override
    public boolean doValidateEdit(GridPanel grid, Record record, String field, Object value, Object originalValue, int rowIndex, int colIndex) {
    return false;
    }
    });

0 comments:

 
Copyright © peyotest