Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@93005 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e8984934a9
commit
79b593b222
|
@ -33,7 +33,6 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardListener;
|
||||
import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
|
||||
//import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
|
||||
import org.gcube.portlets.user.tdwx.client.TabularDataX;
|
||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||
|
||||
|
@ -52,6 +51,7 @@ import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderL
|
|||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
//import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -390,8 +390,10 @@ public class TabularDataController {
|
|||
case TABLEAGGREAGETE:
|
||||
break;
|
||||
case ROWADD:
|
||||
doRowsAdd();
|
||||
break;
|
||||
case ROWDELETE:
|
||||
doRowsDelete();
|
||||
break;
|
||||
case DUPLICATEDELETE:
|
||||
openDuplicatesRows();
|
||||
|
@ -779,31 +781,45 @@ public class TabularDataController {
|
|||
Log.debug("Change Table Request to " + event.getTrId());
|
||||
openTable(event.getTrId());
|
||||
};
|
||||
|
||||
|
||||
protected void doRowsAdd(){
|
||||
ArrayList<String> rows = tabularData.getGridPanel().getSelectedRowsId();
|
||||
onRowsAdd(rows);
|
||||
}
|
||||
|
||||
protected void doRowsDelete(){
|
||||
ArrayList<String> rows = tabularData.getGridPanel().getSelectedRowsId();
|
||||
onRowsDelete(rows);
|
||||
}
|
||||
|
||||
private void onRowsDelete(ArrayList<String> rows){
|
||||
if(rows==null || rows.size()==0){
|
||||
alertMessage("No rows selected", "No rows selected");
|
||||
return;
|
||||
}
|
||||
DeleteRows deleteRows=new DeleteRows(trId, rows,eventBus);
|
||||
deleteRows.delete();
|
||||
}
|
||||
|
||||
private void onRowsAdd(ArrayList<String> rows){
|
||||
tabularData.addRow(rows);
|
||||
}
|
||||
|
||||
protected void doGridContextMenuCommand(GridContextMenuItemEvent event) {
|
||||
Log.debug("GridContextMenu Fire Event",
|
||||
"OperationId: " + event.getGridOperationId());
|
||||
GridOperationId gridOperationId = event.getGridOperationId();
|
||||
ArrayList<String> rows = event.getRows();
|
||||
|
||||
|
||||
|
||||
|
||||
switch (gridOperationId) {
|
||||
case ROWADD:
|
||||
if(rows==null){
|
||||
rows=new ArrayList<String>();
|
||||
}
|
||||
tabularData.addRow(rows);
|
||||
onRowsAdd(rows);
|
||||
break;
|
||||
case ROWEDIT:
|
||||
break;
|
||||
case ROWDELETE:
|
||||
if(rows==null || rows.size()==0){
|
||||
alertMessage("No rows selected", "No rows selected");
|
||||
return;
|
||||
}
|
||||
DeleteRows deleteRows=new DeleteRows(trId, rows,eventBus);
|
||||
deleteRows.delete();
|
||||
onRowsDelete(rows);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
package org.gcube.portlets.user.td.client.grid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;
|
||||
import org.gcube.portlets.user.tdwx.client.TabularDataXGridPanel;
|
||||
import org.gcube.portlets.user.tdwx.client.config.Row;
|
||||
import org.gcube.portlets.user.tdwx.client.model.grid.DataRowColumnConfig;
|
||||
import org.gcube.portlets.user.tdwx.shared.model.ColumnDefinition;
|
||||
import org.gcube.portlets.user.tdwx.shared.model.ColumnType;
|
||||
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
|
@ -50,47 +42,10 @@ public class GridContextMenu {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Log.debug("gridPanel is: " + gridPanel);
|
||||
if (gridPanel != null) {
|
||||
ColumnModel<DataRow> columnModel = gridPanel.getGrid()
|
||||
.getColumnModel();
|
||||
|
||||
List<ColumnConfig<DataRow, ?>> columns = columnModel
|
||||
.getColumns();
|
||||
DataRowColumnConfig<?> c = null;
|
||||
boolean columnIdRetrieved = false;
|
||||
for (ColumnConfig<DataRow, ?> col : columns) {
|
||||
c = (DataRowColumnConfig<?>) col;
|
||||
ColumnType ctype = c.getDefinition().getType();
|
||||
if (ctype == ColumnType.COLUMNID) {
|
||||
columnIdRetrieved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (columnIdRetrieved) {
|
||||
ColumnDefinition cd = c.getDefinition();
|
||||
Log.debug("CD - Definition:" + cd.getId()
|
||||
+ " ColumnLocalId:" + cd.getColumnLocalId()
|
||||
+ " Label:" + cd.getLabel() + " Key:"
|
||||
+ cd.getKey());
|
||||
List<Row> rowsSelected = gridPanel.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 retrived");
|
||||
}
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
ArrayList<String> rows=gridPanel.getSelectedRowsId();
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
GridOperationId.ROWADD, rows);
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
} else {
|
||||
Log.debug("no COLUMNID retrived");
|
||||
}
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,7 +54,7 @@ public class GridContextMenu {
|
|||
tableContextMenu.add(addRowItem);
|
||||
|
||||
|
||||
MenuItem editRowItem = new MenuItem("Edit Row");
|
||||
/*MenuItem editRowItem = new MenuItem("Edit Row");
|
||||
editRowItem.setId(GridOperationId.ROWEDIT.toString());
|
||||
editRowItem.setIcon(TabularDataResources.INSTANCE.rowEdit());
|
||||
editRowItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -108,54 +63,18 @@ public class GridContextMenu {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Log.debug("gridPanel is: " + gridPanel);
|
||||
if (gridPanel != null) {
|
||||
ColumnModel<DataRow> columnModel = gridPanel.getGrid()
|
||||
.getColumnModel();
|
||||
|
||||
List<ColumnConfig<DataRow, ?>> columns = columnModel
|
||||
.getColumns();
|
||||
DataRowColumnConfig<?> c = null;
|
||||
boolean columnIdRetrieved = false;
|
||||
for (ColumnConfig<DataRow, ?> col : columns) {
|
||||
c = (DataRowColumnConfig<?>) col;
|
||||
ColumnType ctype = c.getDefinition().getType();
|
||||
if (ctype == ColumnType.COLUMNID) {
|
||||
columnIdRetrieved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (columnIdRetrieved) {
|
||||
ColumnDefinition cd = c.getDefinition();
|
||||
Log.debug("CD - Definition:" + cd.getId()
|
||||
+ " ColumnLocalId:" + cd.getColumnLocalId()
|
||||
+ " Label:" + cd.getLabel() + " Key:"
|
||||
+ cd.getKey());
|
||||
List<Row> rowsSelected = gridPanel.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 retrived");
|
||||
}
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
if (gridPanel != null) {
|
||||
ArrayList<String> rows=gridPanel.getSelectedRowsId();
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
GridOperationId.ROWEDIT, rows);
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
} else {
|
||||
Log.debug("no COLUMNID retrived");
|
||||
}
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
tableContextMenu.add(editRowItem);
|
||||
|
||||
*/
|
||||
|
||||
MenuItem deleteRowItem = new MenuItem("Delete Row");
|
||||
deleteRowItem.setId(GridOperationId.ROWDELETE.toString());
|
||||
deleteRowItem.setIcon(TabularDataResources.INSTANCE.rowRemove());
|
||||
|
@ -165,49 +84,11 @@ public class GridContextMenu {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Log.debug("gridPanel is: " + gridPanel);
|
||||
if (gridPanel != null) {
|
||||
ColumnModel<DataRow> columnModel = gridPanel.getGrid()
|
||||
.getColumnModel();
|
||||
|
||||
List<ColumnConfig<DataRow, ?>> columns = columnModel
|
||||
.getColumns();
|
||||
Log.debug("Columns Config: "+columns);
|
||||
DataRowColumnConfig<?> c = null;
|
||||
boolean columnIdRetrieved = false;
|
||||
for (ColumnConfig<DataRow, ?> col : columns) {
|
||||
c = (DataRowColumnConfig<?>) col;
|
||||
Log.debug("Column "+c.getDefinition().getLabel()+" type:"+
|
||||
c.getDefinition().getType());
|
||||
ColumnType ctype = c.getDefinition().getType();
|
||||
if (ctype == ColumnType.COLUMNID) {
|
||||
columnIdRetrieved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (columnIdRetrieved) {
|
||||
ColumnDefinition cd = c.getDefinition();
|
||||
Log.debug("CD - Definition:" + cd.getId()
|
||||
+ " ColumnLocalId:" + cd.getColumnLocalId()
|
||||
+ " Label:" + cd.getLabel() + " Key:"
|
||||
+ cd.getKey());
|
||||
List<Row> rowsSelected = gridPanel.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 retrived");
|
||||
}
|
||||
if (gridPanel != null) {
|
||||
ArrayList<String> rows=gridPanel.getSelectedRowsId();
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
GridOperationId.ROWDELETE, rows);
|
||||
GridOperationId.ROWDELETE, rows);
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
} else {
|
||||
Log.debug("no COLUMNID retrived");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -138,8 +138,7 @@ public class ModifyToolBar {
|
|||
aggregateButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
// eventBus.fireEvent(new
|
||||
// ImportTableEvent(ImportTableType.JSON));
|
||||
//eventBus.fireEvent(new RibbonEvent(RibbonType.AGGREGATE));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -156,8 +155,7 @@ public class ModifyToolBar {
|
|||
addRowButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
// eventBus.fireEvent(new
|
||||
// ImportTableEvent(ImportTableType.JSON));
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.ROWADD));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -174,8 +172,7 @@ public class ModifyToolBar {
|
|||
deleteRowButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
// eventBus.fireEvent(new
|
||||
// ImportTableEvent(ImportTableType.JSON));
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.ROWDELETE));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -337,8 +334,8 @@ public class ModifyToolBar {
|
|||
unionButton.disable();
|
||||
groupbyButton.disable();
|
||||
aggregateButton.disable();
|
||||
addRowButton.disable();
|
||||
deleteRowButton.disable();
|
||||
addRowButton.enable();
|
||||
deleteRowButton.enable();
|
||||
deleteDuplicateButton.enable();
|
||||
annotationButton.disable();
|
||||
// Column
|
||||
|
|
Loading…
Reference in New Issue