target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testEnableDropdownMode() { nativeSelect.classList = mock(DOMTokenList.class); view.enableDropdownMode(); verify(nativeSelect.classList).remove(HIDDEN_CSS_CLASS); verify(dropdown).selectpicker("show"); }
@Override public void enableDropdownMode() { nativeSelect.classList.remove(HIDDEN_CSS_CLASS); dropdown().selectpicker("show"); }
KogitoKieAssetsDropdownView extends KieAssetsDropdownView implements KogitoKieAssetsDropdown.View { @Override public void enableDropdownMode() { nativeSelect.classList.remove(HIDDEN_CSS_CLASS); dropdown().selectpicker("show"); } }
KogitoKieAssetsDropdownView extends KieAssetsDropdownView implements KogitoKieAssetsDropdown.View { @Override public void enableDropdownMode() { nativeSelect.classList.remove(HIDDEN_CSS_CLASS); dropdown().selectpicker("show"); } @Inject KogitoKieAssetsDropdownView(final HTMLSelectElement nativeSelect, final HTMLOptionElement htmlOptionElement, final TranslationService translationService); }
KogitoKieAssetsDropdownView extends KieAssetsDropdownView implements KogitoKieAssetsDropdown.View { @Override public void enableDropdownMode() { nativeSelect.classList.remove(HIDDEN_CSS_CLASS); dropdown().selectpicker("show"); } @Inject KogitoKieAssetsDropdownView(final HTMLSelectElement nativeSelect, final HTMLOptionElement htmlOptionElement, final TranslationService translationService); @Override void initialize(); @Override String getValue(); @Override void enableDropdownMode(); }
KogitoKieAssetsDropdownView extends KieAssetsDropdownView implements KogitoKieAssetsDropdown.View { @Override public void enableDropdownMode() { nativeSelect.classList.remove(HIDDEN_CSS_CLASS); dropdown().selectpicker("show"); } @Inject KogitoKieAssetsDropdownView(final HTMLSelectElement nativeSelect, final HTMLOptionElement htmlOptionElement, final TranslationService translationService); @Override void initialize(); @Override String getValue(); @Override void enableDropdownMode(); }
@Test public void testCallbackWithDefaultCommand() { CommandWithThrowableDrivenErrorCallback callback = new CommandWithThrowableDrivenErrorCallback(hasBusyIndicator, commands, defaultCommand); callback.error(message, new RuntimeException()); verify(runtimeException).execute(any()); verify(nullPointerException, never()).execute(any()); verify(defaultCommand, never()).execute(any()); verify(hasBusyIndicator, never()).hideBusyIndicator(); callback.error(message, new NullPointerException()); verify(runtimeException).execute(any()); verify(nullPointerException).execute(any()); verify(defaultCommand, never()).execute(any()); verify(hasBusyIndicator, never()).hideBusyIndicator(); callback.error(message, new Exception()); verify(runtimeException).execute(any()); verify(nullPointerException).execute(any()); verify(defaultCommand).execute(any()); verify(hasBusyIndicator, never()).hideBusyIndicator(); }
@Override public boolean error(final Message message, final Throwable throwable) { final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) { if (e.getKey().getName().equals(_throwable.getClass().getName())) { e.getValue().execute(_throwable); return false; } } if (defaultCommand != null) { defaultCommand.execute(throwable); return false; } return super.error(message, throwable); }
CommandWithThrowableDrivenErrorCallback extends HasBusyIndicatorDefaultErrorCallback { @Override public boolean error(final Message message, final Throwable throwable) { final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) { if (e.getKey().getName().equals(_throwable.getClass().getName())) { e.getValue().execute(_throwable); return false; } } if (defaultCommand != null) { defaultCommand.execute(throwable); return false; } return super.error(message, throwable); } }
CommandWithThrowableDrivenErrorCallback extends HasBusyIndicatorDefaultErrorCallback { @Override public boolean error(final Message message, final Throwable throwable) { final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) { if (e.getKey().getName().equals(_throwable.getClass().getName())) { e.getValue().execute(_throwable); return false; } } if (defaultCommand != null) { defaultCommand.execute(throwable); return false; } return super.error(message, throwable); } CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands); CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands, final CommandWithThrowable defaultCommand); CommandWithThrowableDrivenErrorCallback(HasBusyIndicator view, CommandWithThrowable defaultCommand); }
CommandWithThrowableDrivenErrorCallback extends HasBusyIndicatorDefaultErrorCallback { @Override public boolean error(final Message message, final Throwable throwable) { final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) { if (e.getKey().getName().equals(_throwable.getClass().getName())) { e.getValue().execute(_throwable); return false; } } if (defaultCommand != null) { defaultCommand.execute(throwable); return false; } return super.error(message, throwable); } CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands); CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands, final CommandWithThrowable defaultCommand); CommandWithThrowableDrivenErrorCallback(HasBusyIndicator view, CommandWithThrowable defaultCommand); @Override boolean error(final Message message, final Throwable throwable); }
CommandWithThrowableDrivenErrorCallback extends HasBusyIndicatorDefaultErrorCallback { @Override public boolean error(final Message message, final Throwable throwable) { final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) { if (e.getKey().getName().equals(_throwable.getClass().getName())) { e.getValue().execute(_throwable); return false; } } if (defaultCommand != null) { defaultCommand.execute(throwable); return false; } return super.error(message, throwable); } CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands); CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view, final Map<Class<? extends Throwable>, CommandWithThrowable> commands, final CommandWithThrowable defaultCommand); CommandWithThrowableDrivenErrorCallback(HasBusyIndicator view, CommandWithThrowable defaultCommand); @Override boolean error(final Message message, final Throwable throwable); }
@Test public void success() throws Exception { assetValidatedCallback.callback(new ArrayList<>()); Mockito.verify(notificationEvent).fire(notificationEventArgumentCaptor.capture()); assertEquals("ItemValidatedSuccessfully", notificationEventArgumentCaptor.getValue().getNotification()); assertEquals(NotificationEvent.NotificationType.SUCCESS, notificationEventArgumentCaptor.getValue().getType()); verify(validationPopup, never()).showMessages(anyList()); verify(validationFinishedCommand).execute(); }
@Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); @Override void callback(final List<ValidationMessage> validationMessages); }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); @Override void callback(final List<ValidationMessage> validationMessages); }
@Test public void failure() throws Exception { final ArrayList<ValidationMessage> validationMessages = new ArrayList<>(); validationMessages.add(mock(ValidationMessage.class)); assetValidatedCallback.callback(validationMessages); Mockito.verify(notificationEvent, never()).fire(notificationEventArgumentCaptor.capture()); verify(validationPopup).showMessages(validationMessages); verify(validationFinishedCommand).execute(); }
@Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); @Override void callback(final List<ValidationMessage> validationMessages); }
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand, final Event<NotificationEvent> notificationEvent, final ValidationPopup validationPopup); @Override void callback(final List<ValidationMessage> validationMessages); }
@Test public void testInit() { cardsGrid.init(); verify(view).init(cardsGrid); }
@PostConstruct void init() { view.init(this); }
CardsGridComponent { @PostConstruct void init() { view.init(this); } }
CardsGridComponent { @PostConstruct void init() { view.init(this); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); }
CardsGridComponent { @PostConstruct void init() { view.init(this); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
CardsGridComponent { @PostConstruct void init() { view.init(this); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
@Test public void testSetupCards() { final CardComponent card1 = mock(CardComponent.class); final CardComponent card2 = mock(CardComponent.class); final CardFrameComponent frame1 = mock(CardFrameComponent.class); final CardFrameComponent frame2 = mock(CardFrameComponent.class); final HTMLElement htmlElement1 = mock(HTMLElement.class); final HTMLElement htmlElement2 = mock(HTMLElement.class); final List<CardComponent> cards = asList(card1, card2); when(frames.get()).thenReturn(frame1, frame2); when(frame1.getElement()).thenReturn(htmlElement1); when(frame2.getElement()).thenReturn(htmlElement2); cardsGrid.setupCards(cards); verify(cardsGrid).setCardFrames(asList(frame1, frame2)); verify(frame1).initialize(cardsGrid, card1); verify(frame2).initialize(cardsGrid, card2); verify(view).clearGrid(); verify(view).appendCard(htmlElement1); verify(view).appendCard(htmlElement2); }
public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
@Test public void testCloneWhenSourceIsTextAnnotation() { final TextAnnotation source = buildTextAnnotation(); final TextAnnotation cloned = dmnDeepCloneProcess.clone(source, new TextAnnotation()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getText().getValue()).isEqualTo(TEXT_DATA + FIRST_INDEX_IN_SUFFIX); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testGetSearchType() { assertEquals(REGEXP, indexTerm.getSearchType()); }
@Override public TermSearchType getSearchType() { return REGEXP; }
DMNValueFileExtensionIndexTerm implements ValueIndexTerm { @Override public TermSearchType getSearchType() { return REGEXP; } }
DMNValueFileExtensionIndexTerm implements ValueIndexTerm { @Override public TermSearchType getSearchType() { return REGEXP; } }
DMNValueFileExtensionIndexTerm implements ValueIndexTerm { @Override public TermSearchType getSearchType() { return REGEXP; } @Override String getTerm(); @Override String getValue(); @Override TermSearchType getSearchType(); }
DMNValueFileExtensionIndexTerm implements ValueIndexTerm { @Override public TermSearchType getSearchType() { return REGEXP; } @Override String getTerm(); @Override String getValue(); @Override TermSearchType getSearchType(); }
@Test public void testGetModelsPaths() { final Path path1 = mock(Path.class); final Path path2 = mock(Path.class); final List<Path> expectedPaths = asList(path1, path2); when(pathsHelper.getModelsPaths(workspaceProject)).thenReturn(expectedPaths); final List<Path> actualPaths = service.getModelsPaths(workspaceProject); assertEquals(expectedPaths, actualPaths); }
@Override public List<Path> getModelsPaths(final WorkspaceProject workspaceProject) { return pathsHelper.getModelsPaths(workspaceProject); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public List<Path> getModelsPaths(final WorkspaceProject workspaceProject) { return pathsHelper.getModelsPaths(workspaceProject); } }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public List<Path> getModelsPaths(final WorkspaceProject workspaceProject) { return pathsHelper.getModelsPaths(workspaceProject); } @Inject DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory, final DMNIOHelper dmnIOHelper, final DMNPathsHelper pathsHelper, final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public List<Path> getModelsPaths(final WorkspaceProject workspaceProject) { return pathsHelper.getModelsPaths(workspaceProject); } @Inject DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory, final DMNIOHelper dmnIOHelper, final DMNPathsHelper pathsHelper, final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); @Override String getContent(final Path path); @Override DMNContentResource getProjectContent(final Path path, final String defSetId); @Override void saveContent(final Path path, final String content, final Metadata metadata, final String comment); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override PMMLDocumentMetadata loadPMMLDocumentMetadata(final Path path); @Override String getSource(final Path path); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public List<Path> getModelsPaths(final WorkspaceProject workspaceProject) { return pathsHelper.getModelsPaths(workspaceProject); } @Inject DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory, final DMNIOHelper dmnIOHelper, final DMNPathsHelper pathsHelper, final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); @Override String getContent(final Path path); @Override DMNContentResource getProjectContent(final Path path, final String defSetId); @Override void saveContent(final Path path, final String content, final Metadata metadata, final String comment); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override PMMLDocumentMetadata loadPMMLDocumentMetadata(final Path path); @Override String getSource(final Path path); }
@Test public void testSetupCardsWhenCardsListIsEmptyAndEmptyStateElementIsNotPresent() { cardsGrid.setupCards(emptyList()); verify(view).clearGrid(); verifyNoMoreInteractions(view); }
public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
CardsGridComponent { public void setupCards(final List<CardComponent> cards) { setCardFrames(asFrames(cards)); getView().clearGrid(); asElements(getCardFrames()).forEach(getView()::appendCard); setupEmptyState(getCardFrames().isEmpty()); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
@Test public void testEnableReadOnlyModeForAllCards() { final CardFrameComponent frame1 = mock(CardFrameComponent.class); final CardFrameComponent frame2 = mock(CardFrameComponent.class); final List<CardFrameComponent> cardFrames = asList(frame1, frame2); doReturn(cardFrames).when(cardsGrid).getCardFrames(); cardsGrid.enableReadOnlyModeForAllCards(); verify(frame1).enableReadOnlyMode(); verify(frame2).enableReadOnlyMode(); }
public void enableReadOnlyModeForAllCards() { getCardFrames().forEach(CardFrameComponent::enableReadOnlyMode); }
CardsGridComponent { public void enableReadOnlyModeForAllCards() { getCardFrames().forEach(CardFrameComponent::enableReadOnlyMode); } }
CardsGridComponent { public void enableReadOnlyModeForAllCards() { getCardFrames().forEach(CardFrameComponent::enableReadOnlyMode); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); }
CardsGridComponent { public void enableReadOnlyModeForAllCards() { getCardFrames().forEach(CardFrameComponent::enableReadOnlyMode); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
CardsGridComponent { public void enableReadOnlyModeForAllCards() { getCardFrames().forEach(CardFrameComponent::enableReadOnlyMode); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
@Test public void testGetElement() { final HTMLElement expectedElement = mock(HTMLElement.class); when(view.getElement()).thenReturn(expectedElement); final HTMLElement actualElement = cardsGrid.getElement(); assertEquals(expectedElement, actualElement); }
public HTMLElement getElement() { return view.getElement(); }
CardsGridComponent { public HTMLElement getElement() { return view.getElement(); } }
CardsGridComponent { public HTMLElement getElement() { return view.getElement(); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); }
CardsGridComponent { public HTMLElement getElement() { return view.getElement(); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
CardsGridComponent { public HTMLElement getElement() { return view.getElement(); } @Inject CardsGridComponent(final View view, final ManagedInstance<CardFrameComponent> cardFrameInstances); void setupCards(final List<CardComponent> cards); void setEmptyState(final HTMLElement emptyStateElement); void enableReadOnlyModeForAllCards(); HTMLElement getElement(); }
@Test public void testClearGrid() { cardGrid.innerHTML = "something"; view.clearGrid(); final String expected = ""; final String actual = cardGrid.innerHTML; assertEquals(expected, actual); }
@Override public void clearGrid() { cardGrid.innerHTML = ""; }
CardsGridComponentView implements CardsGridComponent.View { @Override public void clearGrid() { cardGrid.innerHTML = ""; } }
CardsGridComponentView implements CardsGridComponent.View { @Override public void clearGrid() { cardGrid.innerHTML = ""; } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); }
CardsGridComponentView implements CardsGridComponent.View { @Override public void clearGrid() { cardGrid.innerHTML = ""; } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); @Override void init(final CardsGridComponent presenter); @Override void clearGrid(); @Override void appendCard(final HTMLElement cardElement); }
CardsGridComponentView implements CardsGridComponent.View { @Override public void clearGrid() { cardGrid.innerHTML = ""; } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); @Override void init(final CardsGridComponent presenter); @Override void clearGrid(); @Override void appendCard(final HTMLElement cardElement); }
@Test public void testAppendCard() { final HTMLElement cardElement = mock(HTMLElement.class); view.appendCard(cardElement); verify(cardGrid).appendChild(cardElement); }
@Override public void appendCard(final HTMLElement cardElement) { cardGrid.appendChild(cardElement); }
CardsGridComponentView implements CardsGridComponent.View { @Override public void appendCard(final HTMLElement cardElement) { cardGrid.appendChild(cardElement); } }
CardsGridComponentView implements CardsGridComponent.View { @Override public void appendCard(final HTMLElement cardElement) { cardGrid.appendChild(cardElement); } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); }
CardsGridComponentView implements CardsGridComponent.View { @Override public void appendCard(final HTMLElement cardElement) { cardGrid.appendChild(cardElement); } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); @Override void init(final CardsGridComponent presenter); @Override void clearGrid(); @Override void appendCard(final HTMLElement cardElement); }
CardsGridComponentView implements CardsGridComponent.View { @Override public void appendCard(final HTMLElement cardElement) { cardGrid.appendChild(cardElement); } @Inject CardsGridComponentView(final HTMLDivElement cardGrid); @Override void init(final CardsGridComponent presenter); @Override void clearGrid(); @Override void appendCard(final HTMLElement cardElement); }
@Test public void testOnTitleTextClick() { doNothing().when(cardFrameView).enableEditMode(); cardFrameView.onTitleTextClick(mock(ClickEvent.class)); verify(presenter).enableEditMode(); }
@EventHandler("title-text") public void onTitleTextClick(final ClickEvent e) { presenter.enableEditMode(); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-text") public void onTitleTextClick(final ClickEvent e) { presenter.enableEditMode(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-text") public void onTitleTextClick(final ClickEvent e) { presenter.enableEditMode(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-text") public void onTitleTextClick(final ClickEvent e) { presenter.enableEditMode(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-text") public void onTitleTextClick(final ClickEvent e) { presenter.enableEditMode(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testOnOkButtonClick() { cardFrameView.onOkButtonClick(mock(ClickEvent.class)); verify(presenter).changeTitle(); }
@EventHandler("ok-button") public void onOkButtonClick(final ClickEvent e) { presenter.changeTitle(); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("ok-button") public void onOkButtonClick(final ClickEvent e) { presenter.changeTitle(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("ok-button") public void onOkButtonClick(final ClickEvent e) { presenter.changeTitle(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("ok-button") public void onOkButtonClick(final ClickEvent e) { presenter.changeTitle(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("ok-button") public void onOkButtonClick(final ClickEvent e) { presenter.changeTitle(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testOnCloseButtonClick() { cardFrameView.onCloseButtonClick(mock(ClickEvent.class)); verify(presenter).refreshView(); }
@EventHandler("close-button") public void onCloseButtonClick(final ClickEvent e) { presenter.refreshView(); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("close-button") public void onCloseButtonClick(final ClickEvent e) { presenter.refreshView(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("close-button") public void onCloseButtonClick(final ClickEvent e) { presenter.refreshView(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("close-button") public void onCloseButtonClick(final ClickEvent e) { presenter.refreshView(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("close-button") public void onCloseButtonClick(final ClickEvent e) { presenter.refreshView(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testOnInputCloseButtonClick() { titleInput.value = "something"; cardFrameView.onInputCloseButtonClick(mock(ClickEvent.class)); assertEquals("", titleInput.value); }
@EventHandler("input-close-button") public void onInputCloseButtonClick(final ClickEvent e) { titleInput.value = ""; }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("input-close-button") public void onInputCloseButtonClick(final ClickEvent e) { titleInput.value = ""; } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("input-close-button") public void onInputCloseButtonClick(final ClickEvent e) { titleInput.value = ""; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("input-close-button") public void onInputCloseButtonClick(final ClickEvent e) { titleInput.value = ""; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("input-close-button") public void onInputCloseButtonClick(final ClickEvent e) { titleInput.value = ""; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testOnTitleInputKeyDownEventWhenIsEscape() { final KeyDownEvent event = mock(KeyDownEvent.class); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_ESCAPE); cardFrameView.onTitleInputKeyDownEvent(event); verify(event).preventDefault(); verify(presenter).refreshView(); }
@EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testCloneWhenSourceIsDecisionService() { final DecisionService source = buildDecisionService(); final DecisionService cloned = dmnDeepCloneProcess.clone(source, new DecisionService()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(DECISION_SERVICE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getVariable().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testOnTitleInputKeyDownEventWhenIsEnter() { final KeyDownEvent event = mock(KeyDownEvent.class); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_ENTER); cardFrameView.onTitleInputKeyDownEvent(event); verify(event).preventDefault(); verify(presenter).changeTitle(); }
@EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testOnTitleInputKeyDownEventWhenIsNotEnterAndIsNotEscape() { final KeyDownEvent event = mock(KeyDownEvent.class); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_CTRL); cardFrameView.onTitleInputKeyDownEvent(event); verify(event, never()).preventDefault(); verifyNoMoreInteractions(presenter); }
@EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @EventHandler("title-input") public void onTitleInputKeyDownEvent(final KeyDownEvent event) { if (isEscape(event)) { event.preventDefault(); presenter.refreshView(); } if (isEnter(event)) { event.preventDefault(); presenter.changeTitle(); } } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testSetUUID() { final String uuid = "uuid"; cardFrameView.setUUID(uuid); view.setAttribute(CardFrameComponentView.CARD_UUID_ATTR, uuid); }
@Override public void setUUID(final String uuid) { view.setAttribute(CARD_UUID_ATTR, uuid); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setUUID(final String uuid) { view.setAttribute(CARD_UUID_ATTR, uuid); } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setUUID(final String uuid) { view.setAttribute(CARD_UUID_ATTR, uuid); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setUUID(final String uuid) { view.setAttribute(CARD_UUID_ATTR, uuid); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setUUID(final String uuid) { view.setAttribute(CARD_UUID_ATTR, uuid); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testSetIcon() { icon.classList = mock(DOMTokenList.class); final String cssClassName = "fa-download"; cardFrameView.setIcon(cssClassName); verify(icon.classList).add(cssClassName); }
@Override public void setIcon(final String cssClassName) { icon.classList.add(cssClassName); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setIcon(final String cssClassName) { icon.classList.add(cssClassName); } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setIcon(final String cssClassName) { icon.classList.add(cssClassName); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setIcon(final String cssClassName) { icon.classList.add(cssClassName); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setIcon(final String cssClassName) { icon.classList.add(cssClassName); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testSetTitle() { final String title = "title"; titleText.textContent = "something"; titleInput.value = "something"; cardFrameView.setTitle(title); assertEquals(title, titleText.textContent); assertEquals(title, titleInput.value); }
@Override public void setTitle(final String title) { titleText.textContent = title; titleInput.value = title; }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setTitle(final String title) { titleText.textContent = title; titleInput.value = title; } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setTitle(final String title) { titleText.textContent = title; titleInput.value = title; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setTitle(final String title) { titleText.textContent = title; titleInput.value = title; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setTitle(final String title) { titleText.textContent = title; titleInput.value = title; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testGetTitle() { final String expectedTitle = "title"; titleInput.value = expectedTitle; final String actualTitle = cardFrameView.getTitle(); assertEquals(expectedTitle, actualTitle); }
@Override public String getTitle() { return titleInput.value; }
CardFrameComponentView implements CardFrameComponent.View { @Override public String getTitle() { return titleInput.value; } }
CardFrameComponentView implements CardFrameComponent.View { @Override public String getTitle() { return titleInput.value; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public String getTitle() { return titleInput.value; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public String getTitle() { return titleInput.value; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testSetContent() { final HTMLElement content = mock(HTMLElement.class); cardFrameView.setContent(content); verify(this.content).appendChild(content); }
@Override public void setContent(final HTMLElement content) { this.content.appendChild(content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setContent(final HTMLElement content) { this.content.appendChild(content); } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setContent(final HTMLElement content) { this.content.appendChild(content); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setContent(final HTMLElement content) { this.content.appendChild(content); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void setContent(final HTMLElement content) { this.content.appendChild(content); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testEnableReadOnlyMode() { titleText.hidden = true; editMode.hidden = false; cardFrameView.enableReadOnlyMode(); assertFalse(titleText.hidden); assertTrue(editMode.hidden); }
@Override public void enableReadOnlyMode() { titleText.hidden = false; editMode.hidden = true; }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableReadOnlyMode() { titleText.hidden = false; editMode.hidden = true; } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableReadOnlyMode() { titleText.hidden = false; editMode.hidden = true; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableReadOnlyMode() { titleText.hidden = false; editMode.hidden = true; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableReadOnlyMode() { titleText.hidden = false; editMode.hidden = true; } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testEnableEditMode() { titleText.hidden = false; editMode.hidden = true; cardFrameView.enableEditMode(); assertTrue(titleText.hidden); assertFalse(editMode.hidden); verify(titleInput).focus(); }
@Override public void enableEditMode() { titleText.hidden = true; editMode.hidden = false; titleInput.focus(); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableEditMode() { titleText.hidden = true; editMode.hidden = false; titleInput.focus(); } }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableEditMode() { titleText.hidden = true; editMode.hidden = false; titleInput.focus(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableEditMode() { titleText.hidden = true; editMode.hidden = false; titleInput.focus(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); }
CardFrameComponentView implements CardFrameComponent.View { @Override public void enableEditMode() { titleText.hidden = true; editMode.hidden = false; titleInput.focus(); } @Inject CardFrameComponentView(final HTMLDivElement view, final @Named("span") HTMLElement icon, final @Named("h2") HTMLHeadingElement titleText, final HTMLInputElement titleInput, final HTMLButtonElement inputCloseButton, final HTMLDivElement editMode, final HTMLButtonElement okButton, final HTMLButtonElement closeButton, final HTMLDivElement content); @Override void init(final CardFrameComponent presenter); @EventHandler("title-text") void onTitleTextClick(final ClickEvent e); @EventHandler("ok-button") void onOkButtonClick(final ClickEvent e); @EventHandler("close-button") void onCloseButtonClick(final ClickEvent e); @EventHandler("input-close-button") void onInputCloseButtonClick(final ClickEvent e); @EventHandler("title-input") void onTitleInputKeyDownEvent(final KeyDownEvent event); @Override void setUUID(final String uuid); @Override void setIcon(final String cssClassName); @Override void setTitle(final String title); @Override String getTitle(); @Override void setContent(final HTMLElement content); @Override void enableReadOnlyMode(); @Override void enableEditMode(); @Override void setupToggleTitle(final boolean enabled); static final String CARD_UUID_ATTR; }
@Test public void testSetup() { cardFrame.setup(); verify(view).init(cardFrame); }
@PostConstruct void setup() { getView().init(this); }
CardFrameComponent { @PostConstruct void setup() { getView().init(this); } }
CardFrameComponent { @PostConstruct void setup() { getView().init(this); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { @PostConstruct void setup() { getView().init(this); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { @PostConstruct void setup() { getView().init(this); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void testCloneWhenSourceIsKnowledgeSource() { final KnowledgeSource source = buildKnowledgeSource(); setLinks(source, FIRST_URL, SECOND_URL); final KnowledgeSource cloned = dmnDeepCloneProcess.clone(source, new KnowledgeSource()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(KNOWLEDGE_SOURCE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getLinksHolder().getValue().getLinks()) .hasSize(2) .extracting(DMNExternalLink::getUrl).contains(FIRST_URL, SECOND_URL); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testInitialize() { final CardComponent card = mock(CardComponent.class); doNothing().when(cardFrame).refreshView(); cardFrame.initialize(grid, card); assertEquals(card, cardFrame.getCard()); verify(cardFrame).refreshView(); }
public void initialize(final CardsGridComponent grid, final CardComponent card) { this.grid = grid; this.card = card; refreshView(); }
CardFrameComponent { public void initialize(final CardsGridComponent grid, final CardComponent card) { this.grid = grid; this.card = card; refreshView(); } }
CardFrameComponent { public void initialize(final CardsGridComponent grid, final CardComponent card) { this.grid = grid; this.card = card; refreshView(); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { public void initialize(final CardsGridComponent grid, final CardComponent card) { this.grid = grid; this.card = card; refreshView(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { public void initialize(final CardsGridComponent grid, final CardComponent card) { this.grid = grid; this.card = card; refreshView(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void testGetElement() { final HTMLElement expectedElement = mock(HTMLElement.class); when(view.getElement()).thenReturn(expectedElement); final HTMLElement actualElement = cardFrame.getElement(); assertEquals(expectedElement, actualElement); }
public HTMLElement getElement() { return getView().getElement(); }
CardFrameComponent { public HTMLElement getElement() { return getView().getElement(); } }
CardFrameComponent { public HTMLElement getElement() { return getView().getElement(); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { public HTMLElement getElement() { return getView().getElement(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { public HTMLElement getElement() { return getView().getElement(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void testRefreshView() { final CardComponent card = mock(CardComponent.class); final Style.HasCssName icon = mock(Style.HasCssName.class); final HTMLElement content = mock(HTMLElement.class); final String uuid = "uuid"; final String title = "title"; final String iconCSSClass = "icon-css-class"; doReturn(card).when(cardFrame).getCard(); when(icon.getCssName()).thenReturn(iconCSSClass); when(card.getUUID()).thenReturn(uuid); when(card.getIcon()).thenReturn(icon); when(card.getTitle()).thenReturn(title); when(card.getContent()).thenReturn(content); cardFrame.refreshView(); verify(view).setupToggleTitle(true); verify(view).setUUID(uuid); verify(view).setIcon(iconCSSClass); verify(view).setTitle(title); verify(view).setContent(content); verify(view).enableReadOnlyMode(); }
public void refreshView() { getView().setupToggleTitle(isToggleTitleEnabled()); getView().setUUID(getCard().getUUID()); getView().setIcon(getCard().getIcon().getCssName()); getView().setTitle(getCard().getTitle()); getView().setContent(getCard().getContent()); getView().enableReadOnlyMode(); }
CardFrameComponent { public void refreshView() { getView().setupToggleTitle(isToggleTitleEnabled()); getView().setUUID(getCard().getUUID()); getView().setIcon(getCard().getIcon().getCssName()); getView().setTitle(getCard().getTitle()); getView().setContent(getCard().getContent()); getView().enableReadOnlyMode(); } }
CardFrameComponent { public void refreshView() { getView().setupToggleTitle(isToggleTitleEnabled()); getView().setUUID(getCard().getUUID()); getView().setIcon(getCard().getIcon().getCssName()); getView().setTitle(getCard().getTitle()); getView().setContent(getCard().getContent()); getView().enableReadOnlyMode(); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { public void refreshView() { getView().setupToggleTitle(isToggleTitleEnabled()); getView().setUUID(getCard().getUUID()); getView().setIcon(getCard().getIcon().getCssName()); getView().setTitle(getCard().getTitle()); getView().setContent(getCard().getContent()); getView().enableReadOnlyMode(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { public void refreshView() { getView().setupToggleTitle(isToggleTitleEnabled()); getView().setUUID(getCard().getUUID()); getView().setIcon(getCard().getIcon().getCssName()); getView().setTitle(getCard().getTitle()); getView().setContent(getCard().getContent()); getView().enableReadOnlyMode(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void testEnableEditMode() { doReturn(grid).when(cardFrame).getGrid(); cardFrame.enableEditMode(); verify(grid).enableReadOnlyModeForAllCards(); verify(view).enableEditMode(); }
public void enableEditMode() { getGrid().enableReadOnlyModeForAllCards(); getView().enableEditMode(); }
CardFrameComponent { public void enableEditMode() { getGrid().enableReadOnlyModeForAllCards(); getView().enableEditMode(); } }
CardFrameComponent { public void enableEditMode() { getGrid().enableReadOnlyModeForAllCards(); getView().enableEditMode(); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { public void enableEditMode() { getGrid().enableReadOnlyModeForAllCards(); getView().enableEditMode(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { public void enableEditMode() { getGrid().enableReadOnlyModeForAllCards(); getView().enableEditMode(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void testEnableReadOnlyMode() { doNothing().when(cardFrame).refreshView(); cardFrame.enableReadOnlyMode(); verify(cardFrame).refreshView(); }
public void enableReadOnlyMode() { refreshView(); }
CardFrameComponent { public void enableReadOnlyMode() { refreshView(); } }
CardFrameComponent { public void enableReadOnlyMode() { refreshView(); } @Inject CardFrameComponent(final View view); }
CardFrameComponent { public void enableReadOnlyMode() { refreshView(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
CardFrameComponent { public void enableReadOnlyMode() { refreshView(); } @Inject CardFrameComponent(final View view); void initialize(final CardsGridComponent grid, final CardComponent card); HTMLElement getElement(); void refreshView(); void enableEditMode(); void enableReadOnlyMode(); View getView(); }
@Test public void checkSetup() { verify(ruleNameSelector, times(1)).setEnabled(eq(false)); verify(ruleNameSelector, times(1)).removeStyleName(eq(Styles.FORM_CONTROL)); verifyRulesAddedToList(new Assertion(RuleSelector.NONE_SELECTED, "")); }
@Override public void setEnabled(final boolean enabled) { ruleNameSelector.setEnabled(enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { @Override public void setEnabled(final boolean enabled) { ruleNameSelector.setEnabled(enabled); } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { @Override public void setEnabled(final boolean enabled) { ruleNameSelector.setEnabled(enabled); } RuleSelector(); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { @Override public void setEnabled(final boolean enabled) { ruleNameSelector.setEnabled(enabled); } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { @Override public void setEnabled(final boolean enabled) { ruleNameSelector.setEnabled(enabled); } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); final static String NONE_SELECTED; }
@Test public void checkSetRuleNameWhenEmpty() { ruleSelector.setRuleName(""); verify(ruleNameSelector, never()).setValue(anyString()); }
public void setRuleName(final String ruleName) { if (ruleName != null && !ruleName.isEmpty()) { if (ruleNamesLoaded) { ruleNameSelector.setValue(ruleName); } else { onRulesLoadedCommand = Optional.of(() -> setRuleName(ruleName)); } } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public void setRuleName(final String ruleName) { if (ruleName != null && !ruleName.isEmpty()) { if (ruleNamesLoaded) { ruleNameSelector.setValue(ruleName); } else { onRulesLoadedCommand = Optional.of(() -> setRuleName(ruleName)); } } } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public void setRuleName(final String ruleName) { if (ruleName != null && !ruleName.isEmpty()) { if (ruleNamesLoaded) { ruleNameSelector.setValue(ruleName); } else { onRulesLoadedCommand = Optional.of(() -> setRuleName(ruleName)); } } } RuleSelector(); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public void setRuleName(final String ruleName) { if (ruleName != null && !ruleName.isEmpty()) { if (ruleNamesLoaded) { ruleNameSelector.setValue(ruleName); } else { onRulesLoadedCommand = Optional.of(() -> setRuleName(ruleName)); } } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public void setRuleName(final String ruleName) { if (ruleName != null && !ruleName.isEmpty()) { if (ruleNamesLoaded) { ruleNameSelector.setValue(ruleName); } else { onRulesLoadedCommand = Optional.of(() -> setRuleName(ruleName)); } } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); final static String NONE_SELECTED; }
@Test public void checkGetRuleNameWhenNoneSelected() { when(ruleNameSelector.getValue()).thenReturn(RuleSelector.NONE_SELECTED); assertEquals("", ruleSelector.getRuleName()); }
public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); final static String NONE_SELECTED; }
@Test public void checkGetRuleNameWhenEmpty() { when(ruleNameSelector.getValue()).thenReturn(""); assertEquals("", ruleSelector.getRuleName()); }
public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); final static String NONE_SELECTED; }
@Test public void checkGetRuleNameWhenNotEmpty() { when(ruleNameSelector.getValue()).thenReturn("rule1"); assertEquals("rule1", ruleSelector.getRuleName()); }
public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); }
RuleSelector extends Composite implements HasValueChangeHandlers<String>, HasEnabled { public String getRuleName() { final String ruleName = ruleNameSelector.getValue(); if (!(ruleName == null || ruleName.equals(NONE_SELECTED))) { return ruleName; } else { return ""; } } RuleSelector(); void setRuleNames(final Collection<String> ruleNames, final String exclude); void setRuleNames(final Collection<String> ruleNames); String getRuleName(); void setRuleName(final String ruleName); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override boolean isEnabled(); @Override void setEnabled(final boolean enabled); final static String NONE_SELECTED; }
@Test public void testCloneWhenSourceIsBusinessKnowledgeModel() { final BusinessKnowledgeModel source = buildBusinessKnowledgeModel(); setLinks(source, FIRST_URL, SECOND_URL); final BusinessKnowledgeModel cloned = dmnDeepCloneProcess.clone(source, new BusinessKnowledgeModel()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(BKM_SOURCE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getLinksHolder().getValue().getLinks()) .hasSize(2) .extracting(DMNExternalLink::getUrl).contains(FIRST_URL, SECOND_URL); assertThat(cloned.getVariable().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(cloned.getEncapsulatedLogic()).isNotNull(); assertThat(cloned.getEncapsulatedLogic().getId().getValue()).isNotEqualTo(FUNCTION_ID); assertThat(cloned.getEncapsulatedLogic().getKind()).isEqualTo(JAVA); assertThat(cloned.getEncapsulatedLogic().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(cloned.getEncapsulatedLogic().getExpression()).isInstanceOf(Context.class); assertThat(cloned.getEncapsulatedLogic().getExpression().getId()).isNotEqualTo(CONTEXT_ID); assertThat(cloned.getEncapsulatedLogic().getExpression().getTypeRef()).isEqualTo(BuiltInType.NUMBER.asQName()); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testSetup() { component.setup(); verify(view).init(component); }
@PostConstruct void setup() { view.init(this); }
SearchBarComponent { @PostConstruct void setup() { view.init(this); } }
SearchBarComponent { @PostConstruct void setup() { view.init(this); } @Inject SearchBarComponent(final View view); }
SearchBarComponent { @PostConstruct void setup() { view.init(this); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
SearchBarComponent { @PostConstruct void setup() { view.init(this); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
@Test public void testGetView() { assertEquals(view, component.getView()); }
public View getView() { return view; }
SearchBarComponent { public View getView() { return view; } }
SearchBarComponent { public View getView() { return view; } @Inject SearchBarComponent(final View view); }
SearchBarComponent { public View getView() { return view; } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
SearchBarComponent { public View getView() { return view; } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
@Test public void testNextResult() { component.nextResult(); verify(index).nextResult(); verify(component).updateViewNumber(); }
void nextResult() { getEditorSearchIndex().nextResult(); updateViewNumber(); }
SearchBarComponent { void nextResult() { getEditorSearchIndex().nextResult(); updateViewNumber(); } }
SearchBarComponent { void nextResult() { getEditorSearchIndex().nextResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); }
SearchBarComponent { void nextResult() { getEditorSearchIndex().nextResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
SearchBarComponent { void nextResult() { getEditorSearchIndex().nextResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
@Test public void testPreviousResult() { component.previousResult(); verify(index).previousResult(); verify(component).updateViewNumber(); }
void previousResult() { getEditorSearchIndex().previousResult(); updateViewNumber(); }
SearchBarComponent { void previousResult() { getEditorSearchIndex().previousResult(); updateViewNumber(); } }
SearchBarComponent { void previousResult() { getEditorSearchIndex().previousResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); }
SearchBarComponent { void previousResult() { getEditorSearchIndex().previousResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
SearchBarComponent { void previousResult() { getEditorSearchIndex().previousResult(); updateViewNumber(); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
@Test public void testUpdateViewNumber() { final int currentResultNumber = 2; final int totalOfResultsNumber = 4; when(index.getCurrentResultNumber()).thenReturn(currentResultNumber); when(index.getTotalOfResultsNumber()).thenReturn(totalOfResultsNumber); component.updateViewNumber(); verify(view).setCurrentResultNumber(currentResultNumber); verify(view).setTotalOfResultsNumber(totalOfResultsNumber); }
void updateViewNumber() { final int currentResultNumber = editorSearchIndex().map(EditorSearchIndex::getCurrentResultNumber).orElse(0); final int totalOfResultsNumber = editorSearchIndex().map(EditorSearchIndex::getTotalOfResultsNumber).orElse(0); view.setCurrentResultNumber(currentResultNumber); view.setTotalOfResultsNumber(totalOfResultsNumber); }
SearchBarComponent { void updateViewNumber() { final int currentResultNumber = editorSearchIndex().map(EditorSearchIndex::getCurrentResultNumber).orElse(0); final int totalOfResultsNumber = editorSearchIndex().map(EditorSearchIndex::getTotalOfResultsNumber).orElse(0); view.setCurrentResultNumber(currentResultNumber); view.setTotalOfResultsNumber(totalOfResultsNumber); } }
SearchBarComponent { void updateViewNumber() { final int currentResultNumber = editorSearchIndex().map(EditorSearchIndex::getCurrentResultNumber).orElse(0); final int totalOfResultsNumber = editorSearchIndex().map(EditorSearchIndex::getTotalOfResultsNumber).orElse(0); view.setCurrentResultNumber(currentResultNumber); view.setTotalOfResultsNumber(totalOfResultsNumber); } @Inject SearchBarComponent(final View view); }
SearchBarComponent { void updateViewNumber() { final int currentResultNumber = editorSearchIndex().map(EditorSearchIndex::getCurrentResultNumber).orElse(0); final int totalOfResultsNumber = editorSearchIndex().map(EditorSearchIndex::getTotalOfResultsNumber).orElse(0); view.setCurrentResultNumber(currentResultNumber); view.setTotalOfResultsNumber(totalOfResultsNumber); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
SearchBarComponent { void updateViewNumber() { final int currentResultNumber = editorSearchIndex().map(EditorSearchIndex::getCurrentResultNumber).orElse(0); final int totalOfResultsNumber = editorSearchIndex().map(EditorSearchIndex::getTotalOfResultsNumber).orElse(0); view.setCurrentResultNumber(currentResultNumber); view.setTotalOfResultsNumber(totalOfResultsNumber); } @Inject SearchBarComponent(final View view); void init(final EditorSearchIndex<T> editorSearchIndex); View getView(); void disableSearch(); }
@Test public void testInit() { assertEquals(placeholderText, inputElement.placeholder); verify(view).disableSearch(); }
@Override public void init(final SearchBarComponent searchBarComponent) { presenter = searchBarComponent; inputElement.placeholder = translationService.format(SearchBarComponentView_Find); disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void init(final SearchBarComponent searchBarComponent) { presenter = searchBarComponent; inputElement.placeholder = translationService.format(SearchBarComponentView_Find); disableSearch(); } }
SearchBarComponentView implements SearchBarComponent.View { @Override public void init(final SearchBarComponent searchBarComponent) { presenter = searchBarComponent; inputElement.placeholder = translationService.format(SearchBarComponentView_Find); disableSearch(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void init(final SearchBarComponent searchBarComponent) { presenter = searchBarComponent; inputElement.placeholder = translationService.format(SearchBarComponentView_Find); disableSearch(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void init(final SearchBarComponent searchBarComponent) { presenter = searchBarComponent; inputElement.placeholder = translationService.format(SearchBarComponentView_Find); disableSearch(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testOnSearchButtonClickWhenTheSearchIsDisabled() { final ClickEvent clickEvent = mock(ClickEvent.class); when(searchContainer.classList.contains(HIDDEN)).thenReturn(true); view.onSearchButtonClick(clickEvent); verify(searchContainer.classList).remove(HIDDEN); verify(inputElement).focus(); verify(clickEvent).preventDefault(); verify(clickEvent).stopPropagation(); }
@EventHandler("search-button") public void onSearchButtonClick(final ClickEvent clickEvent) { toggle(); clickEvent.preventDefault(); clickEvent.stopPropagation(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("search-button") public void onSearchButtonClick(final ClickEvent clickEvent) { toggle(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("search-button") public void onSearchButtonClick(final ClickEvent clickEvent) { toggle(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("search-button") public void onSearchButtonClick(final ClickEvent clickEvent) { toggle(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("search-button") public void onSearchButtonClick(final ClickEvent clickEvent) { toggle(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testOnNextElementClick() { final ClickEvent clickEvent = mock(ClickEvent.class); view.onNextElementClick(clickEvent); verify(presenter).nextResult(); verify(clickEvent).preventDefault(); verify(clickEvent).stopPropagation(); }
@EventHandler("next-element") public void onNextElementClick(final ClickEvent clickEvent) { presenter.nextResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("next-element") public void onNextElementClick(final ClickEvent clickEvent) { presenter.nextResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("next-element") public void onNextElementClick(final ClickEvent clickEvent) { presenter.nextResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("next-element") public void onNextElementClick(final ClickEvent clickEvent) { presenter.nextResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("next-element") public void onNextElementClick(final ClickEvent clickEvent) { presenter.nextResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testOnPrevElementClick() { final ClickEvent clickEvent = mock(ClickEvent.class); view.onPrevElementClick(clickEvent); verify(presenter).previousResult(); verify(clickEvent).preventDefault(); verify(clickEvent).stopPropagation(); }
@EventHandler("prev-element") public void onPrevElementClick(final ClickEvent clickEvent) { presenter.previousResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("prev-element") public void onPrevElementClick(final ClickEvent clickEvent) { presenter.previousResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("prev-element") public void onPrevElementClick(final ClickEvent clickEvent) { presenter.previousResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("prev-element") public void onPrevElementClick(final ClickEvent clickEvent) { presenter.previousResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("prev-element") public void onPrevElementClick(final ClickEvent clickEvent) { presenter.previousResult(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testOnCloseSearchClick() { final ClickEvent clickEvent = mock(ClickEvent.class); view.onCloseSearchClick(clickEvent); verify(view, times(2)).disableSearch(); verify(clickEvent).preventDefault(); verify(clickEvent).stopPropagation(); }
@EventHandler("close-search") public void onCloseSearchClick(final ClickEvent clickEvent) { disableSearch(); clickEvent.preventDefault(); clickEvent.stopPropagation(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("close-search") public void onCloseSearchClick(final ClickEvent clickEvent) { disableSearch(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("close-search") public void onCloseSearchClick(final ClickEvent clickEvent) { disableSearch(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("close-search") public void onCloseSearchClick(final ClickEvent clickEvent) { disableSearch(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @EventHandler("close-search") public void onCloseSearchClick(final ClickEvent clickEvent) { disableSearch(); clickEvent.preventDefault(); clickEvent.stopPropagation(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testCloneWhenSourceIsDecision() { final Decision source = buildDecision(); setLinks(source, FIRST_URL, SECOND_URL); final Decision cloned = dmnDeepCloneProcess.clone(source, new Decision()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(DECISION_SOURCE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getLinksHolder().getValue().getLinks()) .hasSize(2) .extracting(DMNExternalLink::getUrl).contains(FIRST_URL, SECOND_URL); assertThat(cloned.getVariable().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(cloned.getQuestion().getValue()).isEqualTo(QUESTION); assertThat(cloned.getAllowedAnswers().getValue()).isEqualTo(ANSWER); assertThat(cloned.getExpression()).isNotNull(); assertThat(cloned.getExpression()).isInstanceOf(FunctionDefinition.class); assertThat(cloned.getExpression().getId().getValue()).isNotEqualTo(FUNCTION_ID); assertThat(cloned.getExpression().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression()).isInstanceOf(Context.class); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression().getId()).isNotEqualTo(CONTEXT_ID); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression().getTypeRef()).isEqualTo(BuiltInType.NUMBER.asQName()); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testSetCurrentResultNumber() { currentResult.textContent = "something..."; view.setCurrentResultNumber(42); assertEquals("42", currentResult.textContent); }
@Override public void setCurrentResultNumber(final Integer currentResultNumber) { currentResult.textContent = currentResultNumber.toString(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setCurrentResultNumber(final Integer currentResultNumber) { currentResult.textContent = currentResultNumber.toString(); } }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setCurrentResultNumber(final Integer currentResultNumber) { currentResult.textContent = currentResultNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setCurrentResultNumber(final Integer currentResultNumber) { currentResult.textContent = currentResultNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setCurrentResultNumber(final Integer currentResultNumber) { currentResult.textContent = currentResultNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testSetTotalOfResultsNumber() { totalOfResults.textContent = "something..."; view.setTotalOfResultsNumber(42); assertEquals("42", totalOfResults.textContent); }
@Override public void setTotalOfResultsNumber(final Integer totalOfResultsNumber) { totalOfResults.textContent = totalOfResultsNumber.toString(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setTotalOfResultsNumber(final Integer totalOfResultsNumber) { totalOfResults.textContent = totalOfResultsNumber.toString(); } }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setTotalOfResultsNumber(final Integer totalOfResultsNumber) { totalOfResults.textContent = totalOfResultsNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setTotalOfResultsNumber(final Integer totalOfResultsNumber) { totalOfResults.textContent = totalOfResultsNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
SearchBarComponentView implements SearchBarComponent.View { @Override public void setTotalOfResultsNumber(final Integer totalOfResultsNumber) { totalOfResults.textContent = totalOfResultsNumber.toString(); } @Inject SearchBarComponentView(final HTMLButtonElement searchButton, final HTMLButtonElement searchContainer, final HTMLButtonElement prevElement, final HTMLButtonElement nextElement, final HTMLButtonElement closeSearch, final HTMLInputElement inputElement, final TranslationService translationService, final @Named("span") HTMLElement currentResult, final @Named("span") HTMLElement totalOfResults); @Override void init(final SearchBarComponent searchBarComponent); @EventHandler("search-button") void onSearchButtonClick(final ClickEvent clickEvent); @EventHandler("next-element") void onNextElementClick(final ClickEvent clickEvent); @EventHandler("prev-element") void onPrevElementClick(final ClickEvent clickEvent); @EventHandler("close-search") void onCloseSearchClick(final ClickEvent clickEvent); @EventHandler("search-input") void onSearchInputKeyPress(final KeyUpEvent keyEvent); @Override void setCurrentResultNumber(final Integer currentResultNumber); @Override void setTotalOfResultsNumber(final Integer totalOfResultsNumber); @Override void disableSearch(); }
@Test public void testSearch() { index.search("Element"); verify(searchable1).onFound(); verify(searchable2, never()).onFound(); verify(searchable3, never()).onFound(); verify(searchable4, never()).onFound(); verify(noResultsFoundCallback, never()).execute(); verify(searchPerformedCallback).execute(); }
@Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testSearchWhenAnyElementIsFound() { index.search("Something"); verify(searchable1, never()).onFound(); verify(searchable2, never()).onFound(); verify(searchable3, never()).onFound(); verify(searchable4, never()).onFound(); verify(noResultsFoundCallback).execute(); verify(searchPerformedCallback).execute(); }
@Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testSearchWhenNextElementIsHighlighted() { times(2, () -> index.search("Element")); verify(searchable1).onFound(); verify(searchable2).onFound(); verify(searchable3, never()).onFound(); verify(searchable4, never()).onFound(); verify(noResultsFoundCallback, never()).execute(); }
@Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testSearchWhenAllListWasHighlighted() { times(5, () -> index.search("Element")); verify(searchable1, Mockito.times(2)).onFound(); verify(searchable2).onFound(); verify(searchable3).onFound(); verify(searchable4).onFound(); verify(noResultsFoundCallback, never()).execute(); }
@Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void search(final String term) { triggerClearCurrentResultsCallback(); final boolean isNewSearch = !Objects.equals(term, currentTerm) || isDirty(); final Optional<T> result; if (isNewSearch) { loadSearchResults(term); result = getFirstSearchResult(); } else { result = findNextElement(); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testIsDirtyWhenItsTheFirstSearch() { assertFalse(index.isDirty()); }
@Override public boolean isDirty() { return currentAssetHash != null && !Objects.equals(currentAssetHash, getCurrentAssetHashcode()); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public boolean isDirty() { return currentAssetHash != null && !Objects.equals(currentAssetHash, getCurrentAssetHashcode()); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public boolean isDirty() { return currentAssetHash != null && !Objects.equals(currentAssetHash, getCurrentAssetHashcode()); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public boolean isDirty() { return currentAssetHash != null && !Objects.equals(currentAssetHash, getCurrentAssetHashcode()); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public boolean isDirty() { return currentAssetHash != null && !Objects.equals(currentAssetHash, getCurrentAssetHashcode()); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testGetSubIndexes() { index.registerSubIndex(hasSearchableElements1); index.registerSubIndex(hasSearchableElements2); final List<HasSearchableElements<FakeSearchable>> actualSubIndexes = index.getSubIndexes(); final List<HasSearchableElements<FakeSearchable>> expectedSubIndexes = asList(hasSearchableElements1, hasSearchableElements2); assertEquals(expectedSubIndexes, actualSubIndexes); }
@Override public List<HasSearchableElements<T>> getSubIndexes() { return hasSearchableElementsList; }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public List<HasSearchableElements<T>> getSubIndexes() { return hasSearchableElementsList; } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public List<HasSearchableElements<T>> getSubIndexes() { return hasSearchableElementsList; } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public List<HasSearchableElements<T>> getSubIndexes() { return hasSearchableElementsList; } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public List<HasSearchableElements<T>> getSubIndexes() { return hasSearchableElementsList; } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testNextResult() { index.search("Element"); times(4, () -> index.nextResult()); final InOrder inOrder = Mockito.inOrder(searchable1, searchable2, searchable3, searchable4); inOrder.verify(searchable1).onFound(); inOrder.verify(searchable2).onFound(); inOrder.verify(searchable3).onFound(); inOrder.verify(searchable4).onFound(); inOrder.verify(searchable1).onFound(); inOrder.verifyNoMoreInteractions(); verify(noResultsFoundCallback, never()).execute(); verify(searchPerformedCallback, Mockito.times(5)).execute(); }
@Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testPreviousResult() { index.search("Element"); times(4, () -> index.previousResult()); final InOrder inOrder = Mockito.inOrder(searchable1, searchable4, searchable3, searchable2); inOrder.verify(searchable1).onFound(); inOrder.verify(searchable4).onFound(); inOrder.verify(searchable3).onFound(); inOrder.verify(searchable2).onFound(); inOrder.verify(searchable1).onFound(); inOrder.verifyNoMoreInteractions(); verify(noResultsFoundCallback, never()).execute(); verify(searchPerformedCallback, Mockito.times(5)).execute(); }
@Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testComposingUniqueNodeName() { assertThat(dmnDeepCloneProcess.composeUniqueNodeName(INPUT_DATA_NAME)) .isEqualTo(INPUT_DATA_NAME + FIRST_INDEX_IN_SUFFIX); }
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testNextResultWhenSearchHasNoResult() { index.nextResult(); verify(noResultsFoundCallback).execute(); verify(searchPerformedCallback).execute(); }
@Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void nextResult() { final Optional<T> result = findNextElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testPreviousResultWhenSearchHasNoResult() { index.previousResult(); verify(noResultsFoundCallback).execute(); verify(searchPerformedCallback).execute(); }
@Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void previousResult() { final Optional<T> result = findPreviousElement(); currentResult = result.orElse(null); triggerOnFoundCommand(); triggerOnSearchPerformedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testGetCurrentResultNumber() { index.search("Element 2"); assertEquals(1, index.getCurrentResultNumber()); }
@Override public int getCurrentResultNumber() { return results.size() > 0 ? getCurrentResultIndex() + 1 : 0; }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getCurrentResultNumber() { return results.size() > 0 ? getCurrentResultIndex() + 1 : 0; } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getCurrentResultNumber() { return results.size() > 0 ? getCurrentResultIndex() + 1 : 0; } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getCurrentResultNumber() { return results.size() > 0 ? getCurrentResultIndex() + 1 : 0; } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getCurrentResultNumber() { return results.size() > 0 ? getCurrentResultIndex() + 1 : 0; } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testGetTotalOfResultsNumber() { index.search("Element"); assertEquals(4, index.getTotalOfResultsNumber()); }
@Override public int getTotalOfResultsNumber() { return results.size(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getTotalOfResultsNumber() { return results.size(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getTotalOfResultsNumber() { return results.size(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getTotalOfResultsNumber() { return results.size(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public int getTotalOfResultsNumber() { return results.size(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void testClose() { index.search("Element"); index.close(); assertEquals(0, index.getTotalOfResultsNumber()); assertEquals(0, index.getCurrentResultNumber()); assertEquals("", index.getCurrentTerm()); assertEquals(0, index.getResults().size()); verify(searchPerformedCallback, Mockito.times(2)).execute(); verify(searchClosedCallback).execute(); }
@Override public void close() { results = new ArrayList<>(); currentTerm = ""; currentResult = null; triggerOnSearchPerformedCommand(); triggerSearchClosedCommand(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void close() { results = new ArrayList<>(); currentTerm = ""; currentResult = null; triggerOnSearchPerformedCommand(); triggerSearchClosedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void close() { results = new ArrayList<>(); currentTerm = ""; currentResult = null; triggerOnSearchPerformedCommand(); triggerSearchClosedCommand(); } }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void close() { results = new ArrayList<>(); currentTerm = ""; currentResult = null; triggerOnSearchPerformedCommand(); triggerSearchClosedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
BaseEditorSearchIndex implements EditorSearchIndex<T> { @Override public void close() { results = new ArrayList<>(); currentTerm = ""; currentResult = null; triggerOnSearchPerformedCommand(); triggerSearchClosedCommand(); } @Override void setSearchPerformedCallback(final Command searchPerformedCallback); @Override List<HasSearchableElements<T>> getSubIndexes(); @Override void registerSubIndex(final HasSearchableElements<T> hasSearchableElements); @Override void search(final String term); @Override int getCurrentResultNumber(); @Override int getTotalOfResultsNumber(); @Override void close(); @Override void setNoResultsFoundCallback(final Command callback); @Override void setClearCurrentResultsCallback(final Command callback); @Override void setSearchClosedCallback(final Command searchClosedCallback); @Override boolean isDirty(); @Override void nextResult(); @Override void previousResult(); @Override Integer getCurrentAssetHashcode(); void setCurrentAssetHashcodeSupplier(final Supplier<Integer> currentAssetHashcodeSupplier); @Override Optional<T> getCurrentResult(); }
@Test public void showMessages() { ValidationMessage validationMessage = new ValidationMessage(); validationPopup.showMessages(Arrays.asList(validationMessage)); verify(view).showYesButton(false); verify(view).showCancelButton(true); verify(view).setValidationMessages(anyListOf(ValidationMessage.class)); verify(view).show(); }
public void showMessages(final List<ValidationMessage> messages) { clear(); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(() -> { }, () -> { }, messages); }
ValidationPopup implements ValidationPopupView.Presenter { public void showMessages(final List<ValidationMessage> messages) { clear(); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(() -> { }, () -> { }, messages); } }
ValidationPopup implements ValidationPopupView.Presenter { public void showMessages(final List<ValidationMessage> messages) { clear(); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(() -> { }, () -> { }, messages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); }
ValidationPopup implements ValidationPopupView.Presenter { public void showMessages(final List<ValidationMessage> messages) { clear(); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(() -> { }, () -> { }, messages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
ValidationPopup implements ValidationPopupView.Presenter { public void showMessages(final List<ValidationMessage> messages) { clear(); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(() -> { }, () -> { }, messages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
@Test public void showCopyValidationMessages() { List<ValidationMessage> validationMessages = Arrays.asList(new ValidationMessage()); validationPopup.showCopyValidationMessages(() -> { }, () -> { }, validationMessages); verify(view).showYesButton(true); verify(view).showCancelButton(true); List<ValidationMessage> translatedMessages = Collections.emptyList(); when(validationMessageTranslatorUtils.translate(validationMessages)).thenReturn(translatedMessages); verify(view).setValidationMessages(translatedMessages); verify(view).show(); }
public void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesCopyAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); }
ValidationPopup implements ValidationPopupView.Presenter { public void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesCopyAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } }
ValidationPopup implements ValidationPopupView.Presenter { public void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesCopyAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); }
ValidationPopup implements ValidationPopupView.Presenter { public void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesCopyAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
ValidationPopup implements ValidationPopupView.Presenter { public void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesCopyAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
@Test public void showSaveValidationMessages() { List<ValidationMessage> validationMessages = Arrays.asList(new ValidationMessage()); validationPopup.showSaveValidationMessages(() -> { }, () -> { }, validationMessages); verify(view).showYesButton(true); verify(view).showCancelButton(true); List<ValidationMessage> translatedMessages = Collections.emptyList(); when(validationMessageTranslatorUtils.translate(validationMessages)).thenReturn(translatedMessages); verify(view).setValidationMessages(translatedMessages); verify(view).show(); }
public void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesSaveAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); }
ValidationPopup implements ValidationPopupView.Presenter { public void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesSaveAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } }
ValidationPopup implements ValidationPopupView.Presenter { public void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesSaveAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); }
ValidationPopup implements ValidationPopupView.Presenter { public void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesSaveAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
ValidationPopup implements ValidationPopupView.Presenter { public void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages) { clear(); view.setYesButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_YesSaveAnyway)); view.showYesButton(true); view.setCancelButtonText(translationService.getTranslation(KieWorkbenchWidgetsConstants.ValidationPopup_Cancel)); view.showCancelButton(true); initAndShowModal(yesCommand, cancelCommand, validationMessages); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
@Test public void showTranslatedMessages() { List<ValidationMessage> validationMessages = Arrays.asList(new ValidationMessage()); validationPopup.showTranslatedMessages(validationMessages); List<ValidationMessage> translatedMessages = Collections.emptyList(); when(validationMessageTranslatorUtils.translate(validationMessages)).thenReturn(translatedMessages); verify(view).setValidationMessages(translatedMessages); verify(view).show(); }
public void showTranslatedMessages(final List<ValidationMessage> messages) { showMessages(validationMessageTranslatorUtils.translate(messages)); }
ValidationPopup implements ValidationPopupView.Presenter { public void showTranslatedMessages(final List<ValidationMessage> messages) { showMessages(validationMessageTranslatorUtils.translate(messages)); } }
ValidationPopup implements ValidationPopupView.Presenter { public void showTranslatedMessages(final List<ValidationMessage> messages) { showMessages(validationMessageTranslatorUtils.translate(messages)); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); }
ValidationPopup implements ValidationPopupView.Presenter { public void showTranslatedMessages(final List<ValidationMessage> messages) { showMessages(validationMessageTranslatorUtils.translate(messages)); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
ValidationPopup implements ValidationPopupView.Presenter { public void showTranslatedMessages(final List<ValidationMessage> messages) { showMessages(validationMessageTranslatorUtils.translate(messages)); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
@Test public void getCallback() throws Exception { final AssetValidatedCallback callback = validationPopup.getValidationCallback(mock(Command.class)); callback.callback(new ArrayList<>()); verify(notificationEvent).fire(any()); }
public AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand){ return new AssetValidatedCallback(validationFinishedCommand, notificationEvent, this); }
ValidationPopup implements ValidationPopupView.Presenter { public AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand){ return new AssetValidatedCallback(validationFinishedCommand, notificationEvent, this); } }
ValidationPopup implements ValidationPopupView.Presenter { public AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand){ return new AssetValidatedCallback(validationFinishedCommand, notificationEvent, this); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); }
ValidationPopup implements ValidationPopupView.Presenter { public AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand){ return new AssetValidatedCallback(validationFinishedCommand, notificationEvent, this); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
ValidationPopup implements ValidationPopupView.Presenter { public AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand){ return new AssetValidatedCallback(validationFinishedCommand, notificationEvent, this); } @Inject ValidationPopup(final ValidationPopupView view, final ValidationMessageTranslatorUtils validationMessageTranslatorUtils, final TranslationService translationService, final Event<NotificationEvent> notificationEvent); @PostConstruct void init(); void showMessages(final List<ValidationMessage> messages); AssetValidatedCallback getValidationCallback(final Command validationFinishedCommand); void showTranslatedMessages(final List<ValidationMessage> messages); void showCopyValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showSaveValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); void showDeleteValidationMessages(final Command yesCommand, final Command cancelCommand, final List<ValidationMessage> validationMessages); @Override void onYesButtonClicked(); @Override void onCancelButtonClicked(); }
@Test public void testComposingUniqueNodeNameWhenItAlreadyContainsIndexedSuffix() { mockSingleNodeInTheGraph(); assertThat(dmnDeepCloneProcess.composeUniqueNodeName(INPUT_DATA_NAME + FIRST_INDEX_IN_SUFFIX)) .isEqualTo(INPUT_DATA_NAME + SECOND_INDEX_IN_SUFFIX); }
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testOnAppLauncherRemoveEvent() { final String appName = "appName"; presenter.onAppLauncherAddEvent(new AppLauncherAddEvent(appName, null, null)); presenter.onAppLauncherRemoveEvent(new AppLauncherRemoveEvent(appName)); verify(view).removeAllAppLauncher(); verify(updatedEvent, times(2)).fire(any(AppLauncherUpdatedEvent.class)); assertTrue(presenter.isAppLauncherEmpty()); }
public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); } }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); } }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
@Test public void testOnAppLauncherAddEvent() { final String appName = "appName"; final String url = "url"; final String css = "fa"; presenter.onAppLauncherAddEvent(new AppLauncherAddEvent(appName, url, css)); verify(view).addAppLauncher(appName, url, css); verify(updatedEvent).fire(any(AppLauncherUpdatedEvent.class)); assertFalse(presenter.isAppLauncherEmpty()); }
public void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event) { appLauncherAddEvents.add(event); view.addAppLauncher(event.getAppName(), event.getUrl(), event.getIconClass()); updatedEvent.fire(new AppLauncherUpdatedEvent()); }
AppLauncherPresenter { public void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event) { appLauncherAddEvents.add(event); view.addAppLauncher(event.getAppName(), event.getUrl(), event.getIconClass()); updatedEvent.fire(new AppLauncherUpdatedEvent()); } }
AppLauncherPresenter { public void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event) { appLauncherAddEvents.add(event); view.addAppLauncher(event.getAppName(), event.getUrl(), event.getIconClass()); updatedEvent.fire(new AppLauncherUpdatedEvent()); } }
AppLauncherPresenter { public void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event) { appLauncherAddEvents.add(event); view.addAppLauncher(event.getAppName(), event.getUrl(), event.getIconClass()); updatedEvent.fire(new AppLauncherUpdatedEvent()); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
AppLauncherPresenter { public void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event) { appLauncherAddEvents.add(event); view.addAppLauncher(event.getAppName(), event.getUrl(), event.getIconClass()); updatedEvent.fire(new AppLauncherUpdatedEvent()); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
@Test public void testIsAppLauncherEmpty() { assertTrue(presenter.isAppLauncherEmpty()); presenter.onAppLauncherAddEvent(new AppLauncherAddEvent(null, null, null)); assertFalse(presenter.isAppLauncherEmpty()); }
public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); }
AppLauncherPresenter { public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); } }
AppLauncherPresenter { public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); } }
AppLauncherPresenter { public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
AppLauncherPresenter { public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); } IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
@Test public void setupWithOneCompleteConfigTest() { doReturn(false).when(aboutPopupConfigs).isUnsatisfied(); doReturn(false).when(aboutPopupConfigs).isAmbiguous(); doReturn(config).when(aboutPopupConfigs).get(); aboutPopup.setup(); verify(view).init(aboutPopup); verify(view).setProductName(config.productName()); verify(view).setProductVersion(config.productVersion()); verify(view).setProductLicense(config.productLicense()); verify(view).setProductImageUrl(config.productImageUrl()); verify(view).setBackgroundImageUrl(config.backgroundImageUrl()); }
@PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
@Test public void setupWithOneConfigWithoutBackgroundImageTest() { doReturn(false).when(aboutPopupConfigs).isUnsatisfied(); doReturn(false).when(aboutPopupConfigs).isAmbiguous(); doReturn(new AboutPopupConfigMock("")).when(aboutPopupConfigs).get(); aboutPopup.setup(); verify(view).init(aboutPopup); verify(view).setProductName(config.productName()); verify(view).setProductVersion(config.productVersion()); verify(view).setProductLicense(config.productLicense()); verify(view).setProductImageUrl(config.productImageUrl()); verify(view, never()).setBackgroundImageUrl(anyString()); }
@PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
@Test(expected = RuntimeException.class) public void setupWithNoConfigTest() { doReturn(true).when(aboutPopupConfigs).isUnsatisfied(); doReturn(false).when(aboutPopupConfigs).isAmbiguous(); aboutPopup.setup(); }
@PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
@Test(expected = RuntimeException.class) public void setupWithSeveralConfigsTest() { doReturn(false).when(aboutPopupConfigs).isUnsatisfied(); doReturn(true).when(aboutPopupConfigs).isAmbiguous(); aboutPopup.setup(); }
@PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
AboutPopup { @PostConstruct public void setup() { view.init(this); if (aboutPopupConfigs.isUnsatisfied()) { throw new RuntimeException("One AboutPopupConfig implementation must be provided"); } if (aboutPopupConfigs.isAmbiguous()) { throw new RuntimeException("Only one AboutPopupConfig implementation must be provided"); } final AboutPopupConfig aboutPopupConfig = aboutPopupConfigs.get(); view.setProductName(aboutPopupConfig.productName()); view.setProductVersion(aboutPopupConfig.productVersion()); view.setProductLicense(aboutPopupConfig.productLicense()); view.setProductImageUrl(aboutPopupConfig.productImageUrl()); final String backgroundImageUrl = aboutPopupConfig.backgroundImageUrl(); if (backgroundImageUrl != null && !backgroundImageUrl.isEmpty()) { view.setBackgroundImageUrl(backgroundImageUrl); } } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
@Test public void showTest() { aboutPopup.show(); verify(view).show(); }
public void show() { view.show(); }
AboutPopup { public void show() { view.show(); } }
AboutPopup { public void show() { view.show(); } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); }
AboutPopup { public void show() { view.show(); } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
AboutPopup { public void show() { view.show(); } @Inject AboutPopup(final View view, final ManagedInstance<AboutPopupConfig> aboutPopupConfigs); @PostConstruct void setup(); void show(); }
@Test public void testSetup() { final HTMLElement viewRoot = spy(new HTMLElement()); viewRoot.innerHTML = "bar"; doReturn(viewRoot).when(view).getElement(); final HTMLSelectElement selectElement = spy(new HTMLSelectElement()); doReturn(selectElement).when(view).getSelect(); final Element container = spy(new Element() { @Override public Node appendChild(final Node node) { if (node instanceof HTMLElement) { this.innerHTML += ((HTMLElement) node).innerHTML; } return node; } }); container.innerHTML = ""; final List<KieSelectOption> options = singletonList(new KieSelectOption("Label", "Value")); kieSelectElement.setup( container, options, Arrays.asList("value1", "value2"), value -> { }); verify(view).setValue(eq(Arrays.asList("value1", "value2"))); verify(view).initSelect(); verify(optionsListPresenter).setup(eq(selectElement), eq(options), any()); assertEquals("bar", container.innerHTML); }
public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue(); }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue(); }
@Test public void testOnChange() { final AtomicInteger i = new AtomicInteger(0); doReturn(Arrays.asList("value1", "value2")).when(kieSelectElement).getValue(); kieSelectElement.onChange = value -> { assertEquals(Arrays.asList("value1", "value2"), value); i.incrementAndGet(); }; kieSelectElement.onChange(); assertEquals(1, i.get()); }
public void onChange() { this.onChange.accept(getValue()); }
KieMultipleSelectElement implements KieSelectElementBase { public void onChange() { this.onChange.accept(getValue()); } }
KieMultipleSelectElement implements KieSelectElementBase { public void onChange() { this.onChange.accept(getValue()); } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); }
KieMultipleSelectElement implements KieSelectElementBase { public void onChange() { this.onChange.accept(getValue()); } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue(); }
KieMultipleSelectElement implements KieSelectElementBase { public void onChange() { this.onChange.accept(getValue()); } @Inject KieMultipleSelectElement(final View view, final KieSelectOptionsListPresenter optionsListPresenter, final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue(); }
@Test public void testComposingUniqueNodeNameWhenItContainsNotIndexedSuffix() { assertThat(dmnDeepCloneProcess.composeUniqueNodeName(INPUT_DATA_NAME + "-A3")) .isEqualTo(INPUT_DATA_NAME + "-A3" + FIRST_INDEX_IN_SUFFIX); }
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testIsValidValueWhiteSpaceStart() throws Exception { assertFalse(textBox.isValidValue(" abcd", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValueWhiteSpaceEnd() throws Exception { assertFalse(textBox.isValidValue("abcd ", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValueWhiteSpaceMiddle() throws Exception { assertFalse(textBox.isValidValue("abcd abcd", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValueSpecialCharacters() throws Exception { assertFalse(textBox.isValidValue("abcd%!@*()&^abcd", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValueStartWithNumber() throws Exception { assertFalse(textBox.isValidValue("1abcd ", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValue() throws Exception { assertTrue(textBox.isValidValue("aBCd12", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void testIsValidValueWithSpecialStart() throws Exception { assertTrue(textBox.isValidValue("$a33bcd", false)); }
@Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
BindingTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue(String value, boolean isOnFocusLost) { if (value == null) { return true; } final char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (i == 0) { if (c == '$') { continue; } else if (!Unicode.isLetter(c)) { return false; } } else if (!(Character.isDigit(c) || Unicode.isLetter(c))) { return false; } } return true; } @Override boolean isValidValue(String value, boolean isOnFocusLost); }
@Test public void formSubmitValidState() { editor.setValid(true); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form, times(1)).submit(); }
public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
@Test public void formSubmitInvalidState() { editor.setValid(false); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form, never()).submit(); }
public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
@Test public void testSubmitCompleteInvalidXlsContent() throws Exception { when(event.getResults()).thenReturn("DecisionTableParseException"); editor.setValid(true); editor.submit(path, "filename", "targetUrl", successCallback, errorCallback); verify(form).addSubmitCompleteHandler(submitCompleteCaptor.capture()); submitCompleteCaptor.getValue().onSubmitComplete(event); assertEquals(1, editor.getShownMessages().size()); assertEquals(CommonConstants.INSTANCE.UploadGenericError(), editor.getShownMessages().get(0)); }
public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
AttachmentFileWidget extends Composite { public void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback) { submit(fileName, context.toURI(), FileOperation.CREATE, "", targetUrl, successCallback, errorCallback); } AttachmentFileWidget(); AttachmentFileWidget(final String[] validFileExtensions); AttachmentFileWidget(final boolean addFileUpload); AttachmentFileWidget(final String[] validFileExtensions, final boolean addFileUpload); void reset(); void submit(final Path context, final String fileName, final String targetUrl, final Command successCallback, final Command errorCallback); void submit(final Path path, final String targetUrl, final Command successCallback, final Command errorCallback); void addClickHandler(final ClickHandler clickHandler); void setEnabled(boolean b); void showMessage(String message); String getFilenameSelectedToUpload(); }
@Test public void testComposingUniqueNodeNameWhenNextIndexInSequenceAlreadyPresent() { mockMultipleNodesInTheGraph(); assertThat(dmnDeepCloneProcess.composeUniqueNodeName(INPUT_DATA_NAME + FIRST_INDEX_IN_SUFFIX)) .isEqualTo(INPUT_DATA_NAME + FORTH_INDEX_IN_SUFFIX); }
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); } protected DMNDeepCloneProcess(); @Inject DMNDeepCloneProcess(final FactoryManager factoryManager, final AdapterManager adapterManager, final ClassUtils classUtils, final SessionManager sessionManager); @Override T clone(final S source, final T target); }
@Test public void testCommaSeparatedValuesWithBracketsAndMultiValue() { final DropDownData downData = mock(DropDownData.class); doReturn(new String[]{"a", "\"b, c\"", "d"}).when(downData).getFixedList(); final ListBox listBox = mock(ListBox.class); new EnumDropDownUtilities().setDropDownData(" ( \"a\",\"\"b, c\"\",\"d\" )", downData, true, mock(Path.class), listBox); verify(listBox).clear(); verify(listBox).addItem("a"); verify(listBox).addItem("\"b, c\""); verify(listBox).addItem("d"); verify(listBox).setItemSelected(0, true); verify(listBox).setItemSelected(1, true); verify(listBox).setItemSelected(2, true); }
public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }
@Test public void testCommaSeparatedValuesWithBrackets() { final DropDownData downData = mock(DropDownData.class); doReturn(new String[]{"a", "\"b, c\"", "d"}).when(downData).getFixedList(); final ListBox listBox = mock(ListBox.class); new EnumDropDownUtilities().setDropDownData(" ( \"a\",\"d\" )", downData, true, mock(Path.class), listBox); verify(listBox).clear(); verify(listBox).addItem("a"); verify(listBox).addItem("\"b, c\""); verify(listBox).addItem("d"); verify(listBox).setItemSelected(0, true); verify(listBox, never()).setItemSelected(1, true); verify(listBox).setItemSelected(2, true); }
public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }
@Test public void testCommaSeparatedValuesWithBracketsWhereLastItemIsMultiValue() { final DropDownData downData = mock(DropDownData.class); doReturn(new String[]{"a", "\"b, c\"", "d"}).when(downData).getFixedList(); final ListBox listBox = mock(ListBox.class); new EnumDropDownUtilities().setDropDownData(" ( \"a\",\"\"b, c\"\" )", downData, true, mock(Path.class), listBox); verify(listBox).clear(); verify(listBox).addItem("a"); verify(listBox).addItem("\"b, c\""); verify(listBox).addItem("d"); verify(listBox).setItemSelected(0, true); verify(listBox).setItemSelected(1, true); verify(listBox, never()).setItemSelected(2, true); }
public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox); }