congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DSLVariableValue
Code IndexAdd Tabnine to your IDE (free)

How to use
DSLVariableValue
in
org.drools.guvnor.models.commons.shared.rule

Best Java code snippets using org.drools.guvnor.models.commons.shared.rule.DSLVariableValue (Showing top 20 results out of 315)

origin: org.kie.guvnor/guvnor-guided-dtable-editor-client

private DSLVariableValue visitDSLVariableValue( DSLVariableValue value ) {
  DSLVariableValue clone = new DSLVariableValue();
  clone.setValue( value.getValue() );
  return clone;
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public void setValue( DSLVariableValue value ) {
  this.oldVariableValue = value;
  box.setText( value.getValue() );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public DSLVariableValue getSelectedValue() {
  int selectedIndex = resultWidget.getSelectedIndex();
  if ( selectedIndex != -1 ) {
    return new DSLVariableValue( resultWidget.getValue( selectedIndex ) );
  } else {
    return new DSLVariableValue( "" );
  }
}
origin: org.drools/drools-guvnor-models-commons

assertTrue( values.get( 0 ) instanceof DSLComplexVariableValue );
assertEquals( "rating",
       values.get( 0 ).getValue() );
assertEquals( "ENUM:Applicant.creditRating",
       ( (DSLComplexVariableValue) values.get( 0 ) ).getId() );
dsl.getValues().get( 0 ).setValue( "AA" );
origin: org.drools/drools-guvnor-models-commons

private DSLSentence toDSLSentence( List<String> dslPatterns,
                  String dslLine ) {
  DSLSentence dslSentence = new DSLSentence();
  for ( String dslPattern : dslPatterns ) {
    String regex = dslPattern.replaceAll( "\\{\\s*[\\:\\.\\w]+\\s*\\}", "(.*)" );
    Matcher m = Pattern.compile( regex ).matcher( dslLine );
    if ( m.matches() ) {
      dslSentence.setDefinition( dslPattern );
      for ( int i = 0; i < m.groupCount(); i++ ) {
        dslSentence.getValues().get( i ).setValue( m.group( i + 1 ) );
      }
      return dslSentence;
    }
  }
  dslSentence.setDefinition( dslLine );
  return dslSentence;
}
origin: org.drools/drools-guvnor-models-commons

/**
 * This will strip off any "{" stuff, substituting values accordingly
 */
public String interpolate() {
  getValues();
  if ( definition == null ) {
    return "";
  }
  int variableStart = definition.indexOf( "{" );
  if ( variableStart < 0 ) {
    return definition;
  }
  int index = 0;
  int variableEnd = 0;
  StringBuilder sb = new StringBuilder();
  while ( variableStart >= 0 ) {
    sb.append( definition.substring( variableEnd,
                     variableStart ) );
    variableEnd = getIndexForEndOfVariable( definition,
                        variableStart ) + 1;
    variableStart = definition.indexOf( "{",
                      variableEnd );
    sb.append( values.get( index++ ).getValue() );
  }
  if ( variableEnd < definition.length() ) {
    sb.append( definition.substring( variableEnd ) );
  }
  return sb.toString();
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

  public void valueChanged( String newText,
               String newValue ) {
    makeDirty();
    selectedValue = new DSLVariableValue( newValue );
    //When the value changes we need to reset the content of *ALL* DSLSentenceWidget drop-downs.
    //An improvement would be to determine the chain of dependent drop-downs and only update
    //children of the one whose value changes. However in reality DSLSentences only contain
    //a couple of drop-downs so it's quicker to simply update them all.
    updateEnumDropDowns();
  }
};
origin: org.drools/drools-guvnor-models-commons

@Test
public void testDSLExpansionLHS() {
  final String dslDefinition = "The credit rating is {rating:ENUM:Applicant.creditRating}";
  final String drlExpected =
      "rule \"r1\"\n" +
          "dialect \"mvel\"\n" +
          "when\n" +
          "The credit rating is AA\n" +
          "then\n" +
          "end";
  final DSLSentence dsl = new DSLSentence();
  dsl.setDefinition( dslDefinition );
  //The following line is normally performed by the UI when the user sets values
  dsl.getValues().get( 0 ).setValue( "AA" );
  //Append DSL to RuleModel to check marshalling
  final RuleModel m = new RuleModel();
  m.name = "r1";
  m.addLhsItem( dsl );
  final String drlActual = brlPersistence.marshal( m );
  assertEqualsIgnoreWhitespace( drlExpected,
                 drlActual );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public void refreshDropDownData() {
  resultWidget.setDropDownData( selectedValue.getValue(),
                 getDropDownData() );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

  public DSLVariableValue getSelectedValue() {
    String value = this.resultWidget.getSelectedIndex() == 0 ? "true" : "false";
    return new DSLVariableValue( value );
  }
}
origin: org.drools/drools-guvnor-models-commons

                    factAndField.length() );
fieldValueMap.put( field,
          values.get( iVariable ).getValue() );
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

  public DSLVariableValue getSelectedValue() {
    return new DSLVariableValue( resultWidget.getDateString() );
  }
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public Widget getBox( DSLVariableValue variableDef,
           String regex,
           boolean readonly ) {
  FieldEditor currentBox = new FieldEditor();
  currentBox.setVisibleLength( variableDef.getValue().length() + 1 );
  currentBox.setValue( variableDef );
  currentBox.setRestriction( regex );
  currentBox.box.setEnabled( !readonly );
  return currentBox;
}
origin: org.drools/drools-guvnor-models-commons

private DSLVariableValue parseValue( String variable ) {
  //if the variable doesn't have a ':', then it is considered as a 
  //simple value
  if ( !variable.contains( ":" ) ) {
    return new DSLVariableValue( variable );
  }
  //if it does containt a ':', then the part before it is considered
  //as the real value (used to create the final drl) and the part
  //after it is considered as an id
  String value = variable.substring( 0,
                    variable.indexOf( ":" ) );
  String id = variable.substring( variable.indexOf( ":" ) + 1 );
  return new DSLComplexVariableValue( id, value );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

resultWidget = new EnumDropDown( value.getValue(),
                 handler,
                 dropDownData );
origin: org.drools/drools-guvnor-models-commons

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addCurrentElementToCollection( HierarchicalStreamReader reader,
                       UnmarshallingContext context,
                       Collection collection,
                       Collection target ) {
  Object item = readItem( reader,
              context,
              collection );
  if ( item instanceof DSLVariableValue) {
    target.add( item );
  } else if ( item instanceof String ) {
    //The only other possible legacy type is a String, so using toString() should be OK
    DSLVariableValue value = new DSLVariableValue( item.toString() );
    target.add( value );
  }
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public DSLDateSelector( DSLVariableValue selectedDate,
            String dateFormat ) {
  resultWidget = new DatePickerLabel( selectedDate.getValue(),
                    dateFormat );
  resultWidget.addValueChanged( new ValueChanged() {
    public void valueChanged( String newValue ) {
      updateSentence();
      makeDirty();
    }
  } );
  //Wrap widget within a HorizontalPanel to add a space before and after the Widget
  HorizontalPanel hp = new HorizontalPanel();
  hp.add( new HTML( "&nbsp;" ) );
  hp.add( resultWidget );
  hp.add( new HTML( "&nbsp;" ) );
  initWidget( hp );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public DSLVariableValue getSelectedValue() {
  //if oldVariableValue was of type DSLComplexVariableValue, then return a
  //copy of it with only the 'value' part modified
  if ( oldVariableValue instanceof DSLComplexVariableValue) {
    return new DSLComplexVariableValue( ( (DSLComplexVariableValue) oldVariableValue ).getId(),
                      box.getText() );
  }
  return new DSLVariableValue( box.getText() );
}
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

  public void onClick( ClickEvent event ) {
    final CustomFormPopUp customFormPopUp =
        new CustomFormPopUp( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                   Constants.INSTANCE.FieldValue(),
                   DSLCustomFormButton.this.customFormConfiguration );
    customFormPopUp.addOkButtonHandler( new ClickHandler() {
      public void onClick( ClickEvent event ) {
        String id = customFormPopUp.getFormId();
        String value = customFormPopUp.getFormValue();
        btnCustomForm.setText( value );
        selectedValue = new DSLComplexVariableValue( id,
                               value );
        updateSentence();
        makeDirty();
        customFormPopUp.hide();
      }
    } );
    //if selectedValue is an instance of DSLComplexVariableValue,
    //then both id and value are passed to the custom form
    //if not, only the value is passed and "" is passed as id
    if ( selectedValue instanceof DSLComplexVariableValue ) {
      DSLComplexVariableValue complexSelectedValue = (DSLComplexVariableValue) selectedValue;
      customFormPopUp.show( complexSelectedValue.getId(),
                 complexSelectedValue.getValue() );
    } else {
      customFormPopUp.show( "",
                 selectedValue.getValue() );
    }
  }
} );
origin: org.kie.guvnor/guvnor-guided-rule-editor-client

public DSLCheckBox( String variableDef,
          DSLVariableValue value ) {
  resultWidget = new ListBox();
  resultWidget.addItem( "true" );
  resultWidget.addItem( "false" );
  if ( value.getValue().equalsIgnoreCase( "true" ) ) {
    resultWidget.setSelectedIndex( 0 );
  } else {
    resultWidget.setSelectedIndex( 1 );
  }
  resultWidget.addChangeHandler( new ChangeHandler() {
    public void onChange( ChangeEvent event ) {
      updateSentence();
      makeDirty();
    }
  } );
  resultWidget.setVisible( true );
  //Wrap widget within a HorizontalPanel to add a space before and after the Widget
  HorizontalPanel hp = new HorizontalPanel();
  hp.add( new HTML( "&nbsp;" ) );
  hp.add( resultWidget );
  hp.add( new HTML( "&nbsp;" ) );
  initWidget( hp );
}
org.drools.guvnor.models.commons.shared.ruleDSLVariableValue

Javadoc

This class represents the value of a simple variable inside a DSLSentence. "Simple variable" means that it only contains a single value.

Most used methods

  • getValue
  • <init>
  • setValue

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JTextField (javax.swing)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now