private Component createProfileEditorInvite() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    if (!SettingsManager.get().isSettingsEditorEnabled()) {
      layout.addComponent(
          new Label("No connection profiles defined and you are not allowed to create one."));
    } else {
      Button createProfileLink =
          new Button(
              "Create profile",
              new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                  addProfile();
                }
              });
      createProfileLink.setStyleName(ValoTheme.BUTTON_LINK);

      Label line1 = new Label("No connection profiles defined.");
      line1.setSizeUndefined();

      VerticalLayout inner = new VerticalLayout();
      inner.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
      inner.addComponents(line1, createProfileLink);

      layout.addComponents(inner);
    }

    return layout;
  }
Exemple #2
0
 @Override
 public Layout startLayout() {
   VerticalLayout vl = new VerticalLayout();
   vl.setMargin(true);
   vl.setSpacing(true);
   Label tps = new Label("Temps de scan estimé : " + Ping.TPS);
   Label desc = new Label(Ping.DESCRITPION, ContentMode.HTML);
   HorizontalLayout hl = new HorizontalLayout();
   hl.setMargin(true);
   hl.setSpacing(true);
   @SuppressWarnings("serial")
   Button start =
       new ScanStartButton() {
         @Override
         public void onClick() {
           ping.start(site);
           panel.setContent(runningLayout());
         }
       };
   hl.addComponents(start);
   hl.setSizeUndefined();
   vl.addComponents(desc, tps, hl);
   vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
   return vl;
 }
  UploadStatusInfoWindow(
      final UIEventBus eventBus, final ArtifactUploadState artifactUploadState, final I18N i18n) {
    this.eventBus = eventBus;
    this.artifactUploadState = artifactUploadState;
    this.i18n = i18n;

    setPopupProperties();
    createStatusPopupHeaderComponents();

    mainLayout = new VerticalLayout();
    mainLayout.setSpacing(Boolean.TRUE);
    mainLayout.setSizeUndefined();
    setPopupSizeInMinMode();

    uploads = getGridContainer();
    grid = createGrid();
    setGridColumnProperties();

    mainLayout.addComponents(getCaptionLayout(), grid);
    mainLayout.setExpandRatio(grid, 1.0F);
    setContent(mainLayout);
    eventBus.subscribe(this);
    ui = UI.getCurrent();

    createConfirmDialog();
  }
Exemple #4
0
 @Override
 public Layout resultLayout() {
   addResetButton();
   VerticalLayout vl = new VerticalLayout();
   vl.setMargin(true);
   vl.setSpacing(true);
   Label average;
   if (neo.getScanInfo(scan, "average").data.equals("0.0")) {
     average = new Label("Serveur hors ligne ou protocole ICMP bloqué");
   } else {
     String data = neo.getScanInfo(scan, "average").data;
     average = new Label("Temps de réponse moyen : " + data + " ms");
   }
   vl.addComponents(average);
   return vl;
 }
  public SubsEditViewImpl() {
    ButtonRenderer deleteButton = createDeleteButton();
    Slider percentSlider = createPercentSlider();
    MultiFileUpload uploader = createUploader();

    // need to update the grid a first time for initialization.
    updateGrid(null);
    grid.getColumn("delete").setRenderer(deleteButton);
    fileDownloader = new FileDownloader(generateResource());
    fileDownloader.extend(downloadButton);

    // create the main layout
    VerticalLayout content = new VerticalLayout();

    // layout which contains the uploader and the percentage - in other words : all the
    // configuration information
    HorizontalLayout configHorizontalLayout = new HorizontalLayout();
    configHorizontalLayout.addComponent(uploader);

    // Configure the layout which contains the percentage slider
    AbsoluteLayout sliderLayout = new AbsoluteLayout();
    sliderLayout.setWidth("100px");
    sliderLayout.setHeight("35px");
    sliderLayout.addComponent(percentSlider);

    // Configure the layout which contains the percentage slider layout and the labels linked to the
    // percentage
    HorizontalLayout percentageLayout = new HorizontalLayout();
    percentageLayout.addComponent(percentSliderTitle);
    percentageLayout.addComponent(sliderLayout);
    percentageLayout.addComponent(percentLabel);
    percentageLayout.setComponentAlignment(percentSliderTitle, Alignment.MIDDLE_LEFT);
    percentageLayout.setComponentAlignment(percentLabel, Alignment.MIDDLE_LEFT);

    // add the percentage Layout to the layout which contains the uploader
    configHorizontalLayout.addComponent(percentageLayout);
    configHorizontalLayout.setComponentAlignment(percentageLayout, Alignment.BOTTOM_LEFT);

    // add every layouts to the principal one
    content.addComponent(configHorizontalLayout);
    content.addComponent(new Label(" ", Label.CONTENT_XHTML));
    content.addComponents(grid);
    content.addComponent(downloadButton);
    setCompositionRoot(content);
  }
Exemple #6
0
  @Override
  protected void init(VaadinRequest request) {
    setLocale(Locale.ENGLISH);
    // Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
    setErrorHandler(
        new DefaultErrorHandler() {
          @Override
          public void error(com.vaadin.server.ErrorEvent event) {
            if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
              Notification.show("Sorry, you don't have access to do that.");
            } else {
              super.error(event);
            }
          }
        });

    VerticalLayout layout = new VerticalLayout();
    Panel viewContent = new Panel();
    MenuBar menu = new MenuBar();
    menu.addStyleName("navigation-menu");

    layout.addComponents(menu, viewContent);
    layout.setSizeFull();
    viewContent.setSizeFull();
    layout.setExpandRatio(viewContent, 1);

    menu.addItem("Trading Area", e -> onDashboardClicked());
    menu.addItem("Users", e -> onCustomersClicked());

    navigator = new Navigator(this, viewContent);
    springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
    navigator.addProvider(springViewProvider);
    navigator.setErrorView(ErrorView.class);
    setContent(layout);
    String state = navigator.getState();
    if (state != null && !state.isEmpty()) {
      navigator.navigateTo(state);
    } else {
      navigator.navigateTo(TradingAreaView.NAME);
    }
  }
  private void initUI() {
    VerticalLayout main = new VerticalLayout();
    main.setSpacing(true);
    main.setMargin(true);

    contentP = new VerticalLayout();
    contentP.setSpacing(true);
    contentP.setHeight(80, Unit.PERCENTAGE);

    Button postPublic = new Button(msg.getMessage("RequestProcessingPanel.postPublic"));
    postPublic.setDescription(msg.getMessage("RequestProcessingPanel.postPublicTooltip"));
    postPublic.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            process(commentField.getValue(), true);
          }
        });
    Button postInternal = new Button(msg.getMessage("RequestProcessingPanel.postInternal"));
    postInternal.setDescription(msg.getMessage("RequestProcessingPanel.postInternalTooltip"));
    postInternal.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            process(commentField.getValue(), false);
          }
        });

    commentField = new TextArea();
    commentField.setWidth(100, Unit.PERCENTAGE);

    HorizontalLayout buttons = new HorizontalLayout(postPublic, postInternal);
    buttons.setSpacing(true);

    main.addComponents(contentP, commentField, buttons);
    setCompositionRoot(main);
  }
  @Override
  public void buildComponent(
      String date, String title, String content, Long id, String authorName) {

    addStyleName("subjectNews");

    Label subjectDate = new Label();
    subjectDate.setContentMode(labelContentMode);
    subjectDate.setValue("Publicado: " + date);
    subjectDate.setStyleName(ValoTheme.LABEL_TINY);
    subjectDate.setSizeUndefined();

    // subject
    Label subject = new Label();
    subject.setContentMode(labelContentMode);
    subject.setValue(this.subjectName);

    // content
    Label contentSubject = new Label();
    contentSubject.setContentMode(labelContentMode);
    contentSubject.setValue(content);
    contentSubject.setWidth("100%");

    // title
    Label titleSubject = new Label();
    titleSubject.setContentMode(labelContentMode);
    titleSubject.setValue(title);
    titleSubject.setStyleName(ValoTheme.LABEL_BOLD);

    // author
    Label autName = new Label();
    autName.setContentMode(labelContentMode);
    autName.setValue("Autor: " + authorName);
    autName.setStyleName(ValoTheme.LABEL_TINY);
    autName.setSizeUndefined();

    Panel panel = new Panel();
    panel.setContent(contentSubject);
    panel.setSizeFull();
    panel.setHeight("100px");
    panel.setStyleName(ValoTheme.PANEL_WELL);

    HorizontalLayout topHorizontalLayout = new HorizontalLayout();
    HorizontalLayout botHorizontalLayout = new HorizontalLayout();
    HorizontalLayout auxHorizontalLayout = new HorizontalLayout();
    VerticalLayout elementLayout = new VerticalLayout();

    topHorizontalLayout.setSizeFull();
    topHorizontalLayout.setSpacing(false);
    topHorizontalLayout.setMargin(false);
    topHorizontalLayout.addComponents(autName, subjectDate);
    topHorizontalLayout.setComponentAlignment(subjectDate, Alignment.MIDDLE_RIGHT);
    topHorizontalLayout.setComponentAlignment(autName, Alignment.MIDDLE_LEFT);

    Button editButton = new Button("Editar");
    editButton.setData(id);
    editButton.addClickListener(parentView);
    editButton.addStyleName(ValoTheme.BUTTON_TINY);
    editButton.setWidth("70%");
    editButton.setHeight("70%");

    Button deleteButton = new Button("Eliminar");
    deleteButton.setData(id);
    deleteButton.addClickListener(parentView);
    deleteButton.addStyleName(ValoTheme.BUTTON_TINY);
    deleteButton.setWidth("70%");
    deleteButton.setHeight("70%");

    botHorizontalLayout.setSizeUndefined();
    botHorizontalLayout.setSpacing(false);
    botHorizontalLayout.addComponents(editButton, deleteButton);

    auxHorizontalLayout.setSizeFull();
    auxHorizontalLayout.setSpacing(false);

    elementLayout.setMargin(false);
    elementLayout.setSizeFull();
    elementLayout.setSpacing(false);

    if (id == null) auxHorizontalLayout.addComponents(titleSubject);
    else {
      auxHorizontalLayout.addComponents(titleSubject, botHorizontalLayout);
      auxHorizontalLayout.setComponentAlignment(botHorizontalLayout, Alignment.MIDDLE_RIGHT);
    }

    elementLayout.addComponents(auxHorizontalLayout, panel, topHorizontalLayout, new Hr());

    this.mainLayout.addComponent(elementLayout);
  }
  private void openNotificationsPopup(final ClickEvent event) {
    VerticalLayout notificationsLayout = new VerticalLayout();

    Label title = new Label("Notifications");
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    notificationsLayout.addComponent(title);

    Collection<DashboardNotification> notifications =
        DashboardUI.getDataProvider().getNotifications();
    DashboardEventBus.post(new NotificationsCountUpdatedEvent());

    for (DashboardNotification notification : notifications) {
      VerticalLayout notificationLayout = new VerticalLayout();
      notificationLayout.setMargin(false);
      notificationLayout.setSpacing(false);
      notificationLayout.addStyleName("notification-item");

      Label titleLabel =
          new Label(
              notification.getFirstName()
                  + " "
                  + notification.getLastName()
                  + " "
                  + notification.getAction());
      titleLabel.addStyleName("notification-title");

      Label timeLabel = new Label(notification.getPrettyTime());
      timeLabel.addStyleName("notification-time");

      Label contentLabel = new Label(notification.getContent());
      contentLabel.addStyleName("notification-content");

      notificationLayout.addComponents(titleLabel, timeLabel, contentLabel);
      notificationsLayout.addComponent(notificationLayout);
    }

    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth("100%");
    footer.setSpacing(false);
    Button showAll =
        new Button(
            "View All Notifications",
            new ClickListener() {
              @Override
              public void buttonClick(final ClickEvent event) {
                Notification.show("Not implemented in this demo");
              }
            });
    showAll.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    showAll.addStyleName(ValoTheme.BUTTON_SMALL);
    footer.addComponent(showAll);
    footer.setComponentAlignment(showAll, Alignment.TOP_CENTER);
    notificationsLayout.addComponent(footer);

    if (notificationsWindow == null) {
      notificationsWindow = new Window();
      notificationsWindow.setWidth(300.0f, Unit.PIXELS);
      notificationsWindow.addStyleName("notifications");
      notificationsWindow.setClosable(false);
      notificationsWindow.setResizable(false);
      notificationsWindow.setDraggable(false);
      notificationsWindow.setCloseShortcut(KeyCode.ESCAPE, null);
      notificationsWindow.setContent(notificationsLayout);
    }

    if (!notificationsWindow.isAttached()) {
      notificationsWindow.setPositionY(event.getClientY() - event.getRelativeY() + 40);
      getUI().addWindow(notificationsWindow);
      notificationsWindow.focus();
    } else {
      notificationsWindow.close();
    }
  }