double click enabled

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@87168 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-12-18 16:52:55 +00:00
parent 0254eb1a9c
commit c600574016
1 changed files with 24 additions and 5 deletions

View File

@ -24,6 +24,7 @@ import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
@ -119,7 +120,7 @@ public class ImportVMEReportDialog extends Window {
* view for collections step
* @param vDesc
*/
public void showAvailableReports(List<VMEReportBean> reports, boolean isAssociation) {
public void showAvailableReports(List<VMEReportBean> reports, final boolean isAssociation) {
ColumnModel cm = null;
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
@ -180,7 +181,19 @@ public class ImportVMEReportDialog extends Window {
}
});
grid.addListener(Events.CellDoubleClick, new Listener<GridEvent<VMEReportBean>>(){
@Override
public void handleEvent(GridEvent<VMEReportBean> ge) {
if (ge != null && ge.getModel() != null) {
hide();
if (isAssociation)
associateSelected(grid.getSelectionModel().getSelectedItem(), type);
else
openSelected(grid.getSelectionModel().getSelectedItem(), type);
}
}
});
view.setForceFit(true);
ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);
@ -200,7 +213,7 @@ public class ImportVMEReportDialog extends Window {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), grid.getSelectionModel().getSelectedItem().getName(), type, true));
associateSelected(grid.getSelectionModel().getSelectedItem(), type);
}
}));
}
@ -208,8 +221,8 @@ public class ImportVMEReportDialog extends Window {
gridPanel.addButton(new Button("Open Selected", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), grid.getSelectionModel().getSelectedItem().getName(), type, false));
openSelected(grid.getSelectionModel().getSelectedItem(), type);
hide();
}
}));
}
@ -217,6 +230,12 @@ public class ImportVMEReportDialog extends Window {
mainPanel.setLayout(new FitLayout());
mainPanel.layout();
}
private void associateSelected(VMEReportBean selectedItem, VMETypeIdentifier type) {
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, true));
}
private void openSelected(VMEReportBean selectedItem, VMETypeIdentifier type) {
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, false));
}
/**
*
*/