public UniTimeDialogBox(boolean autoHide, boolean modal) { super(autoHide, modal); setAnimationEnabled(true); setGlassEnabled(true); iContainer = new FlowPanel(); iContainer.addStyleName("dialogContainer"); iClose = new Anchor(); iClose.setTitle(MESSAGES.hintCloseDialog()); iClose.setStyleName("close"); iClose.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onCloseClick(event); } }); iClose.setVisible(autoHide); iControls = new FlowPanel(); iControls.setStyleName("dialogControls"); iControls.add(iClose); }
@Override public void setPageViewCarrier(PageViewCarrier pageViewCarrier) { view.getTitlePanel().clear(); view.getTitlePanel().add(pageViewCarrier.getPageTitle()); if (pageViewCarrier.hasContent()) { Panel contentPanel = new FlowPanel(); if (pageViewCarrier.pageType == PageType.ERROR) { contentPanel.setStyleName(styleNames.QP_PAGE_ERROR()); Label errorLabel = new Label(pageViewCarrier.errorMessage); errorLabel.setStyleName(styleNames.QP_PAGE_ERROR_TEXT()); contentPanel.add(errorLabel); } view.getItemsPanel().clear(); view.getItemsPanel().add(contentPanel); } }
/** * Creates new component design panel for non-visible components. */ public SimpleNonVisibleComponentsPanel() { // Initialize UI VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); heading = new Label(""); heading.setStyleName("ya-NonVisibleComponentsHeader"); panel.add(heading); componentsPanel = new FlowPanel(); componentsPanel.setStyleName("ode-SimpleUiDesignerNonVisibleComponents"); panel.add(componentsPanel); initWidget(panel); }
public final ItemHandle appendEmbeddedImage( HAlignment imageAlignment, String embeddedImageText, String embeddedImageStyle, String description ) { FlowPanel outer = new FlowPanel(DivElement.TAG); String imageAlignment1 = "text-align:center;"; if (imageAlignment == HAlignment.LEFT) { imageAlignment1 = "text-align:left;"; } else if (imageAlignment == HAlignment.RIGHT) { imageAlignment1 = "text-align:right;"; } outer.getElement().setAttribute("style", "display:block;" + imageAlignment1); FlowPanel inner = new FlowPanel(ImageElement.TAG); inner.getElement().setAttribute("alt", description); inner.getElement().setAttribute("src", embeddedImageText); inner.getElement().setAttribute("style", embeddedImageStyle); outer.add(inner); appendAndScrollOrFocusAsAppropriate(outer); return new ItemHandle(this, outer); }
@Override protected KeyValue<FlowPanel, FlowPanel> getElement(Integer index) { parent = panelFactory.getFlowPanel(); FlowPanel childPanel = panelFactory.getFlowPanel(); Style style = parent.getElement().getStyle(); parent.getElement().setId(styleNames.QP_PAGE() + index.intValue()); if (swipeType != SwipeType.DISABLED) { style.setPosition(Position.ABSOLUTE); style.setTop(0, Unit.PX); style.setLeft(WIDTH * index, Unit.PCT); style.setWidth(WIDTH, Unit.PCT); } childPanel.setHeight("100%"); childPanel.setWidth("100%"); parent.add(childPanel); return new KeyValue<FlowPanel, FlowPanel>(parent, childPanel); }
@Test public void shouldInitPresenter_andGenerateGaps() { // given; String script = "script"; NodeList gaps = mock(NodeList.class); when(gaps.getLength()).thenReturn(1); Node gap = mock(Node.class); when(gaps.item(0)).thenReturn(gap); when(element.getElementsByTagName("gap")).thenReturn(gaps); when(element.getChildNodes().toString()).thenReturn(script); // when testObj.initModule(element, moduleSocket, bodyGenerator, eventsBus); // then verify(rootPanel).add(isA(FlowPanel.class)); verify(bodyGenerator).processNode(eq(gap), isA(FlowPanel.class)); verify(presenter).setMmlScript(script); }
@Test public void shouldClearPagesStyles() { // given Collection<FlowPanel> keyPanels = Lists.newArrayList(keyPanel1, keyPanel2); // when testObj.clearPagesStyles(keyPanels); // then verify(keyPanel1).removeStyleName(UNSELECTED_STYLE); verify(keyPanel1).removeStyleName(PAGE_SELECTED_STYLE); verify(keyPanel1).removeStyleName(PREVIOUS_PAGE_STYLE); verify(keyPanel1).removeStyleName(NEXT_PAGE_STYLE); verify(keyPanel2).removeStyleName(UNSELECTED_STYLE); verify(keyPanel2).removeStyleName(PAGE_SELECTED_STYLE); verify(keyPanel2).removeStyleName(PREVIOUS_PAGE_STYLE); verify(keyPanel2).removeStyleName(NEXT_PAGE_STYLE); }
public void testPageViewWithSwipeAndWithout() { PanelCache cache = PlayerGinjectorFactory.getNewPlayerGinjectorForGWTTestCase().getPanelCache(); assertTrue(cache.isEmpty()); KeyValue<FlowPanel, FlowPanel> value = cache.getOrCreateAndPut(0); Style style = value.getKey().getElement().getStyle(); assertTrue(style.getPosition().equals(Position.ABSOLUTE.getCssName())); assertTrue(style.getTop().equals("0px")); assertEquals("0.0%", style.getLeft()); assertEquals("100.0%", style.getWidth()); value = cache.getOrCreateAndPut(2); style = value.getKey().getElement().getStyle(); assertEquals(Position.ABSOLUTE.getCssName(), style.getPosition()); assertEquals("0px", style.getTop()); assertEquals("200.0%", style.getLeft()); assertEquals("100.0%", style.getWidth()); cache.setSwipeType(SwipeType.DISABLED); value = cache.getOrCreateAndPut(3); assertNotSame(Position.ABSOLUTE.getCssName(), style.getPosition()); assertNotSame("0px", style.getTop()); assertNotSame("200.0%", style.getLeft()); assertNotSame("100.0%", style.getWidth()); }
/** * Creates the GUI components for search tab. * * @param searchApp: the FlowPanel that search tab will reside. */ private void addGallerySearchTab(FlowPanel searchApp) { // Add search GUI FlowPanel searchPanel = new FlowPanel(); final TextBox searchText = new TextBox(); searchText.addStyleName("gallery-search-textarea"); Button sb = new Button(MESSAGES.gallerySearchForAppsButton()); searchPanel.add(searchText); searchPanel.add(sb); searchPanel.addStyleName("gallery-search-panel"); searchApp.add(searchPanel); appSearchContent.addStyleName("gallery-search-results"); searchApp.add(appSearchContent); searchApp.addStyleName("gallery-search"); sb.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true); } }); }
/** * Creates new Gallery app box. */ private GalleryAppBox() { gContainer = new FlowPanel(); final HorizontalPanel container = new HorizontalPanel(); container.setWidth("100%"); container.setSpacing(0); container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); HorizontalPanel panel = new HorizontalPanel(); Image image = new Image(); image.setResource(Ode.getImageBundle().waitingIcon()); panel.add(image); Label label = new Label(); label.setText(Ode.getMessages().defaultRpcMessage()); panel.add(label); gContainer.add(panel); this.add(gContainer); }
public ItemViewCarrier(String err) { errorView = new FlowPanel(); errorView.setStyleName("qp-item-error"); Label errorLabel = new Label(err); errorLabel.setStyleName("qp-item-error-text"); errorView.add(errorLabel); }
@Override public void setItemContent(SourcelistItemValue item, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) { removeContent(); fullFillItemWrapperWithContent(item, inlineBodyGeneratorSocket); DraggableObject<FlowPanel> draggableObject = createDragableObjectOnItemWrapper(); addDragHandlersToItem(draggableObject); mathJaxNative.renderMath(); }
private DraggableObject<FlowPanel> createDragableObjectOnItemWrapper() { DraggableObject<FlowPanel> draggableObject = dragDropHelper.enableDragForWidget(itemWrapper); Widget draggableWidget = draggableObject.getDraggableWidget(); container.add(draggableWidget); optionalDraggable = Optional.of(draggableObject); return draggableObject; }
private void addDragEndHandlerToItem(DraggableObject<FlowPanel> draggableObject) { draggableObject.addDragEndHandler(new DragEndHandler() { @Override public void onDragEnd(DragEndEvent event) { removeDraggableStyleFromItem(); dragEndHandler.onDragEnd(event); } }); }
private void addDragStartHandlerToItem(DraggableObject<FlowPanel> draggableObject) { draggableObject.addDragStartHandler(new DragStartHandler() { @Override public void onDragStart(DragStartEvent event) { touchController.setTouchReservation(true); event.getDataTransfer().setDragImage(itemWrapper.getElement(), 0, 0); dragStartHandlerOptional.get().onDragStart(event); } }); }
public Widget getPictureTitleWidget(PicturePlayerBean bean, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) { if (bean.hasTitle()) { Element titleXmlElement = bean.getTitleBean().getTitleName().getValue(); return inlineBodyGeneratorSocket.generateInlineBody(titleXmlElement); } else { return new FlowPanel(); } }
protected FlowPanel parseTemplate(MediaWrapper<?> mediaWrapper, Element template, FlowPanel parent) { parser.setMediaWrapper(mediaWrapper); parser.setFullScreenMediaWrapper(mediaWrapper); parser.setFullScreen(true); parser.parse(template, parent); return parent; }
@Override public void showImage(String url, Size size) { content.clear(); WidgetSize widgetSize = new WidgetSize(size); widgetSize.setOnWidget(content); FlowPanel panelWithBackground = new FlowPanel(); widgetSize.setOnWidget(panelWithBackground); setBackgroundImage(url, panelWithBackground); content.add(panelWithBackground); }
@Inject public TableModule(TableStyleNameConstants styleNames, StyleSocket styleSocket) { this.styleNames = styleNames; this.styleSocket = styleSocket; tablePanel = new FlowPanel(); tablePanel.setStyleName(this.styleNames.QP_TABLE()); }
protected Widget getMediaObject() { Widget mediaObjectWidget; if (isFullScreen) { mediaObjectWidget = fullScreenMediaWrapper.getMediaObject(); } else { FlowPanel videoContainer = new FlowPanel(); videoContainer.add(mediaWrapper.getMediaObject()); videoContainer.getElement().getStyle().setPosition(Position.RELATIVE); mediaObjectWidget = videoContainer; } return mediaObjectWidget; }
public FlashLocalMediaImpl(String name) { elementId = Document.get().createUniqueId(); panelMain = new FlowPanel(); panelMain.setStyleName("qp-" + name + "-flash-local"); panelContent = new FlowPanel(); panelContent.getElement().setId(elementId); panelMain.add(panelContent); initWidget(panelMain); }
/** * Show a Dialog Box when we receive an SC_PRECONDITION_FAILED * response code to any Async RPC call. This is a signal that * either our session has expired, or our login cookie has otherwise * become invalid. This is a fatal error and the user should not * be permitted to continue (many ignore the red error bar and keep * working, in vain). So now when this happens, we put up this * modal dialog box which cannot be dismissed. Instead it presents * just one option, a "Reload" button which reloads the browser. * This should trigger a re-authentication (or in the case of an * App Inventor upgrade trigging the problem, the loading of newer * code). */ public void sessionDead() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.invalidSessionDialogText()); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.sessionDead()); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button reloadSession = new Button(MESSAGES.reloadWindow()); reloadSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); reloadWindow(true); } }); holder.add(reloadSession); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
public void animatePageSwitch( final MultiPageController multiPageController, final float from, final float to, final NavigationButtonDirection direction, final int duration, final boolean onlyPositionReset) { if (Math.abs(from - to) > 1) { if (!onlyPositionReset) { windowDelegate.scrollTo(0, 0); } animation.get().removeAnimationEndCallback(animationCallback); animationCallback = new AnimationEndCallback() { @Override public void onComplate(int position) { scheduler.scheduleDeferred(new ScheduledCommand() { @Override public void execute() { multiPageController.resetFocusAndStyles(); if (direction != null) { multiPageController.invokeNavigationRequest(direction); } if (!onlyPositionReset) { eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.PAGE_VIEW_LOADED)); } multiPageController.setCurrentPosition(to); } }); } }; animation.get().addAnimationEndCallback(animationCallback); FlowPanel target = multiPageController.getMainPanel(); int width = multiPageController.getWidth(); int xPosition = Math.round((to / width)) * width; animation.get().goTo(target, xPosition, duration); } else if (!onlyPositionReset) { eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.PAGE_VIEW_LOADED)); } }
private Set<Integer> getActivePagesIds() { Map<Integer, KeyValue<FlowPanel, FlowPanel>> cache = panelCache.getCache(); Set<Integer> activePanels = Sets.newHashSet(); for (Entry<Integer, KeyValue<FlowPanel, FlowPanel>> entry : cache.entrySet()) { Integer key = entry.getKey(); KeyValue<FlowPanel, FlowPanel> value = entry.getValue(); if (value.getValue().isAttached()) { activePanels.add(key); } } return activePanels; }
public final void appendTiledLineImage(String srcImageText, String additionalCssStyle) { FlowPanel outer = new FlowPanel(DivElement.TAG); outer.getElement().setAttribute("style", additionalCssStyle + "line-height:100%;font-size:1px;width:100%;align:'center';background-image:url('"+srcImageText+"');"); //margin-bottom:6px; FlowPanel inner = new FlowPanel(ImageElement.TAG); inner.getElement().setAttribute("src", srcImageText); inner.getElement().setAttribute("style", "visibility: hidden;"); outer.add(inner); appendAndScrollOrFocusAsAppropriate(outer); }
/** * Creates video on page! */ private static void createVideoDialog(String tutorialId) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText("Tutorial Video"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); // Adds Youtube Video HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); holder.add(ok); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
/** * Possibly display the MIT App Inventor "Splash Screen" * * @param force Bypass the check to see if they have dimissed this version */ private void createWelcomeDialog(boolean force) { if (!shouldShowWelcomeDialog() && !force) { maybeShowNoProjectsDialog(); return; } // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.createWelcomeDialogText()); dialogBox.setHeight(splashConfig.height + "px"); dialogBox.setWidth(splashConfig.width + "px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(splashConfig.content); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button ok = new Button(MESSAGES.createWelcomeDialogButton()); final CheckBox noshow = new CheckBox(MESSAGES.doNotShow()); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); if (noshow.getValue()) { // User checked the box userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS). changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION, "" + splashConfig.version); userSettings.saveSettings(null); } maybeShowNoProjectsDialog(); } }); holder.add(ok); holder.add(noshow); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
private void scheduleDeferredAttachToParent(final MultiPageController multiPageController, final KeyValue<FlowPanel, FlowPanel> pair, final int pageNumber) { scheduler.scheduleDeferred(new ScheduledCommand() { @Override public void execute() { FlowPanel placeHolderPanel = pair.getKey(); FlowPanel pageContentPanel = pair.getValue(); placeHolderPanel.add(pageContentPanel); if (multiPageController.isCurrentPage(pageNumber)) { multiPageController.setCurrentPageHeight(); } } }); }
public void clearPagesStyles(Collection<FlowPanel> keyPanels) { for (FlowPanel flowPanel : keyPanels) { flowPanel.removeStyleName(styleNames.QP_PAGE_UNSELECTED()); flowPanel.removeStyleName(styleNames.QP_PAGE_SELECTED()); flowPanel.removeStyleName(styleNames.QP_PAGE_PREV()); flowPanel.removeStyleName(styleNames.QP_PAGE_NEXT()); } }
public FlowPanel getViewForPage(Integer pageNumber) { boolean pageWasCreated = panelsCache.isPresent(pageNumber); KeyValue<FlowPanel, FlowPanel> panel = panelsCache.getOrCreateAndPut(pageNumber); if (!pageWasCreated) { mainPanel.add(panel.getKey()); applyStylesToPanelOnIndex(pageNumber); showProgressBarForPage(pageNumber); } loadedPages.add(pageNumber); return panel.getValue(); }
private void applyStylesToPanelOnIndex(Integer pageNumber) { KeyValue<FlowPanel, FlowPanel> panelsPair = panelsCache.getOrCreateAndPut(pageNumber); FlowPanel panel = panelsPair.getKey(); boolean isChangeToNextPage = isChangeToNextPage(pageNumber); multiPageControllerStyleManager.setPageStyles(panel, isChangeToNextPage); }
/** * Display a Dialog box that explains that you cannot connect a * device or the emulator to App Inventor until you have a project * selected. */ private void wontConnectDialog() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.noprojectDialogTitle()); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML("<p>" + MESSAGES.noprojectDuringConnect() + "</p>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button okButton = new Button("OK"); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); holder.add(okButton); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
protected Widget createTitleWidget(String index, String text) { Panel titlePanel = new FlowPanel(); titlePanel.setStyleName(styleNames.QP_ITEM_TITLE()); Label indexLabel = new Label(index + ". "); indexLabel.setStyleName(styleNames.QP_ITEM_TITLE_INDEX()); Label textLabel = new Label(text); textLabel.setStyleName(styleNames.QP_ITEM_TITLE_TEXT()); titlePanel.add(indexLabel); titlePanel.add(textLabel); return titlePanel; }
@Inject public Item(@Assisted DisplayContentOptions options, @Assisted ItemOutcomeStorageImpl outcomeStorage, @Assisted JSONArray stateArray, FeedbackModuleFactory feedbackModuleFactory, FlowActivityVariablesProcessor flowActivityVariablesProcessor, @PageScoped VariableProcessingAdapter variableProcessingAdapter, VariablesProcessingModulesInitializer variablesProcessingModulesInitializer, @PageScoped ItemResponseManager responseManager, ItemXMLWrapper xmlMapper, ItemExpressionParser expressionParser, AssessmentControllerFactory assessmentControllerFactory) { this.options = options; this.responseManager = responseManager; this.flowActivityVariablesProcessor = flowActivityVariablesProcessor; this.variableProcessor = variableProcessingAdapter; this.outcomeStorage = outcomeStorage; Element itemBodyNode = xmlMapper.getItemBody(); expressionParser.parseAndConnectExpressions(); new FeedbackAutoMarkInterpreter().interpretFeedbackAutoMark(itemBodyNode, responseManager); moduleSocket = assessmentControllerFactory.getItemModuleSocket(this); itemBody = assessmentControllerFactory.getItemBody(options, moduleSocket); moduleSocket.init(itemBody, state); InlineBodyGeneratorSocket inlineBodyGeneratorSocket = moduleSocket.getInlineBodyGeneratorSocket(); this.moduleFeedbackProcessor = feedbackModuleFactory.getModuleFeedbackProcessor(inlineBodyGeneratorSocket); itemBodyView = new ItemBodyView(itemBody); setState(stateArray); itemBodyView.init(itemBody.init(itemBodyNode)); variablesProcessingModulesInitializer.initializeVariableProcessingModules(responseManager, this.outcomeStorage); Node rootNode = xmlMapper.getAssessmentItems() .item(0); title = ((Element) rootNode).getAttribute("title"); scorePanel = new FlowPanel(); scorePanel.setStyleName("qp-feedback-hidden"); }
@Inject public SoundExecutorSwfSimple(LocalSwfMediaWrapper localSwfMediaWrapper) { panelMain = new FlowPanel(); RootPanel.get().add(panelMain, PANEL_OFFSET, PANEL_OFFSET); localSwfMediaWrapper.setMediaWidget(panelMain); mediaWrapper = localSwfMediaWrapper; }
public final void appendPre(StyledBlock styledBlock, boolean withFormatting, String additionalStyle) { FlowPanel outerWidget = new FlowPanel(PreElement.TAG ); styledBlock.toGwtWidget(this, outerWidget, withFormatting, getPreBlockClassName()); if (additionalStyle != null) { outerWidget.getElement().setAttribute("style",additionalStyle); } appendAndScrollOrFocusAsAppropriate(outerWidget); }
public Audio reAttachAudio(Audio audio) { NodeList<Node> sourceList = getSourceNodes(audio); FlowPanel parentPanel = getParentPanelAndRemoveAudioElement(audio); Audio newAudio = createNewAudioAndAddToFlowPanel(parentPanel); appendChilds(sourceList, newAudio); return newAudio; }
/** * Enlarges image on page */ private static void createImageDialog(String img) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); // Adds Image Image image = new Image(img); image.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent evt) { dialogBox.center(); } }); image.setStyleName("DialogBox-image"); holder.add(ok); DialogBoxContents.add(image); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
@Test public void testParentPanelAndRemoveAudioElement() { // when FlowPanel parentPanel = util.getParentPanelAndRemoveAudioElement(audioMock); // then verify(parentPanel).remove(audioMock); }
@Test public void createNewAudioAndAddToFlowPanel() { // given FlowPanel parentPanel = mock(FlowPanel.class); // when Audio newAudio = util.createNewAudioAndAddToFlowPanel(parentPanel); // then verify(newAudio).addToParent(parentPanel); }