@Test public void testShowFactTypeSelectorFactsNotInSamePackageAndImportedNumber() throws Exception { dataModelPayload.setPackageName(REDHAT_SUBPACKAGE); asyncPackageDataModelOracleFactory.makeAsyncPackageDataModelOracle( resourcePath, ruleModelWithImportedNumber, dataModelPayload); fromAccumulateWidget.showFactTypeSelector(); verify(listBox).addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); verify(listBox).addItem(Number.class.getSimpleName()); verify(listBox, times(2)).addItem(anyString()); }
@Override protected void showFactTypeSelector() { final ListBox box = GWT.create(ListBox.class); AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String[] facts = oracle.getFactTypes(); box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); for (int i = 0; i < facts.length; i++) { box.addItem(facts[i]); } box.setSelectedIndex(0); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern()); popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex()))); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); }
FromAccumulateCompositeFactPatternWidget extends FromCompositeFactPatternWidget { @Override protected void showFactTypeSelector() { final ListBox box = GWT.create(ListBox.class); AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String[] facts = oracle.getFactTypes(); box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); for (int i = 0; i < facts.length; i++) { box.addItem(facts[i]); } box.setSelectedIndex(0); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern()); popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex()))); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); } }
FromAccumulateCompositeFactPatternWidget extends FromCompositeFactPatternWidget { @Override protected void showFactTypeSelector() { final ListBox box = GWT.create(ListBox.class); AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String[] facts = oracle.getFactTypes(); box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); for (int i = 0; i < facts.length; i++) { box.addItem(facts[i]); } box.setSelectedIndex(0); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern()); popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex()))); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); } FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern,
                                                    Boolean readOnly);  FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern); }
FromAccumulateCompositeFactPatternWidget extends FromCompositeFactPatternWidget { @Override protected void showFactTypeSelector() { final ListBox box = GWT.create(ListBox.class); AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String[] facts = oracle.getFactTypes(); box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); for (int i = 0; i < facts.length; i++) { box.addItem(facts[i]); } box.setSelectedIndex(0); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern()); popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex()))); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); } FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern,
                                                    Boolean readOnly);  FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern);  }
FromAccumulateCompositeFactPatternWidget extends FromCompositeFactPatternWidget { @Override protected void showFactTypeSelector() { final ListBox box = GWT.create(ListBox.class); AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String[] facts = oracle.getFactTypes(); box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose()); for (int i = 0; i < facts.length; i++) { box.addItem(facts[i]); } box.setSelectedIndex(0); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern()); popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex()))); setModified(true); getModeller().refreshWidget(); popup.hide(); } }); popup.show(); } FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern,
                                                    Boolean readOnly);  FromAccumulateCompositeFactPatternWidget(RuleModeller modeller,
                                                    EventBus eventBus,
                                                    FromAccumulateCompositeFactPattern pattern);   }