private ActionInsertFactCol52 cloneActionInsertColumn( ActionInsertFactCol52 col ) { ActionInsertFactCol52 clone = null; if ( col instanceof LimitedEntryActionInsertFactCol52 ) { clone = new LimitedEntryActionInsertFactCol52(); DTCellValue52 dcv = cloneLimitedEntryValue( ( (LimitedEntryCol) col ).getValue() ); ( (LimitedEntryCol) clone ).setValue( dcv ); } else { clone = new ActionInsertFactCol52(); } clone.setBoundName( col.getBoundName() ); clone.setType( col.getType() ); clone.setFactField( col.getFactField() ); clone.setFactType( col.getFactType() ); clone.setHeader( col.getHeader() ); clone.setValueList( col.getValueList() ); clone.setDefaultValue( new DTCellValue52( col.getDefaultValue() ) ); clone.setHideColumn( col.isHideColumn() ); clone.setInsertLogical( col.isInsertLogical() ); return clone; }
public InsertFactActionDetectorKey( ActionInsertFactCol52 actionCol ) { super( actionCol ); this.factType = actionCol.getFactType(); this.boundName = actionCol.getBoundName(); this.factField = actionCol.getFactField(); }
private void populateModelColumn( final ActionInsertFactCol52 col, final ActionInsertFactCol52 editingCol ) { col.setBoundName( editingCol.getBoundName() ); col.setType( editingCol.getType() ); col.setFactField( editingCol.getFactField() ); col.setHeader( editingCol.getHeader() ); col.setValueList( editingCol.getValueList() ); col.setDefaultValue( editingCol.getDefaultValue() ); col.setHideColumn( editingCol.isHideColumn() ); col.setFactType( editingCol.getFactType() ); col.setInsertLogical( editingCol.isInsertLogical() ); if ( col instanceof LimitedEntryCol && editingCol instanceof LimitedEntryCol ) { ( (LimitedEntryCol) col ).setValue( ( (LimitedEntryCol) editingCol ).getValue() ); } }
private void doPatternLabel() { if ( this.editingCol.getFactType() != null ) { this.patternLabel.setText( this.editingCol.getFactType() + " [" + editingCol.getBoundName() + "]" ); } }
private ActionInsertFactCol52 makeNewActionColumn( final AvailableField f ) { final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat(); if ( format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ) { final ActionInsertFactCol52 a = new ActionInsertFactCol52(); a.setBoundName( chosenPatternsSelection.getBoundName() ); a.setFactType( chosenPatternsSelection.getFactType() ); a.setFactField( f.getName() ); a.setType( f.getType() ); return a; } else { final LimitedEntryActionInsertFactCol52 a = new LimitedEntryActionInsertFactCol52(); a.setBoundName( chosenPatternsSelection.getBoundName() ); a.setFactType( chosenPatternsSelection.getFactType() ); a.setFactField( f.getName() ); a.setType( f.getType() ); return a; } }
dt.getActionCols().add( asf ); final ActionInsertFactCol52 ins = new ActionInsertFactCol52(); ins.setBoundName( "x" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); dt.getActionCols().add( ins ); final ActionInsertFactCol52 ins_ = new ActionInsertFactCol52(); ins_.setBoundName( "x" ); ins_.setFactField( "rating" ); ins_.setFactType( "Person" ); ins_.setValueList( "one,two,three" ); dt.getActionCols().add( ins_ ); assertTrue( oracle.hasEnums( ins.getFactType(), ins.getFactField() ) ); assertFalse( utils.hasValueList( ins ) ); r = oracle.getEnums( ins.getFactType(), ins.getFactField(), currentValueMap ).getFixedList(); assertEquals( 2, assertTrue( oracle.hasEnums( ins_.getFactType(), ins_.getFactField() ) ); assertTrue( utils.hasValueList( ins_ ) ); r = utils.getValueList( ins_ );
public void onClick( ClickEvent w ) { editingCol.setFactField( box.getItemText( box.getSelectedIndex() ) ); editingCol.setType( oracle.getFieldType( editingCol.getFactType(), editingCol.getFactField() ) ); makeLimitedValueWidget(); makeDefaultValueWidget(); doValueList(); doFieldLabel(); pop.hide(); } } );
a1.getBoundName() ); assertEquals( "Cheese", a1.getFactType() ); assertEquals( "price", a1.getFactField() ); assertEquals( DataType.TYPE_NUMERIC_INTEGER, a1.getType() );
if ( origColumn.isHideColumn() != editColumn.isHideColumn() ) { setColumnVisibility( origColumn, !editColumn.isHideColumn() ); if ( !isEqualOrNull( origColumn.getBoundName(), editColumn.getBoundName() ) ) { if ( !isEqualOrNull( origColumn.getFactType(), editColumn.getFactType() ) || !isEqualOrNull( origColumn.getFactField(), editColumn.getFactField() ) ) { bUpdateColumnData = true; bUpdateColumnDefinition = true; } else if ( !isEqualOrNull( origColumn.getFactType(), editColumn.getFactType() ) || !isEqualOrNull( origColumn.getFactField(), editColumn.getFactField() ) ) { bUpdateColumnData = true; bUpdateColumnDefinition = true; if ( !isEqualOrNull( origColumn.getValueList(), editColumn.getValueList() ) ) { bUpdateColumnDefinition = true; bUpdateColumnData = updateCellsForOptionValueList( editColumn, if ( !origColumn.getHeader().equals( editColumn.getHeader() ) ) { bUpdateColumnDefinition = true;
public void onClick( ClickEvent w ) { String[] val = pats.getValue( pats.getSelectedIndex() ).split( "\\s" ); // NON-NLS editingCol.setFactType( val[ 0 ] ); editingCol.setBoundName( val[ 1 ] ); editingCol.setFactField( null ); makeLimitedValueWidget(); makeDefaultValueWidget(); doPatternLabel(); doFieldLabel(); doValueList(); pop.hide(); } } );
private void doValueList() { if ( model.getTableFormat() == TableFormat.LIMITED_ENTRY ) { return; } //Don't show a Value List if either the Fact\Field is empty final String factType = editingCol.getFactType(); final String factField = editingCol.getFactField(); boolean enableValueList = !( ( factType == null || "".equals( factType ) ) || ( factField == null || "".equals( factField ) ) ); //Don't show a Value List if the Fact\Field has an enumeration if ( enableValueList ) { enableValueList = !oracle.hasEnums( factType, factField ); } valueListWidget.setEnabled( enableValueList ); if ( !enableValueList ) { valueListWidget.setText( "" ); } }
@Override public void makeResult( final GuidedDecisionTable52 model ) { //Copy actions to decision table model int fi = 1; for ( Map.Entry<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> ps : patternToActionsMap.entrySet() ) { final ActionInsertFactFieldsPattern p = ps.getKey(); if ( !getValidator().isPatternValid( p ) ) { String binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); while ( !getValidator().isPatternBindingUnique( p ) ) { binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); } } final String factType = p.getFactType(); final String boundName = p.getBoundName(); final boolean isLogicalInsert = p.isInsertedLogically(); for ( ActionInsertFactCol52 aif : ps.getValue() ) { aif.setFactType( factType ); aif.setBoundName( boundName ); aif.setInsertLogical( isLogicalInsert ); model.getActionCols().add( aif ); } } }
final String binding = baseActionColumn.getBoundName(); for ( ActionCol52 ac : this.model.getActionCols() ) { if ( ac instanceof ActionInsertFactCol52 ) { final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac; if ( aif.getBoundName().equals( binding ) ) { currentValueMap.put( aif.getFactField(), getValue( aif ) );
private boolean isValidFactField() { return !( editingCol.getFactField() == null || "".equals( editingCol.getFactField() ) ); }
private void makeDefaultValueWidget() { if ( model.getTableFormat() == TableFormat.LIMITED_ENTRY ) { return; } if ( nil( editingCol.getFactField() ) ) { setAttributeVisibility( defaultValueWidgetContainerIndex, false ); return; } setAttributeVisibility( defaultValueWidgetContainerIndex, true ); if ( editingCol.getDefaultValue() == null ) { editingCol.setDefaultValue( factory.makeNewValue( editingCol ) ); } //Ensure the Default Value has been updated to represent the column's //data-type. Legacy Default Values are all String-based and need to be //coerced to the correct type final DTCellValue52 defaultValue = editingCol.getDefaultValue(); final DataType.DataTypes dataType = utilities.getDataType( editingCol ); utilities.assertDTCellValue( dataType, defaultValue ); defaultValueWidgetContainer.setWidget( factory.getWidget( editingCol, defaultValue ) ); }
public void onClick( ClickEvent arg0 ) { if ( oracle.isGlobalVariable( editingCol.getBoundName() ) ) { cb.setEnabled( false ); editingCol.setInsertLogical( false ); } else { editingCol.setInsertLogical( cb.getValue() ); } } } );
private ActionInsertFactCol52 makeNewActionInsertColumn() { switch ( model.getTableFormat() ) { case LIMITED_ENTRY: return new LimitedEntryActionInsertFactCol52(); default: return new ActionInsertFactCol52(); } }
private boolean isValidFactType() { return !( editingCol.getFactType() == null || "".equals( editingCol.getFactType() ) ); }
public void onChange( ChangeEvent event ) { editingCol.setFactField( box.getText() ); } } );
@Override public void initialise() { view.init( this ); view.setValidator( getValidator() ); patternToActionsMap.clear(); //Set-up validator for the pattern-to-action mapping voodoo getValidator().setPatternToActionInsertFactFieldsMap( patternToActionsMap ); //Set-up a factory for value editors view.setDTCellValueWidgetFactory( DTCellValueWidgetFactory.getInstance( model, oracle, false, allowEmptyValues() ) ); //Available types final List<String> availableTypes = Arrays.asList( oracle.getFactTypes() ); view.setAvailableFactTypes( availableTypes ); //Existing ActionInsertFactCols (should be empty for a new Decision Table) for ( ActionCol52 a : model.getActionCols() ) { if ( a instanceof ActionInsertFactCol52 ) { final ActionInsertFactCol52 aif = (ActionInsertFactCol52) a; final ActionInsertFactFieldsPattern p = lookupExistingInsertFactPattern( aif.getBoundName() ); final List<ActionInsertFactCol52> actions = patternToActionsMap.get( p ); getValidator().addActionPattern( p ); actions.add( aif ); } } view.setChosenPatterns( new ArrayList<ActionInsertFactFieldsPattern>() ); view.setAvailableFields( new ArrayList<AvailableField>() ); view.setChosenFields( new ArrayList<ActionInsertFactCol52>() ); content.setWidget( view ); }