javagwtgwt2gwt-2.2-celltablepopuppanel

How to open a Popup Panel by clicking a cell in the CellTable?


I have a CellTable being displayed like shown below-enter image description here

On click of the Delete button I want to open a Popup panel in the center of the screen which should contain a Flow Panel and a Button within it.
Right now for the Delete button I have the following function-

deleteColumn.setFieldUpdater(new FieldUpdater<Contact, String>() {
        public void update(int index, Contact object, String value) {           
            try {
                int removeIndex = CONTACTS.indexOf(object);
                CONTACTS.remove(removeIndex);

                table.setRowCount(CONTACTS.size(), true);
                table.setRowData(CONTACTS);

                table.redraw();

            } catch(Exception e) {
                e.printStackTrace();
            }});

I do not understand how to update my function for the same. A sample code will surely help.


Solution

  • How about just displaying a PopupPanel?

    Something like this:

    PopupPanel popup = new PopupPanel(true);
    FlowPanel panel = new FlowPanel();
    //add Button etc
    popup.setSize("1100px","500px");
    popup.clear();
    popup.add(panel);
    popup.show();
    popup.center();
    

    If you want to display a confirm dialog than this code is easier:

    if (Window.confirm("Do you really want to delete the dataset?"))
    {
         //delete code
    }