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

View File

@ -213,9 +213,12 @@
<version>1.0.3</version> <version>1.0.3</version>
</dependency> </dependency>
<!-- AceGWT Widget -->
<!-- Common Encryption <dependency> <groupId>org.gcube.core</groupId> <artifactId>common-encryption</artifactId> <dependency>
<scope>provided</scope> </dependency> --> <groupId>org.gcube.portlets.widget</groupId>
<artifactId>acegwt-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- LOGGING --> <!-- LOGGING -->
<dependency> <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.ribbon.StatAlgoImporterRibbon;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterService; 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.rpc.StatAlgoImporterServiceAsync;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.ToolsPanel;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
@ -27,12 +28,12 @@ import com.sencha.gxt.widget.core.client.container.Viewport;
*/ */
public class StatAlgoImporter implements EntryPoint { 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; private static final int RIBBON_HEIGHT = 120;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final StatAlgoImporterServiceAsync statRunnerService = GWT private final StatAlgoImporterServiceAsync statAlgoImporterService = GWT
.create(StatAlgoImporterService.class); .create(StatAlgoImporterService.class);
// Main Panel // Main Panel
@ -90,18 +91,20 @@ public class StatAlgoImporter implements EntryPoint {
mainPanelLayout.setNorthWidget(accountingManagerMenu.getContainer(), mainPanelLayout.setNorthWidget(accountingManagerMenu.getContainer(),
ribbonData); ribbonData);
// Tools // Right
/* ToolsPanel toolsPanel = new ToolsPanel(eventBus);
* CodeUploadPanel codeUploadPanel=new CodeUploadPanel(eventBus); BorderLayoutData eastData = new BorderLayoutData(310);
* BorderLayoutData westData = new BorderLayoutData(310); eastData.setCollapsible(false);
* westData.setCollapsible(false); westData.setSplit(false); eastData.setSplit(false);
* westData.setFloatable(false); westData.setCollapseMini(false); eastData.setFloatable(false);
* westData.setMargins(new Margins(2, 7, 2, 7)); eastData.setCollapseMini(false);
* westData.setCollapseHidden(true); westData.setMaxSize(310); eastData.setMargins(new Margins(2, 7, 2, 7));
* westData.setMinSize(310); eastData.setCollapseHidden(true);
* mainPanelLayout.setWestWidget(codeUploadPanel, westData); // estData.setMaxSize(510);
* codeUploadPanel.expand(); codeUploadPanel.enable(); // estData.setMinSize(310);
*/ mainPanelLayout.setEastWidget(toolsPanel, eastData);
// codeUploadPanel.expand();
toolsPanel.enable();
bind(mainPanelLayout); bind(mainPanelLayout);
controller.setMainPanelLayout(mainPanelLayout); controller.setMainPanelLayout(mainPanelLayout);

View File

@ -3,11 +3,12 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
import java.util.Date; import java.util.Date;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ImportCodeEvent; 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.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.StatAlgoImporterRibbonEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.UIStateEvent; 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.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.SessionExpiredType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.StatAlgoImporterRibbonType; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.StatAlgoImporterRibbonType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.UIStateType; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.UIStateType;
@ -194,13 +195,17 @@ public class StatAlgoImporterController {
} }
switch(eventType){ switch(eventType){
case HELP: case PROJECT_CREATE:
break; break;
case CREATE_ALGORITHM: case PROJECT_OPEN:
break; break;
case UPLOAD_CODE: case ALGORITHM_CREATE:
break;
case ALGORITHM_IMPORT:
showCodeUploadPanel(); showCodeUploadPanel();
break; break;
case HELP:
break;
default: default:
break; break;
@ -210,8 +215,9 @@ public class StatAlgoImporterController {
private void doImportCodeCommand(ImportCodeEvent event) { private void doImportCodeCommand(ImportCodeEvent event) {
ImportCodeDescription importCodeDesc=event.getImportCodeDescription(); ImportCodeDescription importCodeDesc=event.getImportCodeDescription();
if(importCodeDesc!=null && importCodeDesc.getImportCodeType()!=null){ if(importCodeDesc!=null && importCodeDesc.getImportCodeType()!=null){
ShowCodeEvent showCodeEvent=new ShowCodeEvent(importCodeDesc); ProjectStatusEvent projectStatusEvent= new ProjectStatusEvent(ProjectStatusEventType.UPDATE);
eventBus.fireEvent(showCodeEvent); 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; 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.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus; 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 { public class MainDataPanel extends SimpleContainer {
private EventBus eventBus; private EventBus eventBus;
private CodeViewerPanel codeViewPanel; private CodeEditPanel codeEditPanel;
public MainDataPanel(EventBus eventBus) { public MainDataPanel(EventBus eventBus) {
super(); super();
@ -41,30 +41,29 @@ public class MainDataPanel extends SimpleContainer {
} }
private void bindToEvents() { private void bindToEvents() {
eventBus.addHandler(ShowCodeEvent.TYPE, eventBus.addHandler(ProjectStatusEvent.TYPE,
new ShowCodeEvent.ShowCodeEventHandler() { new ProjectStatusEvent.ProjectStatusEventHandler() {
@Override @Override
public void onShowCode(ShowCodeEvent event) { public void onProjectStatus(ProjectStatusEvent event) {
Log.debug("Catch ShowCodeEvent"); Log.debug("Catch ProjectStatusEvent");
doShowCodeCommand(event); doProjectStatusCommand(event);
} }
}); });
} }
private void doShowCodeCommand(ShowCodeEvent event) { private void doProjectStatusCommand(ProjectStatusEvent event) {
if (codeViewPanel == null) { if (codeEditPanel == null) {
addCodeViewPanel(); addCodeEditPanel();
} else { } else {
codeViewPanel.gridReload(); codeEditPanel.codeUpdate();
} }
} }
private void addCodeViewPanel() { private void addCodeEditPanel() {
codeViewPanel = new CodeViewerPanel(eventBus); codeEditPanel = new CodeEditPanel(eventBus);
add(codeViewPanel, new MarginData(new Margins(0))); add(codeEditPanel, new MarginData(new Margins(0)));
forceLayout(); forceLayout();
} }

View File

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

View File

@ -11,38 +11,6 @@ import com.google.gwt.i18n.client.Messages;
*/ */
public interface HomeToolBarMessages extends 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") @DefaultMessage("Language")
String languageButton(); String languageButton();
@ -60,4 +28,48 @@ public interface HomeToolBarMessages extends Messages {
@DefaultMessage("Spanish") @DefaultMessage("Spanish")
String 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 { public enum StatAlgoImporterRibbonType {
UPLOAD_CODE, PROJECT_CREATE,
CREATE_ALGORITHM, PROJECT_OPEN,
ALGORITHM_IMPORT,
ALGORITHM_CREATE,
HELP; HELP;
} }

View File

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

View File

@ -22,6 +22,10 @@
<!-- --> <!-- -->
<link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" /> <link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" />
<link type="text/css" rel="stylesheet" href="StatAlgoImporter.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" <script type="text/javascript"
src="statalgoimporter/statalgoimporter.nocache.js"></script> src="statalgoimporter/statalgoimporter.nocache.js"></script>