From 7016d0749c0a80bdf430d7e939469fba0c2e7efc Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 27 Mar 2014 16:59:00 +0000 Subject: [PATCH] Added getCellValue with parameter columnLocalId git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@93660 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/tdwx/TabularDataWidgetX.gwt.xml | 27 ++++++++++ .../tdwx/client/TabularDataXGridPanel.java | 51 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/main/java/org/gcube/portlets/user/tdwx/TabularDataWidgetX.gwt.xml diff --git a/src/main/java/org/gcube/portlets/user/tdwx/TabularDataWidgetX.gwt.xml b/src/main/java/org/gcube/portlets/user/tdwx/TabularDataWidgetX.gwt.xml new file mode 100644 index 0000000..a0d07e7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/tdwx/TabularDataWidgetX.gwt.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java index 462a11e..a26f2b6 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java @@ -277,7 +277,58 @@ public class TabularDataXGridPanel extends ContentPanel { return null; } + + /** + * Retrieve selected cell value + * + * @param columnLocalId + * @return + */ + public ArrayList getCellValue(String columnLocalId){ + ArrayList value=null; + if (grid != null) { + ColumnModel columnModel = grid.getColumnModel(); + List> columns = columnModel.getColumns(); + + // Retrive Column with conlumnName + DataRowColumnConfig columnTarget = null; + boolean columnTargetRetrieved = false; + for (ColumnConfig col : columns) { + columnTarget = (DataRowColumnConfig) col; + String columnLocal = columnTarget.getDefinition().getColumnLocalId(); + if (columnLocalId.compareTo(columnLocal)==0) { + columnTargetRetrieved = true; + break; + } + } + + if (columnTargetRetrieved) { + ColumnDefinition cd = columnTarget.getDefinition(); + Log.debug("CD - Definition:" + cd.getId() + " ColumnLocalId:" + + cd.getColumnLocalId() + " Label:" + cd.getLabel() + + " Key:" + cd.getKey()); + List rowsSelected = getSelectedRows(); + Log.debug("Retriving rows selected"); + String rowS = ""; + ArrayList rows = new ArrayList(); + if (rowsSelected != null) { + for (Row row : rowsSelected) { + rowS = row.getFieldAsText(cd.getLabel()); + Log.debug("Selected Row:" + rowS); + rows.add(rowS); + } + } else { + Log.debug("no selected rows retrieved"); + } + return rows; + } else { + Log.debug("no column target retrieved"); + } + } + return value; + } + /** * getSelectedRowsId *