Added the sharing of rules
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@114329 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1d1d9ead45
commit
c7bd80cf99
|
@ -37,13 +37,14 @@ public class RuleToolBar {
|
|||
private ToolBar toolBar;
|
||||
|
||||
// Rules
|
||||
private TextButton ruleNewButton;
|
||||
private TextButton ruleOpenButton;
|
||||
private TextButton ruleDeleteButton;
|
||||
private TextButton ruleApplyButton;
|
||||
private TextButton ruleTabularResourceButton;
|
||||
private TextButton ruleOnTabularResourceButton;
|
||||
private TextButton ruleShareButton;
|
||||
|
||||
// private TextButton ruleShareButton;
|
||||
// On Column
|
||||
private TextButton ruleOnColumnNewButton;
|
||||
private TextButton ruleOnColumnApplyButton;
|
||||
|
||||
public RuleToolBar(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
|
@ -106,40 +107,42 @@ public class RuleToolBar {
|
|||
ruleLayout.setWidget(0, 1, ruleDeleteButton);
|
||||
ruleLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
|
||||
|
||||
ruleTabularResourceButton = new TextButton(msgs.ruleTabularResourceButton(),
|
||||
ruleOnTabularResourceButton = new TextButton(
|
||||
msgs.ruleTabularResourceButton(),
|
||||
TabularDataResources.INSTANCE.ruleTabularResource32());
|
||||
ruleTabularResourceButton.disable();
|
||||
ruleTabularResourceButton.setScale(ButtonScale.LARGE);
|
||||
ruleTabularResourceButton.setIconAlign(IconAlign.TOP);
|
||||
ruleTabularResourceButton.setToolTip(msgs.ruleTabularResourceButtonToolTip());
|
||||
ruleTabularResourceButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleTabularResourceButton.addSelectHandler(new SelectHandler() {
|
||||
ruleOnTabularResourceButton.disable();
|
||||
ruleOnTabularResourceButton.setScale(ButtonScale.LARGE);
|
||||
ruleOnTabularResourceButton.setIconAlign(IconAlign.TOP);
|
||||
ruleOnTabularResourceButton.setToolTip(msgs
|
||||
.ruleTabularResourceButtonToolTip());
|
||||
ruleOnTabularResourceButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleOnTabularResourceButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.RULES_APPLIED_ON_TABULAR_RESOURCE));
|
||||
eventBus.fireEvent(new RibbonEvent(
|
||||
RibbonType.RULES_APPLIED_ON_TABULAR_RESOURCE));
|
||||
}
|
||||
});
|
||||
|
||||
ruleLayout.setWidget(0, 2, ruleTabularResourceButton);
|
||||
ruleLayout.setWidget(0, 2, ruleOnTabularResourceButton);
|
||||
ruleLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
|
||||
|
||||
|
||||
/*
|
||||
* ruleShareButton = new TextButton(msgs.ruleShareButton(),
|
||||
* TabularDataResources.INSTANCE.ruleShare32());
|
||||
* ruleShareButton.enable();
|
||||
* ruleShareButton.setScale(ButtonScale.LARGE);
|
||||
* ruleShareButton.setIconAlign(IconAlign.TOP);
|
||||
* ruleShareButton.setToolTip(msgs.ruleShareButtonToolTip());
|
||||
* ruleShareButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
* ruleShareButton.addSelectHandler(new SelectHandler() {
|
||||
*
|
||||
* public void onSelect(SelectEvent event) { eventBus.fireEvent(new
|
||||
* RibbonEvent(RibbonType.RULE_SHARE)); } });
|
||||
*
|
||||
* ruleLayout.setWidget(0, 3, ruleShareButton);
|
||||
* ruleLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
|
||||
*/
|
||||
ruleShareButton = new TextButton(msgs.ruleShareButton(),
|
||||
TabularDataResources.INSTANCE.ruleShare32());
|
||||
ruleShareButton.enable();
|
||||
ruleShareButton.setScale(ButtonScale.LARGE);
|
||||
ruleShareButton.setIconAlign(IconAlign.TOP);
|
||||
ruleShareButton.setToolTip(msgs.ruleShareButtonToolTip());
|
||||
ruleShareButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleShareButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_SHARE));
|
||||
}
|
||||
});
|
||||
|
||||
ruleLayout.setWidget(0, 3, ruleShareButton);
|
||||
ruleLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
|
||||
|
||||
cleanCells(ruleLayout.getElement());
|
||||
|
||||
|
@ -153,41 +156,41 @@ public class RuleToolBar {
|
|||
|
||||
FlexTable ruleOnColumnLayout = new FlexTable();
|
||||
ruleOnColumnGroup.add(ruleOnColumnLayout);
|
||||
|
||||
ruleNewButton = new TextButton(msgs.ruleNewButton(),
|
||||
|
||||
ruleOnColumnNewButton = new TextButton(msgs.ruleNewButton(),
|
||||
TabularDataResources.INSTANCE.ruleColumnAdd32());
|
||||
ruleNewButton.enable();
|
||||
ruleNewButton.setToolTip(msgs.ruleNewButtonToolTip());
|
||||
ruleNewButton.setScale(ButtonScale.LARGE);
|
||||
ruleNewButton.setIconAlign(IconAlign.TOP);
|
||||
ruleNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleNewButton.addSelectHandler(new SelectHandler() {
|
||||
ruleOnColumnNewButton.enable();
|
||||
ruleOnColumnNewButton.setToolTip(msgs.ruleNewButtonToolTip());
|
||||
ruleOnColumnNewButton.setScale(ButtonScale.LARGE);
|
||||
ruleOnColumnNewButton.setIconAlign(IconAlign.TOP);
|
||||
ruleOnColumnNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleOnColumnNewButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_NEW));
|
||||
}
|
||||
});
|
||||
|
||||
ruleOnColumnLayout.setWidget(0, 0, ruleNewButton);
|
||||
|
||||
ruleOnColumnLayout.setWidget(0, 0, ruleOnColumnNewButton);
|
||||
ruleOnColumnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
|
||||
|
||||
ruleApplyButton = new TextButton(msgs.ruleApplyButton(),
|
||||
|
||||
ruleOnColumnApplyButton = new TextButton(msgs.ruleApplyButton(),
|
||||
TabularDataResources.INSTANCE.ruleColumnApply32());
|
||||
ruleApplyButton.disable();
|
||||
ruleApplyButton.setScale(ButtonScale.LARGE);
|
||||
ruleApplyButton.setIconAlign(IconAlign.TOP);
|
||||
ruleApplyButton.setToolTip(msgs.ruleApplyButtonToolTip());
|
||||
ruleApplyButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleApplyButton.addSelectHandler(new SelectHandler() {
|
||||
ruleOnColumnApplyButton.disable();
|
||||
ruleOnColumnApplyButton.setScale(ButtonScale.LARGE);
|
||||
ruleOnColumnApplyButton.setIconAlign(IconAlign.TOP);
|
||||
ruleOnColumnApplyButton.setToolTip(msgs.ruleApplyButtonToolTip());
|
||||
ruleOnColumnApplyButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
ruleOnColumnApplyButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_APPLY));
|
||||
}
|
||||
});
|
||||
|
||||
ruleOnColumnLayout.setWidget(0, 1, ruleApplyButton);
|
||||
ruleOnColumnLayout.setWidget(0, 1, ruleOnColumnApplyButton);
|
||||
ruleOnColumnLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
|
||||
|
||||
|
||||
cleanCells(ruleLayout.getElement());
|
||||
|
||||
eventBus.addHandler(UIStateEvent.TYPE,
|
||||
|
@ -218,38 +221,40 @@ public class RuleToolBar {
|
|||
switch (uiStateType) {
|
||||
case START:
|
||||
ruleOpenButton.enable();
|
||||
ruleNewButton.enable();
|
||||
ruleDeleteButton.enable();
|
||||
ruleApplyButton.disable();
|
||||
ruleTabularResourceButton.disable();
|
||||
// ruleShareButton.enable();
|
||||
ruleOnTabularResourceButton.disable();
|
||||
ruleShareButton.enable();
|
||||
ruleOnColumnNewButton.enable();
|
||||
ruleOnColumnApplyButton.disable();
|
||||
break;
|
||||
case TR_CLOSE:
|
||||
case TR_READONLY:
|
||||
ruleOpenButton.enable();
|
||||
ruleNewButton.enable();
|
||||
ruleDeleteButton.enable();
|
||||
ruleApplyButton.disable();
|
||||
ruleTabularResourceButton.disable();
|
||||
// ruleShareButton.enable();
|
||||
ruleOnTabularResourceButton.disable();
|
||||
ruleShareButton.enable();
|
||||
ruleOnColumnNewButton.enable();
|
||||
ruleOnColumnApplyButton.disable();
|
||||
|
||||
break;
|
||||
case TR_OPEN:
|
||||
case TABLEUPDATE:
|
||||
case TABLECURATION:
|
||||
ruleOpenButton.enable();
|
||||
ruleNewButton.enable();
|
||||
ruleDeleteButton.enable();
|
||||
ruleApplyButton.enable();
|
||||
ruleTabularResourceButton.enable();
|
||||
// ruleShareButton.enable();
|
||||
ruleOnTabularResourceButton.enable();
|
||||
ruleShareButton.enable();
|
||||
ruleOnColumnNewButton.enable();
|
||||
ruleOnColumnApplyButton.enable();
|
||||
|
||||
break;
|
||||
case WIZARD_OPEN:
|
||||
ruleOpenButton.disable();
|
||||
ruleNewButton.disable();
|
||||
ruleDeleteButton.disable();
|
||||
ruleApplyButton.disable();
|
||||
ruleTabularResourceButton.disable();
|
||||
// ruleShareButton.disable();
|
||||
ruleOnTabularResourceButton.disable();
|
||||
ruleShareButton.disable();
|
||||
ruleOnColumnNewButton.disable();
|
||||
ruleOnColumnApplyButton.disable();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,6 @@ public class TabularDataRibbon {
|
|||
|
||||
private TabPanel ribbon;
|
||||
|
||||
//private PlainTabPanel ribbon;
|
||||
|
||||
private FileToolBar fileToolBar;
|
||||
private CurationToolBar curationToolBar;
|
||||
|
|
|
@ -242,7 +242,7 @@ public class RuleAppliedPanel extends FramedPanel {
|
|||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.owner(), 70, "Owner");
|
||||
propsRules.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
|
@ -253,9 +253,11 @@ public class RuleAppliedPanel extends FramedPanel {
|
|||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.readableExpression(), 160, "Expression");
|
||||
|
||||
|
||||
readableExpressionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
|
@ -264,13 +266,13 @@ public class RuleAppliedPanel extends FramedPanel {
|
|||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
l.add(readableExpressionCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
@ -390,7 +392,7 @@ public class RuleAppliedPanel extends FramedPanel {
|
|||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setToolTip("Rule Owner");
|
||||
ruleOwner.setValue(rule.getOwner());
|
||||
ruleOwner.setValue(rule.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
|
|
|
@ -229,7 +229,7 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.owner(), 70, "Owner");
|
||||
propsRules.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
|
@ -240,6 +240,7 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.readableExpression(), 160, "Expression");
|
||||
|
||||
|
@ -251,13 +252,13 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
l.add(readableExpressionCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
@ -401,6 +402,8 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
|
||||
protected void updateRulesInGrids(ColumnData columnData) {
|
||||
column = columnData;
|
||||
applicableRulesStore.clear();
|
||||
appliesRulesStore.clear();
|
||||
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||
.getColumnRuleMapping();
|
||||
|
||||
|
@ -410,7 +413,6 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
|
||||
if (applied != null) {
|
||||
appliedRules = applied;
|
||||
appliesRulesStore.clear();
|
||||
appliesRulesStore.addAll(new ArrayList<RuleDescriptionData>(
|
||||
applied));
|
||||
|
||||
|
@ -457,9 +459,6 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
applicableRules = result;
|
||||
|
||||
|
||||
applicableRulesStore.clear();
|
||||
applicableRulesStore
|
||||
.addAll(new ArrayList<RuleDescriptionData>(
|
||||
applicableRules));
|
||||
|
@ -596,7 +595,7 @@ public class RuleApplyPanel extends FramedPanel {
|
|||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setToolTip("Rule Owner");
|
||||
ruleOwner.setValue(rule.getOwner());
|
||||
ruleOwner.setValue(rule.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
|
|
|
@ -159,7 +159,7 @@ public class RuleDeletePanel extends FramedPanel {
|
|||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.owner(), 70, "Owner");
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
|
@ -170,6 +170,7 @@ public class RuleDeletePanel extends FramedPanel {
|
|||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.readableExpression(), 160, "Expression");
|
||||
|
||||
|
@ -181,14 +182,14 @@ public class RuleDeletePanel extends FramedPanel {
|
|||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
l.add(readableExpressionCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
@ -445,7 +446,7 @@ public class RuleDeletePanel extends FramedPanel {
|
|||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setToolTip("Rule Owner");
|
||||
ruleOwner.setValue(rule.getOwner());
|
||||
ruleOwner.setValue(rule.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
|
|
|
@ -165,7 +165,7 @@ public class RuleOpenPanel extends FramedPanel {
|
|||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.owner(), 70, "Owner");
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,8 @@ public class RuleOpenPanel extends FramedPanel {
|
|||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.readableExpression(), 160, "Expression");
|
||||
|
||||
|
@ -187,14 +188,14 @@ public class RuleOpenPanel extends FramedPanel {
|
|||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
l.add(readableExpressionCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
@ -453,7 +454,7 @@ public class RuleOpenPanel extends FramedPanel {
|
|||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setToolTip("Rule Owner");
|
||||
ruleOwner.setValue(rule.getOwner());
|
||||
ruleOwner.setValue(rule.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.gcube.portlets.user.td.client.rule;
|
||||
|
||||
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||
import org.gcube.portlets.user.td.sharewidget.client.TemplateShare;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.sharewidget.client.RuleShare;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
@ -65,10 +65,10 @@ public class RuleShareDialog extends Window {
|
|||
}
|
||||
|
||||
|
||||
public void templateShare(TemplateData templateData) {
|
||||
public void ruleShare(RuleDescriptionData ruleDescriptionData) {
|
||||
Log.debug("Share Window");
|
||||
@SuppressWarnings("unused")
|
||||
TemplateShare templateShare = new TemplateShare(templateData, eventBus);
|
||||
RuleShare ruleShare = new RuleShare(ruleDescriptionData, eventBus);
|
||||
close();
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||
import org.gcube.portlets.user.td.client.rule.RuleDeletePanel.RuleDeleteTemplates;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
|
@ -14,11 +15,15 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredE
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
|
@ -36,21 +41,30 @@ import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
|||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||
import com.sencha.gxt.widget.core.client.Dialog;
|
||||
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
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.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
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;
|
||||
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
|
@ -102,22 +116,66 @@ public class RuleSharePanel extends FramedPanel {
|
|||
CheckBoxSelectionModel<RuleDescriptionData> sm = new CheckBoxSelectionModel<RuleDescriptionData>(
|
||||
identity);
|
||||
|
||||
RuleDescriptionDataProperties props = GWT.create(RuleDescriptionDataProperties.class);
|
||||
RuleDescriptionDataProperties props = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.scopeLabel(), 40, "Scope");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.readableExpression(), 230, "Expression");
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(readableExpressionCol);
|
||||
l.add(ownerCol);
|
||||
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(l);
|
||||
|
||||
|
@ -193,7 +251,10 @@ public class RuleSharePanel extends FramedPanel {
|
|||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
|
||||
createContextMenu();
|
||||
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(grid);
|
||||
toolBar.addStyleName(ThemeStyles.get().style().borderTop());
|
||||
|
@ -278,24 +339,24 @@ public class RuleSharePanel extends FramedPanel {
|
|||
|
||||
|
||||
protected ArrayList<RuleDescriptionData> getSelectedItem() {
|
||||
ArrayList<RuleDescriptionData> templates = new ArrayList<RuleDescriptionData>();
|
||||
for (RuleDescriptionData template : grid.getSelectionModel()
|
||||
ArrayList<RuleDescriptionData> rules = new ArrayList<RuleDescriptionData>();
|
||||
for (RuleDescriptionData rule : grid.getSelectionModel()
|
||||
.getSelectedItems()) {
|
||||
templates.add(template);
|
||||
rules.add(rule);
|
||||
}
|
||||
return templates;
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
||||
protected void share() {
|
||||
|
||||
ArrayList<RuleDescriptionData> templates = getSelectedItem();
|
||||
if (templates == null || templates.size() == 0) {
|
||||
UtilsGXT3.info("Attention", "Select the template");
|
||||
ArrayList<RuleDescriptionData> rules = getSelectedItem();
|
||||
if (rules == null || rules.size() == 0) {
|
||||
UtilsGXT3.info("Attention", "Select the rule");
|
||||
} else {
|
||||
RuleDescriptionData template = templates.get(0);
|
||||
Log.debug("templateShare: " + template);
|
||||
//parent.templateShare(template);
|
||||
RuleDescriptionData rule = rules.get(0);
|
||||
Log.debug("templateShare: " + rule);
|
||||
parent.ruleShare(rule);
|
||||
|
||||
}
|
||||
|
||||
|
@ -332,5 +393,99 @@ public class RuleSharePanel extends FramedPanel {
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
|
||||
final Dialog infoRuleDialog = new Dialog();
|
||||
infoRuleDialog.setHeadingText("Info Rule");
|
||||
infoRuleDialog.getHeader().setIcon(
|
||||
TabularDataResources.INSTANCE.information());
|
||||
infoRuleDialog.setPredefinedButtons(PredefinedButton.OK);
|
||||
|
||||
FieldSet configurationFieldSet = new FieldSet();
|
||||
configurationFieldSet.setHeadingText("Configuration");
|
||||
configurationFieldSet.setCollapsible(false);
|
||||
configurationFieldSet.setBorders(true);
|
||||
|
||||
VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer();
|
||||
configurationFieldSet.add(configurationFieldSetLayout,
|
||||
new MarginData(0));
|
||||
|
||||
TextField ruleName = new TextField();
|
||||
ruleName.setToolTip("Rule Name");
|
||||
ruleName.setValue(rule.getName());
|
||||
ruleName.setReadOnly(true);
|
||||
FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Name");
|
||||
configurationFieldSetLayout.add(ruleNameLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextField ruleScope = new TextField();
|
||||
ruleScope.setToolTip("Rule Scope");
|
||||
ruleScope.setValue(rule.getScopeLabel());
|
||||
ruleScope.setReadOnly(true);
|
||||
FieldLabel ruleScopeLabel = new FieldLabel(ruleScope, "Scope");
|
||||
configurationFieldSetLayout.add(ruleScopeLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextArea ruleDescription = new TextArea();
|
||||
ruleDescription.setToolTip("Rule Description");
|
||||
ruleDescription.setValue(rule.getDescription());
|
||||
ruleDescription.setReadOnly(true);
|
||||
FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription,
|
||||
"Description");
|
||||
configurationFieldSetLayout.add(ruleDescriptionLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setToolTip("Rule Owner");
|
||||
ruleOwner.setValue(rule.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextArea ruleExpression = new TextArea();
|
||||
ruleExpression.setToolTip("Rule Expression");
|
||||
ruleExpression.setValue(rule.getReadableExpression());
|
||||
ruleExpression.setReadOnly(true);
|
||||
ruleExpression.setHeight("82px");
|
||||
FieldLabel ruleExpressionLabel = new FieldLabel(ruleExpression,
|
||||
"Expression");
|
||||
configurationFieldSetLayout.add(ruleExpressionLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
infoRuleDialog.add(configurationFieldSet, new MarginData(0));
|
||||
infoRuleDialog.setHideOnButtonClick(true);
|
||||
infoRuleDialog.setButtonAlign(BoxLayoutPack.CENTER);
|
||||
infoRuleDialog.setWidth(500);
|
||||
|
||||
infoRuleDialog.show();
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setIcon(TabularDataResources.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -106,11 +106,11 @@
|
|||
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> -->
|
||||
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED" /> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
|
|
Loading…
Reference in New Issue