private void initialiseCEPWindow() { ddCEPWindow.addValueChangeHandler( new ValueChangeHandler<OperatorSelection>() { @Override public void onValueChange( final ValueChangeEvent<OperatorSelection> event ) { if ( chosenPatternSelection == null ) { return; } OperatorSelection selection = event.getValue(); String selected = selection.getValue(); chosenPatternSelection.getWindow().setOperator( selected ); } } ); }
public CEPWindowOperatorsDropdown( HasCEPWindow hcw, boolean isReadOnly ) { this(); this.isReadOnly = isReadOnly; setCEPWindow( hcw ); }
/** * Allow parent Widgets to register for events when the operator changes */ public HandlerRegistration addValueChangeHandler( ValueChangeHandler<OperatorSelection> handler ) { return addHandler( handler, ValueChangeEvent.getType() ); }
public void setCEPWindow( HasCEPWindow hcw ) { this.hcw = hcw; windowContainer.clear(); windowContainer.add( getDropDown() ); windowContainer.add( getOperatorExtension() ); }
private Widget createCEPWindowWidget( final HasCEPWindow c ) { HorizontalPanel hp = new HorizontalPanel(); Label lbl = new Label( Constants.INSTANCE.OverCEPWindow() ); lbl.setStyleName( "paddedLabel" ); hp.add( lbl ); cwo = new CEPWindowOperatorsDropdown( c, isReadOnly ); if ( !isReadOnly ) { cwo.addValueChangeHandler( new ValueChangeHandler<OperatorSelection>() { public void onValueChange( ValueChangeEvent<OperatorSelection> event ) { OperatorSelection selection = event.getValue(); String selected = selection.getValue(); c.getWindow().setOperator( selected ); } } ); } hp.add( cwo ); return hp; }
public void onClick( ClickEvent w ) { String[] val = pats.getValue( pats.getSelectedIndex() ).split( "\\s" ); editingPattern = model.getConditionPattern( val[ 1 ] ); //Clear Field and Operator when pattern changes editingCol.setFactField( null ); editingCol.setOperator( null ); //Set-up UI entryPointName.setText( editingPattern.getEntryPointName() ); cwo.selectItem( editingPattern.getWindow().getOperator() ); makeLimitedValueWidget(); makeDefaultValueWidget(); displayCEPOperators(); doPatternLabel(); doValueList(); doCalculationType(); pop.hide(); } } );
public CEPWindowOperatorsDropdown() { windowContainer.setStylePrimaryName( GuidedRuleEditorResources.INSTANCE.css().container() ); initWidget( windowContainer ); }
private void operatorChanged( OperatorSelection selection ) { parametersContainer.clear(); String operator = selection.getValue(); if ( CEPOracle.isCEPWindowOperatorTime( operator ) ) { AbstractRestrictedEntryTextBox txt = new CEPTimeParameterTextBox( hcw.getWindow(), 1 ); initialiseTextBox( txt ); } else if ( CEPOracle.isCEPWindowOperatorLength( operator ) ) { AbstractRestrictedEntryTextBox txt = new CEPLengthParameterTextBox( hcw.getWindow(), 1 ); initialiseTextBox( txt ); } else { parametersContainer.setVisible( false ); hcw.getWindow().clearParameters(); } }
/** * Select a given item in the drop-down * @param operator The DRL operator, not the HumanReadable form */ public void selectItem( String operator ) { String currentOperator = box.getValue( box.getSelectedIndex() ); if ( currentOperator.equals( operator ) ) { return; } for ( int i = 0; i < box.getItemCount(); i++ ) { String op = box.getValue( i ); if ( op.equals( operator ) ) { box.setSelectedIndex( i ); break; } } String selected = box.getValue( box.getSelectedIndex() ); String selectedText = box.getItemText( box.getSelectedIndex() ); OperatorSelection selection = new OperatorSelection( selected, selectedText ); operatorChanged( selection ); }
private Widget createCEPWindowWidget( final RuleModeller modeller, final HasCEPWindow c ) { if ( modeller.getSuggestionCompletions().isFactTypeAnEvent( pattern.getFactType() ) ) { HorizontalPanel hp = new HorizontalPanel(); Label lbl = new Label( HumanReadableConstants.INSTANCE.OverCEPWindow() ); lbl.setStyleName( "paddedLabel" ); hp.add( lbl ); CEPWindowOperatorsDropdown cwo = new CEPWindowOperatorsDropdown( c, readOnly ); if ( !this.isReadOnly() ) { cwo.addValueChangeHandler( new ValueChangeHandler<OperatorSelection>() { public void onValueChange( ValueChangeEvent<OperatorSelection> event ) { setModified( true ); OperatorSelection selection = event.getValue(); String selected = selection.getValue(); c.getWindow().setOperator( selected ); getModeller().makeDirty(); } } ); } hp.add( cwo ); return hp; } return new HTML(); }
selectItem( hcw.getWindow().getOperator() );
cwo.selectItem( editingPattern.getWindow().getOperator() ); makeLimitedValueWidget(); makeDefaultValueWidget();
private void chosenTypesSelected( final Set<Pattern52> ps ) { btnRemove.setEnabled( true ); if ( ps.size() == 1 ) { chosenPatternSelection = ps.iterator().next(); patternDefinition.setVisible( true ); validateBinding(); txtBinding.setEnabled( true ); txtBinding.setText( chosenPatternSelection.getBoundName() ); txtEntryPoint.setEnabled( true ); txtEntryPoint.setText( chosenPatternSelection.getEntryPointName() ); enableMoveUpButton(); enableMoveDownButton(); if ( presenter.isPatternEvent( chosenPatternSelection ) ) { ddCEPWindow.setCEPWindow( chosenPatternSelection ); cepWindowContainer.setVisible( true ); } else { cepWindowContainer.setVisible( false ); } } else { chosenPatternSelection = null; patternDefinition.setVisible( false ); txtBinding.setEnabled( false ); txtBinding.setText( "" ); txtEntryPoint.setEnabled( false ); txtEntryPoint.setText( "" ); btnMoveUp.setEnabled( false ); btnMoveDown.setEnabled( false ); cepWindowContainer.setVisible( false ); } }