@Override public ActionInsertFactFieldsPattern clonePattern() { ActionInsertFactFieldsPattern cloned = (ActionInsertFactFieldsPattern) super.clonePattern(); cloned.setInsertedLogically( isInsertedLogically ); return cloned; }
private ActionInsertFactFieldsPattern lookupExistingInsertFactPattern(final String boundName) { for (ActionInsertFactFieldsPattern p : patternToActionsMap.keySet()) { if (p.getBoundName().equals(boundName)) { return p; } } final ActionInsertFactFieldsPattern p = new ActionInsertFactFieldsPattern(); patternToActionsMap.put(p, new ArrayList<ActionInsertFactCol52>()); return p; }
@Override public List<BaseColumnFieldDiff> diff( BaseColumn otherColumn ) { if ( otherColumn == null ) { return null; } List<BaseColumnFieldDiff> result = super.diff( otherColumn ); ActionInsertFactFieldsPattern other = (ActionInsertFactFieldsPattern) otherColumn; // Field: isInsertedLogically. if ( this.isInsertedLogically() != other.isInsertedLogically() ) { result.add( new BaseColumnFieldDiffImpl( FIELD_IS_INSERTED_LOGICALLY, this.isInsertedLogically(), other.isInsertedLogically() ) ); } return result; }
@Override public void render( final Context context, final ActionInsertFactFieldsPattern value, final SafeHtmlBuilder sb ) { final String binding = value.getBoundName(); final StringBuilder b = new StringBuilder(); if ( binding == null || "".equals( binding ) ) { b.append( value.getFactType() ); } else { b.append( value.getBoundName() ); b.append( " : " ); b.append( value.getFactType() ); } sb.append( TEMPLATE.text( getCssStyleName( value ), b.toString() ) ); }
@Test public void testPatternsSelectionModel() throws Exception { verify(view.chosenPatternsContainer).add(chosenPatternsWidgetCaptor.capture()); patternSelectionModel = (MultiSelectionModel<ActionInsertFactFieldsPattern>) chosenPatternsWidgetCaptor.getValue().getSelectionModel(); pattern = new ActionInsertFactFieldsPattern(); pattern.setFactType("Message"); pattern.setBoundName("m"); patternSelectionModel.setSelected(pattern, true); assertTrue(patternSelectionModel.isSelected(pattern)); pattern.setInsertedLogically(true); assertTrue(patternSelectionModel.isSelected(pattern)); }
@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); } } }
@UiHandler(value = "btnAddFactTypes") public void btnAddFactTypesClick( final ClickEvent event ) { for ( String type : availableFactTypesSelections ) { ActionInsertFactFieldsPattern pattern = new ActionInsertFactFieldsPattern(); pattern.setFactType( type ); chosenPatterns.add( pattern ); presenter.addPattern( pattern ); } setChosenPatterns( chosenPatterns ); presenter.stateChanged(); }
private void chosenPatternsSelected( final Set<ActionInsertFactFieldsPattern> cps ) { btnRemoveFactTypes.setEnabled( cps.size() > 0 ); fieldDefinition.setVisible( false ); if ( cps.size() == 1 ) { chosenPatternsSelection = cps.iterator().next(); presenter.selectPattern( chosenPatternsSelection ); patternDefinition.setVisible( true ); validateBinding(); txtBinding.setEnabled( true ); txtBinding.setVisible( true ); txtBinding.setText( chosenPatternsSelection.getBoundName() ); chkLogicalInsert.setEnabled( true ); chkLogicalInsert.setVisible( true ); chkLogicalInsert.setValue( chosenPatternsSelection.isInsertedLogically() ); } else { chosenPatternsSelection = null; setAvailableFields( new ArrayList<AvailableField>() ); setChosenFields( new ArrayList<ActionInsertFactCol52>() ); patternDefinition.setVisible( false ); txtBinding.setEnabled( false ); txtBinding.setVisible( false ); txtBinding.setText( "" ); chkLogicalInsert.setEnabled( false ); chkLogicalInsert.setVisible( false ); } }
@Override public void onValueChange( final ValueChangeEvent<String> event ) { final String binding = txtBinding.getText(); chosenPatternsSelection.setBoundName( binding ); presenter.stateChanged(); validateBinding(); }
@Override public boolean hasEnums(final ActionInsertFactCol52 selectedAction) { for (Map.Entry<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> e : this.patternToActionsMap.entrySet()) { if (e.getValue().contains(selectedAction)) { final String factType = e.getKey().getFactType(); final String factField = selectedAction.getFactField(); return this.oracle.hasEnums(factType, factField); } } return false; }
@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); } } }
@UiHandler(value = "btnAddFactTypes") public void btnAddFactTypesClick( final ClickEvent event ) { for ( String type : availableFactTypesSelections ) { ActionInsertFactFieldsPattern pattern = new ActionInsertFactFieldsPattern(); pattern.setFactType( type ); chosenPatterns.add( pattern ); presenter.addPattern( pattern ); } setChosenPatterns( chosenPatterns ); presenter.stateChanged(); }
private void chosenPatternsSelected( final Set<ActionInsertFactFieldsPattern> cps ) { btnRemoveFactTypes.setEnabled( cps.size() > 0 ); fieldDefinition.setVisible( false ); if ( cps.size() == 1 ) { chosenPatternsSelection = cps.iterator().next(); presenter.selectPattern( chosenPatternsSelection ); patternDefinition.setVisible( true ); validateBinding(); txtBinding.setEnabled( true ); txtBinding.setVisible( true ); txtBinding.setText( chosenPatternsSelection.getBoundName() ); chkLogicalInsert.setEnabled( true ); chkLogicalInsert.setVisible( true ); chkLogicalInsert.setValue( chosenPatternsSelection.isInsertedLogically() ); } else { chosenPatternsSelection = null; setAvailableFields( new ArrayList<AvailableField>() ); setChosenFields( new ArrayList<ActionInsertFactCol52>() ); patternDefinition.setVisible( false ); txtBinding.setEnabled( false ); txtBinding.setVisible( false ); txtBinding.setText( "" ); chkLogicalInsert.setEnabled( false ); chkLogicalInsert.setVisible( false ); } }
@Override public void render( final Context context, final ActionInsertFactFieldsPattern value, final SafeHtmlBuilder sb ) { final String binding = value.getBoundName(); final StringBuilder b = new StringBuilder(); if ( binding == null || "".equals( binding ) ) { b.append( value.getFactType() ); } else { b.append( value.getBoundName() ); b.append( " : " ); b.append( value.getFactType() ); } sb.append( TEMPLATE.text( getCssStyleName( value ), b.toString() ) ); }
@Override public void onValueChange( final ValueChangeEvent<String> event ) { final String binding = txtBinding.getText(); chosenPatternsSelection.setBoundName( binding ); presenter.stateChanged(); validateBinding(); }
@Override public boolean hasEnums(final ActionInsertFactCol52 selectedAction) { for (Map.Entry<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> e : this.patternToActionsMap.entrySet()) { if (e.getValue().contains(selectedAction)) { final String factType = e.getKey().getFactType(); final String factField = selectedAction.getFactField(); return this.oracle.hasEnums(factType, factField); } } return false; }
@Override public void update( Pattern52 other ) { super.update( other ); setInsertedLogically( ( (ActionInsertFactFieldsPattern) other ).isInsertedLogically ); }
private ActionInsertFactFieldsPattern lookupExistingInsertFactPattern(final String boundName) { for (ActionInsertFactFieldsPattern p : patternToActionsMap.keySet()) { if (p.getBoundName().equals(boundName)) { return p; } } final ActionInsertFactFieldsPattern p = new ActionInsertFactFieldsPattern(); patternToActionsMap.put(p, new ArrayList<ActionInsertFactCol52>()); return p; }
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; } }
final String type = pattern.getFactType();