This commit is contained in:
Giancarlo Panichi 2013-12-20 14:47:53 +00:00 committed by Giancarlo Panichi
parent 4a241c3af3
commit 0a9b87cfcf
3 changed files with 75 additions and 47 deletions

View File

@ -145,4 +145,18 @@ public class TabularDataX {
return new TableId(defaultDataSourceFactoryName, tableKey);
}
/**
*
* @param i index of column in ColumnModel
* @return id of column and equals to column name on service
*/
public String getColumnId(int i){
String columnId=null;
if(gridPanel!=null){
columnId=gridPanel.getColumnId(i);
}
return columnId;
}
}

View File

@ -102,4 +102,6 @@ public class TabularDataXController {
service.getTableDefinition(tableId, callback);
}
}

View File

@ -20,6 +20,7 @@ import org.gcube.portlets.user.tdwx.client.event.OpenTableEvent;
import org.gcube.portlets.user.tdwx.client.event.OpenTableEventHandler;
import org.gcube.portlets.user.tdwx.client.event.TableReadyEvent;
import org.gcube.portlets.user.tdwx.client.event.TableReadyEventHandler;
import org.gcube.portlets.user.tdwx.client.model.grid.DataRowColumnConfig;
import org.gcube.portlets.user.tdwx.client.model.grid.DataRowModelKeyProvider;
import org.gcube.portlets.user.tdwx.client.model.grid.DataRowPagingReader;
import org.gcube.portlets.user.tdwx.client.model.util.ColumnConfigGenerator;
@ -32,7 +33,6 @@ import org.gcube.portlets.user.tdwx.shared.model.ColumnType;
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
@ -66,8 +66,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* Defines the panel that will contain the grid
*
@ -82,7 +82,6 @@ public class TabularDataXGridPanel extends ContentPanel {
protected com.google.web.bindery.event.shared.EventBus externalBus;
protected Grid<DataRow> grid;
protected VerticalLayoutContainer container;
@ -170,10 +169,9 @@ public class TabularDataXGridPanel extends ContentPanel {
*
* Set SelectionMode
*
* The selection model supports 3 different selection modes: SINGLE
* - Only single selections allowed SIMPLE - Multiple selections
* without having to use the control and shift keys MULTI - Multiple
* selections
* The selection model supports 3 different selection modes: SINGLE - Only
* single selections allowed SIMPLE - Multiple selections without having to
* use the control and shift keys MULTI - Multiple selections
*
*
* @param mode
@ -225,7 +223,6 @@ public class TabularDataXGridPanel extends ContentPanel {
eventBus.addHandler(CloseTableEvent.TYPE, new CloseTableEventHandler() {
public void onCloseTable(CloseTableEvent event) {
doCloseTable();
}
@ -324,7 +321,6 @@ public class TabularDataXGridPanel extends ContentPanel {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
container.forceLayout();
}
@ -365,7 +361,6 @@ public class TabularDataXGridPanel extends ContentPanel {
}
/**
*
* Add Items to menu of Columns
@ -387,7 +382,6 @@ public class TabularDataXGridPanel extends ContentPanel {
HeaderContextMenuHandler headerContextMenuHandler = new HeaderContextMenuEvent.HeaderContextMenuHandler() {
public void onHeaderContextMenu(HeaderContextMenuEvent event) {
Log.debug("Header Menu");
final Menu menu = event.getMenu();
@ -403,7 +397,8 @@ public class TabularDataXGridPanel extends ContentPanel {
.getSelectedItem();
if (headerColumnMenuItems.contains(menuItem)) {
Log.debug("Event Fire on EventBus");
externalBus.fireEvent(new GridHeaderColumnMenuItemEvent(
externalBus
.fireEvent(new GridHeaderColumnMenuItemEvent(
GridHeaderColumnMenuItemType.SELECTED,
menuItem.getId(), colIndex));
@ -428,8 +423,25 @@ public class TabularDataXGridPanel extends ContentPanel {
}
/**
*
* @param i index of column in ColumnModel
* @return id of column and equals to column name on service
*/
public String getColumnId(int i) {
Log.debug("Retrive Column Id of column:" + i);
String columnId = null;
if (grid != null) {
ColumnModel<DataRow> columnModel = grid.getColumnModel();
List<ColumnConfig<DataRow, ?>> columns = columnModel.getColumns();
DataRowColumnConfig<?> dc = (DataRowColumnConfig<?>) columns.get(i);
columnId = dc.getDefinition().getId();
Log.debug("Column - Definition: Id: " + columnId);
}
return columnId;
}
}