Пример #1
0
  private void buildMainLayout() {
    // setMainWindow(new Window("Address Book Demo application"));

    MyApplication.debug(3, "buildMainLayout");
    // getWindow().setName("FirstPage!");
    layout = new VerticalLayout();
    layout.setSizeFull();

    layout.addComponent(createToolbar());
    layout.addComponent(horizontalSplit);

    /* Allocate all available extra space to the horizontal split panel */

    layout.setExpandRatio(horizontalSplit, 1);
    /* Set the initial split position so we can have a 200 pixel menu to the left */

    horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
    MyApplication.debug(3, "buildMainLayout 2");
    try {
      if (layout != null) {
        getWindow().setLayout(layout);
        MyApplication.debug(3, "buildMainLayout end");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #2
0
  public DashboardView() {
    activities = getActivities();
    addStyleName(ValoTheme.PANEL_BORDERLESS);
    setSizeFull();
    DashboardEventBus.register(this);

    root = new VerticalLayout();
    root.setSizeFull();
    root.setMargin(true);
    root.addStyleName("dashboard-view");
    setContent(root);
    Responsive.makeResponsive(root);

    root.addComponent(buildSparkCards());

    Component content = buildContent();
    root.addComponent(content);
    root.setExpandRatio(content, 1);
  }
  private Component createConnectionSelectorLayout() {
    final ProfileInfoPanelHolder infoPanelHolder = new ProfileInfoPanelHolder();
    profileSelector = createProfileSelector(infoPanelHolder);
    HorizontalLayout content = new HorizontalLayout(profileSelector, infoPanelHolder);
    content.setSizeFull();
    content.setExpandRatio(infoPanelHolder, 1);

    Component buttons = createConnectionButtons(infoPanelHolder);
    Component profileManagerToolbar = createProfileManagerToolbar(profileSelector);

    HorizontalLayout footer = new HorizontalLayout(profileManagerToolbar, buttons);
    footer.setWidth("100%");
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);

    VerticalLayout layout = new VerticalLayout(content, footer);
    layout.setSizeFull();
    layout.setExpandRatio(content, 1);

    return layout;
  }
  private ProfilePreferencesWindow(final User user, final boolean preferencesTabOpen) {
    addStyleName("profile-window");
    setId(ID);
    Responsive.makeResponsive(this);

    setModal(true);
    setCloseShortcut(KeyCode.ESCAPE, null);
    setResizable(false);
    setClosable(false);
    setHeight(90.0f, Unit.PERCENTAGE);
    setWidth(60.0f, Unit.PERCENTAGE);

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();
    content.setMargin(new MarginInfo(true, false, false, false));
    setContent(content);

    TabSheet detailsWrapper = new TabSheet();
    detailsWrapper.setSizeFull();
    detailsWrapper.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    detailsWrapper.addStyleName(ValoTheme.TABSHEET_ICONS_ON_TOP);
    detailsWrapper.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS);
    content.addComponent(detailsWrapper);
    content.setExpandRatio(detailsWrapper, 1f);

    detailsWrapper.addComponent(buildProfileTab());
    detailsWrapper.addComponent(buildPreferencesTab());

    if (preferencesTabOpen) {
      detailsWrapper.setSelectedTab(1);
    }

    content.addComponent(buildFooter());

    fieldGroup = new BeanFieldGroup<>(User.class);
    fieldGroup.bindMemberFields(this);
    fieldGroup.setItemDataSource(user);
  }
Пример #5
0
  @SuppressWarnings("serial")
  public NotAllowedPopover() {
    setWidth("75%");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    setHeight("150px");

    Label lbl;
    layout.addComponent(
        lbl =
            new Label(
                "This mmowgli game does not allow guest access.  Thank you for your interest."));

    layout.setExpandRatio(lbl, 1.0f);
    Button closeButt;
    layout.addComponent(closeButt = new Button("Close"));

    NavigationView nv = new NavigationView(layout);
    nv.setCaption("Access Not Allowed");
    setContent(nv);
    this.center();

    closeButt.addClickListener(
        new ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            HSess.init();
            GameLinks links = GameLinks.getTL();
            HSess.close();

            UI.getCurrent().getPage().setLocation(links.getThanksForInterestLink());
            getSession().close();
          }
        });
  }
Пример #6
0
  /** @param el */
  public BookImage(Books el, String user) {
    super();
    this.Book = el;

    this.setStyleName("cells");
    this.setHeight("250px");
    this.setWidth("200px");

    rating.setAnimated(true);
    rating.setCaption(null);
    rating.setMaxValue(5);
    rating.setStyleName("rating");
    rating.setReadOnly(true);

    rating_my.setAnimated(true);
    rating_my.setCaption(null);
    rating_my.setMaxValue(5);
    rating_my.setStyleName("rating_my");

    IRaitingService iRaitingService = new IRaitingService();
    try {
      double rate = iRaitingService.getRaiting(el.getId());
      rating.setReadOnly(false);
      rating.setValue(rate);
      rating.setReadOnly(true);
      double myrate = iRaitingService.getRaiting(user, el.getId());
      rating_my.setValue(myrate);
    } catch (SQLException e) {
      e.printStackTrace();
    }

    rating_my.addValueChangeListener(
        e -> {
          try {
            Rating rat =
                iRaitingService.getUser(
                    getUI().getSession().getAttribute("user").toString(), el.getId());

            rat.setRaiting(rating_my.getValue());

            iRaitingService.update(rat);

            double rate = iRaitingService.getRaiting(el.getId());
            rating.setReadOnly(false);
            rating.setValue(rate);
            rating.setReadOnly(true);

            new Notification(String.valueOf(rate), Notification.Type.TRAY_NOTIFICATION)
                .show(Page.getCurrent());
          } catch (SQLException e1) {
            e1.printStackTrace();
          }
        });

    rating_layout.addComponent(rating);
    rating_layout.addComponent(rating_my);
    rating_layout.setComponentAlignment(rating, Alignment.MIDDLE_LEFT);
    rating_layout.setComponentAlignment(rating_my, Alignment.MIDDLE_LEFT);
    rating_layout.setStyleName("ratinglayout");

    imageEmbedded.setSource(new FileResource(new File(Book.getImage())));

    title.setValue(Book.getTitle());
    author.setValue(Book.getAuthor());

    if (Book.getFile().isEmpty()) buttonDownload.setEnabled(false);

    buttonDownload.setWidth("80%");
    imageEmbedded.setWidth("100%");
    imageEmbedded.setHeight("100%");

    title.setWidth(null);
    author.setWidth(null);

    VerticalLayout bodyLayout = new VerticalLayout(title, author, imageEmbedded);

    bodyLayout.setExpandRatio(title, 12);
    bodyLayout.setExpandRatio(author, 8);
    bodyLayout.setExpandRatio(imageEmbedded, 80);
    bodyLayout.setSizeFull();
    bodyLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
    bodyLayout.setComponentAlignment(author, Alignment.MIDDLE_CENTER);
    bodyLayout.setComponentAlignment(imageEmbedded, Alignment.MIDDLE_CENTER);

    buttonDownload.setStyleName("super-button");
    title.setStyleName("name-label");
    author.setStyleName("author-label");

    this.addComponent(rating_layout);
    this.addComponent(bodyLayout);
    this.addComponent(buttonDownload);

    this.setComponentAlignment(rating_layout, Alignment.TOP_CENTER);
    this.setComponentAlignment(bodyLayout, Alignment.TOP_CENTER);
    this.setComponentAlignment(buttonDownload, Alignment.BOTTOM_CENTER);
    this.setExpandRatio(rating_layout, 5);
    this.setExpandRatio(bodyLayout, 85);
    this.setExpandRatio(buttonDownload, 10);

    StreamResource sr = getStream();
    FileDownloader fileDownloader = new FileDownloader(sr);
    fileDownloader.extend(buttonDownload);

    bodyLayout.addLayoutClickListener(
        e -> {
          BookWin win = new BookWin(this.Book);
          UI.getCurrent().addWindow(win);
        });
  }