refs 4713: DataMiner - Add a direct link to the algorithms

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

Added direct link

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@130300 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-07-13 09:07:49 +00:00
parent a1ed1043a5
commit cf49f22d33
12 changed files with 280 additions and 96 deletions

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.dataminermanager.client.experiments.ExperimentPan
import org.gcube.portlets.user.dataminermanager.client.resources.Resources;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaRegionType;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaRequestEventType;
import org.gcube.portlets.user.dataminermanager.client.type.MenuType;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
@ -27,18 +28,15 @@ import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.Viewport;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class DataMinerManager implements EntryPoint {
public static final Resources resources = GWT.create(Resources.class);
private static final String SM_DIV = "contentDiv";
@SuppressWarnings("unused")
private DataMinerManagerController dataMinerManagerController;
private Header header;
private HomePanel homePanel;
private DataSpacePanel dataSpacePanel;
@ -47,8 +45,7 @@ public class DataMinerManager implements EntryPoint {
private SimpleContainer previousPanel;
private SimpleContainer centerPanel;
/**
* {@inheritDoc}
*/
@ -100,7 +97,7 @@ public class DataMinerManager implements EntryPoint {
dataSpacePanel = new DataSpacePanel();
experimentPanel = new ExperimentPanel();
computationsPanel = new ComputationsPanel();
bind();
// Layout
@ -109,15 +106,14 @@ public class DataMinerManager implements EntryPoint {
mainPanelLayout.setBorders(false);
mainPanelLayout.setResize(true);
mainPanelLayout.getElement().getStyle().setBackgroundColor("#FFFFFF");
// Center
centerPanel = new SimpleContainer();
MarginData mainData = new MarginData(new Margins(0));
mainPanelLayout.setCenterWidget(centerPanel, mainData);
// Menu
header = new Header();
header = new Header();
BorderLayoutData menuData = new BorderLayoutData(40);
menuData.setMargins(new Margins(5));
@ -127,14 +123,24 @@ public class DataMinerManager implements EntryPoint {
mainPanelLayout.setNorthWidget(header, menuData);
//
centerPanel.add(homePanel);
previousPanel = homePanel;
if (dataMinerManagerController.getOperatorId() != null
&& !dataMinerManagerController.getOperatorId().isEmpty()){
header.setMenu(MenuType.EXPERIMENT);
centerPanel.add(experimentPanel);
previousPanel = experimentPanel;
} else {
centerPanel.add(homePanel);
previousPanel = homePanel;
}
bindWindow(mainPanelLayout);
mainPanelLayout.forceLayout();
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(MenuSwitchEvent.TYPE,
new MenuSwitchEvent.MenuSwitchEventHandler() {
@ -183,19 +189,16 @@ public class DataMinerManager implements EntryPoint {
}
}
/**
*
* @param event
*/
private void menuSwitch(MenuSwitchEvent event){
if(event==null||event.getMenuType()==null){
private void menuSwitch(MenuSwitchEvent event) {
if (event == null || event.getMenuType() == null) {
return;
}
switch(event.getMenuType()){
switch (event.getMenuType()) {
case COMPUTATIONS:
switchPanel(computationsPanel);
fireDataMinerWorkAreareRequestUpdate(DataMinerWorkAreaRegionType.Computations);
@ -212,19 +215,19 @@ public class DataMinerManager implements EntryPoint {
break;
default:
break;
}
}
private void fireDataMinerWorkAreareRequestUpdate(DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType) {
private void fireDataMinerWorkAreareRequestUpdate(
DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType) {
DataMinerWorkAreaRequestEvent event = new DataMinerWorkAreaRequestEvent(
DataMinerWorkAreaRequestEventType.UPDATE, dataMinerWorkAreaRegionType);
DataMinerWorkAreaRequestEventType.UPDATE,
dataMinerWorkAreaRegionType);
EventBusProvider.INSTANCE.fireEvent(event);
}
/**
*
* @param panel
@ -236,8 +239,4 @@ public class DataMinerManager implements EntryPoint {
previousPanel = panel;
}
}

View File

@ -56,6 +56,7 @@ public class DataMinerManagerController {
private DataMinerWorkArea dataMinerWorkArea;
private List<OperatorsClassification> operatorsClassifications;
private MenuType currentVisualization;
private String operatorId;
public DataMinerManagerController() {
init();
@ -68,9 +69,14 @@ public class DataMinerManagerController {
public DataMinerWorkArea getDataMinerWorkArea() {
return dataMinerWorkArea;
}
public String getOperatorId(){
return operatorId;
}
private void init() {
currentVisualization = MenuType.HOME;
restoreUISession();
bind();
callHello();
checkSession();
@ -256,6 +262,14 @@ public class DataMinerManagerController {
}
private void restoreUISession() {
// checkLocale();
operatorId = com.google.gwt.user.client.Window.Location
.getParameter(Constants.DATA_MINER_OPERATOR_ID);
}
private void callHello() {
DataMinerPortletServiceAsync.INSTANCE
@ -521,8 +535,15 @@ public class DataMinerManagerController {
break;
}
}
OperatorsClassificationEvent ocEvent = new OperatorsClassificationEvent(
OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){
ocEvent = new OperatorsClassificationEvent(
find, operatorId);
} else {
ocEvent = new OperatorsClassificationEvent(
find);
}
EventBusProvider.INSTANCE.fireEvent(ocEvent);
}
@ -544,8 +565,15 @@ public class DataMinerManagerController {
}
}
}
OperatorsClassificationEvent ocEvent = new OperatorsClassificationEvent(
OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){
ocEvent = new OperatorsClassificationEvent(
event.getClassificationName(), find, operatorId);
} else {
ocEvent = new OperatorsClassificationEvent(
event.getClassificationName(), find);
}
EventBusProvider.INSTANCE.fireEvent(ocEvent);
}

View File

@ -117,6 +117,54 @@ public class Header extends HorizontalPanel {
menuComputations.setVisible(false);
}
public void setMenu(MenuType menuType){
Log.debug("SetMenu: " + menuType);
if (menuType.compareTo(MenuType.HOME) == 0) {
menuGoBack.setVisible(false);
menuDataSpace.setVisible(false);
menuExperiment.setVisible(false);
menuComputations.setVisible(false);
if (currentSelection != null
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
menuExperiment.removeStyleName("menuItemImage-selected");
else if (currentSelection != null
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
menuDataSpace.removeStyleName("menuItemImage-selected");
else if (currentSelection != null
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
menuComputations.removeStyleName("menuItemImage-selected");
} else {
if (currentSelection == null
|| (currentSelection != null && currentSelection
.compareTo(MenuType.HOME) == 0)) {
menuGoBack.setVisible(true);
menuDataSpace.setVisible(true);
menuExperiment.setVisible(true);
menuComputations.setVisible(true);
}
if (currentSelection != null
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
menuExperiment.removeStyleName("menuItemImage-selected");
else if (currentSelection != null
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
menuDataSpace.removeStyleName("menuItemImage-selected");
else if (currentSelection != null
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
menuComputations.removeStyleName("menuItemImage-selected");
Image imgNew = (menuType.compareTo(MenuType.DATA_SPACE) == 0 ? menuDataSpace
: (menuType.compareTo(MenuType.EXPERIMENT) == 0 ? menuExperiment
: menuComputations));
imgNew.addStyleName("menuItemImage-selected");
}
currentSelection = menuType;
return;
}
/**
* @param inputSpace
*/

View File

@ -16,7 +16,7 @@ import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class Operator implements Serializable {
public class Operator implements Serializable, Comparable<Operator> {
private static final long serialVersionUID = -4084498655645951188L;
private String id;
@ -231,4 +231,9 @@ public class Operator implements Serializable {
+ operatorParameters + ", hasImage=" + hasImage + "]";
}
@Override
public int compareTo(Operator o) {
return id.compareTo(o.getId());
}
}

View File

@ -13,7 +13,7 @@ import java.util.List;
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OperatorCategory implements Serializable {
public class OperatorCategory implements Serializable, Comparable<OperatorCategory> {
private static final long serialVersionUID = 7511425996378626337L;
private String id;
@ -215,6 +215,11 @@ public class OperatorCategory implements Serializable {
+ description + ", operators=" + operators + ", hasImage="
+ hasImage + "]";
}
@Override
public int compareTo(OperatorCategory o) {
return id.compareTo(o.getId());
}

View File

@ -24,28 +24,45 @@ public class OperatorsClassificationEvent
private OperatorsClassificationRequestType operatorsClassificationRequestType;
private String classificationName;
private OperatorsClassification operatorsClassification;
public interface OperatorsClassificationEventHandler extends
EventHandler {
private String operatorId;
public interface OperatorsClassificationEventHandler extends EventHandler {
void onOperatorsClassification(OperatorsClassificationEvent event);
}
public interface HasOperatorsClassificationEventHandler extends
HasHandlers {
public interface HasOperatorsClassificationEventHandler extends HasHandlers {
public HandlerRegistration addOperatorsClassificationEventHandler(
OperatorsClassificationEventHandler handler);
}
public OperatorsClassificationEvent(OperatorsClassification operatorsClassification) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
this.operatorsClassification=operatorsClassification;
}
public OperatorsClassificationEvent(
String classificationName, OperatorsClassification operatorsClassification) {
OperatorsClassification operatorsClassification) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
this.operatorsClassification = operatorsClassification;
this.operatorId = null;
}
public OperatorsClassificationEvent(String classificationName,
OperatorsClassification operatorsClassification) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName=classificationName;
this.operatorsClassification=operatorsClassification;
this.classificationName = classificationName;
this.operatorsClassification = operatorsClassification;
this.operatorId = null;
}
public OperatorsClassificationEvent(
OperatorsClassification operatorsClassification, String operatorId) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
this.operatorsClassification = operatorsClassification;
this.operatorId = operatorId;
}
public OperatorsClassificationEvent(String classificationName,
OperatorsClassification operatorsClassification, String operatorId) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName;
this.operatorsClassification = operatorsClassification;
this.operatorId = operatorId;
}
@Override
@ -79,6 +96,10 @@ public class OperatorsClassificationEvent
return operatorsClassification;
}
public String getOperatorId() {
return operatorId;
}
@Override
public String toString() {
return "OperatorsClassificationEvent [operatorsClassificationRequestType="
@ -86,11 +107,7 @@ public class OperatorsClassificationEvent
+ ", classificationName="
+ classificationName
+ ", operatorsClassification="
+ operatorsClassification + "]";
+ operatorsClassification + ", operatorId=" + operatorId + "]";
}
}

View File

@ -22,7 +22,8 @@ public class OperatorsClassificationRequestEvent
public static Type<OperatorsClassificationRequestEventHandler> TYPE = new Type<OperatorsClassificationRequestEventHandler>();
private OperatorsClassificationRequestType operatorsClassificationRequestType;
private String classificationName;
private boolean operatorId;
public interface OperatorsClassificationRequestEventHandler extends
EventHandler {
void onRequest(OperatorsClassificationRequestEvent event);
@ -34,16 +35,24 @@ public class OperatorsClassificationRequestEvent
OperatorsClassificationRequestEventHandler handler);
}
public OperatorsClassificationRequestEvent() {
/*public OperatorsClassificationRequestEvent() {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
}
public OperatorsClassificationRequestEvent(
String classificationName) {
this.operatorId = false;
}*/
public OperatorsClassificationRequestEvent(String classificationName,
boolean operatorId) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName=classificationName;
this.classificationName = classificationName;
this.operatorId = operatorId;
}
/*public OperatorsClassificationRequestEvent(String classificationName) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName;
this.operatorId = false;
}*/
@Override
protected void dispatch(OperatorsClassificationRequestEventHandler handler) {
handler.onRequest(this);
@ -71,14 +80,16 @@ public class OperatorsClassificationRequestEvent
return classificationName;
}
public boolean isOperatorId() {
return operatorId;
}
@Override
public String toString() {
return "OperatorsClassificationRequestEvent [operatorsClassificationRequestType="
+ operatorsClassificationRequestType
+ ", classificationName="
+ classificationName + "]";
+ classificationName + ", operatorId=" + operatorId + "]";
}
}

View File

@ -19,6 +19,7 @@ import org.gcube.portlets.user.dataminermanager.client.parametersfield.OperatorF
import org.gcube.portlets.user.dataminermanager.client.parametersfield.TabularFld;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminermanager.shared.Constants;
import org.gcube.portlets.user.dataminermanager.shared.exception.SessionExpiredServiceException;
import org.gcube.portlets.user.dataminermanager.shared.parameters.ColumnListParameter;
import org.gcube.portlets.user.dataminermanager.shared.parameters.ColumnParameter;
@ -28,6 +29,7 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Image;
import com.sencha.gxt.core.client.util.Margins;
@ -98,8 +100,18 @@ public class ComputationParametersPanel extends SimpleContainer {
img.setStylePrimaryName("workflow-icon");// -15
v.add(img, new VerticalLayoutData(-1, -1, new Margins(-15, 0, 0, 5)));
HtmlLayoutContainer title = new HtmlLayoutContainer("<span>"
+ operator.getName() + "</span>");
String locationRef = "";
try {
String location = Location.getHref();
String[] locationData = location.split("\\?");
locationRef=locationData[0];
} catch (Throwable e) {
Log.error("Error retrieving location: "+e.getLocalizedMessage());
}
HtmlLayoutContainer title = new HtmlLayoutContainer("<span><a href='"
+ locationRef + "?" + Constants.DATA_MINER_OPERATOR_ID + "="
+ operator.getId() + "'>" + operator.getName() + "</a></span>");
title.addStyleName("workflow-title");
v.add(title, new VerticalLayoutData(-1, -1, new Margins(20, 0, 0, -25)));
@ -107,8 +119,8 @@ public class ComputationParametersPanel extends SimpleContainer {
descr = (descr == null || descr.contentEquals("")) ? "no-description"
: operator.getDescription();// display:block;clear:both;'
HtmlLayoutContainer description = new HtmlLayoutContainer(
"<span style='padding-left:10px;padding-right:10px;display:inline-block;'>" + descr
+ "</span>");
"<span style='padding-left:10px;padding-right:10px;display:inline-block;'>"
+ descr + "</span>");
description.addStyleName("workflow-description");
v.add(description, new VerticalLayoutData(-1, -1, new Margins(0)));
@ -282,7 +294,7 @@ public class ComputationParametersPanel extends SimpleContainer {
} catch (Throwable e) {
Log.error("Error in show form:" + e.getLocalizedMessage());
Log.error("Error: "+Arrays.asList(e.getStackTrace()).toString());
Log.error("Error: " + Arrays.asList(e.getStackTrace()).toString());
e.printStackTrace();
}
}

View File

@ -47,6 +47,14 @@ public class OperatorCategoryPanel extends SimpleContainer {
create();
}
public OperatorCategory getCategory() {
return category;
}
private void create(){
v=new VerticalLayoutContainer();
add(v);
@ -149,4 +157,21 @@ public class OperatorCategoryPanel extends SimpleContainer {
isCollapsed = false;
forceLayout();
}
public void setDefaultOperator(){
expand();
}
public void setOperatorDefault(Operator operatorDefault) {
expand();
for(OperatorPanel opPanel:operatorPanelsList){
if(opPanel.getOperator().compareTo(operatorDefault)==0){
opPanel.setAsTheDefaultOperator();
break;
}
}
}
}

View File

@ -127,4 +127,9 @@ public class OperatorPanel extends SimpleContainer {
this.removeStyleName("operatorPanel-selected");
// titleHtml.removeStyleName("operatorPanel-title-selected");
}
public void setAsTheDefaultOperator(){
handler.addOperator(OperatorPanel.this, operator);
}
}

View File

@ -70,6 +70,7 @@ public class OperatorsPanel extends FramedPanel {
private View view = null;
private String currentClassificationName = Constants.UserClassificationName;
/**
*
*/
@ -118,8 +119,56 @@ public class OperatorsPanel extends FramedPanel {
operators.clear();
operators.addAll(event.getOperatorsClassification()
.getOperators());
String operatorId = event.getOperatorId();
Log.debug("ShowCategoriesList");
List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels
.get(currentClassificationName);
if (categoryPanels == null) {
categoryPanels = new ArrayList<OperatorCategoryPanel>();
if (operatorsClassification != null) {
for (OperatorCategory cat : operatorsClassification
.getOperatorCategories()) {
categoryPanels.add(new OperatorCategoryPanel(
handler, cat));
}
}
mapCategoriesPanels.put(currentClassificationName,
categoryPanels);
}
v.clear();
for (OperatorCategoryPanel panel : categoryPanels){
v.add(panel);
}
view = View.CATEGORIES;
if(operatorId!=null&&!operatorId.isEmpty()){
OperatorCategory operatorCategoryDefault=null;
Operator operatorDefault=null;
for(Operator op:operators){
if(op.getId().compareTo(operatorId)==0){
operatorDefault=op;
operatorCategoryDefault=op.getCategory();
break;
}
}
if(operatorCategoryDefault!=null){
for (OperatorCategoryPanel opCategoryPanel : categoryPanels){
if(opCategoryPanel.getCategory().compareTo(operatorCategoryDefault)==0){
opCategoryPanel.setOperatorDefault(operatorDefault);
break;
}
}
}
}
forceLayout();
}
showCategoriesList(false);
}
}
@ -137,29 +186,10 @@ public class OperatorsPanel extends FramedPanel {
add(topV);
waitMessage(true);
OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent(
currentClassificationName);
Log.debug("OperatorsPanel fire: "+operatorsClassificationRequestEvent);
currentClassificationName, true);
Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent);
EventBusProvider.INSTANCE
.fireEvent(operatorsClassificationRequestEvent);
/*
* // if the operators classification is not loaded, let's load by an
* rpc if (DataMinerManager.getOperatorsClassifications() == null) {
*
* DataMinerPortletServiceAsync.INSTANCE
* .getOperatorsClassifications(new
* AsyncCallback<List<OperatorsClassification>>() {
*
* @Override public void onSuccess( List<OperatorsClassification>
* result) { waitMessage(false);
*
* DataMinerManager .setOperatorsClassifications(result);
* showCategoriesList(false); }
*
* @Override public void onFailure(Throwable caught) {
* waitMessage(false); UtilsGXT3.alert("Error", ERROR_GET_OPERATORS); }
* }); } else showCategoriesList(false);
*/
}
/**
@ -263,7 +293,6 @@ public class OperatorsPanel extends FramedPanel {
return;
}
private void waitMessage(boolean show) {
if (show)
this.mask(LOADING_MESSAGE);

View File

@ -14,7 +14,7 @@ public class Constants {
public static final String DATA_MINER_MANAGER_ID = "DataMinerManagerId";
public static final String DATA_MINER_LANG_COOKIE = "DataMinerLangCookie";
public static final String DATA_MINER_LANG = "DataMinerLang";
public static final String DATA_MINER_ALGORITHM_ID = "AlgorirthmId";
public static final String DATA_MINER_OPERATOR_ID = "OperatorId";
public static final String DEFAULT_USER = "giancarlo.panichi";