當前位置: 首頁>>代碼示例>>Java>>正文


Java ClickHandler.onClick方法代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.ClickHandler.onClick方法的典型用法代碼示例。如果您正苦於以下問題:Java ClickHandler.onClick方法的具體用法?Java ClickHandler.onClick怎麽用?Java ClickHandler.onClick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.event.dom.client.ClickHandler的用法示例。


在下文中一共展示了ClickHandler.onClick方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldCallPlayOrStopDescriptionOnPlayButtonClick

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldCallPlayOrStopDescriptionOnPlayButtonClick() {
    // given
    String file = "test.mp3";
    Entry entry = mock(Entry.class);
    when(entry.getEntryExampleSound()).thenReturn(file);

    doAnswer(new Answer<Void>() {
        @Override
        public Void answer(InvocationOnMock invocation) {
            clickHandler = (ClickHandler) invocation.getArguments()[0];
            return null;
        }
    }).when(explanationView).addPlayButtonHandler(any(ClickHandler.class));

    // when
    testObj.init();
    testObj.processEntry(entry);
    clickHandler.onClick(null);

    // then
    verify(explanationDescriptionSoundController).playOrStopExplanationSound(entry.getEntryExampleSound());
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:24,代碼來源:ExplanationControllerTest.java

示例2: shouldCallPlayOrStopEntryOnPlayButtonClick

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldCallPlayOrStopEntryOnPlayButtonClick() {
    // given
    String file = "test.mp3";
    Entry entry = mock(Entry.class);
    when(entry.getEntrySound()).thenReturn(file);

    doAnswer(new Answer<Void>() {
        @Override
        public Void answer(InvocationOnMock invocation) {
            clickHandler = (ClickHandler) invocation.getArguments()[0];
            return null;
        }
    }).when(explanationView).addEntryPlayButtonHandler(any(ClickHandler.class));

    // when
    testObj.init();
    testObj.processEntry(entry);
    clickHandler.onClick(null);

    // then
    verify(entryDescriptionSoundController).playOrStopEntrySound(entry.getEntrySound());
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:24,代碼來源:ExplanationControllerTest.java

示例3: shouldHideFeedback

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldHideFeedback() {
    //given
    Element element = mock(Element.class);
    testObj.initModule(element);
    verify(feedbackPresenter).addCloseButtonClickHandler(clickHandlerCaptor.capture());
    ClickHandler clickHandler = clickHandlerCaptor.getValue();
    ClickEvent clickEvent = mock(ClickEvent.class);

    //when
    clickHandler.onClick(clickEvent);

    //then
    verify(feedbackPresenter, times(2)).hideFeedback();
    verify(feedbackBlend, times(2)).hide();
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:17,代碼來源:TextActionProcessorTest.java

示例4: shouldOpenURl

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldOpenURl() {
    // given
    doAnswer(new Answer<Void>() {
        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
            clickHandler = (ClickHandler) invocation.getArguments()[0];
            return null;
        }
    }).when(view).addAnchorClickHandler(any(ClickHandler.class));

    instance.setBean(bean);
    instance.init();

    ClickEvent clickEvent = mock(ClickEvent.class);

    // when
    clickHandler.onClick(clickEvent);

    // then
    verify(assetOpenDelegatorService).open(URL);
    verify(clickEvent).preventDefault();
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:24,代碼來源:ButtonModulePresenterTest.java

示例5: shouldShowFeedback

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldShowFeedback() {
    //given
    Element element = mock(Element.class);
    testObj.initModule(element);
    verify(feedbackPresenter).addShowButtonClickHandler(clickHandlerCaptor.capture());
    ClickHandler clickHandler = clickHandlerCaptor.getValue();
    ClickEvent clickEvent = mock(ClickEvent.class);
    //when
    clickHandler.onClick(clickEvent);
    //then
    verify(feedbackPresenter).showFeedback();
    verify(feedbackBlend).show(feedbackPresenter);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:15,代碼來源:TextActionProcessorTest.java

示例6: shouldShowMenu_onFirstClick

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldShowMenu_onFirstClick() {
    // given
    ClickHandler clickHandler = commandCaptor.getValue();

    // when
    clickHandler.onClick(clickEvent);

    // then
    verify(view).removeStyleName(qpMenuHidden);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:12,代碼來源:MenuPresenterTest.java

示例7: shouldHideMenu_onSecondClick

import com.google.gwt.event.dom.client.ClickHandler; //導入方法依賴的package包/類
@Test
public void shouldHideMenu_onSecondClick() {
    // given
    ClickHandler clickHandler = commandCaptor.getValue();

    // when
    clickHandler.onClick(clickEvent);
    clickHandler.onClick(clickEvent);

    // then
    verify(view).addStyleName(qpMenuHidden);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:13,代碼來源:MenuPresenterTest.java


注:本文中的com.google.gwt.event.dom.client.ClickHandler.onClick方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。