[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-2245) Guided Editor in BRMS always shows DSL sentences completely separated from fact patterns - but original input order is required in certain situations.

Esteban Aliverti (JIRA) jira-events at lists.jboss.org
Mon Jun 14 07:48:46 EDT 2010


     [ https://jira.jboss.org/browse/JBRULES-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteban Aliverti resolved JBRULES-2245.
---------------------------------------

    Fix Version/s: 5.1.0.M2
       Resolution: Done


You can put a DSL in the place you want now. In fact, now you are allowed to move a pattern (whether it is a DSL or not) after you inserted it in the Guided Editor.

> Guided Editor in BRMS always shows DSL sentences completely separated from fact patterns - but original input order is required in certain situations.
> ------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-2245
>                 URL: https://jira.jboss.org/browse/JBRULES-2245
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-guvnor
>    Affects Versions: 5.0.1.FINAL
>            Reporter: Gunnar von der Beck
>            Assignee: Mark Proctor
>            Priority: Minor
>             Fix For: 5.1.0.M2
>
>         Attachments: RuleModeller.java, screenshot.guided-editor.jpeg
>
>
> When building custom DSL snippets for expressions like "over window:time(...)" or "over window:length(...)" i would like to give the user the option to mix these DSL snippets with facts by using the guided editor in the BRMS. Especially these DSL snippets must be placed directly after a fact pattern, e.g. "Product( ... ) over window:time(30d)". Therefore they only make sense in a context behind a fact definition.
> But the guided editor in Guvnor always places DSL sentences on the bottom of the left hand side - totally separated from the rest (not in the generated code, but in the GUI-View). So in more complex situations the user might loose the context of his DSL-like-input. 
> Anyway I think that the preferred way of presenting the users input would be to leave the original input order as is.
> So here is my solution - a minor change in org.drools.guvnor.client.modeldriven.ui.RuleModeller. You might want to adopt it if you think this is a good idea.
> {code:title=RuleModeller.java|borderStyle=solid}
> package org.drools.guvnor.client.modeldriven.ui;
> ...
> public class RuleModeller extends DirtyableComposite {
> ...
>     /**
>      * Builds all the condition widgets.
>      */
>     private Widget renderLhs(final RuleModel model) {
>         DirtyableVerticalPane vert = new DirtyableVerticalPane();
>         IPattern lastPattern = null;
>         for ( int i = 0; i < model.lhs.length; i++ ) {
>             IPattern pattern = model.lhs[i];
>             // start new code
>             // insert spacer when switching from DSL sentence to other pattern
>             if (lastPattern != null &&
>             		(lastPattern instanceof DSLSentence)
>             		&& (!(pattern instanceof DSLSentence))) {
>                 vert.add( spacerWidget() );
>             }
>             lastPattern = pattern;
>             // end new code
>             Widget w = null;
>             if (pattern instanceof FactPattern) {
>                 w = new FactPatternWidget(this, pattern, completions, true) ;
>                 vert.add( wrapLHSWidget( model,
>                               i,
>                               w ) );
>                 vert.add( spacerWidget() );
>             } else if (pattern instanceof CompositeFactPattern) {
>                 w = new CompositeFactPatternWidget(this, (CompositeFactPattern) pattern, completions) ;
>                 vert.add( wrapLHSWidget( model, i, w ));
>                 vert.add( spacerWidget() );
>             } else if (pattern instanceof DSLSentence) {
>                 // start new code: do not ignore DSL sentences any more
>                 w = new DSLSentenceWidget((DSLSentence) pattern,completions);
>                 vert.add( wrapLHSWidget( model, i, w ) );
>                 vert.setStyleName( "model-builderInner-Background" ); //NON-NLS
>                 // end new code 
>             } else if (pattern instanceof FreeFormLine){
>             	final FreeFormLine ffl = (FreeFormLine) pattern;
>             	final TextBox tb = new TextBox();
>             	tb.setText(ffl.text);
>             	tb.setTitle(constants.ThisIsADrlExpressionFreeForm());
>             	tb.addChangeListener(new ChangeListener() {
>             		public void onChange(Widget arg0) {
>             			ffl.text = tb.getText();
> 					}
>             	});
>             	vert.add(wrapLHSWidget(model, i, tb));
>             	vert.add( spacerWidget() );
>             } else {
>                 throw new RuntimeException("I don't know what type of pattern that is.");
>             }
>             // removed the second extra loop for DSLSentence patterns: integrated above
>         }
>         return vert;
>     }
> ...
> }
> {code}
> This would give the end user a lot more options building rules with the guided editor - especially when mixing prepared DSL sentences with Fact patterns.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list