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 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 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 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 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); } } }
@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); } } }
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 ); } }
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 ); } }
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; } }
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; } }