From ecc8cd4e8a291d6ee485f551cc95bf07a852c084 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 23 Apr 2015 16:43:47 +0000 Subject: [PATCH] Updated Rules git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@114384 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/td/client/rule/RuleActivePanel.java | 72 +------------- .../user/td/client/rule/RuleApplyPanel.java | 72 +------------- .../user/td/client/rule/RuleDeletePanel.java | 72 +------------- .../user/td/client/rule/RuleInfoDialog.java | 98 +++++++++++++++++++ .../user/td/client/rule/RuleOpenPanel.java | 73 +------------- .../user/td/client/rule/RuleSharePanel.java | 72 +------------- 6 files changed, 107 insertions(+), 352 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/client/rule/RuleInfoDialog.java diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleActivePanel.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleActivePanel.java index 63953ee..48b4a82 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleActivePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleActivePanel.java @@ -34,23 +34,18 @@ 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; @@ -385,73 +380,10 @@ public class RuleActivePanel extends FramedPanel { protected void requestInfo(RuleDescriptionData rule) { - - final Dialog infoRuleDialog = new Dialog(); - infoRuleDialog.setModal(true); - 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); - + final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule); infoRuleDialog.show(); + } protected void createContextMenu(final Grid grid) { diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleApplyPanel.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleApplyPanel.java index c6b12a4..7c02be1 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleApplyPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleApplyPanel.java @@ -39,15 +39,12 @@ import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.dnd.core.client.GridDragSource; import com.sencha.gxt.dnd.core.client.GridDropTarget; -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; @@ -55,8 +52,6 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; 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; @@ -575,73 +570,10 @@ public class RuleApplyPanel extends FramedPanel { } protected void requestInfo(RuleDescriptionData rule) { - - final Dialog infoRuleDialog = new Dialog(); - infoRuleDialog.setModal(true); - 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); - + final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule); infoRuleDialog.show(); + } protected void createContextMenu(final Grid grid) { 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 c367553..90d7add 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 @@ -42,22 +42,16 @@ 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; @@ -404,72 +398,10 @@ public class RuleDeletePanel extends FramedPanel { protected void requestInfo(RuleDescriptionData rule) { - final Dialog infoRuleDialog = new Dialog(); - infoRuleDialog.setModal(true); - 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); - + final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule); infoRuleDialog.show(); + } protected void createContextMenu() { diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleInfoDialog.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleInfoDialog.java new file mode 100644 index 0000000..ce4cd2f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleInfoDialog.java @@ -0,0 +1,98 @@ +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.rule.RuleDescriptionData; + +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.widget.core.client.Dialog; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; +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.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; + + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class RuleInfoDialog extends Dialog { + RuleDescriptionData ruleDescriptionData; + + public RuleInfoDialog(RuleDescriptionData ruleDescriptionData){ + this.ruleDescriptionData=ruleDescriptionData; + initWindow(); + create(); + } + + protected void initWindow(){ + setModal(true); + setHeadingText("Info Rule"); + getHeader().setIcon( + TabularDataResources.INSTANCE.information()); + setPredefinedButtons(PredefinedButton.OK); + setHideOnButtonClick(true); + setButtonAlign(BoxLayoutPack.CENTER); + setWidth(500); + + } + + protected void create(){ + 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.setValue(ruleDescriptionData.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.setValue(ruleDescriptionData.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.setValue(ruleDescriptionData.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.setValue(ruleDescriptionData.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.setValue(ruleDescriptionData.getReadableExpression()); + ruleExpression.setReadOnly(true); + ruleExpression.setHeight("82px"); + FieldLabel ruleExpressionLabel = new FieldLabel(ruleExpression, + "Expression"); + configurationFieldSetLayout.add(ruleExpressionLabel, + new VerticalLayoutData(1, -1, new Margins(0))); + + add(configurationFieldSet, new MarginData(0)); + + } + + +} 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 2a85c7d..975b335 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 @@ -42,22 +42,16 @@ 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; @@ -411,73 +405,10 @@ public class RuleOpenPanel extends FramedPanel { } protected void requestInfo(RuleDescriptionData rule) { - - final Dialog infoRuleDialog = new Dialog(); - infoRuleDialog.setModal(true); - 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); - + final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule); infoRuleDialog.show(); + } protected void createContextMenu() { diff --git a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleSharePanel.java b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleSharePanel.java index 80d4084..0bd66b7 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/rule/RuleSharePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/client/rule/RuleSharePanel.java @@ -41,22 +41,16 @@ 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; @@ -395,71 +389,7 @@ public class RuleSharePanel extends FramedPanel { } protected void requestInfo(RuleDescriptionData rule) { - - final Dialog infoRuleDialog = new Dialog(); - infoRuleDialog.setModal(true); - 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); - + final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule); infoRuleDialog.show(); }