[jboss-svn-commits] JBL Code SVN: r31287 - labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jan 28 12:13:56 EST 2010
Author: eaa
Date: 2010-01-28 12:13:56 -0500 (Thu, 28 Jan 2010)
New Revision: 31287
Modified:
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/RuleModel.java
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/SingleFieldConstraint.java
Log:
Guided Editor:
RuleModel support the adition of IPattern/IAction in a specified position
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/RuleModel.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/RuleModel.java 2010-01-28 16:06:25 UTC (rev 31286)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/RuleModel.java 2010-01-28 17:13:56 UTC (rev 31287)
@@ -225,6 +225,14 @@
}
public void addLhsItem(final IPattern pat) {
+ this.addLhsItem(pat, true);
+ }
+
+ public void addLhsItem(final IPattern pat,boolean append) {
+ this.addLhsItem(pat, append?this.lhs.length:0);
+ }
+
+ public void addLhsItem(final IPattern pat,int position) {
if ( this.lhs == null ) {
this.lhs = new IPattern[0];
}
@@ -232,15 +240,30 @@
final IPattern[] list = this.lhs;
final IPattern[] newList = new IPattern[list.length + 1];
- for ( int i = 0; i < list.length; i++ ) {
- newList[i] = list[i];
+ for (int i = 0; i < newList.length; i++) {
+ if (i<position){
+ newList[i] = list[i];
+ }else if (i>position){
+ newList[i] = list[i-1];
+ }else{
+ newList[i]=pat;
+ }
+
}
- newList[list.length] = pat;
this.lhs = newList;
}
+
public void addRhsItem(final IAction action) {
+ this.addRhsItem(action, true);
+ }
+
+ public void addRhsItem(final IAction action,boolean append) {
+ this.addRhsItem(action, append?this.rhs.length:0);
+ }
+
+ public void addRhsItem(final IAction action,int position) {
if ( this.rhs == null ) {
this.rhs = new IAction[0];
}
@@ -248,10 +271,15 @@
final IAction[] list = this.rhs;
final IAction[] newList = new IAction[list.length + 1];
- for ( int i = 0; i < list.length; i++ ) {
- newList[i] = list[i];
+ for (int i = 0; i < newList.length; i++) {
+ if (i<position){
+ newList[i] = list[i];
+ }else if (i>position){
+ newList[i] = list[i-1];
+ }else{
+ newList[i]=action;
+ }
}
- newList[list.length] = action;
this.rhs = newList;
}
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/SingleFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/SingleFieldConstraint.java 2010-01-28 16:06:25 UTC (rev 31286)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/brl/SingleFieldConstraint.java 2010-01-28 17:13:56 UTC (rev 31287)
@@ -16,7 +16,8 @@
public FieldConstraint parent;
/**
- * Used instead of "value" when constraintValueType = TYPE_EXPR_BUILDER
+ * Used instead of "value" when constraintValueType = TYPE_EXPR_BUILDER.
+ * Eteban Aliverti
*/
private ExpressionFormLine expression = new ExpressionFormLine();
More information about the jboss-svn-commits
mailing list