ref 6078:TDM - Create a new widget to support operations's invocation on DataMiner

https://support.d4science.org/issues/6078

Updated to support DataMinerManagerWidget

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/data-miner-manager-widget@144881 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-03-13 18:58:26 +00:00
parent d978d83f28
commit 826cfbd75e
8 changed files with 302 additions and 29 deletions

View File

@ -28,6 +28,7 @@ import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.StartComp
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.StartComputationExecutionRequestEvent;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.monitor.StatusMonitor;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.tr.TabularResourceData;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaEventType;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.MenuType;
@ -55,7 +56,8 @@ public class DataMinerManagerController {
private DataMinerWorkArea dataMinerWorkArea;
private List<OperatorsClassification> operatorsClassifications;
private MenuType currentVisualization;
private String operatorId;
//private String operatorId;
private TabularResourceData tabularResourceData;
public DataMinerManagerController() {
init();
@ -64,15 +66,20 @@ public class DataMinerManagerController {
public UserInfo getUserInfo() {
return userInfo;
}
//public String getOperatorId(){
// return operatorId;
//}
public DataMinerWorkArea getDataMinerWorkArea() {
return dataMinerWorkArea;
}
public String getOperatorId(){
return operatorId;
public void setTabularResourceData(TabularResourceData tabularResourceData){
this.tabularResourceData=tabularResourceData;
}
private void init() {
currentVisualization = MenuType.EXPERIMENT;
restoreUISession();
@ -263,8 +270,8 @@ public class DataMinerManagerController {
private void restoreUISession() {
// checkLocale();
operatorId = com.google.gwt.user.client.Window.Location
.getParameter(Constants.DATA_MINER_OPERATOR_ID);
//operatorId = com.google.gwt.user.client.Window.Location
// .getParameter(Constants.DATA_MINER_OPERATOR_ID);
}
@ -536,13 +543,14 @@ public class DataMinerManagerController {
}
OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){
ocEvent = new OperatorsClassificationEvent(
find, operatorId);
} else {
//TODO
//if(event.isOperatorId()){
// ocEvent = new OperatorsClassificationEvent(
// find, operatorId);
//} else {
ocEvent = new OperatorsClassificationEvent(
find);
}
//}
EventBusProvider.INSTANCE.fireEvent(ocEvent);
}
@ -566,13 +574,14 @@ public class DataMinerManagerController {
}
OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){
ocEvent = new OperatorsClassificationEvent(
event.getClassificationName(), find, operatorId);
} else {
//TODO
//if(event.isOperatorId()){
// ocEvent = new OperatorsClassificationEvent(
// event.getClassificationName(), find, operatorId);
//} else {
ocEvent = new OperatorsClassificationEvent(
event.getClassificationName(), find);
}
//}
EventBusProvider.INSTANCE.fireEvent(ocEvent);
}

View File

@ -1,6 +1,14 @@
package org.gcube.portlets.widgets.dataminermanagerwidget.client;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionEvent;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionEvent.ExternalExecutionEventHandler;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionEvent.HasExternalExecutionEventHandler;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionRequestEvent;
import org.gcube.portlets.widgets.dataminermanagerwidget.client.tr.TabularResourceData;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.HandlerRegistration;
import com.sencha.gxt.widget.core.client.Window;
/**
@ -9,19 +17,22 @@ import com.sencha.gxt.widget.core.client.Window;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DataMinerManagerDialog extends Window {
//private DateTimeFormat dateTimeFormat= DateTimeFormat.getFormat("yyyy/MM/dd HH:mm:ss SSS");
public class DataMinerManagerDialog extends Window implements HasExternalExecutionEventHandler {
// private DateTimeFormat dateTimeFormat=
// DateTimeFormat.getFormat("yyyy/MM/dd HH:mm:ss SSS");
private static final String WIDTH = "1024px";
private static final String HEIGHT = "600px";
//private static final String PANELWIDTH = "620px";
//private static final String PANELHEIGHT = "308px";
// private static final String PANELWIDTH = "620px";
// private static final String PANELHEIGHT = "308px";
private DataMinerManagerController dataMinerManagerController;
public DataMinerManagerDialog() {
Log.debug("DataMinerManagerDialog");
initWindow();
create();
bind();
}
private void initWindow() {
@ -36,8 +47,35 @@ public class DataMinerManagerDialog extends Window {
}
private void create() {
DataMinerManagerPanel dataMinerManagerPanel=new DataMinerManagerPanel();
dataMinerManagerController = new DataMinerManagerController();
DataMinerManagerPanel dataMinerManagerPanel = new DataMinerManagerPanel();
setWidget(dataMinerManagerPanel);
}
public void setTabularResourceData(TabularResourceData tabularResourceData){
dataMinerManagerController.setTabularResourceData(tabularResourceData);
}
private void bind() {
EventBusProvider.INSTANCE
.addHandler(
ExternalExecutionRequestEvent.TYPE,
new ExternalExecutionRequestEvent.ExternalExecutionRequestEventHandler() {
@Override
public void onSubmit(ExternalExecutionRequestEvent event) {
Log.debug("Catch ExternalExecutionRequestEvent: "
+ event);
}
});
}
@Override
public HandlerRegistration addExternalExecutionEventHandler(
ExternalExecutionEventHandler handler) {
return addHandler(handler, ExternalExecutionEvent.getType());
}
}

View File

@ -30,7 +30,7 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
public class DataMinerManagerPanel extends ContentPanel {
public static final Resources resources = GWT.create(Resources.class);
private DataMinerManagerController dataMinerManagerController;
private Header header;
private HomePanel homePanel;
@ -55,7 +55,6 @@ public class DataMinerManagerPanel extends ContentPanel {
}
private void create() {
dataMinerManagerController = new DataMinerManagerController();
homePanel = new HomePanel();
dataSpacePanel = new DataSpacePanel();
experimentPanel = new ExperimentPanel();
@ -108,6 +107,8 @@ public class DataMinerManagerPanel extends ContentPanel {
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(MenuSwitchEvent.TYPE,
new MenuSwitchEvent.MenuSwitchEventHandler() {

View File

@ -26,8 +26,8 @@ public class ComputationDataEvent extends
void onComputationData(ComputationDataEvent event);
}
public interface HasOutputShowResourceEventHandler extends HasHandlers {
public HandlerRegistration addOutputShowResourceEventHandler(
public interface HasComputationDataEventHandler extends HasHandlers {
public HandlerRegistration addComputationDataEventHandler(
ComputationDataEventHandler handler);
}

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* External Execution Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExternalExecutionEvent extends
GwtEvent<ExternalExecutionEvent.ExternalExecutionEventHandler> {
public static Type<ExternalExecutionEventHandler> TYPE = new Type<ExternalExecutionEventHandler>();
private Operator op;
public interface ExternalExecutionEventHandler extends EventHandler {
void onSubmit(ExternalExecutionEvent event);
}
public interface HasExternalExecutionEventHandler extends
HasHandlers {
public HandlerRegistration addExternalExecutionEventHandler(
ExternalExecutionEventHandler handler);
}
public ExternalExecutionEvent(Operator op) {
this.op = op;
}
@Override
protected void dispatch(ExternalExecutionEventHandler handler) {
handler.onSubmit(this);
}
@Override
public Type<ExternalExecutionEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ExternalExecutionEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ExternalExecutionEvent event) {
source.fireEvent(event);
}
public Operator getOp() {
return op;
}
@Override
public String toString() {
return "ExternalExecutionEvent [op=" + op + "]";
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Start Computation Execution Request Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExternalExecutionRequestEvent extends
GwtEvent<ExternalExecutionRequestEvent.ExternalExecutionRequestEventHandler> {
public static Type<ExternalExecutionRequestEventHandler> TYPE = new Type<ExternalExecutionRequestEventHandler>();
private Operator op;
public interface ExternalExecutionRequestEventHandler extends EventHandler {
void onSubmit(ExternalExecutionRequestEvent event);
}
public interface HasExternalExecutionRequestEventHandler extends
HasHandlers {
public HandlerRegistration addExternalExecutionRequestEventHandler(
ExternalExecutionRequestEventHandler handler);
}
public ExternalExecutionRequestEvent(Operator op) {
this.op = op;
}
@Override
protected void dispatch(ExternalExecutionRequestEventHandler handler) {
handler.onSubmit(this);
}
@Override
public Type<ExternalExecutionRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ExternalExecutionRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ExternalExecutionRequestEvent event) {
source.fireEvent(event);
}
public Operator getOp() {
return op;
}
@Override
public String toString() {
return "ExternalExecutionRequestEvent [op=" + op + "]";
}
}

View File

@ -0,0 +1,92 @@
/**
*
*/
package org.gcube.portlets.widgets.dataminermanagerwidget.client.tr;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.data.analysis.dataminermanagercl.shared.data.ColumnItem;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabularResourceData implements Serializable {
private static final long serialVersionUID = 3680043028889915839L;
private String tabularResourceId;
private String name;
private String description;
private String type;
private ArrayList<ColumnItem> columns;
/**
*
*/
public TabularResourceData() {
super();
}
public TabularResourceData(String tabularResourceId, String name,
String description, String type, ArrayList<ColumnItem> columns) {
super();
this.tabularResourceId = tabularResourceId;
this.name = name;
this.description = description;
this.type = type;
this.columns = columns;
}
public String getTabularResourceId() {
return tabularResourceId;
}
public void setTabularResourceId(String tabularResourceId) {
this.tabularResourceId = tabularResourceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public ArrayList<ColumnItem> getColumns() {
return columns;
}
public void setColumns(ArrayList<ColumnItem> columns) {
this.columns = columns;
}
@Override
public String toString() {
return "TabularResourceData [tabularResourceId=" + tabularResourceId
+ ", name=" + name + ", description=" + description + ", type="
+ type + ", columns=" + columns + "]";
}
}

View File

@ -48,7 +48,7 @@ public class TableReader {
TableItemSimple tableItemSimple=new TableItemSimple(publicLink,item.getName(), item.getType().name());
ArrayList<ColumnItem> columnItemList=new ArrayList<ColumnItem>();
for(int i=0; i<columns.size(); i++){
ColumnItem columnItem=new ColumnItem(i, columns.get(i));
ColumnItem columnItem=new ColumnItem(String.valueOf(i), columns.get(i));
columnItemList.add(columnItem);
}
tableItemSimple.setColumns(columnItemList);