1452: Implement a GUI for StatMan Algorithms Importer

Task-Url: https://support.d4science.org/issues/1452

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@120463 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-11-27 18:03:06 +00:00
parent 19bd0eb7b9
commit 65b1c0f9aa
26 changed files with 858 additions and 128 deletions

11
pom.xml
View File

@ -212,10 +212,13 @@
<artifactId>juniversalchardet</artifactId>
<version>1.0.3</version>
</dependency>
<!-- Common Encryption <dependency> <groupId>org.gcube.core</groupId> <artifactId>common-encryption</artifactId>
<scope>provided</scope> </dependency> -->
<!-- AceGWT Widget -->
<dependency>
<groupId>org.gcube.portlets.widget</groupId>
<artifactId>acegwt-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- LOGGING -->
<dependency>

View File

@ -5,6 +5,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.Sta
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.ribbon.StatAlgoImporterRibbon;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterService;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.ToolsPanel;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
@ -19,7 +20,7 @@ import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderL
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.Viewport;
/**
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
@ -27,12 +28,12 @@ import com.sencha.gxt.widget.core.client.container.Viewport;
*/
public class StatAlgoImporter implements EntryPoint {
private static final String JSP_TAG_ID = "StatisticalRunnerPortlet";
private static final String JSP_TAG_ID = "StatAlgoImporterPortlet";
private static final int RIBBON_HEIGHT = 120;
@SuppressWarnings("unused")
private final StatAlgoImporterServiceAsync statRunnerService = GWT
private final StatAlgoImporterServiceAsync statAlgoImporterService = GWT
.create(StatAlgoImporterService.class);
// Main Panel
@ -90,18 +91,20 @@ public class StatAlgoImporter implements EntryPoint {
mainPanelLayout.setNorthWidget(accountingManagerMenu.getContainer(),
ribbonData);
// Tools
/*
* CodeUploadPanel codeUploadPanel=new CodeUploadPanel(eventBus);
* BorderLayoutData westData = new BorderLayoutData(310);
* westData.setCollapsible(false); westData.setSplit(false);
* westData.setFloatable(false); westData.setCollapseMini(false);
* westData.setMargins(new Margins(2, 7, 2, 7));
* westData.setCollapseHidden(true); westData.setMaxSize(310);
* westData.setMinSize(310);
* mainPanelLayout.setWestWidget(codeUploadPanel, westData);
* codeUploadPanel.expand(); codeUploadPanel.enable();
*/
// Right
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
BorderLayoutData eastData = new BorderLayoutData(310);
eastData.setCollapsible(false);
eastData.setSplit(false);
eastData.setFloatable(false);
eastData.setCollapseMini(false);
eastData.setMargins(new Margins(2, 7, 2, 7));
eastData.setCollapseHidden(true);
// estData.setMaxSize(510);
// estData.setMinSize(310);
mainPanelLayout.setEastWidget(toolsPanel, eastData);
// codeUploadPanel.expand();
toolsPanel.enable();
bind(mainPanelLayout);
controller.setMainPanelLayout(mainPanelLayout);

View File

@ -3,11 +3,12 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
import java.util.Date;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ImportCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ShowCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.UIStateEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.StatAlgoImporterRibbonType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.UIStateType;
@ -194,13 +195,17 @@ public class StatAlgoImporterController {
}
switch(eventType){
case HELP:
case PROJECT_CREATE:
break;
case CREATE_ALGORITHM:
case PROJECT_OPEN:
break;
case UPLOAD_CODE:
case ALGORITHM_CREATE:
break;
case ALGORITHM_IMPORT:
showCodeUploadPanel();
break;
case HELP:
break;
default:
break;
@ -210,8 +215,9 @@ public class StatAlgoImporterController {
private void doImportCodeCommand(ImportCodeEvent event) {
ImportCodeDescription importCodeDesc=event.getImportCodeDescription();
if(importCodeDesc!=null && importCodeDesc.getImportCodeType()!=null){
ShowCodeEvent showCodeEvent=new ShowCodeEvent(importCodeDesc);
eventBus.fireEvent(showCodeEvent);
ProjectStatusEvent projectStatusEvent= new ProjectStatusEvent(ProjectStatusEventType.UPDATE);
eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired");
}
}

View File

@ -0,0 +1,65 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
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;
/**
* Project Status Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ProjectStatusEvent extends
GwtEvent<ProjectStatusEvent.ProjectStatusEventHandler> {
public static Type<ProjectStatusEventHandler> TYPE = new Type<ProjectStatusEventHandler>();
private ProjectStatusEventType projectStatusEventType;
public interface ProjectStatusEventHandler extends EventHandler {
void onProjectStatus(ProjectStatusEvent event);
}
public interface HasProjectStatusEventHandler extends HasHandlers {
public HandlerRegistration addProjectStatusEventHandler(
ProjectStatusEventHandler handler);
}
public ProjectStatusEvent(ProjectStatusEventType projectStatusEventType) {
this.projectStatusEventType = projectStatusEventType;
}
@Override
protected void dispatch(ProjectStatusEventHandler handler) {
handler.onProjectStatus(this);
}
@Override
public Type<ProjectStatusEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ProjectStatusEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ProjectStatusEvent projectStatusEvent) {
source.fireEvent(projectStatusEvent);
}
public ProjectStatusEventType getProjectStatusEventType() {
return projectStatusEventType;
}
@Override
public String toString() {
return "ProjectStatusEvent [projectStatusEventType="
+ projectStatusEventType + "]";
}
}

View File

@ -0,0 +1,105 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
import java.util.ArrayList;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorMode;
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorTheme;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class CodeEditPanel extends ContentPanel {
private EventBus eventBus;
private AceEditor editor;
public CodeEditPanel(EventBus eventBus) {
super();
Log.debug("CodeEditPanel");
this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
init();
create();
}
private void init() {
forceLayoutOnResize = true;
setBodyBorder(false);
setBorders(false);
setHeaderVisible(false);
setResize(true);
}
private void create() {
editor = new AceEditor();
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(editor, new VerticalLayoutData(1, 1));
add(v);
editor.startEditor();
loadCode();
}
private void loadCode() {
StatAlgoImporterServiceAsync.INSTANCE
.getCode(new AsyncCallback<ArrayList<CodeData>>() {
public void onFailure(Throwable caught) {
if (caught instanceof StatAlgoImporterSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving code: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
caught.getLocalizedMessage());
}
caught.printStackTrace();
}
public void onSuccess(ArrayList<CodeData> result) {
Log.debug("loaded " + result.size() + " code lines");
String text = new String();
for (CodeData codeData : result) {
Log.debug("Read: " + codeData);
text+=codeData.getCodeLine()+"\r\n";
}
editor.setShowPrintMargin(false);
editor.setMode(AceEditorMode.R);
editor.setTheme(AceEditorTheme.ECLIPSE);
editor.setText(text);
forceLayout();
}
});
}
public void codeUpdate() {
loadCode();
}
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ShowCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
@ -17,7 +17,7 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
public class MainDataPanel extends SimpleContainer {
private EventBus eventBus;
private CodeViewerPanel codeViewPanel;
private CodeEditPanel codeEditPanel;
public MainDataPanel(EventBus eventBus) {
super();
@ -41,30 +41,29 @@ public class MainDataPanel extends SimpleContainer {
}
private void bindToEvents() {
eventBus.addHandler(ShowCodeEvent.TYPE,
new ShowCodeEvent.ShowCodeEventHandler() {
eventBus.addHandler(ProjectStatusEvent.TYPE,
new ProjectStatusEvent.ProjectStatusEventHandler() {
@Override
public void onShowCode(ShowCodeEvent event) {
Log.debug("Catch ShowCodeEvent");
doShowCodeCommand(event);
public void onProjectStatus(ProjectStatusEvent event) {
Log.debug("Catch ProjectStatusEvent");
doProjectStatusCommand(event);
}
});
}
private void doShowCodeCommand(ShowCodeEvent event) {
if (codeViewPanel == null) {
addCodeViewPanel();
private void doProjectStatusCommand(ProjectStatusEvent event) {
if (codeEditPanel == null) {
addCodeEditPanel();
} else {
codeViewPanel.gridReload();
codeEditPanel.codeUpdate();
}
}
private void addCodeViewPanel() {
codeViewPanel = new CodeViewerPanel(eventBus);
add(codeViewPanel, new MarginData(new Margins(0)));
private void addCodeEditPanel() {
codeEditPanel = new CodeEditPanel(eventBus);
add(codeEditPanel, new MarginData(new Margins(0)));
forceLayout();
}

View File

@ -50,5 +50,10 @@ public interface StatAlgoImporterResources extends ClientBundle {
@Source("algorithm_32.png")
ImageResource algorithm32();
@Source("project-create_32.png")
ImageResource projectCreate32();
@Source("project-open_32.png")
ImageResource projectOpen32();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -19,6 +19,7 @@ import com.sencha.gxt.cell.core.client.ButtonCell.ButtonArrowAlign;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.ButtonGroup;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -38,14 +39,16 @@ public class HomeToolBar {
private ToolBar toolBar;
//Home
private TextButton importButton;
private TextButton btnCreateProject;
private TextButton btnOpenProject;
//Algorithm
private TextButton createAlgorithmButton;
private TextButton btnImportAlgorithm;
private TextButton btnCreateAlgorithm;
// Help
private TextButton helpButton;
private TextButton btnHelp;
// private TextButton languageButton;
@ -73,35 +76,55 @@ public class HomeToolBar {
toolBar.setSpacing(5);
toolBar.setEnableOverflow(false);
// Home
ButtonGroup homeGroup = new ButtonGroup();
homeGroup.setId("Home");
homeGroup.setHeadingText(msgs.fileGroupHeadingText());
homeGroup.setHeight(GROUP_HEIGHT);
toolBar.add(homeGroup);
// Project
ButtonGroup projectGroup = new ButtonGroup();
projectGroup.setId("Project");
projectGroup.setHeadingText(msgs.projectGroupHeadingText());
projectGroup.setHeight(GROUP_HEIGHT);
toolBar.add(projectGroup);
FlexTable homeLayout = new FlexTable();
homeGroup.add(homeLayout);
importButton = new TextButton(msgs.importButton(),
StatAlgoImporterResources.INSTANCE.upload32());
importButton.setId("importButton");
importButton.setScale(ButtonScale.MEDIUM);
importButton.setIconAlign(IconAlign.LEFT);
importButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
importButton.setToolTip(msgs.importButtonToolTip());
importButton.addSelectHandler(new SelectHandler() {
projectGroup.add(homeLayout);
btnCreateProject = new TextButton(msgs.btnCreateProject(),
StatAlgoImporterResources.INSTANCE.projectCreate32());
btnCreateProject.setId("btnCreateProject");
btnCreateProject.setScale(ButtonScale.MEDIUM);
btnCreateProject.setIconAlign(IconAlign.LEFT);
btnCreateProject.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnCreateProject.setToolTip(msgs.btnCreateProjectToolTip());
btnCreateProject.getElement().setMargins(new Margins(0, 4, 0, 0));
btnCreateProject.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new StatAlgoImporterRibbonEvent(
StatAlgoImporterRibbonType.UPLOAD_CODE));
StatAlgoImporterRibbonType.ALGORITHM_IMPORT));
}
});
homeLayout.setWidget(0, 0, btnCreateProject);
homeLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
btnOpenProject = new TextButton(msgs.btnOpenProject(),
StatAlgoImporterResources.INSTANCE.projectOpen32());
btnOpenProject.setId("btnOpenProject");
btnOpenProject.setScale(ButtonScale.MEDIUM);
btnOpenProject.setIconAlign(IconAlign.LEFT);
btnOpenProject.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnOpenProject.setToolTip(msgs.btnOpenProjectToolTip());
btnOpenProject.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new StatAlgoImporterRibbonEvent(
StatAlgoImporterRibbonType.ALGORITHM_IMPORT));
}
});
homeLayout.setWidget(0, 0, importButton);
homeLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
homeLayout.setWidget(0, 1, btnOpenProject);
homeLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
// Algorithm
ButtonGroup algorithmGroup = new ButtonGroup();
algorithmGroup.setId("Algorithm");
@ -109,28 +132,48 @@ public class HomeToolBar {
algorithmGroup.setHeight(GROUP_HEIGHT);
toolBar.add(algorithmGroup);
FlexTable algorithmLayout = new FlexTable();
FlexTable algorithmLayout = new FlexTable();
algorithmGroup.add(algorithmLayout);
createAlgorithmButton = new TextButton(msgs.createAlgorithmButton(),
StatAlgoImporterResources.INSTANCE.algorithm32());
createAlgorithmButton.setId("createAlgorithmButton");
createAlgorithmButton.setScale(ButtonScale.MEDIUM);
createAlgorithmButton.setIconAlign(IconAlign.LEFT);
createAlgorithmButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
createAlgorithmButton.setToolTip(msgs.createAlgorithmButtonToolTip());
createAlgorithmButton.addSelectHandler(new SelectHandler() {
btnImportAlgorithm = new TextButton(msgs.importButton(),
StatAlgoImporterResources.INSTANCE.upload32());
btnImportAlgorithm.setId("importButton");
btnImportAlgorithm.setScale(ButtonScale.MEDIUM);
btnImportAlgorithm.setIconAlign(IconAlign.LEFT);
btnImportAlgorithm.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnImportAlgorithm.setToolTip(msgs.importButtonToolTip());
btnImportAlgorithm.getElement().setMargins(new Margins(0, 4, 0, 0));
btnImportAlgorithm.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new StatAlgoImporterRibbonEvent(
StatAlgoImporterRibbonType.CREATE_ALGORITHM));
StatAlgoImporterRibbonType.ALGORITHM_IMPORT));
}
});
algorithmLayout.setWidget(0, 0, createAlgorithmButton);
algorithmLayout.setWidget(0, 0, btnImportAlgorithm);
algorithmLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
btnCreateAlgorithm = new TextButton(msgs.createAlgorithmButton(),
StatAlgoImporterResources.INSTANCE.algorithm32());
btnCreateAlgorithm.setId("createAlgorithmButton");
btnCreateAlgorithm.setScale(ButtonScale.MEDIUM);
btnCreateAlgorithm.setIconAlign(IconAlign.LEFT);
btnCreateAlgorithm.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnCreateAlgorithm.setToolTip(msgs.createAlgorithmButtonToolTip());
btnCreateAlgorithm.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new StatAlgoImporterRibbonEvent(
StatAlgoImporterRibbonType.ALGORITHM_CREATE));
}
});
algorithmLayout.setWidget(0, 1, btnCreateAlgorithm);
algorithmLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
// Help
ButtonGroup helpGroup = new ButtonGroup();
helpGroup.setId("Help");
@ -154,14 +197,14 @@ public class HomeToolBar {
* helpLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
*/
helpButton = new TextButton(msgs.helpButton(),
btnHelp = new TextButton(msgs.helpButton(),
StatAlgoImporterResources.INSTANCE.help32());
helpButton.enable();
helpButton.setToolTip(msgs.helpButtonToolTip());
helpButton.setScale(ButtonScale.MEDIUM);
helpButton.setIconAlign(IconAlign.LEFT);
helpButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
helpButton.addSelectHandler(new SelectHandler() {
btnHelp.enable();
btnHelp.setToolTip(msgs.helpButtonToolTip());
btnHelp.setScale(ButtonScale.MEDIUM);
btnHelp.setIconAlign(IconAlign.LEFT);
btnHelp.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnHelp.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new StatAlgoImporterRibbonEvent(
@ -169,7 +212,7 @@ public class HomeToolBar {
}
});
helpLayout.setWidget(0, 1, helpButton);
helpLayout.setWidget(0, 1, btnHelp);
helpLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
/*
@ -265,9 +308,9 @@ public class HomeToolBar {
try {
switch (uiStateType) {
case START:
importButton.enable();
createAlgorithmButton.enable();
helpButton.enable();
btnImportAlgorithm.enable();
btnCreateAlgorithm.enable();
btnHelp.enable();
// testButton.disable();
break;

View File

@ -10,38 +10,6 @@ import com.google.gwt.i18n.client.Messages;
*
*/
public interface HomeToolBarMessages extends Messages {
//
@DefaultMessage("Code")
String fileGroupHeadingText();
@DefaultMessage("Import")
String importButton();
@DefaultMessage("Import Code")
String importButtonToolTip();
//
@DefaultMessage("Help")
String helpGroupHeadingText();
@DefaultMessage("Help")
String helpButton();
@DefaultMessage("Help")
String helpButtonToolTip();
//
@DefaultMessage("Algorithm")
String algorithmGroupHeadingText();
@DefaultMessage("Create")
String createAlgorithmButton();
@DefaultMessage("Create Algorithm")
String createAlgorithmButtonToolTip();
//
@DefaultMessage("Language")
@ -59,5 +27,49 @@ public interface HomeToolBarMessages extends Messages {
@DefaultMessage("Spanish")
String spanish();
//
@DefaultMessage("Project")
String projectGroupHeadingText();
@DefaultMessage("Create")
String btnCreateProject();
@DefaultMessage("Create Project")
String btnCreateProjectToolTip();
@DefaultMessage("Open")
String btnOpenProject();
@DefaultMessage("Open Project")
String btnOpenProjectToolTip();
//
@DefaultMessage("Algorithm")
String algorithmGroupHeadingText();
@DefaultMessage("Import")
String importButton();
@DefaultMessage("Import algorithm")
String importButtonToolTip();
@DefaultMessage("Create")
String createAlgorithmButton();
@DefaultMessage("Create algorithm for Statistical Manager")
String createAlgorithmButtonToolTip();
//
@DefaultMessage("Help")
String helpGroupHeadingText();
@DefaultMessage("Help")
String helpButton();
@DefaultMessage("Help")
String helpButtonToolTip();
}

View File

@ -0,0 +1,43 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExplorerProjectPanel extends ContentPanel {
//private EventBus eventBus;
public ExplorerProjectPanel(EventBus eventBus) {
super();
Log.debug("ExplorerProjectPanel");
//this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
init();
create();
}
private void init() {
forceLayoutOnResize = true;
setBodyBorder(false);
setBorders(false);
setHeaderVisible(false);
setResize(true);
}
private void create() {
}
}

View File

@ -0,0 +1,82 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input.InputVariablePanel;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.core.client.util.Margins;
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.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ToolsPanel extends SimpleContainer {
private EventBus eventBus;
private InputVariablePanel inputVariablePanel;
private ExplorerProjectPanel explorerProjectPanel;
private boolean first = true;
public ToolsPanel(EventBus eventBus) {
super();
this.eventBus = eventBus;
init();
create();
bindToEvents();
}
protected void init() {
forceLayoutOnResize = true;
// setBodyBorder(false);
setBorders(false);
// setHeaderVisible(false);
}
protected void create() {
}
private void bindToEvents() {
eventBus.addHandler(ProjectStatusEvent.TYPE,
new ProjectStatusEvent.ProjectStatusEventHandler() {
@Override
public void onProjectStatus(ProjectStatusEvent event) {
Log.debug("Catch ShowCodeEvent");
doProjectStatusCommand(event);
}
});
}
private void doProjectStatusCommand(ProjectStatusEvent event) {
if (first) {
first = false;
addPanel();
} else {
}
}
private void addPanel() {
VerticalLayoutContainer v = new VerticalLayoutContainer();
inputVariablePanel = new InputVariablePanel(eventBus);
explorerProjectPanel = new ExplorerProjectPanel(eventBus);
v.add(inputVariablePanel, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(explorerProjectPanel, new VerticalLayoutData(1, -1,
new Margins(0)));
add(v, new MarginData(new Margins(0)));
forceLayout();
}
}

View File

@ -0,0 +1,47 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class EnvironmentVariablesPanel extends ContentPanel {
private EventBus eventBus;
public EnvironmentVariablesPanel(EventBus eventBus) {
super();
Log.debug("EnvironmentVariablesPanel");
this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
init();
create();
}
private void init() {
forceLayoutOnResize = true;
setBodyBorder(false);
setBorders(false);
setHeaderVisible(false);
setResize(true);
}
private void create() {
}
public void update(){
}
}

View File

@ -0,0 +1,22 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface InputVariableMessages extends Messages {
//
@DefaultMessage("Selected Rows")
String selectedRowsItem();
@DefaultMessage("Enviroment Variables")
String environmentVariables();
}

View File

@ -0,0 +1,116 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.UIStateEvent;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class InputVariablePanel extends ContentPanel {
private EventBus eventBus;
private InputVariableTabPanel inputVariableTabPanel;
private InputVariablePanelState state;
public InputVariablePanel(EventBus eventBus) {
super();
Log.debug("Open InputVariablePanel");
this.eventBus = eventBus;
setId("InputVariablePanel");
setHeaderVisible(false);
setResize(true);
setBodyBorder(false);
setBorders(false);
forceLayoutOnResize = true;
inputVariableTabPanel = new InputVariableTabPanel(eventBus, this);
add(inputVariableTabPanel);
startPanel();
bindToEvents();
}
protected void bindToEvents() {
eventBus.addHandler(UIStateEvent.TYPE,
new UIStateEvent.UIStateHandler() {
public void onUIState(UIStateEvent event) {
manageUIStateEvents(event);
}
});
eventBus.addHandler(ProjectStatusEvent.TYPE,
new ProjectStatusEvent.ProjectStatusEventHandler() {
@Override
public void onProjectStatus(ProjectStatusEvent event) {
manageProjectStatusEvents(event);
}
});
}
protected void manageUIStateEvents(UIStateEvent event) {
Log.debug("InputVariablePanel recieved event from UI: "
+ event.toString());
switch (event.getUiStateType()) {
case START:
break;
case WAITING:
break;
default:
break;
}
}
protected void manageProjectStatusEvents(ProjectStatusEvent event) {
Log.debug("InputVariablePanel recieved event ProjectStatus: "
+ event.toString());
switch (event.getProjectStatusEventType()) {
case OPEN:
startPanel();
break;
case UPDATE:
updatePanel();
break;
default:
break;
}
}
/*
private void closePanelOnly() {
collapse();
disable();
state = InputVariablePanelState.CLOSED;
}*/
private void startPanel() {
enable();
expand();
state = InputVariablePanelState.OPENED;
inputVariableTabPanel.startTabs();
}
private void updatePanel() {
if (state == InputVariablePanelState.OPENED) {
inputVariableTabPanel.updateTabs();
Log.debug("ToolBoxPanel Updated");
}
}
}

View File

@ -0,0 +1,12 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum InputVariablePanelState {
CLOSED,
OPENED;
}

View File

@ -0,0 +1,100 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel;
//import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class InputVariableTabPanel extends TabPanel {
private InputVariableMessages msgs;
private EventBus eventBus;
private EnvironmentVariablesPanel enviromentVariablesPanel;
private SelectedRowsPanel selectedRowsPanel;
public InputVariableTabPanel(EventBus eventBus,
InputVariablePanel toolBoxPanel) {
super();
Log.debug("Create InpuntVariableTabPanel");
this.eventBus = eventBus;
this.msgs = GWT.create(InputVariableMessages.class);
setId("InputVariableTabPanel");
setBodyBorder(false);
setBorders(false);
setAnimScroll(true);
setTabScroll(true);
setCloseContextMenu(true);
}
public void startTabs() {
Log.debug("Start InputVariable Tabs");
addEnvironmentVariablesPanel();
addSelectedRowsPanel();
setActiveWidget(getWidget(0));
}
/*
* public void openEnviromentVariablesPanel() {
* Log.debug("Open EnviromentVariablesPanel Tab"); if
* (enviromentVariablesPanel == null) { addChangeColumnTypePanel(trId,
* columnName); } else { enviromentVariablesPanel.update(); }
* setActiveWidget(changeColumnTypePanel);
*
* }
*/
// Close
/*
* public void closePropertiesTabs() { Log.debug("Close Properties Tab"); if
* (trProperties != null) { remove(trProperties); trProperties = null; }
*
* }
*/
//
public void updateTabs() {
try {
enviromentVariablesPanel.update();
selectedRowsPanel.update();
forceLayout();
} catch (Throwable e) {
Log.error("Error in InputVariableTabPanel: "
+ e.getLocalizedMessage());
e.printStackTrace();
}
}
// Add
private void addSelectedRowsPanel() {
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
msgs.selectedRowsItem(), false);
selectedRowsPanel = new SelectedRowsPanel(eventBus);
selectedRowsPanel.setHeaderVisible(false);
add(selectedRowsPanel, selectedRowsPanelItemConf);
}
private void addEnvironmentVariablesPanel() {
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
msgs.environmentVariables(), false);
enviromentVariablesPanel = new EnvironmentVariablesPanel(eventBus);
enviromentVariablesPanel.setHeaderVisible(false);
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
}
}

View File

@ -0,0 +1,47 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class SelectedRowsPanel extends ContentPanel {
private EventBus eventBus;
public SelectedRowsPanel(EventBus eventBus) {
super();
Log.debug("SelectedRowsPanel");
this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
init();
create();
}
private void init() {
forceLayoutOnResize = true;
setBodyBorder(false);
setBorders(false);
setHeaderVisible(false);
setResize(true);
}
private void create() {
}
public void update(){
}
}

View File

@ -0,0 +1,12 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum ProjectStatusEventType {
OPEN,
UPDATE;
}

View File

@ -7,7 +7,9 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
*
*/
public enum StatAlgoImporterRibbonType {
UPLOAD_CODE,
CREATE_ALGORITHM,
PROJECT_CREATE,
PROJECT_OPEN,
ALGORITHM_IMPORT,
ALGORITHM_CREATE,
HELP;
}

View File

@ -18,10 +18,10 @@
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
<inherits name="com.google.gwt.resources.Resources" />
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
<inherits name='edu.ycp.cs.dh.acegwt.acegwt' />
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlets.user.statisticalalgorithmsimporter.client.StatAlgoImporter' />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -27,7 +27,9 @@
value="pretty" />
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
<inherits name='edu.ycp.cs.dh.acegwt.acegwt' />
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.user.statisticalalgorithmsimporter.client.StatAlgoImporter' />

View File

@ -22,6 +22,10 @@
<!-- -->
<link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" />
<link type="text/css" rel="stylesheet" href="StatAlgoImporter.css">
<script src="statalgoimporter/js/jquery-1.11.3.min.js"></script>
<script src="statalgoimporter/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="statalgoimporter/ace/theme-eclipse.js" type="text/javascript" charset="utf-8"></script>
<script src="statalgoimporter/ace/mode-r.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript"
src="statalgoimporter/statalgoimporter.nocache.js"></script>