private void addNavigation() {

    userLabel = new Label();
    userLabel.setSizeFull();
    HorizontalLayout informtaion = new HorizontalLayout();
    informtaion.addComponent(userLabel);

    HorizontalLayout navigation = new HorizontalLayout();
    navigation.addComponents(
        btnAdverts,
        btnLogin,
        btnRegistration,
        btnAdvertReg,
        btnMyAccout,
        btnAdminAccount,
        btnLogout);

    HorizontalLayout languages = new HorizontalLayout();
    languages.addComponents(btnHun, btnEng);

    HorizontalLayout headersplitter = new HorizontalLayout();
    headersplitter.addComponents(informtaion, navigation, languages);
    headersplitter.setWidth(i18Helper.getMessage("size_100"));
    headersplitter.setComponentAlignment(informtaion, Alignment.TOP_LEFT);
    headersplitter.setComponentAlignment(navigation, Alignment.TOP_CENTER);
    headersplitter.setComponentAlignment(languages, Alignment.TOP_RIGHT);

    header.addComponent(headersplitter);
    header.setComponentAlignment(headersplitter, Alignment.TOP_CENTER);
  }
Esempio n. 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;
 }
Esempio n. 3
0
  private com.vaadin.ui.Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(final Button.ClickEvent event) {
            DashboardEventBus.post(
                new UserLoginRequestedEvent(username.getValue(), password.getValue()));
          }
        });
    return fields;
  }
Esempio n. 4
0
  private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    username = new TextField("Usuario");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    username.focus();

    clave = new PasswordField("Contraseña");
    clave.setIcon(FontAwesome.LOCK);
    clave.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Entrar");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);

    fields.addComponents(username, clave, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(
        new ClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(final ClickEvent event) {

            doLogin();
          }
        });
    return fields;
  }
Esempio n. 5
0
  private Component AutoGeneratedLayoutDesign() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    // set parent Test Case manually without a field
    if (editmode == false && (clonemode == false)) {
      testsession.setParentcase(parentcase);
    }

    binder = new FieldGroup();
    //		BeanItem<Person> item = new BeanItem<Person>(person);		// takes item as argument
    //		item.addNestedProperty("address.street");	// Address info is not person but address to which
    // person is linked
    binder.setItemDataSource(newSessionItem); // link to data model to binder	
    //		binder.bindMemberFields(form);	// link to layout

    // GENERATE FIELDS
    //	for (Object propertyId : item.getItemPropertyIds()) {
    //		if(!"address".equals(propertyId)) {
    //			Field field = binder.buildAndBind(propertyId);
    //			layout.addComponent(field);
    //		}
    //	}

    // using bind() to determine what type of field is created yourself...
    title = new TextField();
    binder.bind(title, "title");
    title.setWidth(22, Unit.EM);
    title.setCaption("Title");
    title.focus();
    title.setImmediate(true);
    title.addValidator(new BeanValidator(TestSession.class, "title"));
    //		title.setValidationVisible(false);
    title.setNullRepresentation("");
    layout.addComponent(title);

    binder.setBuffered(true);

    // button layout
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setWidth("100%");
    buttons.addStyleName("buttons-margin-top");
    layout.addComponent(buttons);

    createButton = new Button("Create", this);
    if (editmode) createButton.setCaption("Save");
    createButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    createButton.setClickShortcut(KeyCode.ENTER);

    cancelButton = new Button("Cancel", this);

    buttons.addComponents(createButton, cancelButton);
    buttons.setComponentAlignment(createButton, Alignment.MIDDLE_LEFT);
    buttons.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

    return layout;
  }
 private HorizontalLayout getCaptionLayout() {
   final HorizontalLayout captionLayout = new HorizontalLayout();
   captionLayout.setSizeFull();
   captionLayout.setHeight("36px");
   captionLayout.addComponents(windowCaption, minimizeButton, resizeButton, closeButton);
   captionLayout.setExpandRatio(windowCaption, 1.0F);
   captionLayout.addStyleName("v-window-header");
   return captionLayout;
 }
Esempio n. 7
0
  public UserSelect() {
    loginInfo = new Label("");
    loginInfo.addStyleName("error-font");
    loginInfo.addStyleName("margin15");
    loginInfo.addStyleName("margin-top40");
    loginInfo.setVisible(false);
    selected = null;
    loginField = new PasswordField("");
    loginField.setWidth("200px");
    loginField.addStyleName("margin15");
    loginField.addStyleName("margin-bot40");
    loginBut = new Button("login");
    loginBut.addStyleName("margin15");
    loginBut.addClickListener(
        e -> {
          if (loginField.getValue().equals(selected.getPassword())) {
            hidePass();
            Globals.user = selected;
            Globals.root.changeScreen(Globals.user);
          } else {
            loginInfo.setVisible(true);
            loginInfo.setValue("Wrong password");
            loginField.setValue("");
          }
        });

    loginBox = new HorizontalLayout();
    loginBox.addStyleName("popup-box");
    loginBox.addComponents(loginField, loginBut, loginInfo);
    loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_LEFT);
    loginBox.setComponentAlignment(loginBut, Alignment.MIDDLE_CENTER);
    loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_RIGHT);
    loginBox.setVisible(false);
    userIcon = new ThemeResource("icons/user.png");
    users = Globals.control.usersData();
    vbox = new VerticalLayout();
    // vbox.setSizeUndefined();
    vbox.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    Panel p = new Panel();
    p.setSizeFull();

    p.setContent(vbox);
    // vbox.addStyleName("border-l-r");
    this.addComponent(p, "left: 25%; right: 25%; top: 15px");
    this.addComponent(loginBox, "left: 25%; right: 25%; top: 40%");

    this.addLayoutClickListener(
        e -> {
          if (!loginBox.isVisible()) return;
          System.out.println(e.getClickedComponent());
          if (e.getClickedComponent() == null || e.getClickedComponent().equals(vbox)) hidePass();
        });
  }
Esempio n. 8
0
  private HorizontalLayout createButtonBar() {
    final HorizontalLayout buttonBar = new HorizontalLayout();
    Button drawBadge =
        new Button(
            "Draw badge",
            new Button.ClickListener() {
              @Override
              public void buttonClick(Button.ClickEvent clickEvent) {
                extension.addBadge();
              }
            });

    final Button enableZoomTracking = new Button("Enable zoom tracking");
    enableZoomTracking.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            extension.enableZoomTracking();
            buttonBar.replaceComponent(enableZoomTracking, goBackInZooming);
          }
        });

    goBackInZooming =
        new Button(
            "Go back in zoom state",
            new Button.ClickListener() {
              @Override
              public void buttonClick(Button.ClickEvent clickEvent) {
                if (list.size() > 1) {
                  ZoomCoordinates zoom = list.get(list.size() - 2);
                  zoomTo(zoom);
                  list.remove(list.size() - 1);
                } else {
                  list.clear();
                  XAxis xAxis = chart.getConfiguration().getxAxis();
                  YAxis yAxis = chart.getConfiguration().getyAxis();
                  xAxis.setExtremes(148, 182);
                  yAxis.setExtremes(0, 125);
                  goBackInZooming.setEnabled(false);
                }
                writeOutZoomInfo();
              }
            });
    goBackInZooming.setEnabled(false);
    buttonBar.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    buttonBar.addComponents(drawBadge, enableZoomTracking, zoominfo);
    buttonBar.setSpacing(true);
    return buttonBar;
  }
Esempio n. 9
0
 @Override
 public Layout runningLayout() {
   HorizontalLayout hl = new HorizontalLayout();
   hl.setMargin(true);
   ProgressBar pb = new ProgressBar();
   pb.setIndeterminate(true);
   Label running = new Label("Scan en Cours");
   hl.setSizeFull();
   hl.setSpacing(true);
   hl.addComponents(pb, running);
   hl.setSizeUndefined();
   VerticalLayout vl = new VerticalLayout();
   vl.setSizeFull();
   vl.addComponent(hl);
   vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
   return vl;
 }
Esempio n. 10
0
  /**
   * Constructor, passing the Vaadin application page
   *
   * @param ui MainUI application page
   */
  public HeaderComponent(MainUI ui) {
    setHeight("50px");
    setStyleName("header");

    final HorizontalLayout bannerArea = new HorizontalLayout();
    bannerArea.setStyleName("menuArea");
    bannerArea.setSizeFull();

    final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png");
    final Image bannerImg = new Image();
    bannerImg.setAlternateText("Intec");
    bannerImg.setHeight("50px");
    bannerImg.setDescription("Intec Logo");
    bannerImg.setSource(resource);
    bannerImg.setWidth(null);
    bannerImg.setStyleName("bannerImg");

    setMenubar(new MenuBar());
    getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE);
    getMenubar().addStyleName("valo-menu-subtitle-indent");
    getMenubar().setWidth(100, Unit.PERCENTAGE);

    if (!"Anonymous".equals(getUserName())) {
      final MenuItem logout = menubar.addItem("Logout", null);
      logout.setStyleName("menuRight");
    }

    final MenuItem userItem = menubar.addItem(getUserName(), null);
    userItem.setStyleName("menuRight");

    bannerArea.addComponents(bannerImg, menubar);
    bannerArea.setExpandRatio(menubar, 1);
    addComponent(bannerArea);
    setExpandRatio(bannerArea, 1);
    setSizeFull();
  }
Esempio n. 11
0
    public ProfileOverview(final Item profileItem) {

      final Component comp = this;

      final ProfileTree profileTree =
          JadevaadincockpitUI.getCurrent().getMainView().getProfileTree();
      final Object profileItemId =
          profileItem.getItemProperty(ProfileContainer.PROPERTY.ID).getValue();
      JADEOptions options =
          (JADEOptions)
              profileItem.getItemProperty(ProfileContainer.PROPERTY.JADEOPTIONS).getValue();

      HorizontalLayout buttonLayout = new HorizontalLayout();
      Button executeButton = null;
      Button renameButton = null;
      Label spacerLabel = new Label();

      Button editButton = new Button("edit");
      editButton.setIcon(new ThemeResource("icons/edit_16.png"));
      Button deleteButton = new Button("delete");
      deleteButton.setIcon(new ThemeResource("icons/delete_16.png"));

      if (!options.isFragment.value() && !options.profile.Value().equalsIgnoreCase("globals")) {
        executeButton = new Button("execute");
        executeButton.setIcon(new ThemeResource("icons/exec_16.png"));
        executeButton.addClickListener(
            new ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {
                // TODO profile has to be saved before execution as checkMandatory() will read from
                // the file (not from the options-Object)
                JadevaadincockpitUI.getCurrent()
                    .getApplicationAttributes()
                    .getJadeSettingsFile()
                    .saveSettingsFile(profileItemId);

                JadeVaadinAdapter jadeAdapter = new JadeVaadinAdapter();
                jadeAdapter.execute(profileItem);
              }
            });
      }

      if (!options.profile.Value().equalsIgnoreCase("globals")) {
        renameButton = new Button("rename");
        renameButton.setIcon(new ThemeResource("icons/rename_16.png"));
        renameButton.addClickListener(
            new ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {

                TextInputDialog dialog =
                    new TextInputDialog(
                        "Rename Profile",
                        "Please enter a new name.",
                        new TextInputDialog.Callback() {

                          @Override
                          public void onDialogResult(boolean isOk, String input) {

                            if (isOk) {
                              JadevaadincockpitUI.getCurrent()
                                  .getApplicationAttributes()
                                  .getJadeSettingsFile()
                                  .renameProfile(profileItemId, input);
                            }
                          }
                        });
                dialog.setEmptyInputAllowed(false);
                dialog.setEmptyInputMessage("Please enter a name.");

                UI.getCurrent().addWindow(dialog);
              }
            });
      }

      if (executeButton != null) {
        buttonLayout.addComponent(executeButton);
      }
      buttonLayout.addComponent(editButton);
      if (renameButton != null) {
        buttonLayout.addComponent(renameButton);
      }
      buttonLayout.addComponents(deleteButton, spacerLabel);

      buttonLayout.setExpandRatio(spacerLabel, 1);
      buttonLayout.setSpacing(true);

      final ComponentGroup group = new ComponentGroup(options.profile.Value());

      options.profile.addValueChangedListener(
          new IValueChangedListener() {

            @Override
            public void ValueHasChanged(SOSOptionElement pobjOptionElement) {
              group.setCaption(pobjOptionElement.Value());
            }

            @Override
            public void ValidationError(SOSValidationError pobjVE) {
              // TODO Auto-generated method stub

            }
          });

      Label descLabel = new Label(options.title.Value());

      // TODO panel soll beim Löschen des zugehörigen Items entfernt werden
      //			profileTree.addItemSetChangeListener(new ItemSetChangeListener() {
      //
      //				@Override
      //				public void containerItemSetChange(ItemSetChangeEvent event) {
      //					if (!event.getContainer().containsId(profileItemId)) {
      //						removeGroup(comp);
      //					}
      //
      //				}
      //			});

      group.addComponents(buttonLayout, descLabel);

      setCompositionRoot(group);

      editButton.addClickListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
              profileTree.setValue(profileItemId);
            }
          });

      deleteButton.addClickListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

              ConfirmationDialog dialog =
                  new ConfirmationDialog(
                      "Delete Profile",
                      "Do you really want to delete the selected profile from the settings file?",
                      new ConfirmationDialog.Callback() {

                        @Override
                        public void onDialogResult(boolean isOk) {
                          if (isOk) {
                            // delete profile
                            JadevaadincockpitUI.getCurrent()
                                .getApplicationAttributes()
                                .getJadeSettingsFile()
                                .deleteProfile(profileItemId);
                          } else {
                            // Do nothing
                          }
                        }
                      });

              UI.getCurrent().addWindow(dialog);
            }
          });
    }
Esempio n. 12
0
  @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);
  }
Esempio n. 13
0
  private Component createContentWrapper(final Component content) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("dashboard-panel-slot");

    CssLayout card = new CssLayout();
    card.setWidth("100%");
    card.addStyleName(ValoTheme.LAYOUT_CARD);

    HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");
    toolbar.setSpacing(false);

    Label caption = new Label(content.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    content.setCaption(null);

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max =
        tools.addItem(
            "",
            FontAwesome.EXPAND,
            new Command() {

              @Override
              public void menuSelected(final MenuItem selectedItem) {
                if (!slot.getStyleName().contains("max")) {
                  selectedItem.setIcon(FontAwesome.COMPRESS);
                  toggleMaximized(slot, true);
                } else {
                  slot.removeStyleName("max");
                  selectedItem.setIcon(FontAwesome.EXPAND);
                  toggleMaximized(slot, false);
                }
              }
            });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", FontAwesome.COG, null);
    root.addItem(
        "Configure",
        new Command() {
          @Override
          public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
          }
        });
    root.addSeparator();
    root.addItem(
        "Close",
        new Command() {
          @Override
          public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
          }
        });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card.addComponents(toolbar, content);
    slot.addComponent(card);
    return slot;
  }