Java Code Examples for com.google.gwt.user.client.ui.FlowPanel

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.FlowPanel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: UniTimeDialogBox.java   Source Code and License 7 votes vote down vote up
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);
  }
 
Example 2
Project: empiria.player   File: PageViewSocketImpl.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 3
Project: appinventor-extensions   File: SimpleNonVisibleComponentsPanel.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 4
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 5
Project: empiria.player   File: PanelCache.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 6
Project: empiria.player   File: InteractionMathJaxModuleTest.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 7
Project: empiria.player   File: MultiPageControllerStyleManagerTest.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 8
Project: empiria.player   File: PanelCacheGWTTestCase.java   Source Code and License 6 votes vote down vote up
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());

}
 
Example 9
Project: appinventor-extensions   File: GalleryList.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
    }
  });
}
 
Example 10
Project: appinventor-extensions   File: GalleryAppBox.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 11
Project: empiria.player   File: ItemViewCarrier.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 12
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 5 votes vote down vote up
@Override
public void setItemContent(SourcelistItemValue item, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) {
    removeContent();
    fullFillItemWrapperWithContent(item, inlineBodyGeneratorSocket);
    DraggableObject<FlowPanel> draggableObject = createDragableObjectOnItemWrapper();
    addDragHandlersToItem(draggableObject);
    mathJaxNative.renderMath();
}
 
Example 13
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 5 votes vote down vote up
private DraggableObject<FlowPanel> createDragableObjectOnItemWrapper() {
    DraggableObject<FlowPanel> draggableObject = dragDropHelper.enableDragForWidget(itemWrapper);
    Widget draggableWidget = draggableObject.getDraggableWidget();

    container.add(draggableWidget);
    optionalDraggable = Optional.of(draggableObject);
    return draggableObject;
}
 
Example 14
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 5 votes vote down vote up
private void addDragEndHandlerToItem(DraggableObject<FlowPanel> draggableObject) {
    draggableObject.addDragEndHandler(new DragEndHandler() {

        @Override
        public void onDragEnd(DragEndEvent event) {
            removeDraggableStyleFromItem();
            dragEndHandler.onDragEnd(event);
        }
    });
}
 
Example 15
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 5 votes vote down vote up
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);
        }
    });
}
 
Example 16
Project: empiria.player   File: PictureTitleProvider.java   Source Code and License 5 votes vote down vote up
public Widget getPictureTitleWidget(PicturePlayerBean bean, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) {
    if (bean.hasTitle()) {
        Element titleXmlElement = bean.getTitleBean().getTitleName().getValue();
        return inlineBodyGeneratorSocket.generateInlineBody(titleXmlElement);
    } else {
        return new FlowPanel();
    }
}
 
Example 17
Project: empiria.player   File: VideoFullScreenHelper.java   Source Code and License 5 votes vote down vote up
protected FlowPanel parseTemplate(MediaWrapper<?> mediaWrapper, Element template, FlowPanel parent) {
    parser.setMediaWrapper(mediaWrapper);
    parser.setFullScreenMediaWrapper(mediaWrapper);
    parser.setFullScreen(true);
    parser.parse(template, parent);
    return parent;
}
 
Example 18
Project: empiria.player   File: BonusPopupViewImpl.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 19
Project: empiria.player   File: TableModule.java   Source Code and License 5 votes vote down vote up
@Inject
public TableModule(TableStyleNameConstants styleNames, StyleSocket styleSocket) {
    this.styleNames = styleNames;
    this.styleSocket = styleSocket;

    tablePanel = new FlowPanel();
    tablePanel.setStyleName(this.styleNames.QP_TABLE());
}
 
Example 20
Project: empiria.player   File: ObjectTemplateParser.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 21
Project: empiria.player   File: FlashLocalMediaImpl.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 22
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
}
 
Example 23
Project: empiria.player   File: PageSwitchAnimation.java   Source Code and License 5 votes vote down vote up
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));
    }
}
 
Example 24
Project: empiria.player   File: VisiblePagesManager.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 25
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 26
Project: appinventor-extensions   File: TutorialPanel.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
}
 
Example 27
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
}
 
Example 28
Project: empiria.player   File: PanelAttacher.java   Source Code and License 5 votes vote down vote up
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();
            }
        }
    });
}
 
Example 29
Project: empiria.player   File: MultiPageControllerStyleManager.java   Source Code and License 5 votes vote down vote up
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());
    }
}
 
Example 30
Project: empiria.player   File: MultiPageController.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 31
Project: empiria.player   File: MultiPageController.java   Source Code and License 5 votes vote down vote up
private void applyStylesToPanelOnIndex(Integer pageNumber) {
    KeyValue<FlowPanel, FlowPanel> panelsPair = panelsCache.getOrCreateAndPut(pageNumber);
    FlowPanel panel = panelsPair.getKey();

    boolean isChangeToNextPage = isChangeToNextPage(pageNumber);
    multiPageControllerStyleManager.setPageStyles(panel, isChangeToNextPage);
}
 
Example 32
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
}
 
Example 33
Project: empiria.player   File: ItemController.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 34
Project: empiria.player   File: Item.java   Source Code and License 5 votes vote down vote up
@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");
}
 
Example 35
Project: empiria.player   File: SoundExecutorSwfSimple.java   Source Code and License 5 votes vote down vote up
@Inject
public SoundExecutorSwfSimple(LocalSwfMediaWrapper localSwfMediaWrapper) {
    panelMain = new FlowPanel();
    RootPanel.get().add(panelMain, PANEL_OFFSET, PANEL_OFFSET);
    localSwfMediaWrapper.setMediaWidget(panelMain);
    mediaWrapper = localSwfMediaWrapper;
}
 
Example 36
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 37
Project: empiria.player   File: ReAttachAudioUtil.java   Source Code and License 5 votes vote down vote up
public Audio reAttachAudio(Audio audio) {
    NodeList<Node> sourceList = getSourceNodes(audio);
    FlowPanel parentPanel = getParentPanelAndRemoveAudioElement(audio);
    Audio newAudio = createNewAudioAndAddToFlowPanel(parentPanel);
    appendChilds(sourceList, newAudio);
    return newAudio;
}
 
Example 38
Project: appinventor-extensions   File: TutorialPanel.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
}
 
Example 39
Project: empiria.player   File: ReAttachAudioUtilTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testParentPanelAndRemoveAudioElement() {
    // when
    FlowPanel parentPanel = util.getParentPanelAndRemoveAudioElement(audioMock);

    // then
    verify(parentPanel).remove(audioMock);
}
 
Example 40
Project: empiria.player   File: ReAttachAudioUtilTest.java   Source Code and License 5 votes vote down vote up
@Test
public void createNewAudioAndAddToFlowPanel() {
    // given
    FlowPanel parentPanel = mock(FlowPanel.class);

    // when
    Audio newAudio = util.createNewAudioAndAddToFlowPanel(parentPanel);

    // then
    verify(newAudio).addToParent(parentPanel);
}
 
Example 41
Project: empiria.player   File: PageSwitchAnimationGWTTestCase.java   Source Code and License 5 votes vote down vote up
public void testAnimation() {
    final FlowPanel panel = new FlowPanel();
    panel.getElement().getStyle().setPosition(Position.ABSOLUTE);
    panel.getElement().getStyle().setLeft(100, Unit.PCT);
    PageSwitchAnimation animation = new PageSwitchAnimation(panel, 200) {
        @Override
        protected void onComplete() {
            super.onComplete();
            assertEquals("200.0%", panel.getElement().getStyle().getLeft());
            finishTest();
        }
    };
    delayTestFinish(500);
    animation.run(50);
}
 
Example 42
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 5 votes vote down vote up
/**
   * Helper method called by constructor to initialize ui components
   */
  private void initComponents() {
    // Initialize UI
    panel = new VerticalPanel();
    panel.setWidth("100%");
    galleryGUI = new FlowPanel();
    appSingle = new FlowPanel();
    appDetails = new FlowPanel();
    appHeader = new FlowPanel();
    appInfo = new FlowPanel();
    appAction = new FlowPanel();
    appAuthor = new FlowPanel();
    appMeta = new FlowPanel();
    appDates = new FlowPanel();
    appPrimaryWrapper = new FlowPanel();
    appSecondaryWrapper = new FlowPanel();
    appDescPanel = new FlowPanel();
    appReportPanel = new FlowPanel();
    appSharePanel = new FlowPanel();
    appActionTabs = new TabPanel();
    sidebarTabs = new TabPanel();
    appComments = new FlowPanel();
    appCommentsList = new FlowPanel();
    appsByAuthor = new FlowPanel();
    appsByTags = new FlowPanel();
    appsRemixes = new FlowPanel();
    returnToGallery = new FlowPanel();
//    tagSelected = "";

    appCreated = new Label();
    appChanged = new Label();
    descBox = new FlowPanel();
    titleBox = new FlowPanel();
    desc = new TextArea();
    titleText = new TextArea();
    moreInfoText = new TextArea();
    creditText = new TextArea();
    ccLicenseRef = new HTML(MESSAGES.galleryCcLicenseRef());
    ccLicenseRef.addStyleName("app-action-html");
  }
 
Example 43
Project: appinventor-extensions   File: ProfilePage.java   Source Code and License 5 votes vote down vote up
/**
 * Creates the GUI components for a regular app tab.
 * This method resides here because it needs access to global variables.
 * @param container: the FlowPanel that this app tab will reside.
 * @param content: the sub-panel that contains the actual app content.
 */
private void addGalleryAppTab(FlowPanel container, FlowPanel content, final String incomingUserId) {
  // Search specific
  generalTotalResultsLabel = new Label();
  container.add(generalTotalResultsLabel);

  final OdeAsyncCallback<GalleryAppListResult> byAuthorCallback = new OdeAsyncCallback<GalleryAppListResult>(
    // failure message
    MESSAGES.galleryError()) {
    @Override
    public void onSuccess(GalleryAppListResult appsResult) {
      refreshApps(appsResult,false);
    }
  };
  Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
  container.add(content);

  buttonNext = new Label();
  buttonNext.setText(MESSAGES.galleryMoreApps());
  buttonNext.addStyleName("active");

  FlowPanel next = new FlowPanel();
  next.add(buttonNext);
  next.addStyleName("gallery-nav-next");
  container.add(next);
  buttonNext.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
       if (!appCatalogExhausted) {
            // If the next page still has apps to retrieve, do it
            appCatalogCounter += NUMAPPSTOSHOW;
            Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
          }
    }
  });
}
 
Example 44
Project: gwt-promptly   File: StyledBlock.java   Source Code and License 5 votes vote down vote up
void toGwtWidget(
   final PromptlyPanel promptlyPanel,
   FlowPanel outerWidget,
   boolean withFormatting,
   String outerClassOverride
) {

   if (outerClassOverride != null) {
      outerWidget.getElement().setAttribute("class", outerClassOverride);
   }
   
   for (StyledParagraphItem paragraphItem : _items) {
      final String text  = paragraphItem.getText();
      final String style = paragraphItem.getStyle();
      
      FlowPanel spanElement = new FlowPanel(SpanElement.TAG /* <span> tag */ );
      spanElement.getElement().setInnerText(text);
      
      if (withFormatting && style != null) {
         spanElement.getElement().setAttribute("style", style);
      }
      
      final ItemListener callback = paragraphItem.getCallback();
      
      if (callback != null) {
         
         Hyperlink hl = new Hyperlink(promptlyPanel, promptlyPanel.getNextHyperlinkIdAndIncrement(), callback, text);
         spanElement.addDomHandler(hl , ClickEvent.getType());
         spanElement.getElement().setAttribute("onMouseOver", "this.style.fontWeight='normal'");
         spanElement.getElement().setAttribute("onMouseOut",  "this.style.fontWeight='normal'");
      }
      outerWidget.add(spanElement);
   }
}
 
Example 45
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 5 votes vote down vote up
private final void appendAndScrollOrFocusAsAppropriate(FlowPanel tag) {
   int numWidgets = _mainTextFlowDiv.getWidgetCount();
   if (numWidgets == 0) {
      _mainTextFlowDiv.add(tag);
   } else {
      _mainTextFlowDiv.insert(tag, _mainTextFlowDiv.getWidgetCount()-1);
   }
 
   if (_isCommandLineMode) {
      focusOnCommandLine();
   } else {
      tag.getElement().scrollIntoView();
   }
}
 
Example 46
Project: appinventor-extensions   File: GalleryListBox.java   Source Code and License 5 votes vote down vote up
/**
 * Load GalleryList
 */
public static void loadGalleryList(){
  INSTANCE.plist = new GalleryList();
  FlowPanel pContainer = new FlowPanel();
  pContainer.add(INSTANCE.plist);
  INSTANCE.add(pContainer);
}
 
Example 47
Project: appinventor-extensions   File: ProfileBox.java   Source Code and License 5 votes vote down vote up
/**
   * Creates new user profile box.
   */
  private ProfileBox() {
//    super(MESSAGES.userProfileBoxCaption(),
//        300,    // height
//        false,  // minimizable
//        false); // removable
    pContainer = new FlowPanel();
    this.add(pContainer);
  }
 
Example 48
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 4 votes vote down vote up
/**
* 
* @param styledBlock A non null styled paragraph instance
* @param withFormatting If false, then styles will be ignored.
*/
 public final void append(StyledBlock styledBlock, boolean withFormatting) {
    FlowPanel outerWidget = new FlowPanel(ParagraphElement.TAG /* <p> tag */ );
    styledBlock.toGwtWidget(this, outerWidget, withFormatting, null /* outer style override */);
    appendAndScrollOrFocusAsAppropriate(outerWidget);
 }
 
Example 49
Project: empiria.player   File: InfoModule.java   Source Code and License 4 votes vote down vote up
private void createMainPanel() {
    mainPanel = new FlowPanel();
    mainPanel.setStyleName(styleNames.QP_INFO());
    mainPanel.add(contentPanel);
}
 
Example 50
Project: empiria.player   File: InfoModule.java   Source Code and License 4 votes vote down vote up
private void createContentPanel() {
    contentPanel = new FlowPanel();
    contentPanel.setStyleName(styleNames.QP_INFO_CONTENT());
}
 
Example 51
Project: empiria.player   File: MathTextModule.java   Source Code and License 4 votes vote down vote up
private void createMainPanel() {
    mainPanel = new FlowPanel();
    mainPanel.setStyleName("qp-mathtext");
}
 
Example 52
Project: empiria.player   File: LinkModule.java   Source Code and License 4 votes vote down vote up
private void prepareMainPanel() {
    mainPanel = new FlowPanel();
    setPrimaryStyleName();
    mainPanel.add(getContainer());
}
 
Example 53
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 4 votes vote down vote up
private void fullFillItemWrapperWithContent(SourcelistItemValue item, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) {
    IsWidget contentWidget = contentFactory.createSourceListContentWidget(item, inlineBodyGeneratorSocket);
    itemWrapper = new FlowPanel();
    itemWrapper.add(contentWidget);
}
 
Example 54
Project: empiria.player   File: DragGapViewImpl.java   Source Code and License 4 votes vote down vote up
private void addDragHandlersToItem(DraggableObject<FlowPanel> draggableObject) {
    addDragStartHandlerToItem(draggableObject);
    addDragEndHandlerToItem(draggableObject);
}
 
Example 55
Project: empiria.player   File: SimpleContainerModuleBase.java   Source Code and License 4 votes vote down vote up
public SimpleContainerModuleBase() {
    this.panel = new FlowPanel();
}
 
Example 56
Project: empiria.player   File: ImgTemplateParser.java   Source Code and License 4 votes vote down vote up
protected MediaController createEmptyModuleWrapper() {
    return new ModuleWrapper(new FlowPanel());
}
 
Example 57
Project: empiria.player   File: VideoFullScreenViewImpl.java   Source Code and License 4 votes vote down vote up
@Override
public FlowPanel getContainer() {
    return container;
}
 
Example 58
Project: empiria.player   File: VideoFullScreenViewImpl.java   Source Code and License 4 votes vote down vote up
@Override
public FlowPanel getControls() {
    return controls;
}
 
Example 59
Project: empiria.player   File: MediaControllerWrapper.java   Source Code and License 4 votes vote down vote up
public MediaControllerWrapper(Widget widget) {
    FlowPanel panel = new FlowPanel();
    panel.add(widget);
    this.widget = panel;// widget;
}
 
Example 60
Project: empiria.player   File: AbstractConnectionItemView.java   Source Code and License 4 votes vote down vote up
public FlowPanel getSelectionElement() {
    return selection;
}