diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/RuleToolBar.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/RuleToolBar.java
index 2ba2a31..393bf26 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/RuleToolBar.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/RuleToolBar.java
@@ -41,7 +41,7 @@ public class RuleToolBar {
private TextButton ruleOpenButton;
private TextButton ruleDeleteButton;
private TextButton ruleApplyButton;
- private TextButton ruleShareButton;
+ //private TextButton ruleShareButton;
public RuleToolBar(EventBus eventBus) {
@@ -68,8 +68,8 @@ public class RuleToolBar {
//templateGroup.disable();
toolBar.add(rulesGroup);
- FlexTable templateLayout = new FlexTable();
- rulesGroup.add(templateLayout);
+ FlexTable ruleLayout = new FlexTable();
+ rulesGroup.add(ruleLayout);
ruleNewButton = new TextButton(msgs.ruleNewButton(),
TabularDataResources.INSTANCE.ruleAdd32());
@@ -86,8 +86,8 @@ public class RuleToolBar {
}
});
- templateLayout.setWidget(0, 0, ruleNewButton);
- templateLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
+ ruleLayout.setWidget(0, 0, ruleNewButton);
+ ruleLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
ruleOpenButton = new TextButton(msgs.ruleOpenButton(),
TabularDataResources.INSTANCE.ruleEdit32());
@@ -104,8 +104,8 @@ public class RuleToolBar {
}
});
- templateLayout.setWidget(0, 1, ruleOpenButton);
- templateLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
+ ruleLayout.setWidget(0, 1, ruleOpenButton);
+ ruleLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
ruleDeleteButton = new TextButton(msgs.ruleDeleteButton(),
@@ -123,8 +123,8 @@ public class RuleToolBar {
}
});
- templateLayout.setWidget(0, 2, ruleDeleteButton);
- templateLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
+ ruleLayout.setWidget(0, 2, ruleDeleteButton);
+ ruleLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
ruleApplyButton = new TextButton(msgs.ruleApplyButton(),
@@ -141,10 +141,10 @@ public class RuleToolBar {
}
});
- templateLayout.setWidget(0, 3, ruleApplyButton);
- templateLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
-
+ ruleLayout.setWidget(0, 3, ruleApplyButton);
+ ruleLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
+ /*
ruleShareButton = new TextButton(msgs.ruleShareButton(),
TabularDataResources.INSTANCE.ruleShare32());
ruleShareButton.enable();
@@ -159,10 +159,11 @@ public class RuleToolBar {
}
});
- templateLayout.setWidget(0, 4, ruleShareButton);
- templateLayout.getFlexCellFormatter().setRowSpan(0, 4, 2);
-
- cleanCells(templateLayout.getElement());
+ ruleLayout.setWidget(0, 4, ruleShareButton);
+ ruleLayout.getFlexCellFormatter().setRowSpan(0, 4, 2);
+ */
+
+ cleanCells(ruleLayout.getElement());
eventBus.addHandler(UIStateEvent.TYPE,
new UIStateEvent.UIStateHandler() {
@@ -195,7 +196,7 @@ public class RuleToolBar {
ruleNewButton.enable();
ruleDeleteButton.enable();
ruleApplyButton.disable();
- ruleShareButton.enable();
+ //ruleShareButton.enable();
break;
case TR_CLOSE:
case TR_READONLY:
@@ -203,7 +204,7 @@ public class RuleToolBar {
ruleNewButton.enable();
ruleDeleteButton.enable();
ruleApplyButton.disable();
- ruleShareButton.enable();
+ //ruleShareButton.enable();
break;
case TR_OPEN:
case TABLEUPDATE:
@@ -212,14 +213,14 @@ public class RuleToolBar {
ruleNewButton.enable();
ruleDeleteButton.enable();
ruleApplyButton.enable();
- ruleShareButton.enable();
+ //ruleShareButton.enable();
break;
case WIZARD_OPEN:
ruleOpenButton.disable();
ruleNewButton.disable();
ruleDeleteButton.disable();
ruleApplyButton.disable();
- ruleShareButton.disable();
+ //ruleShareButton.disable();
break;
default:
break;
diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/TabularDataRibbon.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/TabularDataRibbon.java
index 77df75b..fa8e860 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/TabularDataRibbon.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/TabularDataRibbon.java
@@ -58,18 +58,19 @@ public class TabularDataRibbon {
con.add(modifyToolBar.getToolBar(), vldata);
ribbon.add(con, msgs.modify());
-
+
ruleToolBar = new RuleToolBar(eventBus);
con = new VerticalLayoutContainer();
con.add(ruleToolBar.getToolBar(), vldata);
ribbon.add(con, msgs.rule());
-
+
templateToolBar = new TemplateToolBar(eventBus);
con = new VerticalLayoutContainer();
con.add(templateToolBar.getToolBar(), vldata);
ribbon.add(con, msgs.template());
-
+
+
analyseToolBar = new AnalyseToolBar(eventBus);
con = new VerticalLayoutContainer();
con.add(analyseToolBar.getToolBar(), vldata);
diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleDeletePanel.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleDeletePanel.java
index 051cf0f..9694149 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleDeletePanel.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleDeletePanel.java
@@ -15,16 +15,20 @@ 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.safehtml.shared.SafeHtml;
+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;
import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode;
+import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.client.loader.RpcProxy;
@@ -58,6 +62,12 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class RuleDeletePanel extends FramedPanel {
private static final String WIDTH = "630px";
private static final String HEIGHT = "520px";
+
+ private interface RuleDeleteTemplates extends XTemplates {
+ @XTemplate("{value}")
+ SafeHtml format(String value);
+ }
+
private EventBus eventBus;
private RuleDeleteDialog parent;
private TemplateDeleteSession templateDeleteSession;
@@ -104,15 +114,57 @@ public class RuleDeletePanel extends FramedPanel {
ColumnConfig nameCol = new ColumnConfig(
props.name(), 120, "Name");
+ nameCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleDeleteTemplates ruleDeleteTemplates = GWT
+ .create(RuleDeleteTemplates.class);
+ sb.append(ruleDeleteTemplates.format(value));
+ }
+ });
+
ColumnConfig descriptionCol = new ColumnConfig(
props.description(), 120, "Description");
+ descriptionCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleDeleteTemplates ruleDeleteTemplates = GWT
+ .create(RuleDeleteTemplates.class);
+ sb.append(ruleDeleteTemplates.format(value));
+ }
+ });
+
+ ColumnConfig ownerCol = new ColumnConfig(
+ props.owner(), 70, "Owner");
+ ownerCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleDeleteTemplates ruleDeleteTemplates = GWT
+ .create(RuleDeleteTemplates.class);
+ sb.append(ruleDeleteTemplates.format(value));
+ }
+ });
ColumnConfig readableExpressionCol = new ColumnConfig(
- props.readableExpression(), 230, "Expression");
+ props.readableExpression(), 160, "Expression");
+ readableExpressionCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleDeleteTemplates ruleDeleteTemplates = GWT
+ .create(RuleDeleteTemplates.class);
+ sb.append(ruleDeleteTemplates.format(value));
+ }
+ });
+
List> l = new ArrayList>();
l.add(nameCol);
l.add(descriptionCol);
+ l.add(ownerCol);
l.add(readableExpressionCol);
ColumnModel cm = new ColumnModel(
diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenDialog.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenDialog.java
index b3d12d5..6a63a1c 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenDialog.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenDialog.java
@@ -1,8 +1,10 @@
package org.gcube.portlets.user.td.client.rule;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
+import org.gcube.portlets.user.td.expressionwidget.client.RuleDialog;
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
@@ -17,10 +19,11 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
public class RuleOpenDialog extends Window {
private static final String WIDTH = "720px";
private static final String HEIGHT = "530px";
+ private EventBus eventBus;
public RuleOpenDialog(EventBus eventBus) {
initWindow();
-
+ this.eventBus=eventBus;
RuleOpenPanel templateOpenPanel = new RuleOpenPanel(this,
eventBus);
add(templateOpenPanel);
@@ -59,10 +62,17 @@ public class RuleOpenDialog extends Window {
hide();
}
- public void ruleOpen(RuleDescriptionData ruleDescriptionData) {
-
- close();
+ public void ruleEdit(RuleDescriptionData ruleDescriptionData) {
+ openRuleDialog(ruleDescriptionData);
}
+
+ private void openRuleDialog(RuleDescriptionData ruleDescriptionData) {
+ Log.debug("Request Open New Rule Dialog");
+ RuleDialog cfDialog = new RuleDialog(ruleDescriptionData,eventBus);
+ cfDialog.show();
+
+ }
+
}
diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenPanel.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenPanel.java
index 136d2e6..840ef46 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenPanel.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleOpenPanel.java
@@ -14,16 +14,20 @@ 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.safehtml.shared.SafeHtml;
+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;
import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode;
+import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.client.loader.RpcProxy;
@@ -63,12 +67,17 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class RuleOpenPanel extends FramedPanel {
private static final String WIDTH = "630px";
private static final String HEIGHT = "520px";
+
+ private interface RuleOpenTemplates extends XTemplates {
+ @XTemplate("{value}")
+ SafeHtml format(String value);
+ }
+
private EventBus eventBus;
private RuleOpenDialog parent;
private TextButton btnOpen;
private TextButton btnClose;
-
private ListLoader> loader;
private Grid grid;
@@ -103,25 +112,68 @@ public class RuleOpenPanel extends FramedPanel {
CheckBoxSelectionModel sm = new CheckBoxSelectionModel(
identity);
- RuleDescriptionDataProperties props = GWT.create(RuleDescriptionDataProperties.class);
+ RuleDescriptionDataProperties props = GWT
+ .create(RuleDescriptionDataProperties.class);
ColumnConfig nameCol = new ColumnConfig(
props.name(), 120, "Name");
-
+
+ nameCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleOpenTemplates ruleOpenTemplates = GWT
+ .create(RuleOpenTemplates.class);
+ sb.append(ruleOpenTemplates.format(value));
+ }
+ });
+
ColumnConfig descriptionCol = new ColumnConfig(
props.description(), 120, "Description");
+ descriptionCol.setCell(new AbstractCell() {
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleOpenTemplates ruleOpenTemplates = GWT
+ .create(RuleOpenTemplates.class);
+ sb.append(ruleOpenTemplates.format(value));
+ }
+ });
+ ColumnConfig ownerCol = new ColumnConfig(
+ props.owner(), 70, "Owner");
+ ownerCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleOpenTemplates ruleOpenTemplates = GWT
+ .create(RuleOpenTemplates.class);
+ sb.append(ruleOpenTemplates.format(value));
+ }
+ });
+
+
ColumnConfig readableExpressionCol = new ColumnConfig(
- props.readableExpression(), 230, "Expression");
+ props.readableExpression(), 160, "Expression");
+
+ readableExpressionCol.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, String value, SafeHtmlBuilder sb) {
+ RuleOpenTemplates ruleOpenTemplates = GWT
+ .create(RuleOpenTemplates.class);
+ sb.append(ruleOpenTemplates.format(value));
+ }
+ });
-
List> l = new ArrayList>();
l.add(nameCol);
l.add(descriptionCol);
+ l.add(ownerCol);
l.add(readableExpressionCol);
- ColumnModel cm = new ColumnModel(l);
+ ColumnModel cm = new ColumnModel(
+ l);
store = new ExtendedListStore(props.id());
@@ -149,7 +201,8 @@ public class RuleOpenPanel extends FramedPanel {
RpcProxy> proxy = new RpcProxy>() {
- public void load(ListLoadConfig loadConfig,
+ public void load(
+ ListLoadConfig loadConfig,
final AsyncCallback> callback) {
loadData(loadConfig, callback);
}
@@ -201,15 +254,15 @@ public class RuleOpenPanel extends FramedPanel {
toolBar.addStyleName(ThemeStyles.get().style().borderTop());
toolBar.getElement().getStyle().setProperty("borderBottom", "none");
- btnOpen = new TextButton("Open");
+ btnOpen = new TextButton("Edit");
btnOpen.setIcon(TabularDataResources.INSTANCE.ruleEdit());
btnOpen.setIconAlign(IconAlign.RIGHT);
- btnOpen.setToolTip("Open");
+ btnOpen.setToolTip("Edit");
btnOpen.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Open");
- open();
+ edit();
}
});
@@ -226,8 +279,6 @@ public class RuleOpenPanel extends FramedPanel {
}
});
-
-
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
@@ -235,7 +286,6 @@ public class RuleOpenPanel extends FramedPanel {
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnOpen, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
-
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
@@ -249,8 +299,8 @@ public class RuleOpenPanel extends FramedPanel {
protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback> callback) {
-
- ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN,
+
+ ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN,
new AsyncCallback>() {
@Override
@@ -265,7 +315,7 @@ public class RuleOpenPanel extends FramedPanel {
"Error retrieving rules");
}
callback.onFailure(caught);
-
+
}
@Override
@@ -273,38 +323,29 @@ public class RuleOpenPanel extends FramedPanel {
Log.trace("loaded " + result.size() + " Rules");
callback.onSuccess(new ListLoadResultBean(
result));
-
+
}
});
-
}
- protected ArrayList getSelectedItem() {
- ArrayList templates = new ArrayList();
- for (RuleDescriptionData template : grid.getSelectionModel()
- .getSelectedItems()) {
- templates.add(template);
- }
- return templates;
+ protected RuleDescriptionData getSelectedItem() {
+ RuleDescriptionData template = grid.getSelectionModel().getSelectedItem();
+ return template;
}
- protected void open() {
+ protected void edit() {
- ArrayList templates = getSelectedItem();
- if (templates == null || templates.size() == 0) {
- UtilsGXT3.info("Attention", "Select the template");
+ RuleDescriptionData rule = getSelectedItem();
+ if (rule == null ) {
+ UtilsGXT3.info("Attention", "Select the rule");
} else {
- RuleDescriptionData template = templates.get(0);
- Log.debug("templateOpenSession: " + template);
- parent.ruleOpen(template);
+ parent.ruleEdit(rule);
}
}
-
-
protected void close() {
parent.close();
}
diff --git a/src/main/java/org/gcube/portlets/user/td/client/template/TemplateOpenPanel.java b/src/main/java/org/gcube/portlets/user/td/client/template/TemplateOpenPanel.java
index d6f7c1e..93e4b13 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/template/TemplateOpenPanel.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/template/TemplateOpenPanel.java
@@ -61,12 +61,12 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class TemplateOpenPanel extends FramedPanel {
private static final String WIDTH = "630px";
private static final String HEIGHT = "520px";
+
private EventBus eventBus;
private TemplateOpenDialog parent;
private TextButton btnOpen;
private TextButton btnClose;
-
private ListLoader> loader;
private Grid grid;
@@ -105,6 +105,7 @@ public class TemplateOpenPanel extends FramedPanel {
ColumnConfig nameCol = new ColumnConfig(
props.name(), 120, "Name");
+
ColumnConfig categoryCol = new ColumnConfig(
props.category(), 60, "Category");
@@ -121,7 +122,7 @@ public class TemplateOpenPanel extends FramedPanel {
l.add(nameCol);
l.add(categoryCol);
l.add(ownerCol);
- l.add(agencyCol);
+ l.add(agencyCol);
l.add(descriptionCol);
ColumnModel cm = new ColumnModel(l);
@@ -229,8 +230,6 @@ public class TemplateOpenPanel extends FramedPanel {
}
});
-
-
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
@@ -238,7 +237,6 @@ public class TemplateOpenPanel extends FramedPanel {
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnOpen, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
-
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
@@ -303,8 +301,6 @@ public class TemplateOpenPanel extends FramedPanel {
}
-
-
protected void close() {
parent.close();
}