[jboss-svn-commits] JBL Code SVN: r34106 - in labs/jbossrules/trunk: drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jul 21 19:58:33 EDT 2010
Author: eaa
Date: 2010-07-21 19:58:32 -0400 (Wed, 21 Jul 2010)
New Revision: 34106
Added:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/CustomFormPopUp.java
Modified:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CustomFormsEditorPanel.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/WorkingSetEditor.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/RepositoryServiceServlet.java
labs/jbossrules/trunk/drools-ide-common/src/main/java/org/drools/ide/common/client/modeldriven/brl/SingleFieldConstraint.java
Log:
GUVNOR-562: Allow the addition of custom forms for populating constraint's fields in Guided Editor
- Added Custom Form configuration panel in Working Set window
- Guided Editor opens a popup with the Custom Form when creating a condition that contains a field with associated Custom Form configuration.
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml 2010-07-21 23:58:32 UTC (rev 34106)
@@ -19,10 +19,10 @@
-->
- <extend-property name="locale" values="es_ES"/>
+ <!--extend-property name="locale" values="es_ES"/>
<extend-property name="locale" values="zh_CN"/>
<extend-property name="locale" values="ja_JP"/>
- <extend-property name="locale" values="pt_BR"/>
+ <extend-property name="locale" values="pt_BR"/-->
<!-- Specify the app entry point class. -->
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -52,6 +52,7 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
@@ -62,6 +63,8 @@
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+import org.drools.factconstraints.client.customform.CustomFormConfiguration;
+import org.drools.guvnor.client.packages.WorkingSetManager;
/**
* This is an editor for constraint values.
@@ -87,10 +90,9 @@
private boolean readOnly;
private Command onValueChangeCommand;
-
public ConstraintValueEditor(FactPattern pattern, String fieldName,
- BaseSingleFieldConstraint con, RuleModeller modeller, String valueType,
- boolean readOnly) {
+ BaseSingleFieldConstraint con, RuleModeller modeller, String valueType,
+ boolean readOnly) {
this.pattern = pattern;
this.fieldName = fieldName;
this.sce = modeller.getSuggestionCompletions();
@@ -102,7 +104,7 @@
valueType = sce.getFieldType(pattern.factType, fieldName);
this.fieldType = valueType;
this.numericValue = SuggestionCompletionEngine.TYPE_NUMERIC.equals(valueType);
-
+
this.readOnly = readOnly;
if (SuggestionCompletionEngine.TYPE_BOOLEAN.equals(valueType)) {
this.dropDownData = DropDownData.create(new String[]{"true", "false"}); //NON-NLS
@@ -114,27 +116,42 @@
initWidget(panel);
}
- private void refreshEditor() {
+ private void refreshEditor() {
panel.clear();
Widget constraintWidget = null;
if (constraint.getConstraintValueType() == SingleFieldConstraint.TYPE_UNDEFINED) {
Image clickme = new Image("images/edit.gif"); //NON-NLS
clickme.addClickHandler(new ClickHandler() {
-
- public void onClick(ClickEvent event) {
- showTypeChoice((Widget) event.getSource(), constraint);
+
+ public void onClick(ClickEvent event) {
+ showTypeChoice((Widget) event.getSource(), constraint);
}
});
constraintWidget = clickme;
} else {
switch (constraint.getConstraintValueType()) {
case SingleFieldConstraint.TYPE_LITERAL:
+
+ if (this.constraint instanceof SingleFieldConstraint) {
+ final SingleFieldConstraint con = (SingleFieldConstraint) this.constraint;
+ CustomFormConfiguration customFormConfiguration = WorkingSetManager.getInstance().getCustomFormConfiguration(modeller.getAsset().metaData.packageName, pattern.factType, fieldName);
+ if (customFormConfiguration != null) {
+ constraintWidget = new Button(con.getValue(), new ClickHandler() {
+
+ public void onClick(ClickEvent event) {
+ showTypeChoice((Widget) event.getSource(), constraint);
+ }
+ });
+ break;
+ }
+ }
+
if (this.dropDownData != null) {
constraintWidget = new EnumDropDownLabel(this.pattern,
this.fieldName,
this.sce,
this.constraint);
- ((EnumDropDownLabel)constraintWidget).setOnValueChangeCommand(new Command() {
+ ((EnumDropDownLabel) constraintWidget).setOnValueChangeCommand(new Command() {
public void execute() {
executeOnValueChangeCommand();
@@ -156,36 +173,36 @@
}
});
- constraintWidget = datePicker;
+ constraintWidget = datePicker;
} else {
- constraintWidget = new SmallLabel(this.constraint.getValue());
+ constraintWidget = new SmallLabel(this.constraint.getValue());
}
} else {
if (!this.readOnly) {
- constraintWidget = new DefaultLiteralEditor(this.constraint,
+ constraintWidget = new DefaultLiteralEditor(this.constraint,
this.numericValue);
- ((DefaultLiteralEditor)constraintWidget).setOnValueChangeCommand(new Command() {
+ ((DefaultLiteralEditor) constraintWidget).setOnValueChangeCommand(new Command() {
- public void execute() {
- executeOnValueChangeCommand();
- }
- });
+ public void execute() {
+ executeOnValueChangeCommand();
+ }
+ });
} else {
- constraintWidget = new SmallLabel(this.constraint.getValue());
+ constraintWidget = new SmallLabel(this.constraint.getValue());
}
}
break;
case SingleFieldConstraint.TYPE_RET_VALUE:
- constraintWidget = returnValueEditor();
+ constraintWidget = returnValueEditor();
break;
case SingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE:
- constraintWidget = expressionEditor();
+ constraintWidget = expressionEditor();
break;
case SingleFieldConstraint.TYPE_VARIABLE:
- constraintWidget = variableEditor();
+ constraintWidget = variableEditor();
break;
case BaseSingleFieldConstraint.TYPE_TEMPLATE:
- constraintWidget = new DefaultLiteralEditor(this.constraint, false);
+ constraintWidget = new DefaultLiteralEditor(this.constraint, false);
break;
default:
break;
@@ -196,7 +213,7 @@
private Widget variableEditor() {
- if (this.readOnly){
+ if (this.readOnly) {
return new SmallLabel(this.constraint.getValue());
}
@@ -233,9 +250,9 @@
}
box.addChangeHandler(new ChangeHandler() {
-
- public void onChange(ChangeEvent event) {
- executeOnValueChangeCommand();
+
+ public void onChange(ChangeEvent event) {
+ executeOnValueChangeCommand();
constraint.setValue(box.getItemText(box.getSelectedIndex()));
}
});
@@ -269,11 +286,11 @@
}
ExpressionBuilder builder = new ExpressionBuilder(this.modeller, ((SingleFieldConstraint) this.constraint).getExpressionValue());
builder.addExpressionTypeChangeHandler(new ExpressionTypeChangeHandler() {
-
- public void onExpressionTypeChanged(ExpressionTypeChangeEvent event) {
- System.out.println("type changed: " + event.getOldType() + " -> " + event.getNewType());
- }
- });
+
+ public void onExpressionTypeChanged(ExpressionTypeChangeEvent event) {
+ System.out.println("type changed: " + event.getOldType() + " -> " + event.getNewType());
+ }
+ });
builder.addOnModifiedCommand(new Command() {
public void execute() {
@@ -285,19 +302,49 @@
builder);
return ed;
}
-
+
/**
* Show a list of possibilities for the value type.
*/
private void showTypeChoice(Widget w,
final BaseSingleFieldConstraint con) {
+
+ /////////////////////
+ CustomFormConfiguration customFormConfiguration = WorkingSetManager.getInstance().getCustomFormConfiguration(modeller.getAsset().metaData.packageName, pattern.factType, fieldName);
+
+ if (customFormConfiguration != null) {
+ if (!(con instanceof SingleFieldConstraint)) {
+ Window.alert("Unexpected constraint type!");
+ return;
+ }
+ final CustomFormPopUp customFormPopUp = new CustomFormPopUp("images/newex_wiz.gif", constants.FieldValue(), customFormConfiguration);
+
+ final SingleFieldConstraint sfc = (SingleFieldConstraint) con;
+
+ customFormPopUp.addOkButtonHandler(new ClickHandler() {
+
+ public void onClick(ClickEvent event) {
+ sfc.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL);
+ sfc.setId(customFormPopUp.getFormId());
+ sfc.setValue(customFormPopUp.getFormValue());
+ doTypeChosen(customFormPopUp);
+ }
+ });
+
+ customFormPopUp.show(sfc.getId(), sfc.getValue());
+ return;
+ }
+
+ //////////////////////////
+
final FormStylePopup form = new FormStylePopup("images/newex_wiz.gif",
constants.FieldValue());
Button lit = new Button(constants.LiteralValue());
lit.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- con.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL);
+
+ public void onClick(ClickEvent event) {
+ con.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL);
doTypeChosen(form);
}
});
@@ -306,22 +353,23 @@
new InfoPopup(constants.LiteralValue(),
constants.LiteralValTip())));
- if (modeller.isTemplate()) {
- String templateKeyLabel = constants.TemplateKey();
- Button templateKeyButton = new Button(templateKeyLabel);
- templateKeyButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- con.setConstraintValueType(BaseSingleFieldConstraint.TYPE_TEMPLATE);
- doTypeChosen(form);
- }
- });
-
- form.addAttribute(templateKeyLabel + ":",
- widgets(templateKeyButton,
- new InfoPopup(templateKeyLabel,
- constants.LiteralValTip())));
+ if (modeller.isTemplate()) {
+ String templateKeyLabel = constants.TemplateKey();
+ Button templateKeyButton = new Button(templateKeyLabel);
+ templateKeyButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(ClickEvent event) {
+ con.setConstraintValueType(BaseSingleFieldConstraint.TYPE_TEMPLATE);
+ doTypeChosen(form);
+ }
+ });
+
+ form.addAttribute(templateKeyLabel + ":",
+ widgets(templateKeyButton,
+ new InfoPopup(templateKeyLabel,
+ constants.LiteralValTip())));
}
-
+
form.addRow(new HTML("<hr/>"));
form.addRow(new SmallLabel(constants.AdvancedOptions()));
@@ -333,9 +381,9 @@
FactPattern f = model.getBoundFact(var);
String fieldConstraint = model.getBindingType(var);
- if ((f != null && f.factType != null && this.fieldType != null)
- && (f.factType.equals(this.fieldType)
- || this.fieldType.equals(fieldConstraint))) {
+ if ((f != null && f.factType != null && this.fieldType != null)
+ && (f.factType.equals(this.fieldType)
+ || this.fieldType.equals(fieldConstraint))) {
foundABouncVariableThatMatches = true;
break;
} else {
@@ -351,7 +399,8 @@
if (foundABouncVariableThatMatches) {
Button variable = new Button(constants.BoundVariable());
variable.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
+
+ public void onClick(ClickEvent event) {
con.setConstraintValueType(SingleFieldConstraint.TYPE_VARIABLE);
doTypeChosen(form);
}
@@ -365,7 +414,8 @@
Button formula = new Button(constants.NewFormula());
formula.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
+
+ public void onClick(ClickEvent event) {
con.setConstraintValueType(SingleFieldConstraint.TYPE_RET_VALUE);
doTypeChosen(form);
}
@@ -378,7 +428,8 @@
Button expression = new Button(constants.ExpressionEditor());
expression.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
+
+ public void onClick(ClickEvent event) {
con.setConstraintValueType(SingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE);
doTypeChosen(form);
}
@@ -408,13 +459,12 @@
return panel;
}
- private void executeOnValueChangeCommand(){
- if (this.onValueChangeCommand != null){
+ private void executeOnValueChangeCommand() {
+ if (this.onValueChangeCommand != null) {
this.onValueChangeCommand.execute();
}
}
-
public boolean isDirty() {
return super.isDirty();
}
@@ -422,6 +472,4 @@
public void setOnValueChangeCommand(Command onValueChangeCommand) {
this.onValueChangeCommand = onValueChangeCommand;
}
-
-
}
Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/CustomFormPopUp.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/CustomFormPopUp.java (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/CustomFormPopUp.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -0,0 +1,109 @@
+package org.drools.guvnor.client.modeldriven.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.IFrameElement;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Frame;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import org.drools.factconstraints.client.customform.CustomFormConfiguration;
+import org.drools.guvnor.client.common.FormStylePopup;
+import org.drools.guvnor.client.messages.Constants;
+
+/**
+ *
+ * @author esteban
+ */
+public class CustomFormPopUp extends FormStylePopup{
+
+ private Constants constants = ((Constants) GWT.create(Constants.class));
+
+ private final CustomFormConfiguration configuration;
+ private final Button okButton;
+ private final Button cancelButton;
+ private Frame externalFrame;
+
+ public CustomFormPopUp(String image, String title, CustomFormConfiguration configuration) {
+ super(image, title);
+ this.configuration = configuration;
+
+
+
+ this.externalFrame = new Frame();
+ this.externalFrame.setWidth(configuration.getCustomFormWidth()+"px");
+ this.externalFrame.setHeight(configuration.getCustomFormHeight()+"px");
+// this.externalFrame.setWidth("100%");
+// this.externalFrame.setHeight("100%");
+
+ VerticalPanel vp = new VerticalPanel();
+ vp.setWidth("100%");
+ vp.setHeight("100%");
+ //vp.setHeight(configuration.getCustomFormHeight()+"px");
+ vp.add(this.externalFrame);
+
+ okButton = new Button(constants.OK());
+
+ //cancel button with default handler
+ cancelButton = new Button(constants.Cancel(),new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+
+
+ HorizontalPanel hp = new HorizontalPanel();
+ hp.setWidth("100%");
+ hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+ hp.add(okButton);
+ hp.add(cancelButton);
+
+ vp.add(hp);
+
+ this.addRow(vp);
+
+
+ }
+
+ public void addOkButtonHandler(ClickHandler handler){
+ this.okButton.addClickHandler(handler);
+ }
+
+ public void addCancelButtonHandler(ClickHandler handler){
+ this.cancelButton.addClickHandler(handler);
+ }
+
+ public void show(String selectedId, String selectedValue){
+
+
+ String url = configuration.getCustomFormURL();
+ if (url == null || url.trim().equals("")){
+ //TODO: show an error
+ return;
+ }else{
+ String parameters = "cf_id="+selectedId+"&cf_value="+selectedValue+"&factType="+this.configuration.getFactType()+"&fieldName="+this.configuration.getFieldName();
+ //advanced url parsing for adding attributes :P
+ url = url +(url.contains("?")?"&":"?")+parameters;
+ this.externalFrame.setUrl(url);
+ this.show();
+ }
+ }
+
+ private Element getExternalFrameElement(String id){
+ IFrameElement iframe = IFrameElement.as(this.externalFrame.getElement());
+ return iframe.getContentDocument().getElementById(id);
+ }
+
+ public String getFormId(){
+ return this.getExternalFrameElement("cf_id").getPropertyString("value");
+ }
+
+ public String getFormValue(){
+ return this.getExternalFrameElement("cf_value").getPropertyString("value");
+ }
+
+
+}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -31,6 +31,9 @@
import org.drools.guvnor.client.rpc.WorkingSetConfigData;
import com.google.gwt.user.client.Command;
+import java.util.ArrayList;
+import org.drools.factconstraints.client.customform.CustomFormConfiguration;
+import org.drools.factconstraints.client.helper.CustomFormsContainer;
/**
*
@@ -238,6 +241,39 @@
this.autoVerifierEnabled = autoVerifierEnabled;
}
+ /**
+ * Returns the associated CustomFormConfiguration for a given FactType and FieldName.
+ * Because CustomFormConfiguration is stored inside a WorkingSet, the
+ * packageName attribute is used to retrieve all the active WorkingSets.
+ * If more than one active WorkingSet contain a CustomFormConfiguration for
+ * the given FactType and FieldName the first to be found (in any specific
+ * nor deterministic order) will be returned.
+ * @param packageName the name of the package. Used to get the active
+ * working sets
+ * @param factType The short class name of the Fact Type
+ * @param fieldName The field name
+ * @return the associated CustomFormConfiguration for the given FactType and
+ * FieldName in the active working sets or null if any.
+ */
+ public CustomFormConfiguration getCustomFormConfiguration(String packageName, String factType, String fieldName){
+ Set<WorkingSetConfigData> packageWorkingSets = this.getActiveWorkingSets(packageName);
+ if (packageWorkingSets != null){
+ List<CustomFormConfiguration> configs = new ArrayList<CustomFormConfiguration>();
+ for (WorkingSetConfigData workingSetConfigData : packageWorkingSets) {
+ if (workingSetConfigData.customForms != null && !workingSetConfigData.customForms.isEmpty()){
+ configs.addAll(workingSetConfigData.customForms);
+ }
+ }
+ CustomFormsContainer cfc = new CustomFormsContainer(configs);
+ if (cfc.containsCustomFormFor(factType, fieldName)){
+ return cfc.getCustomForm(factType, fieldName);
+ }
+ }
+ return null;
+
+ }
+
+
}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CustomFormsEditorPanel.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CustomFormsEditorPanel.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CustomFormsEditorPanel.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -21,6 +21,7 @@
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
@@ -50,6 +51,8 @@
private ListBox factsCombo = new ListBox(false);
private ListBox fieldsCombo = new ListBox(false);
private TextBox customFormURL = new TextBox();
+ private TextBox customFormWidth = new TextBox();
+ private TextBox customFormHeight = new TextBox();
private boolean validFactsChanged = true;
private Map<String, ConstraintConfiguration> contraintsMap = new HashMap<String, ConstraintConfiguration>();
private final RuleAsset workingSet;
@@ -64,7 +67,9 @@
factsCombo.setVisibleItemCount(1);
fieldsCombo.setVisibleItemCount(1);
customFormURL.setWidth("400px");
- customFormURL.setTitle("Leave it blank if you want to remove the Custom Form URL");
+ customFormURL.setTitle("Leave it blank if you want to remove the Custom Form URL"); //TODO: I18N
+ customFormHeight.setWidth("50px");
+ customFormWidth.setWidth("50px");
factsCombo.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
@@ -95,6 +100,18 @@
Button btnUpdateURL = new Button(constants.OK(), new ClickHandler() {
public void onClick(ClickEvent event) {
+
+ int w;
+ int h;
+
+ try{
+ w = Integer.parseInt(customFormWidth.getText());
+ h = Integer.parseInt(customFormHeight.getText());
+ } catch (NumberFormatException ex){
+ Window.alert("Width and Height must be integer values!"); //TODO: I18N
+ return;
+ }
+
if (((WorkingSetConfigData) workingSet.content).customForms == null) {
((WorkingSetConfigData) workingSet.content).customForms = new ArrayList<CustomFormConfiguration>();
}
@@ -106,20 +123,25 @@
newCustomFormConfiguration.setFactType(factType);
newCustomFormConfiguration.setFieldName(fieldName);
newCustomFormConfiguration.setCustomFormURL(customFormURL.getText());
-
+ newCustomFormConfiguration.setCustomFormWidth(w);
+ newCustomFormConfiguration.setCustomFormHeight(h);
+
workingSetEditor.getCustomFormsContainer().putCustomForm(newCustomFormConfiguration);
((WorkingSetConfigData) workingSet.content).customForms = workingSetEditor.getCustomFormsContainer().getCustomForms();
}
});
- HorizontalPanel hp = new HorizontalPanel();
- hp.add(customFormURL);
- hp.add(btnUpdateURL);
-
- vp.add(hp);
+ vp.add(customFormURL);
+ vp.add(new SmallLabel("Width:"));
+ vp.add(customFormWidth);
+ vp.add(new SmallLabel("Height:"));
+ vp.add(customFormHeight);
table.setWidget(2, 0, vp);
+ table.setWidget(3, 0, btnUpdateURL);
+
+
fillSelectedFacts();
fillSelectedFactFields();
fillFieldConstrains();
@@ -167,9 +189,14 @@
contraintsMap.clear();
if (this.workingSetEditor.getCustomFormsContainer().containsCustomFormFor(factField, fieldName)){
- this.customFormURL.setText(this.workingSetEditor.getCustomFormsContainer().getCustomForm(factField, fieldName).getCustomFormURL());
+ CustomFormConfiguration customForm = this.workingSetEditor.getCustomFormsContainer().getCustomForm(factField, fieldName);
+ this.customFormURL.setText(customForm.getCustomFormURL());
+ this.customFormWidth.setText(String.valueOf(customForm.getCustomFormWidth()));
+ this.customFormHeight.setText(String.valueOf(customForm.getCustomFormHeight()));
}else{
this.customFormURL.setText("");
+ this.customFormWidth.setText("");
+ this.customFormHeight.setText("");
}
}
}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/WorkingSetEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/WorkingSetEditor.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/WorkingSetEditor.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -40,7 +40,6 @@
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import org.drools.factconstraints.client.customform.CustomFormConfiguration;
import org.drools.factconstraints.client.helper.CustomFormsContainer;
public class WorkingSetEditor extends Composite {
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/RepositoryServiceServlet.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/RepositoryServiceServlet.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/RepositoryServiceServlet.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -17,17 +17,17 @@
package org.drools.guvnor.server;
import java.io.IOException;
-import java.util.Set;
import javax.servlet.http.HttpServletResponse;
+import org.drools.guvnor.client.rpc.BulkTestRunResult;
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
-import org.drools.guvnor.client.rpc.AnalysisReport;
import org.drools.guvnor.client.rpc.RepositoryService;
-import org.drools.guvnor.client.rpc.RuleAsset;
import org.drools.guvnor.server.repository.MailboxService;
import org.drools.guvnor.server.repository.RepositoryStartupService;
import org.drools.guvnor.server.util.LoggingHelper;
import org.drools.guvnor.server.util.TestEnvironmentSessionHelper;
+import org.drools.repository.PackageItem;
import org.drools.repository.RulesRepository;
import org.drools.repository.RulesRepositoryException;
import org.jboss.seam.Component;
@@ -289,6 +289,11 @@
public org.drools.guvnor.client.rpc.SingleScenarioResult runScenario(java.lang.String p0, org.drools.ide.common.client.modeldriven.testing.Scenario p1) throws SerializationException {
return getService().runScenario( p0, p1);
}
+
+ public BulkTestRunResult runScenariosInPackage(PackageItem item) throws DetailedSerializationException, SerializationException {
+ return getService().runScenariosInPackage(item);
+ }
+
public org.drools.guvnor.client.rpc.BulkTestRunResult runScenariosInPackage(java.lang.String p0) throws SerializationException {
return getService().runScenariosInPackage( p0);
}
@@ -358,7 +363,7 @@
public org.drools.guvnor.client.rpc.SnapshotDiffs compareSnapshots(java.lang.String p0, java.lang.String p1, java.lang.String p2) {
return getService().compareSnapshots( p0, p1, p2);
}
-
+
}
Modified: labs/jbossrules/trunk/drools-ide-common/src/main/java/org/drools/ide/common/client/modeldriven/brl/SingleFieldConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-ide-common/src/main/java/org/drools/ide/common/client/modeldriven/brl/SingleFieldConstraint.java 2010-07-21 21:07:18 UTC (rev 34105)
+++ labs/jbossrules/trunk/drools-ide-common/src/main/java/org/drools/ide/common/client/modeldriven/brl/SingleFieldConstraint.java 2010-07-21 23:58:32 UTC (rev 34106)
@@ -16,7 +16,6 @@
package org.drools.ide.common.client.modeldriven.brl;
-
/**
* This represents a constraint on a fact - involving a SINGLE FIELD.
*
@@ -25,18 +24,21 @@
*/
public class SingleFieldConstraint extends BaseSingleFieldConstraint implements FieldConstraint {
- private String fieldBinding;
- private String fieldName;
- private String operator;
- private String fieldType;
- private FieldConstraint parent;
-
+ private String fieldBinding;
+ private String fieldName;
+ private String operator;
+ private String fieldType;
+ private FieldConstraint parent;
/**
* Used instead of "value" when constraintValueType = TYPE_EXPR_BUILDER.
* Esteban Aliverti
*/
private ExpressionFormLine expression = new ExpressionFormLine();
-
+ /**
+ * Used with "value" when using custom forms.
+ * Esteban Aliverti
+ */
+ private String id;
public ConnectiveConstraint[] connectives;
public SingleFieldConstraint(final String field, final String fieldType, final FieldConstraint parent) {
@@ -58,23 +60,23 @@
}
public void setFieldBinding(String fieldBinding) {
- this.fieldBinding = fieldBinding;
- }
+ this.fieldBinding = fieldBinding;
+ }
- public String getFieldBinding() {
- return fieldBinding;
- }
+ public String getFieldBinding() {
+ return fieldBinding;
+ }
- /**
+ /**
* This adds a new connective.
*
*/
public void addNewConnective() {
- if ( this.connectives == null ) {
+ if (this.connectives == null) {
this.connectives = new ConnectiveConstraint[]{new ConnectiveConstraint(this.getFieldName(), this.getFieldType(), null, null)};
} else {
final ConnectiveConstraint[] newList = new ConnectiveConstraint[this.connectives.length + 1];
- for ( int i = 0; i < this.connectives.length; i++ ) {
+ for (int i = 0; i < this.connectives.length; i++) {
newList[i] = this.connectives[i];
}
newList[this.connectives.length] = new ConnectiveConstraint(this.getFieldName(), this.getFieldType(), null, null);
@@ -86,7 +88,7 @@
* Returns true of there is a field binding.
*/
public boolean isBound() {
- return this.getFieldBinding() != null && this.getFieldBinding().length() > 0;
+ return this.getFieldBinding() != null && this.getFieldBinding().length() > 0;
}
public ExpressionFormLine getExpressionValue() {
@@ -97,35 +99,44 @@
this.expression = expression;
}
- public void setFieldName(String fieldName) {
- this.fieldName = fieldName;
- }
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
- public String getFieldName() {
- return fieldName;
- }
+ public String getFieldName() {
+ return fieldName;
+ }
- public void setOperator(String operator) {
- this.operator = operator;
- }
+ public void setOperator(String operator) {
+ this.operator = operator;
+ }
- public String getOperator() {
- return operator;
- }
+ public String getOperator() {
+ return operator;
+ }
- public void setFieldType(String fieldType) {
- this.fieldType = fieldType;
- }
+ public void setFieldType(String fieldType) {
+ this.fieldType = fieldType;
+ }
- public String getFieldType() {
- return fieldType;
- }
+ public String getFieldType() {
+ return fieldType;
+ }
- public void setParent(FieldConstraint parent) {
- this.parent = parent;
- }
+ public void setParent(FieldConstraint parent) {
+ this.parent = parent;
+ }
- public FieldConstraint getParent() {
- return parent;
- }
+ public FieldConstraint getParent() {
+ return parent;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
}
More information about the jboss-svn-commits
mailing list