Added HelpPanel

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-toolbox-widget@90705 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-01-29 17:18:53 +00:00 committed by Giancarlo Panichi
parent 3061820859
commit 419c8c2694
3 changed files with 159 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.td.toolboxwidget.client; package org.gcube.portlets.user.td.toolboxwidget.client;
import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties; import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties;
import org.gcube.portlets.user.td.toolboxwidget.client.help.HelpPanel;
//import org.gcube.portlets.user.td.taskswidget.client.TdTaskController; //import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -21,6 +22,7 @@ public class ToolBox extends TabPanel {
protected EventBus eventBus; protected EventBus eventBus;
protected TabularResourceProperties trProperties; protected TabularResourceProperties trProperties;
protected ToolBoxPanel toolBoxPanel; protected ToolBoxPanel toolBoxPanel;
protected HelpPanel helpPanel;
//protected TdTaskController tdTaskController; //protected TdTaskController tdTaskController;
//protected DialogBox tdTaskMainWindow; //protected DialogBox tdTaskMainWindow;
protected FramedPanel taskPanel; protected FramedPanel taskPanel;
@ -36,15 +38,18 @@ public class ToolBox extends TabPanel {
setTabScroll(true); setTabScroll(true);
setCloseContextMenu(true); setCloseContextMenu(true);
// setResizeTabs(true); // setResizeTabs(true);
} }
public void closeTabs() { public void closeTabs() {
Log.debug("Close ToolBox Tabs"); Log.debug("Close ToolBox Tabs");
remove(helpPanel);
helpPanel=null;
remove(trProperties); remove(trProperties);
trProperties=null; trProperties=null;
remove(taskPanel); //remove(taskPanel);
// remove(tdTaskMainPanel); // remove(tdTaskMainPanel);
//tdTaskMainWindow=null; //tdTaskMainWindow=null;
@ -64,19 +69,49 @@ public class ToolBox extends TabPanel {
} }
public void startTabs(){
Log.debug("Start ToolBox Tabs");
addHelpPanel();
setActiveWidget(getWidget(0));
}
public void openTabs() { public void openTabs() {
Log.debug("Open ToolBox Tabs"); Log.debug("Open ToolBox Tabs");
addTrProperties(); addTrProperties();
addTdTaskPanel(); //addTdTaskPanel();
/* /*
* Label taskLabel = new Label("Task Properties"); * Label taskLabel = new Label("Task Properties");
* taskLabel.addStyleName("pad-text"); functionalityTab .add(taskLabel, * taskLabel.addStyleName("pad-text"); functionalityTab .add(taskLabel,
* new TabItemConfig("Task", true)); * new TabItemConfig("Task", true));
*/ */
setActiveWidget(getWidget(0)); setActiveWidget(trProperties);
} }
protected void addHelpPanel() {
TabItemConfig propertiesItemConf = new TabItemConfig("Help", true);
helpPanel = new HelpPanel("Help", eventBus);
helpPanel.setHeaderVisible(false);
add(helpPanel, propertiesItemConf);
addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (getWidgetCount() == 1) {
toolBoxPanel.closePanelOnly();
remove(helpPanel);
}
}
});
};
protected void addTrProperties() { protected void addTrProperties() {
TabItemConfig propertiesItemConf = new TabItemConfig("Properties", true); TabItemConfig propertiesItemConf = new TabItemConfig("Properties", true);

View File

@ -20,17 +20,15 @@ public class ToolBoxPanel extends ContentPanel {
public ToolBoxPanel(String name, EventBus eventBus) { public ToolBoxPanel(String name, EventBus eventBus) {
super(); super();
Log.debug("Close ToolBoxPanel"); Log.debug("Open ToolBoxPanel");
this.eventBus=eventBus; this.eventBus=eventBus;
setId(name); setId(name);
setWidth(310); setWidth(310);
setHeaderVisible(false); setHeaderVisible(false);
setResize(true); setResize(true);
state=ToolBoxPanelState.CLOSED;
toolBox = new ToolBox("ToolBox",eventBus,this); toolBox = new ToolBox("ToolBox",eventBus,this);
add(toolBox); add(toolBox);
startPanel();
bindToEvents(); bindToEvents();
} }
@ -79,9 +77,11 @@ public class ToolBoxPanel extends ContentPanel {
closePanel(); closePanel();
break; break;
case TR_OPEN: case TR_OPEN:
this.enable();
updatePanel(); updatePanel();
break; break;
case WIZARD_OPEN: case WIZARD_OPEN:
this.disable();
break; break;
default: default:
break; break;
@ -107,6 +107,7 @@ public class ToolBoxPanel extends ContentPanel {
} }
} else { } else {
Log.debug("ToolBoxPanel No table open"); Log.debug("ToolBoxPanel No table open");
} }
@ -127,6 +128,15 @@ public class ToolBoxPanel extends ContentPanel {
Log.debug("ToolBoxPanel Closed"); Log.debug("ToolBoxPanel Closed");
} }
public void startPanel(){
enable();
expand();
state = ToolBoxPanelState.OPENED;
toolBox.openTabs();
}
public void updatePanel(){ public void updatePanel(){
if (state == ToolBoxPanelState.OPENED) { if (state == ToolBoxPanelState.OPENED) {
toolBox.updateTabs(); toolBox.updateTabs();

View File

@ -0,0 +1,105 @@
package org.gcube.portlets.user.td.toolboxwidget.client.help;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.metadatawidget.client.TRMetadataAccordionPanel;
import org.gcube.portlets.user.td.metadatawidget.client.TableMetadataAccordionPanel;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.FieldSet;
import com.sencha.gxt.widget.core.client.form.TextArea;
import com.sencha.gxt.widget.core.client.form.TextField;
public class HelpPanel extends FramedPanel {
protected String headingTitle;
protected HashMap<String, String> tabularResourcePropertiesMap;
protected VerticalLayoutContainer vl;
protected EventBus eventBus;
protected FieldSet contents;
protected VerticalLayoutContainer layoutCaptions;
public HelpPanel(String name, EventBus eventBus) {
super();
setId(name);
this.eventBus = eventBus;
forceLayoutOnResize = true;
setBodyBorder(false);
vl = new VerticalLayoutContainer();
initInformation();
this.add(vl);
}
public void addContents() {
HTML title=new HTML("<H2>Tabular Data Manager Help<H2>");
add(title);
contents = new FieldSet();
contents.setHeadingText("Contents");
contents.setCollapsible(true);
contents.setResize(true);
layoutCaptions = new VerticalLayoutContainer();
contents.add(layoutCaptions);
HTML info=new HTML("<p>Tabular Data Manager offers facilities supporting the management of the entire life-cycle" +
"(creation, curation, manipulation and publication) of Tabular Resources such as datasets, codelist or generic table." +
" i.e. tabular data representing observations of a given event or phenomenon at different time intervals." +
" Tabular Resource are used in many domains ranging from statistics to signal processing and econometrics." +
" Tabular Data Manager offers a rich set of facilities ranging from those supporting the assessment" +
" of data correctness to those supporting the verification of the compliance of data with given code lists," +
" the aggregation and filtering of data.</p>");
layoutCaptions.add(info,
new VerticalLayoutData(-1, -1, new Margins(1)));
vl.add(contents);
}
/*
* protected void getLastTable(TRId trId) { TDGWTServiceAsync.INSTANCE
* .getLastTable(trId,new AsyncCallback<TableData>() {
*
* public void onSuccess(TableData result) { updateTable(result);
* Log.info("Retrived LastTable:" + result.getName());
*
* }
*
* public void onFailure(Throwable caught) { AlertMessageBox d = new
* AlertMessageBox("Error", "Error retrienving Last Table: " +
* caught.getLocalizedMessage()); d.addHideHandler(new HideHandler() {
*
* public void onHide(HideEvent event) { //
*
* }
*
* }); d.show();
*
* }
*
* }); }
*/
public void initInformation() {
addContents();
}
}