From cf49f22d33f14868191e5c5bd74c04026939307c Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 13 Jul 2016 09:07:49 +0000 Subject: [PATCH] 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 --- .../client/DataMinerManager.java | 69 +++++++++-------- .../client/DataMinerManagerController.java | 32 +++++++- .../user/dataminermanager/client/Header.java | 48 ++++++++++++ .../client/bean/Operator.java | 7 +- .../client/bean/OperatorCategory.java | 7 +- .../events/OperatorsClassificationEvent.java | 53 ++++++++----- .../OperatorsClassificationRequestEvent.java | 31 +++++--- .../ComputationParametersPanel.java | 22 ++++-- .../experiments/OperatorCategoryPanel.java | 25 +++++++ .../client/experiments/OperatorPanel.java | 5 ++ .../client/experiments/OperatorsPanel.java | 75 +++++++++++++------ .../dataminermanager/shared/Constants.java | 2 +- 12 files changed, 280 insertions(+), 96 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManager.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManager.java index f986c18..ea7fbae 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManager.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManager.java @@ -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 onModuleLoad(). */ 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; } - - - - } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java index 1eda14b..8237927 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java @@ -56,6 +56,7 @@ public class DataMinerManagerController { private DataMinerWorkArea dataMinerWorkArea; private List 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); } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/Header.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/Header.java index 86bc868..9d2d4be 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/Header.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/Header.java @@ -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 */ diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/Operator.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/Operator.java index 1b71b9b..50e72ef 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/Operator.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/Operator.java @@ -16,7 +16,7 @@ import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter; * email: g.panichi@isti.cnr.it * */ -public class Operator implements Serializable { +public class Operator implements Serializable, Comparable { 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()); + } + } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/OperatorCategory.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/OperatorCategory.java index cd3ba68..bcb1896 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/OperatorCategory.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/bean/OperatorCategory.java @@ -13,7 +13,7 @@ import java.util.List; * email: g.panichi@isti.cnr.it * */ -public class OperatorCategory implements Serializable { +public class OperatorCategory implements Serializable, Comparable { 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()); + } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java index 54c3b09..0335fe5 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java @@ -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 + "]"; } - - - - } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java index 60114db..558570d 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java @@ -22,7 +22,8 @@ public class OperatorsClassificationRequestEvent public static Type TYPE = new Type(); 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 + "]"; } - - } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationParametersPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationParametersPanel.java index f3eee5f..50fa86c 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationParametersPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationParametersPanel.java @@ -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("" - + operator.getName() + ""); + 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("" + operator.getName() + ""); 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( - "" + descr - + ""); + "" + + descr + ""); 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(); } } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorCategoryPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorCategoryPanel.java index 44161ad..0a4aace 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorCategoryPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorCategoryPanel.java @@ -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; + } + } + + } } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorPanel.java index e35ccfc..9b146f5 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorPanel.java @@ -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); + } + } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java index 3ac4db1..f6fa5ef 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java @@ -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 categoryPanels = mapCategoriesPanels + .get(currentClassificationName); + if (categoryPanels == null) { + categoryPanels = new ArrayList(); + 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>() { - * - * @Override public void onSuccess( List - * 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); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java b/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java index da98290..cf95bfe 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java @@ -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";