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
This commit is contained in:
parent
b729105096
commit
7016d0749c
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='TabularDataWidgetX'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
|
||||
<inherits name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
|
||||
<!--Loggers Enabled by default -->
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||
<set-property name="log_FirebugLogger" value="ENABLED" />
|
||||
<set-property name="log_SystemLogger" value="ENABLED" />
|
||||
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_WindowLogger" value="DISABLED" />
|
||||
|
||||
</module>
|
|
@ -278,6 +278,57 @@ public class TabularDataXGridPanel extends ContentPanel {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve selected cell value
|
||||
*
|
||||
* @param columnLocalId
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<String> getCellValue(String columnLocalId){
|
||||
ArrayList<String> value=null;
|
||||
if (grid != null) {
|
||||
ColumnModel<DataRow> columnModel = grid.getColumnModel();
|
||||
|
||||
List<ColumnConfig<DataRow, ?>> columns = columnModel.getColumns();
|
||||
|
||||
// Retrive Column with conlumnName
|
||||
DataRowColumnConfig<?> columnTarget = null;
|
||||
boolean columnTargetRetrieved = false;
|
||||
for (ColumnConfig<DataRow, ?> 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<Row> rowsSelected = getSelectedRows();
|
||||
Log.debug("Retriving rows selected");
|
||||
String rowS = "";
|
||||
ArrayList<String> rows = new ArrayList<String>();
|
||||
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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue