@Override public void setContent( final Path path, final RuleModel model, final DataModelOracle dataModel, final boolean isReadOnly, final boolean isDSLEnabled ) { modeller = new RuleModeller( path, model, dataModel, new RuleModellerWidgetFactory(), localBus, isReadOnly, isDSLEnabled ); panel.add( this.modeller ); }
private void clearLinesIcons( int col ) { for ( int i = 0; i < layout.getRowCount(); i++ ) { this.clearLineIcons( i, col ); } }
public RuleModeller( final Path path, final RuleModel model, final DataModelOracle dataModel, final ModellerWidgetFactory widgetFactory, final RuleModellerConfiguration configuration, final EventBus eventBus, final boolean isReadOnly ) { this.path = path; this.model = model; this.dataModel = dataModel; this.widgetFactory = widgetFactory; this.configuration = configuration; this.eventBus = eventBus; this.isReadOnly = isReadOnly; doLayout(); }
@Override public boolean isDirty() { //The Modeller widget isn't set until after the content has been loaded from an asynchronous call to //the server. It is therefore possible that the User attempts to close the tab before Modeller is set return ( modeller == null ) ? false : modeller.getRuleModeller().isDirty(); }
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = modeller.getModel().getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.modeller.getModel().getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } //If the fieldTypes are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFieldType.equals( this.variableType ) ) { return true; } return false; }
public void onClick( ClickEvent event ) { if ( Window.confirm( Constants.INSTANCE.RemoveThisItem() ) ) { model.removeField( idx ); setModified( true ); getModeller().refreshWidget(); //Signal possible change in Template variables TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent( getModeller().getModel() ); getEventBus().fireEventFromSource( tvce, getModeller().getModel() ); } } } );
Boolean readOnly = this.lockRHS() ? true : null; RuleModellerWidget w = getWidgetFactory().getWidget( this, eventBus, action, w.addOnModifiedCommand( this.onWidgetModifiedCommand ); widget.add( wrapRHSWidget( model, i, w ) ); widget.add( spacerWidget() ); this.wrapLineNumber( i + 1, false ) ); layout.getFlexCellFormatter().setHorizontalAlignment( currentLayoutRow, final Image image = GuidedRuleEditorImages508.INSTANCE.Error(); image.setTitle( Constants.INSTANCE.InvalidPatternSectionDisabled() ); this.addLineIcon( currentLayoutRow, 0, image ); if ( !( this.lockRHS() || w.isReadOnly() ) ) { this.addActionsButtonsToLayout( Constants.INSTANCE.AddAnActionBelow(), new ClickHandler() {
Boolean readOnly = this.lockLHS() ? true : null; RuleModellerWidget w = getWidgetFactory().getWidget( this, eventBus, pattern, w.addOnModifiedCommand( this.onWidgetModifiedCommand ); vert.add( wrapLHSWidget( model, i, w ) ); vert.add( spacerWidget() ); this.wrapLineNumber( i + 1, true ) ); layout.getFlexCellFormatter().setHorizontalAlignment( currentLayoutRow, final Image image = GuidedRuleEditorImages508.INSTANCE.Error(); image.setTitle( Constants.INSTANCE.InvalidPatternSectionDisabled() ); this.addLineIcon( currentLayoutRow, 0, image ); if ( !( this.lockLHS() || w.isReadOnly() ) ) { this.addActionsButtonsToLayout( Constants.INSTANCE.AddAConditionBelow(), new ClickHandler() {
/** * Returns the completions. */ public DataModelOracle getCompletions() { return this.modeller.getSuggestionCompletions(); }
@Override public RuleModel getContent() { return modeller.getModel(); }
final CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration( this.getModeller().getPath(), factType, field ); editorReadOnly = !this.getModeller().getSuggestionCompletions().isFactTypeRecognized( factType );
final BaseSingleFieldConstraint con ) { CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration( modeller.getPath(), factType, fieldName ); if ( modeller.isTemplate() ) { String templateKeyLabel = Constants.INSTANCE.TemplateKey(); Button templateKeyButton = new Button( templateKeyLabel );
private void renderOptions( final int optionsRowIndex ) { layout.setWidget( optionsRowIndex, 2, new SmallLabel( Constants.INSTANCE.optionsRuleModeller() ) ); if ( !isReadOnly ) { layout.setWidget( optionsRowIndex, 4, getAddAttribute() ); } layout.setWidget( optionsRowIndex + 1, 3, new RuleAttributeWidget( this, this.model, isReadOnly ) ); }
CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration( modeller.getPath(), factType, fieldName );
private boolean isLHSFactTypeEquivalent( String boundVariable ) { String boundFactType = modeller.getModel().getLHSBoundFact( boundVariable ).getFactType(); //If the types are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFactType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( boundFactType, this.value.getField() ); return isEnumEquivalent( dd ); } //If the types are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFactType.equals( this.variableType ) ) { return true; } return false; }
private DataModelOracle getCompletionEngine() { return this.getModeller().getSuggestionCompletions(); }
public void onClick( ClickEvent event ) { if ( Window.confirm( Constants.INSTANCE.RemoveThisItem() ) ) { model.removeField( idx ); setModified( true ); getModeller().refreshWidget(); //Signal possible change in Template variables TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent( getModeller().getModel() ); getEventBus().fireEventFromSource( tvce, getModeller().getModel() ); } } } );
private RuleModel getRuleModel() { return this.getModeller().getModel(); }
private boolean isRHSFieldTypeEquivalent( String boundVariable ) { String boundFactType = modeller.getModel().getRHSBoundFact( boundVariable ).getFactType(); if ( boundFactType == null ) { return false; } if ( this.variableType == null ) { return false; } //If the types are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFactType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( boundFactType, this.value.getField() ); return isEnumEquivalent( dd ); } //If the types are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFactType.equals( this.variableType ) ) { return true; } return false; }
/** * Pops up the fact selector. */ protected void showConditionSelector( Integer position ) { RuleModellerConditionSelectorPopup popup = new RuleModellerConditionSelectorPopup( model, this, position, getSuggestionCompletions() ); popup.show(); }