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