Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@93502 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-25 10:15:58 +00:00 committed by Giancarlo Panichi
parent 16a869a8b4
commit 219c63d754
2 changed files with 35 additions and 26 deletions

View File

@ -211,24 +211,22 @@ public class TemplateApplyPanel extends FramedPanel {
} }
/*protected void setMenu() { /*
Menu contextMenu = new Menu(); * protected void setMenu() { Menu contextMenu = new Menu();
*
MenuItem deleteTemplateItem = new MenuItem("Delete"); * MenuItem deleteTemplateItem = new MenuItem("Delete");
deleteTemplateItem.setId("DeleteTemplate"); * deleteTemplateItem.setId("DeleteTemplate");
deleteTemplateItem.setIcon(ResourceBundle.INSTANCE.removeTemplate()); * deleteTemplateItem.setIcon(ResourceBundle.INSTANCE.removeTemplate());
deleteTemplateItem.addSelectionHandler(new SelectionHandler<Item>() { * deleteTemplateItem.addSelectionHandler(new SelectionHandler<Item>() {
*
@Override * @Override public void onSelection(SelectionEvent<Item> event) {
public void onSelection(SelectionEvent<Item> event) { * Log.debug("Delete Template"); TemplateData templateDesc =
Log.debug("Delete Template"); * getSelectedItem();
TemplateData templateDesc = getSelectedItem(); *
* } });
} *
}); * grid.setContextMenu(contextMenu); }
*/
grid.setContextMenu(contextMenu);
}*/
protected TemplateData getSelectedItem() { protected TemplateData getSelectedItem() {
return grid.getSelectionModel().getSelectedItem(); return grid.getSelectionModel().getSelectedItem();
@ -236,11 +234,15 @@ public class TemplateApplyPanel extends FramedPanel {
protected void apply() { protected void apply() {
templateApplySession = new TemplateApplySession(); templateApplySession = new TemplateApplySession();
templateApplySession.setTemplateData(getSelectedItem()); TemplateData template = getSelectedItem();
templateApplySession.setTrId(trId); if (template == null) {
Log.debug("applyTemplateSession: " + templateApplySession); UtilsGXT3.info("Attention", "Select the template to apply");
parent.applyTemplate(templateApplySession); } else {
templateApplySession.setTemplateData(getSelectedItem());
templateApplySession.setTrId(trId);
Log.debug("applyTemplateSession: " + templateApplySession);
parent.applyTemplate(templateApplySession);
}
} }
protected void close() { protected void close() {

View File

@ -237,10 +237,17 @@ public class TemplateDeletePanel extends FramedPanel {
protected void delete() { protected void delete() {
templateDeleteSession = new TemplateDeleteSession(); templateDeleteSession = new TemplateDeleteSession();
templateDeleteSession.setTemplates(getSelectedItem()); ArrayList<TemplateData> templates=getSelectedItem();
Log.debug("templateDeleteSession: " + templateDeleteSession); if(templates==null|| templates.size()==0){
parent.templatesDelete(templateDeleteSession); UtilsGXT3.info("Attention",
"Select the template to be deleted");
} else {
templateDeleteSession.setTemplates(getSelectedItem());
Log.debug("templateDeleteSession: " + templateDeleteSession);
parent.templatesDelete(templateDeleteSession);
}
} }
protected void close() { protected void close() {