Minor Updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@92743 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-06 11:42:54 +00:00
parent 651e9e6c5e
commit 77b19aec0f
5 changed files with 327 additions and 68 deletions

View File

@ -190,3 +190,67 @@ Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 5 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 18.47 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
40% complete (ETR: 7 seconds)
40% complete (ETR: 7 seconds)
40% complete (ETR: 7 seconds)
40% complete (ETR: 7 seconds)
40% complete (ETR: 7 seconds)
50% complete (ETR: 5 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 9.42 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="tabular-data-widgetx-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widgetx/tabular-data-widgetx">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-widget-common-event-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget-common-event/tabular-data-widget-common-event">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -16,15 +19,15 @@
<dependent-module archiveName="tabular-data-open-widget-2.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-open-widget/tabular-data-open-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-table-widget-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-table-widget/tabular-data-table-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-toolbox-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-toolbox-widget/tabular-data-toolbox-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-information-widget-2.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-information-widget/tabular-data-information-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-table-widget-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-table-widget/tabular-data-table-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="tabular-data-portlet"/>
<property name="java-output-path" value="/tabular-data-portlet/target/tabular-data-portlet-2.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>

View File

@ -241,6 +241,13 @@
<artifactId>tabular-data-sdmx-export-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- tabular-data-table-widget -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-table-widget</artifactId>
<version>[0.0.1-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- tabular-data-toolbox-widget -->
<dependency>

View File

@ -3,6 +3,8 @@
*/
package org.gcube.portlets.user.td.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD;
import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD;
import org.gcube.portlets.user.td.expressionwidget.client.ColumnFilterDialog;
@ -13,6 +15,7 @@ import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD;
import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD;
import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridHeaderColumnMenuItemEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.TasksMonitorEvent;
@ -23,6 +26,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.TaskType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridHeaderOperationId;
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;
@ -54,7 +58,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
*/
public class TabularDataController {
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
protected SimpleEventBus eventBus;
protected TabularDataX tabularData;
protected UIStateType uiState = UIStateType.START;
@ -74,10 +78,7 @@ public class TabularDataController {
* Grid TableId
*/
protected TableId tableOpening;
public TabularDataController() {
eventBus = new SimpleEventBus();
callHello();
@ -110,26 +111,26 @@ public class TabularDataController {
public void setWestData(BorderLayoutData westData) {
this.westData = westData;
}
protected void callHello(){
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<String>(){
protected void callHello() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
Log.info("No valid user found: "+caught.getMessage());
Log.info("No valid user found: " + caught.getMessage());
alertMessage("Error", "No user found");
}
@Override
public void onSuccess(String result) {
Log.info("Hello: "+result);
Log.info("Hello: " + result);
}
});
}
// Bind Controller to events on bus
protected void bindToEvents() {
eventBus.addHandler(
@ -144,6 +145,17 @@ public class TabularDataController {
}
});
eventBus.addHandler(GridContextMenuItemEvent.TYPE,
new GridContextMenuItemEvent.GridContextMenuItemEventHandler() {
public void onGridContextMenuItemEvent(
GridContextMenuItemEvent event) {
Log.debug("Catch Event ContextMenuItemEvent");
doGridContextMenuCommand(event);
}
});
eventBus.addHandler(ChangeTableRequestEvent.TYPE,
new ChangeTableRequestEvent.ChangeTableRequestEventHandler() {
@ -192,8 +204,6 @@ public class TabularDataController {
d.show();
}
// Resume state of user interface
protected void resumeUIState() {
try {
@ -748,6 +758,30 @@ public class TabularDataController {
openTable(event.getTrId());
};
protected void doGridContextMenuCommand(GridContextMenuItemEvent event) {
Log.debug("GridContextMenu Fire Event",
"OperationId: " + event.getGridOperationId());
GridOperationId gridOperationId = event.getGridOperationId();
ArrayList<String> rows = event.getRows();
if(rows==null || rows.size()==0){
alertMessage("No rows selected", "No rows selected");
return;
}
switch (gridOperationId) {
case ROWADD:
break;
case ROWEDIT:
break;
case ROWDELETE:
break;
default:
break;
}
}
protected void doGridHeaderColumnMenuCommand(
GridHeaderColumnMenuItemEvent event) {
Log.debug("GridHeaderColumnMenu Fire Event",

View File

@ -1,74 +1,225 @@
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;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* Defines the context menu of grid
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* Defines the context menu of grid
*/
public class GridContextMenu {
protected Menu tableContextMenu;
protected final TabularDataXGridPanel gridPanel;
protected EventBus eventBus;
public GridContextMenu(final TabularDataXGridPanel gridPanel,EventBus eventBus){
this.gridPanel=gridPanel;
this.eventBus=eventBus;
tableContextMenu=new Menu();
MenuItem addRowItem = new MenuItem("Add Row");
addRowItem.setId(GridOperationId.ROWADD.toString());
addRowItem.setIcon(TabularDataResources.INSTANCE.rowInsert());
addRowItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
Log.debug("gridPanel is: " + gridPanel);
if (gridPanel != null) {
List<Row> rows = gridPanel.getSelectedRows();
protected Menu tableContextMenu;
protected final TabularDataXGridPanel gridPanel;
protected EventBus eventBus;
public GridContextMenu(final TabularDataXGridPanel gridPanel,
final EventBus eventBus) {
this.gridPanel = gridPanel;
this.eventBus = eventBus;
tableContextMenu = new Menu();
MenuItem addRowItem = new MenuItem("Add Row");
addRowItem.setId(GridOperationId.ROWADD.toString());
addRowItem.setIcon(TabularDataResources.INSTANCE.rowInsert());
addRowItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
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(
GridOperationId.ROWADD, rows);
eventBus.fireEvent(eventGridContextMenu);
} else {
Log.debug("no COLUMNID retrived");
}
}
});
tableContextMenu.add(addRowItem);
MenuItem editRowItem = new MenuItem("Edit Row");
editRowItem.setId(GridOperationId.ROWEDIT.toString());
editRowItem.setIcon(TabularDataResources.INSTANCE.rowEdit());
tableContextMenu.add(editRowItem);
MenuItem removeRowItem = new MenuItem("Delete Row");
removeRowItem.setId(GridOperationId.ROWDELETE.toString());
removeRowItem.setIcon(TabularDataResources.INSTANCE.rowRemove());
tableContextMenu.add(removeRowItem);
}
}
});
tableContextMenu.add(addRowItem);
/**
*
* @return context menu for grid
*/
public Menu getMenu(){
return tableContextMenu;
}
MenuItem editRowItem = new MenuItem("Edit Row");
editRowItem.setId(GridOperationId.ROWEDIT.toString());
editRowItem.setIcon(TabularDataResources.INSTANCE.rowEdit());
editRowItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
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(
GridOperationId.ROWEDIT, rows);
eventBus.fireEvent(eventGridContextMenu);
} else {
Log.debug("no COLUMNID retrived");
}
}
}
});
tableContextMenu.add(editRowItem);
MenuItem deleteRowItem = new MenuItem("Delete Row");
deleteRowItem.setId(GridOperationId.ROWDELETE.toString());
deleteRowItem.setIcon(TabularDataResources.INSTANCE.rowRemove());
deleteRowItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
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(
GridOperationId.ROWDELETE, rows);
eventBus.fireEvent(eventGridContextMenu);
} else {
Log.debug("no COLUMNID retrived");
}
}
}
});
tableContextMenu.add(deleteRowItem);
}
/**
*
* @return context menu for grid
*/
public Menu getMenu() {
return tableContextMenu;
}
}