[jboss-svn-commits] JBL Code SVN: r31288 - in labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client: modeldriven/ui and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jan 28 12:14:59 EST 2010
Author: eaa
Date: 2010-01-28 12:14:59 -0500 (Thu, 28 Jan 2010)
New Revision: 31288
Modified:
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.java
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.properties
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants_es_ES.properties
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/FromAccumulateCompositeFactPatternWidget.java
labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleModeller.java
Log:
Guided Editor:
IPattern/Actions can be added in any order now.
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.java 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.java 2010-01-28 17:14:59 UTC (rev 31288)
@@ -2018,4 +2018,16 @@
String MoveDown();
String Clean();
+
+ String Top();
+
+ String Bottom();
+
+ String Line0();
+
+ String PositionColon();
+
+ String ConditionPositionExplanation();
+
+ String ActionPositionExplanation();
}
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.properties
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.properties 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants.properties 2010-01-28 17:14:59 UTC (rev 31288)
@@ -961,4 +961,10 @@
Clean=Clean
MoveUp=Move up
MoveDown=Move down
-clickToAddPattern=click to add pattern...
\ No newline at end of file
+clickToAddPattern=click to add pattern...
+Top=Top
+Bottom=Bottom
+Line0=Line {0}
+PositionColon=Position:
+ConditionPositionExplanation=Select the position where the Condition will be added.
+ActionPositionExplanation=Select the position where the Action will be added.
\ No newline at end of file
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants_es_ES.properties
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants_es_ES.properties 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Constants_es_ES.properties 2010-01-28 17:14:59 UTC (rev 31288)
@@ -891,4 +891,10 @@
CreateInGlobalArea=Crear en el \u00E1rea global
TypeArchived=Archivado
TypeDeleted=Eliminado
-clickToAddPattern=click para agregar patr\u00F3n...
\ No newline at end of file
+clickToAddPattern=click para agregar patr\u00F3n...
+Top=Al principio
+Bottom=Al final
+Line0=L\u00EDnea {0}
+PositionColon=Posici\u00F3n:
+ConditionPositionExplanation=Seleccione la posici\u00F3n donde la Condici\u00F3n ser\u00E1 agregada.
+ActionPositionExplanation=Seleccione la posici\u00F3n donde la Acci\u00F3n ser\u00E1 agregada.
\ No newline at end of file
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ConstraintValueEditor.java 2010-01-28 17:14:59 UTC (rev 31288)
@@ -221,7 +221,7 @@
}
ExpressionBuilder builder = new ExpressionBuilder(this.modeller, ((SingleFieldConstraint)this.constraint).getExpression());
String msg = constants.ExpressionEditor();
- Widget ed = widgets( new HTML("="),
+ Widget ed = widgets( new HTML(" "),
builder );
return ed;
}
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/FromAccumulateCompositeFactPatternWidget.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/FromAccumulateCompositeFactPatternWidget.java 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/FromAccumulateCompositeFactPatternWidget.java 2010-01-28 17:14:59 UTC (rev 31288)
@@ -3,12 +3,12 @@
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.TabPanel;
import org.drools.guvnor.client.common.ClickableLabel;
import org.drools.guvnor.client.common.DirtyableFlexTable;
import org.drools.guvnor.client.common.DirtyableVerticalPane;
@@ -120,9 +120,14 @@
//panel.setWidget(r++, 0, codeTable);
+ Panel codePanel = new Panel();
+ codePanel.setAutoWidth(true);
+ codePanel.setClosable(false);
+ codePanel.setTitle("Custom Code");
+ codePanel.setAutoHeight(true);
+ codePanel.add(codeTable);
+ tPanel.add(codePanel);
- tPanel.add(codeTable, "Custom Code");
-
DirtyableFlexTable functionTable = new DirtyableFlexTable();
functionTable.setWidget(0, 0, new HTML("<div class='x-form-field'>Function:</div>"));
@@ -133,7 +138,13 @@
// panel.setWidget(r++, 0, functionTable);
- tPanel.add(functionTable, "Function");
+ Panel functionPanel = new Panel();
+ functionPanel.setAutoWidth(true);
+ functionPanel.setClosable(false);
+ functionPanel.setTitle("Function");
+ functionPanel.setAutoHeight(true);
+ functionPanel.add(functionTable);
+ tPanel.add(functionPanel);
ChangeListener changeListener = new ChangeListener() {
@@ -178,8 +189,13 @@
boolean useFunction = getFromAccumulatePattern().useFunctionOrCode().equals(FromAccumulateCompositeFactPattern.USE_FUNCTION);
- tPanel.selectTab(useFunction?1:0);
+ tPanel.setActiveTab(useFunction?1:0);
+ tPanel.setBorder(false);
+ tPanel.setBodyBorder(false);
+ tPanel.setWidth(200);
+
+
// functionTable.setVisible(useFunction);
// codeTable.setVisible(!useFunction);
Modified: labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleModeller.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleModeller.java 2010-01-28 17:13:56 UTC (rev 31287)
+++ labs/jbossrules/branches/guvnor_expressionEditor3_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleModeller.java 2010-01-28 17:14:59 UTC (rev 31288)
@@ -355,6 +355,14 @@
final Map<String, Command> cmds = new HashMap<String, Command>();
+ final ListBox positionCbo = new ListBox();
+ positionCbo.addItem(constants.Bottom(),String.valueOf(this.model.lhs.length));
+ positionCbo.addItem(constants.Top(),"0");
+ for (int i = 1; i < model.lhs.length; i++) {
+ positionCbo.addItem(Format.format(constants.Line0(), i),String.valueOf(i));
+ }
+
+
final ListBox choices = new ListBox(true);
//
@@ -367,7 +375,7 @@
choices.addItem(sen.toString(), key);
cmds.put(key, new Command() {
public void execute() {
- addNewDSLLhs(sen);
+ addNewDSLLhs(sen,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -388,7 +396,7 @@
choices.addItem(f + " ...", key);
cmds.put(key, new Command() {
public void execute() {
- addNewFact(f);
+ addNewFact(f,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -407,7 +415,7 @@
choices.addItem( HumanReadable.getCEDisplayName( ce ) + " ...", key );
cmds.put(key, new Command() {
public void execute() {
- addNewCE(ce);
+ addNewCE(ce,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -422,7 +430,7 @@
choices.addItem( HumanReadable.getCEDisplayName( ce ) + " ...", key );
cmds.put(key, new Command() {
public void execute() {
- addNewFCE(ce);
+ addNewFCE(ce,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -433,7 +441,7 @@
choices.addItem(constants.FreeFormDrl(), "FF");
cmds.put("FF", new Command() {
public void execute() {
- model.addLhsItem(new FreeFormLine());
+ model.addLhsItem(new FreeFormLine(),Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
refreshWidget();
popup.hide();
}
@@ -443,7 +451,7 @@
choices.addItem(constants.ExpressionEditor(), "EE");
cmds.put("EE", new Command() {
public void execute() {
- model.addLhsItem(new ExpressionFormLine());
+ model.addLhsItem(new ExpressionFormLine(),Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
refreshWidget();
popup.hide();
}
@@ -474,6 +482,12 @@
}
});
+ HorizontalPanel hp0 = new HorizontalPanel();
+ hp0.add(new HTML(constants.PositionColon()));
+ hp0.add(positionCbo);
+ hp0.add(new InfoPopup(constants.PositionColon(), constants.ConditionPositionExplanation()));
+ popup.addRow(hp0);
+
HorizontalPanel hp = new HorizontalPanel();
hp.add(choices);
Button b = new Button(constants.OK());
@@ -495,8 +509,8 @@
});
}
- protected void addNewDSLLhs(DSLSentence sentence) {
- model.addLhsItem( sentence.copy() );
+ protected void addNewDSLLhs(DSLSentence sentence,int position) {
+ model.addLhsItem( sentence.copy(),position );
refreshWidget();
}
@@ -506,6 +520,14 @@
popup.setWidth(-1);
popup.setTitle(constants.AddANewAction());
+ final ListBox positionCbo = new ListBox();
+ positionCbo.addItem(constants.Bottom(),String.valueOf(this.model.rhs.length));
+ positionCbo.addItem(constants.Top(),"0");
+ for (int i = 1; i < model.rhs.length; i++) {
+ positionCbo.addItem(Format.format(constants.Line0(), i),String.valueOf(i));
+ }
+
+
final ListBox choices = new ListBox(true);
final Map<String, Command> cmds = new HashMap<String, Command>();
@@ -529,7 +551,7 @@
choices.addItem(sentence, "DSL" + sentence); //NON-NLS
cmds.put("DSL" + sentence, new Command() { //NON-NLS
public void execute() {
- addNewDSLRhs(sen);
+ addNewDSLRhs(sen,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -549,7 +571,7 @@
choices.addItem(Format.format(constants.ChangeFieldValuesOf0(), v), "VAR" + v); //NON-NLS
cmds.put("VAR" + v, new Command() { //NON-NLS
public void execute() {
- addActionSetField(v);
+ addActionSetField(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -562,7 +584,7 @@
choices.addItem(Format.format(constants.ChangeFieldValuesOf0(), v), "GLOBVAR" + v); //NON-NLS
cmds.put("GLOBVAR" + v, new Command() { //NON-NLS
public void execute() {
- addActionSetField(v);
+ addActionSetField(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -576,7 +598,7 @@
choices.addItem(Format.format(constants.Retract0(), v), "RET" + v); //NON-NLS
cmds.put("RET" + v, new Command() { //NON-NLS
public void execute() {
- addRetract(v);
+ addRetract(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -590,7 +612,7 @@
choices.addItem(Format.format(constants.Modify0(), v), "MOD" + v); //NON-NLS
cmds.put("MOD" + v, new Command() { //NON-NLS
public void execute() {
- addModify(v);
+ addModify(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -605,7 +627,7 @@
choices.addItem(Format.format(constants.InsertFact0(), item), "INS" + item); //NON-NLS
cmds.put("INS" + item, new Command() { //NON-NLS
public void execute() {
- model.addRhsItem( new ActionInsertFact(item) );
+ model.addRhsItem( new ActionInsertFact(item),Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())) );
refreshWidget();
popup.hide();
}
@@ -617,7 +639,7 @@
choices.addItem(Format.format(constants.LogicallyInsertFact0(), item), "LINS" + item); //NON-NLS
cmds.put("LINS" + item, new Command() { //NON-NLS
public void execute() {
- model.addRhsItem( new ActionInsertLogicalFact(item) );
+ model.addRhsItem( new ActionInsertLogicalFact(item),Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())) );
refreshWidget();
popup.hide();
}
@@ -637,7 +659,7 @@
ActionGlobalCollectionAdd gca = new ActionGlobalCollectionAdd();
gca.globalName = glob;
gca.factName = var;
- model.addRhsItem(gca);
+ model.addRhsItem(gca,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
refreshWidget();
popup.hide();
}
@@ -650,7 +672,7 @@
choices.addItem(constants.AddFreeFormDrl(), "FF"); //NON-NLS
cmds.put("FF", new Command() { //NON-NLS
public void execute() {
- model.addRhsItem(new FreeFormLine());
+ model.addRhsItem(new FreeFormLine(),Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
refreshWidget();
popup.hide();
}
@@ -660,7 +682,7 @@
choices.addItem(Format.format(constants.CallMethodOn0(), v ), "GLOBCALL" + v); //NON-NLS
cmds.put("GLOBCALL" + v, new Command() { //NON-NLS
public void execute() {
- addCallMethod(v);
+ addCallMethod(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -674,7 +696,7 @@
choices.addItem(Format.format(constants.CallMethodOn0(), v ), "CALL" + v); //NON-NLS
cmds.put("CALL" + v, new Command() { //NON-NLS
public void execute() {
- addCallMethod(v);
+ addCallMethod(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
@@ -686,13 +708,20 @@
choices.addItem(Format.format(constants.CallMethodOn0(), v), "CALL" + v); //NON-NLS
cmds.put("CALL" + v, new Command() { //NON-NLS
public void execute() {
- addCallMethod(v);
+ addCallMethod(v,Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
popup.hide();
}
});
}
}
+
+ HorizontalPanel hp0 = new HorizontalPanel();
+ hp0.add(new HTML(constants.PositionColon()));
+ hp0.add(positionCbo);
+ hp0.add(new InfoPopup(constants.PositionColon(), constants.ActionPositionExplanation()));
+ popup.addRow(hp0);
+
HorizontalPanel hp = new HorizontalPanel();
final ClickListener cl = new ClickListener() {
public void onClick(Widget sender) {
@@ -722,37 +751,37 @@
choices.setFocus(true);
}
- protected void addModify(String itemText) {
- this.model.addRhsItem(new ActionUpdateField(itemText));
+ protected void addModify(String itemText,int position) {
+ this.model.addRhsItem(new ActionUpdateField(itemText),position);
refreshWidget();
}
- protected void addNewDSLRhs(DSLSentence sentence) {
- this.model.addRhsItem( sentence.copy() );
+ protected void addNewDSLRhs(DSLSentence sentence,int position) {
+ this.model.addRhsItem( sentence.copy(),position );
refreshWidget();
}
- protected void addRetract(String var) {
- this.model.addRhsItem( new ActionRetractFact(var) );
+ protected void addRetract(String var,int position) {
+ this.model.addRhsItem( new ActionRetractFact(var),position );
refreshWidget();
}
- protected void addActionSetField(String itemText) {
- this.model.addRhsItem(new ActionSetField(itemText));
+ protected void addActionSetField(String itemText,int position) {
+ this.model.addRhsItem(new ActionSetField(itemText),position);
refreshWidget();
}
- protected void addCallMethod(String itemText) {
- this.model.addRhsItem(new ActionCallMethod(itemText));
+ protected void addCallMethod(String itemText,int position) {
+ this.model.addRhsItem(new ActionCallMethod(itemText),position);
refreshWidget();
}
- protected void addNewCE(String s) {
- this.model.addLhsItem( new CompositeFactPattern(s) );
+ protected void addNewCE(String s,int position) {
+ this.model.addLhsItem( new CompositeFactPattern(s),position );
refreshWidget();
}
- protected void addNewFCE(String type) {
+ protected void addNewFCE(String type,int position) {
FromCompositeFactPattern p = null;
if (type.equals("from")){
p = new FromCompositeFactPattern();
@@ -762,15 +791,15 @@
p = new FromCollectCompositeFactPattern();
}
- this.model.addLhsItem(p);
+ this.model.addLhsItem(p,position);
refreshWidget();
}
/**
* Adds a fact to the model, and then refreshes the display.
*/
- protected void addNewFact(String itemText) {
- this.model.addLhsItem( new FactPattern(itemText) );
+ protected void addNewFact(String itemText,int position) {
+ this.model.addLhsItem( new FactPattern(itemText),position );
refreshWidget();
}
More information about the jboss-svn-commits
mailing list