Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@99100 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3a84399740
commit
3c1547d314
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.td.openwidget.client;
|
package org.gcube.portlets.user.td.openwidget.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||||
|
@ -25,9 +26,9 @@ public class TDOpen extends WizardWindow {
|
||||||
* @param targetId
|
* @param targetId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TDOpen(String title,EventBus eventBus) {
|
public TDOpen(TRId trId,String title,EventBus eventBus) {
|
||||||
super(title,eventBus);
|
super(title,eventBus);
|
||||||
Log.info("TDOpen: "+title);
|
Log.info("TDOpen: "+title+", current tr: "+trId);
|
||||||
setWidth(WITHWIZARD);
|
setWidth(WITHWIZARD);
|
||||||
setHeight(HEIGHTWIZARD);
|
setHeight(HEIGHTWIZARD);
|
||||||
BUTTONNEXTLABEL="Open";
|
BUTTONNEXTLABEL="Open";
|
||||||
|
@ -39,7 +40,7 @@ public class TDOpen extends WizardWindow {
|
||||||
tdOpenSession= new TDOpenSession();
|
tdOpenSession= new TDOpenSession();
|
||||||
|
|
||||||
|
|
||||||
TabResourcesSelectionCard tabResourcesSelection= new TabResourcesSelectionCard(tdOpenSession);
|
TabResourcesSelectionCard tabResourcesSelection= new TabResourcesSelectionCard(trId,tdOpenSession);
|
||||||
addCard(tabResourcesSelection);
|
addCard(tabResourcesSelection);
|
||||||
tabResourcesSelection.setup();
|
tabResourcesSelection.setup();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.gcube.portlets.user.td.openwidget.client;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
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;
|
||||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||||
|
@ -16,8 +18,9 @@ public class TDOpenEntry implements EntryPoint {
|
||||||
|
|
||||||
|
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
TRId trId=new TRId();
|
||||||
SimpleEventBus eventBus=new SimpleEventBus();
|
SimpleEventBus eventBus=new SimpleEventBus();
|
||||||
TDOpen tdopen= new TDOpen("Open Tabular Resource",eventBus);
|
TDOpen tdopen= new TDOpen(trId,"Open Tabular Resource",eventBus);
|
||||||
Log.info(tdopen.getId());
|
Log.info(tdopen.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,9 @@ 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.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -29,18 +32,21 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
public class TabResourcesSelectionCard extends WizardCard {
|
public class TabResourcesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
protected TabResourcesSelectionCard thisCard;
|
protected TabResourcesSelectionCard thisCard;
|
||||||
|
protected TRId trId;
|
||||||
protected TDOpenSession tdOpenSession;
|
protected TDOpenSession tdOpenSession;
|
||||||
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
||||||
protected TabResource selectedTabResource = null;
|
protected TabResource selectedTabResource = null;
|
||||||
|
|
||||||
public TabResourcesSelectionCard(final TDOpenSession tdOpenSession) {
|
public TabResourcesSelectionCard(TRId trId,
|
||||||
|
final TDOpenSession tdOpenSession) {
|
||||||
super("Select a Tabular Resource", "");
|
super("Select a Tabular Resource", "");
|
||||||
Log.debug("TabResourcesSelectionCard");
|
Log.debug("TabResourcesSelectionCard");
|
||||||
this.tdOpenSession = tdOpenSession;
|
this.tdOpenSession = tdOpenSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
this.trId = trId;
|
||||||
|
|
||||||
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
|
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,
|
||||||
|
res);
|
||||||
|
|
||||||
tabResourcesSelectionPanel
|
tabResourcesSelectionPanel
|
||||||
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
||||||
|
@ -124,35 +130,43 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callDeleteLastTable(){
|
protected void callDeleteLastTable() {
|
||||||
Log.debug("Delete TR:" + tdOpenSession
|
Log.debug("Delete TR:"
|
||||||
.getSelectedTabResource().getTrId());
|
+ tdOpenSession.getSelectedTabResource().getTrId());
|
||||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(tdOpenSession
|
TDGWTServiceAsync.INSTANCE.removeTabularResource(tdOpenSession
|
||||||
.getSelectedTabResource().getTrId(),
|
.getSelectedTabResource().getTrId(), new AsyncCallback<Void>() {
|
||||||
new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
AlertMessageBox d = new AlertMessageBox("Error",
|
AlertMessageBox d = new AlertMessageBox("Error",
|
||||||
"Error on delete TabResource: "
|
"Error on delete TabResource: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
d.addHideHandler(new HideHandler() {
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
public void onHide(HideEvent event) {
|
public void onHide(HideEvent event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
tabResourcesSelectionPanel.gridReload();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
Log.debug("Remove tabular resource success");
|
||||||
|
Log.debug("Check current tr for close: "+trId);
|
||||||
|
if (trId!=null && trId.getId()!=null && trId.getId().compareTo(
|
||||||
|
tdOpenSession.getSelectedTabResource().getTrId()
|
||||||
|
.getId()) == 0) {
|
||||||
|
Log.debug("Fire Close Event on current TR");
|
||||||
|
getEventBus().fireEvent(new RibbonEvent(RibbonType.CLOSE));
|
||||||
|
} else {
|
||||||
|
Log.debug("No tr opened");
|
||||||
|
}
|
||||||
|
tabResourcesSelectionPanel.gridReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateTDOpenSessionInfo(TableData table) {
|
protected void updateTDOpenSessionInfo(TableData table) {
|
||||||
TabResource tabResource = tdOpenSession.getSelectedTabResource();
|
TabResource tabResource = tdOpenSession.getSelectedTabResource();
|
||||||
|
|
Loading…
Reference in New Issue