Updated Rules
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@114314 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ce54e01782
commit
1d1d9ead45
|
@ -8,6 +8,7 @@ import java.util.HashMap;
|
||||||
import org.gcube.portlets.user.td.chartswidget.client.ChartsWidgetTD;
|
import org.gcube.portlets.user.td.chartswidget.client.ChartsWidgetTD;
|
||||||
import org.gcube.portlets.user.td.client.logs.TDMLogs;
|
import org.gcube.portlets.user.td.client.logs.TDMLogs;
|
||||||
import org.gcube.portlets.user.td.client.rstudio.RStudio;
|
import org.gcube.portlets.user.td.client.rstudio.RStudio;
|
||||||
|
import org.gcube.portlets.user.td.client.rule.RuleAppliedDialog;
|
||||||
import org.gcube.portlets.user.td.client.rule.RuleApplyDialog;
|
import org.gcube.portlets.user.td.client.rule.RuleApplyDialog;
|
||||||
import org.gcube.portlets.user.td.client.rule.RuleDeleteDialog;
|
import org.gcube.portlets.user.td.client.rule.RuleDeleteDialog;
|
||||||
import org.gcube.portlets.user.td.client.rule.RuleOpenDialog;
|
import org.gcube.portlets.user.td.client.rule.RuleOpenDialog;
|
||||||
|
@ -1758,7 +1759,7 @@ public class TabularDataController {
|
||||||
private void openRulesAppliedOnTabularResource() {
|
private void openRulesAppliedOnTabularResource() {
|
||||||
Log.debug("Request Open Rules Applied on TabularResource Dialog");
|
Log.debug("Request Open Rules Applied on TabularResource Dialog");
|
||||||
if (trId != null) {
|
if (trId != null) {
|
||||||
RuleApplyDialog raDialog = new RuleApplyDialog(
|
RuleAppliedDialog raDialog = new RuleAppliedDialog(
|
||||||
trId, eventBus);
|
trId, eventBus);
|
||||||
raDialog.show();
|
raDialog.show();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.gcube.portlets.user.td.client.rule;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RuleAppliedDialog extends Window {
|
||||||
|
private static final String WIDTH = "720px";
|
||||||
|
private static final String HEIGHT = "428px";
|
||||||
|
public RuleAppliedDialog(TRId trId, EventBus eventBus) {
|
||||||
|
initWindow();
|
||||||
|
|
||||||
|
RuleAppliedPanel ruleApplyPanel = new RuleAppliedPanel(this,
|
||||||
|
trId, eventBus);
|
||||||
|
add(ruleApplyPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initWindow() {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setResizable(false);
|
||||||
|
setHeadingText("Rules Applied On TabularResource");
|
||||||
|
setClosable(true);
|
||||||
|
setModal(true);
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
getHeader().setIcon(TabularDataResources.INSTANCE.ruleTabularResource());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initTools() {
|
||||||
|
super.initTools();
|
||||||
|
|
||||||
|
closeBtn.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void close() {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,441 @@
|
||||||
|
package org.gcube.portlets.user.td.client.rule;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||||
|
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.client.rpc.TDGWTServiceAsync;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||||
|
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
||||||
|
|
||||||
|
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.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
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.XTemplates;
|
||||||
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
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.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.grid.filters.GridFilters;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.filters.StringFilter;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RuleAppliedPanel extends FramedPanel {
|
||||||
|
private static final int RULE_ON_COLUMN_FIELDSET_HEIGHT = 348;
|
||||||
|
private static final String RULES_GRID_HEIGHT = "102px";
|
||||||
|
private static final String WIDTH = "630px";
|
||||||
|
private static final String HEIGHT = "418px";
|
||||||
|
|
||||||
|
interface RuleApplyTemplates extends XTemplates {
|
||||||
|
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||||
|
SafeHtml format(String value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EventBus eventBus;
|
||||||
|
private RuleAppliedDialog parent;
|
||||||
|
private TRId trId;
|
||||||
|
private ArrayList<ColumnData> columns;
|
||||||
|
|
||||||
|
private AppliedRulesResponseData appliedRuleResponseData;
|
||||||
|
|
||||||
|
private TextButton btnClose;
|
||||||
|
|
||||||
|
public RuleAppliedPanel(RuleAppliedDialog parent, TRId trId,
|
||||||
|
EventBus eventBus) {
|
||||||
|
this.parent = parent;
|
||||||
|
this.trId = trId;
|
||||||
|
|
||||||
|
Log.debug("RuleAppliedPanel");
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setBodyBorder(false);
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
retrieveColumns();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveColumns() {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Locked",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsFinalException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Final",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
Log.debug("Error retrieving columns: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error retrieving columns",
|
||||||
|
"Error retrieving column on server!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
Log.debug("Retrieved Columns");
|
||||||
|
if (result == null) {
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
"The requested columns is null");
|
||||||
|
}
|
||||||
|
columns = result;
|
||||||
|
|
||||||
|
getAppliedBaseColumnRules();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create() {
|
||||||
|
|
||||||
|
Log.debug("Create RuleAppliedPanel(): " + trId);
|
||||||
|
|
||||||
|
// SimpleContainer rulesOnColumnContainer=new SimpleContainer();
|
||||||
|
FieldSet columnRulesFieldSet = new FieldSet();
|
||||||
|
columnRulesFieldSet.setHeadingText("Rules On Column");
|
||||||
|
columnRulesFieldSet.setCollapsible(false);
|
||||||
|
|
||||||
|
VerticalLayoutContainer columnRulesFieldSetLayout = new VerticalLayoutContainer();
|
||||||
|
columnRulesFieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||||
|
columnRulesFieldSetLayout.setAdjustForScroll(true);
|
||||||
|
|
||||||
|
columnRulesFieldSet.add(columnRulesFieldSetLayout);
|
||||||
|
|
||||||
|
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||||
|
.getColumnRuleMapping();
|
||||||
|
if (columnRuleMapping != null && columnRuleMapping.size() > 0) {
|
||||||
|
|
||||||
|
for (ColumnData column : columns) {
|
||||||
|
ArrayList<RuleDescriptionData> columnAppliedRules = columnRuleMapping
|
||||||
|
.get(column.getColumnId());
|
||||||
|
if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
|
||||||
|
FieldLabel columnLabel = createColumnRules(column,
|
||||||
|
columnAppliedRules);
|
||||||
|
columnRulesFieldSetLayout.add(columnLabel,
|
||||||
|
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FieldLabel noRulesLabel = new FieldLabel(null, "No rules applied!");
|
||||||
|
noRulesLabel.setLabelSeparator("");
|
||||||
|
columnRulesFieldSetLayout.add(noRulesLabel, new VerticalLayoutData(
|
||||||
|
1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
btnClose = new TextButton("Close");
|
||||||
|
btnClose.setIcon(TabularDataResources.INSTANCE.close());
|
||||||
|
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||||
|
btnClose.setToolTip("Close");
|
||||||
|
btnClose.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Close");
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.add(columnRulesFieldSet, new VerticalLayoutData(-1,
|
||||||
|
RULE_ON_COLUMN_FIELDSET_HEIGHT, new Margins(0)));
|
||||||
|
v.add(flowButton,
|
||||||
|
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||||
|
add(v);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private FieldLabel createColumnRules(ColumnData column,
|
||||||
|
ArrayList<RuleDescriptionData> columnAppliedRules) {
|
||||||
|
// Rules
|
||||||
|
|
||||||
|
RuleDescriptionDataProperties propsRules = GWT
|
||||||
|
.create(RuleDescriptionDataProperties.class);
|
||||||
|
|
||||||
|
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||||
|
propsRules.name(), 120, "Name");
|
||||||
|
|
||||||
|
nameCol.setCell(new AbstractCell<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||||
|
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||||
|
.create(RuleApplyTemplates.class);
|
||||||
|
sb.append(ruleApplyTemplates.format(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||||
|
propsRules.description(), 120, "Description");
|
||||||
|
descriptionCol.setCell(new AbstractCell<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||||
|
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||||
|
.create(RuleApplyTemplates.class);
|
||||||
|
sb.append(ruleApplyTemplates.format(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||||
|
propsRules.owner(), 70, "Owner");
|
||||||
|
ownerCol.setCell(new AbstractCell<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||||
|
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||||
|
.create(RuleApplyTemplates.class);
|
||||||
|
sb.append(ruleApplyTemplates.format(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||||
|
propsRules.readableExpression(), 160, "Expression");
|
||||||
|
|
||||||
|
readableExpressionCol.setCell(new AbstractCell<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||||
|
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||||
|
.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);
|
||||||
|
|
||||||
|
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||||
|
l);
|
||||||
|
|
||||||
|
StringFilter<RuleDescriptionData> nameFilter = new StringFilter<RuleDescriptionData>(
|
||||||
|
propsRules.name());
|
||||||
|
StringFilter<RuleDescriptionData> descriptionFilter = new StringFilter<RuleDescriptionData>(
|
||||||
|
propsRules.description());
|
||||||
|
|
||||||
|
// Applies Rules
|
||||||
|
ListStore<RuleDescriptionData> appliedRulesStore = new ListStore<RuleDescriptionData>(
|
||||||
|
propsRules.id());
|
||||||
|
|
||||||
|
if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
|
||||||
|
appliedRulesStore.addAll(columnAppliedRules);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Grid<RuleDescriptionData> gridAppliedRules = new Grid<RuleDescriptionData>(
|
||||||
|
appliedRulesStore, cm);
|
||||||
|
gridAppliedRules.setHeight(RULES_GRID_HEIGHT);
|
||||||
|
gridAppliedRules.getView().setStripeRows(true);
|
||||||
|
gridAppliedRules.getView().setColumnLines(true);
|
||||||
|
gridAppliedRules.getView().setAutoFill(true);
|
||||||
|
gridAppliedRules.setBorders(false);
|
||||||
|
gridAppliedRules.setLoadMask(true);
|
||||||
|
gridAppliedRules.setColumnReordering(true);
|
||||||
|
gridAppliedRules.setColumnResize(true);
|
||||||
|
gridAppliedRules.getView().setAutoExpandColumn(descriptionCol);
|
||||||
|
|
||||||
|
GridFilters<RuleDescriptionData> filtersAppliesRules = new GridFilters<RuleDescriptionData>();
|
||||||
|
filtersAppliesRules.initPlugin(gridAppliedRules);
|
||||||
|
filtersAppliesRules.setLocal(true);
|
||||||
|
filtersAppliesRules.addFilter(nameFilter);
|
||||||
|
filtersAppliesRules.addFilter(descriptionFilter);
|
||||||
|
|
||||||
|
createContextMenu(gridAppliedRules);
|
||||||
|
|
||||||
|
FieldLabel rulesAppliedLabel = new FieldLabel(gridAppliedRules,
|
||||||
|
column.getLabel());
|
||||||
|
|
||||||
|
return rulesAppliedLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void getAppliedBaseColumnRules() {
|
||||||
|
|
||||||
|
ExpressionServiceAsync.INSTANCE.getAppliedRulesByTabularResourceId(
|
||||||
|
trId, new AsyncCallback<AppliedRulesResponseData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error retrieving applied rules",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(AppliedRulesResponseData result) {
|
||||||
|
Log.trace("AppliedRuleResponseData: " + result);
|
||||||
|
appliedRuleResponseData = result;
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void close() {
|
||||||
|
parent.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.getOwner());
|
||||||
|
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(final Grid<RuleDescriptionData> grid) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -99,18 +99,18 @@
|
||||||
<set-property-fallback name="locale" value="en" />
|
<set-property-fallback name="locale" value="en" />
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||||
<set-property name="log_DivLogger" value="ENABLED" />
|
<set-property name="log_DivLogger" value="ENABLED" />
|
||||||
<set-property name="log_GWTLogger" value="ENABLED" />
|
<set-property name="log_GWTLogger" value="ENABLED" />
|
||||||
<set-property name="log_SystemLogger" value="ENABLED" />
|
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" 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_ConsoleLogger" value="DISABLED" />
|
||||||
<set-property name="log_DivLogger" value="DISABLED" />
|
<set-property name="log_DivLogger" value="DISABLED" />
|
||||||
<set-property name="log_GWTLogger" 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" /> -->
|
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED" /> -->
|
||||||
|
|
||||||
<!-- Specify the paths for translatable code -->
|
<!-- Specify the paths for translatable code -->
|
||||||
|
|
Loading…
Reference in New Issue