@Test
  public void localeChangesOnAttach() {
    TextField tf = new TextField();

    ;
    tf.setConverter(
        new StringToIntegerConverter() {
          @Override
          protected NumberFormat getFormat(Locale locale) {
            if (locale == null) {
              NumberFormat format = super.getFormat(locale);
              format.setGroupingUsed(false);
              format.setMinimumIntegerDigits(10);
              return format;
            }
            return super.getFormat(locale);
          }
        });
    tf.setImmediate(true);
    tf.setConvertedValue(10000);
    Assert.assertEquals("0000010000", tf.getValue());

    VerticalLayout vl = new VerticalLayout();
    ui.setContent(vl);
    ui.setLocale(new Locale("en", "US"));

    vl.addComponent(tf);
    Assert.assertEquals("10,000", tf.getValue());
  }
    @Override
    public ComponentContainer getLayout() {
      String title =
          (user.getUsername() == null)
              ? AppContext.getMessage(UserI18nEnum.VIEW_NEW_USER)
              : user.getDisplayName();
      final AddViewLayout formAddLayout = new AddViewLayout(title, FontAwesome.USER);

      final VerticalLayout layout = new VerticalLayout();
      final Label organizationHeader =
          new Label(AppContext.getMessage(UserI18nEnum.SECTION_BASIC_INFORMATION));
      organizationHeader.setStyleName("h2");
      layout.addComponent(organizationHeader);

      this.basicInformationLayout =
          new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT);
      this.basicInformationLayout.getLayout().setWidth("100%");
      this.basicInformationLayout.getLayout().setMargin(false);
      this.basicInformationLayout.getLayout().addStyleName(UIConstants.COLORED_GRIDLAYOUT);

      layout.addComponent(this.basicInformationLayout.getLayout());

      formAddLayout.addHeaderRight(createButtonControls());
      formAddLayout.addBody(layout);
      formAddLayout.addBottomControls(createBottomPanel());
      return formAddLayout;
    }
Example #3
0
  public VerticalTabsheet(boolean isLeft) {
    CssLayout contentLayout = new CssLayout();
    new Restrain(contentLayout).setMinHeight("100%");

    navigatorWrapper = new CssLayout();
    navigatorWrapper.setStyleName("navigator-wrap");
    navigatorContainer = new VerticalLayout();
    navigatorWrapper.addComponent(navigatorContainer);

    contentWrapper = new VerticalLayout();
    contentWrapper.setStyleName("container-wrap");
    contentWrapper.setWidth("100%");

    tabContainer = new CssLayout();
    tabContainer.setWidth("100%");
    contentWrapper.addComponent(tabContainer);

    if (isLeft) {
      contentLayout.addComponent(navigatorWrapper);
      contentLayout.addComponent(contentWrapper);

    } else {
      contentLayout.addComponent(contentWrapper);
      contentLayout.addComponent(navigatorWrapper);
    }

    this.setCompositionRoot(contentLayout);
    this.setStyleName(TABSHEET_STYLENAME);
  }
  void confirmDelete() {

    // Create the window...
    subwindow = new Window("Xoa ??");
    // ...and make it modal
    subwindow.setModal(true);

    // Configure the windws layout; by default a VerticalLayout
    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Add some content; a label and a close-button
    Label message = new Label("Ban co chac chan muon xoa ?");
    subwindow.addComponent(message);

    Button close =
        new Button(
            "Co",
            new Button.ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {

                (subwindow.getParent()).removeWindow(subwindow);
              }
            });
    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.TOP_RIGHT);
  } // end of confirmDelete
Example #5
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();
    }
  }
Example #6
0
 public void setNavigatorWidth(String width) {
   navigatorContainer.setWidth(width);
   Iterator<Component> i = navigatorContainer.iterator();
   while (i.hasNext()) {
     Component childComponent = i.next();
     childComponent.setWidth(width);
   }
 }
Example #7
0
 public Button addButtonOnNavigatorContainer(String id, String caption, Resource icon) {
   final ButtonTabImpl button = new ButtonTabImpl(id, 0, caption, "");
   navigatorContainer.addComponent(button);
   navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
   button.setStyleName(TAB_STYLENAME);
   button.setWidth("90%");
   button.setIcon(icon);
   return button;
 }
 /** Issue #843-swingx: BasicTaskPaneContainerUI must respect custom Layout. */
 @Test
 public void testRespectCustomLayout() {
   JXTaskPaneContainer container = new JXTaskPaneContainer();
   VerticalLayout layout = (VerticalLayout) container.getLayout();
   VerticalLayout custom = new VerticalLayout(layout.getGap() + 10);
   container.setLayout(custom);
   container.updateUI();
   assertSame(custom, container.getLayout());
 }
Example #9
0
  private ButtonTabImpl getButtonById(String viewId) {
    for (int i = 0; i < navigatorContainer.getComponentCount(); i++) {
      ButtonTabImpl button = (ButtonTabImpl) navigatorContainer.getComponent(i);
      if (viewId.equals(button.getTabId())) {
        return button;
      }
    }

    return null;
  }
    private void initLayout() {
        FormLayout loginForm = new FormLayout();
        loginForm.setSizeUndefined();

        loginForm.addComponent(userName = new TextField("Username"));
        loginForm.addComponent(passwordField = new PasswordField("Password"));
        loginForm.addComponent(login = new Button("Login"));
        login.addStyleName(ValoTheme.BUTTON_PRIMARY);
        login.setDisableOnClick(true);
        login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        login.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                login();
            }
        });

        VerticalLayout loginLayout = new VerticalLayout();
        loginLayout.setSizeUndefined();

        loginLayout.addComponent(loginFailedLabel = new Label());
        loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
        loginFailedLabel.setSizeUndefined();
        loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
        loginFailedLabel.setVisible(false);

        loginLayout.addComponent(loginForm);
        loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

        VerticalLayout rootLayout = new VerticalLayout(loginLayout);
        rootLayout.setSizeFull();
        rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
        setCompositionRoot(rootLayout);
        setSizeFull();
    }
Example #11
0
 @Override
 public void show() {
   this.setVisible(true);
   users = Globals.control.usersData();
   vbox.removeAllComponents();
   for (UserData d : users) {
     Button b = genBut(d.name);
     vbox.addComponent(b);
     vbox.setComponentAlignment(b, Alignment.TOP_CENTER);
   }
 }
  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;
  }
  private void displayTaskStatistic() {
    rightColumn.removeAllComponents();
    UnresolvedTaskByAssigneeWidget unresolvedTaskByAssigneeWidget =
        new UnresolvedTaskByAssigneeWidget();
    unresolvedTaskByAssigneeWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByAssigneeWidget);

    UnresolvedTaskByPriorityWidget unresolvedTaskByPriorityWidget =
        new UnresolvedTaskByPriorityWidget();
    unresolvedTaskByPriorityWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByPriorityWidget);

    UnresolvedTaskByStatusWidget unresolvedTaskByStatusWidget = new UnresolvedTaskByStatusWidget();
    unresolvedTaskByStatusWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByStatusWidget);
  }
  @Override
  protected void init(VaadinRequest vaadinRequest) {
    //    DI.addNewClassLoaderAndMerge(Service.class.getClassLoader());

    // inject
    DI.getInstance().activateDI(this);

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    Button button = new Button("Click Me");
    button.addClickListener(
        event -> layout.addComponent(new Label("Thank you for clicking " + service.doWork())));
    layout.addComponent(button);
  }
Example #15
0
 public void showTabsCaption() {
   Iterator<Component> iter = navigatorContainer.iterator();
   while (iter.hasNext()) {
     ButtonTabImpl comp = (ButtonTabImpl) iter.next();
     comp.showCaption();
   }
 }
  @Override
  protected void init(VaadinRequest request) {
    System.out.println("request = " + request);
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);
    layout.addComponent(chart);

    try {
      empf = new MqttClient("tcp://192.168.0.106:1883", "MyfirstMQTTEmpf", new MemoryPersistence());
      empf.setCallback(
          new MqttCallback() {
            @Override
            public void connectionLost(Throwable throwable) {}

            @Override
            public void messageArrived(String str, MqttMessage mqttMessage) throws Exception {
              byte[] payload = mqttMessage.getPayload();
              lastMessage = new String(payload);
              System.out.println("s = " + str + " msg " + lastMessage);
            }

            @Override
            public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {}
          });

      Button button = new Button("refresh");
      button.addClickListener(
          event ->
              access(
                  () ->
                      chart
                          .getConfiguration()
                          .getSeries()
                          .forEach(
                              s ->
                                  ((ListSeries) s)
                                      .updatePoint(0, Double.valueOf(lastMessage.split(":")[3])))));
      layout.addComponent(button);
      empf.connect();
      empf.subscribe(TOPIC, 1);

      mqqtThread.start();
    } catch (MqttException e) {
      e.printStackTrace();
    }
  }
Example #17
0
 public SelectWindow(
     float width,
     int units,
     Collection<T> items,
     T selectedItem,
     Resource icon,
     String caption,
     String message,
     String okButtonText,
     String cancelButtonText) {
   super();
   if (caption != null) {
     setCaption(caption);
   }
   if (icon != null) {
     setIcon(icon);
   }
   setWidth(width, units);
   setModal(true);
   setClosable(false);
   setResizable(false);
   setDraggable(false);
   VerticalLayout verticalLayout = new VerticalLayout();
   verticalLayout.setMargin(true);
   verticalLayout.setSpacing(true);
   setContent(verticalLayout);
   Label label = new Label(message);
   addComponent(label);
   mySelect = new Select(null, items);
   mySelect.setNullSelectionAllowed(false);
   mySelect.setValue(selectedItem != null ? selectedItem : items.iterator().next());
   mySelect.setWidth(100, Sizeable.UNITS_PERCENTAGE);
   addComponent(mySelect);
   Panel panel = new Panel();
   addComponent(panel);
   verticalLayout.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT);
   panel.addStyleName("light");
   HorizontalLayout horizontalLayout = new HorizontalLayout();
   panel.setContent(horizontalLayout);
   horizontalLayout.setSpacing(true);
   verticalLayout.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT);
   myCancelButton = new Button(cancelButtonText, this);
   panel.addComponent(myCancelButton);
   myOkButton = new Button(okButtonText, this);
   panel.addComponent(myOkButton);
 }
  @Override
  protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(
        new SplitButton.SplitButtonClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
          }
        });
    controlsBtn.setSizeUndefined();
    Button selectBtn =
        new Button(
            "Select from existing opportunities",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                ContactOpportunitySelectionWindow opportunitiesWindow =
                    new ContactOpportunitySelectionWindow(ContactOpportunityListComp.this);
                OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
                criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
                UI.getCurrent().addWindow(opportunitiesWindow);
                opportunitiesWindow.setSearchCriteria(criteria);
                controlsBtn.setPopupVisible(false);
              }
            });
    selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
    OptionPopupContent buttonControlsLayout = new OptionPopupContent();
    buttonControlsLayout.addOption(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
  }
  public SettingsLayout(String userName, MainPage mainPage) {
    this.mainPage = mainPage;
    this.userName = userName;

    WebApplicationContext context = (WebApplicationContext) mainPage.getContext();
    WebBrowser webBrowser = context.getBrowser();
    height = webBrowser.getScreenHeight() - 310;

    setMargin(true);
    setSpacing(true);
    vl.setMargin(true);
    vl.setSpacing(true);
    panelEmail.setWidth("100%");
    addComponent(hl);

    hl.setFirstComponent(panelEmail);
    hl.setSecondComponent(panelPassword);

    oldEmail.setValue(GeneralController.getEmailFromUserName(userName));
    oldEmail.setWidth("250");
    oldEmail.setReadOnly(false);

    newEmail.setWidth("250");
    newEmail.addValidator(new EmailValidator("Email должен содержать знак '@' и полный домен."));

    saveButton = new Button("Сохранить изменения");
    saveButton.setVisible(true);
    saveButton.setIcon(new ThemeResource("icons/32/save.png"));

    resetUserPasswordButton.setVisible(true);
    resetUserPasswordButton.setIcon(new ThemeResource("icons/32/group_key.png"));
    resetUserPasswordButton.addListener(this);

    oldEmailInscription.setReadOnly(true);
    panelEmail.addComponent(oldEmailInscription);
    panelEmail.addComponent(oldEmail);
    panelEmail.addComponent(newEmail);
    panelEmail.addComponent(saveButton);
    panelPassword.addComponent(label);
    panelPassword.addComponent(resetUserPasswordButton);

    panelEmail.setHeight(height);
    panelPassword.setHeight(height);

    saveButton.addListener(this);
  }
  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("&nbsp;", Label.CONTENT_XHTML));
    content.addComponents(grid);
    content.addComponent(downloadButton);
    setCompositionRoot(content);
  }
  public TableEditorWindow(final Table table, final Object value, Object... dates) {

    for (Object o : dates) dates2.add(o);
    VerticalLayout content = new VerticalLayout();
    Object[] columns = table.getVisibleColumns();
    String[] headers = table.getColumnHeaders();
    int n = columns.length;

    for (int i = 0; i < n; ++i) {
      HorizontalLayout lay = new HorizontalLayout();
      Label l = new Label(headers[i]);
      lay.addComponent(l);
      Component field = dates2.contains(columns[i]) ? new DateField() : new TextField();

      lay.addComponent(field);
      map.put(columns[i], field);
      content.addComponent(lay);
      lay.setComponentAlignment(l, Alignment.MIDDLE_LEFT);
      lay.setComponentAlignment(field, Alignment.MIDDLE_RIGHT);
    }

    if (value != null) {
      Item item = table.getItem(value);
      for (Object o : columns) {
        Object val = item.getItemProperty(o).getValue();
        if (dates2.contains(o)) {
          ((DateField) map.get(o)).setValue((Date) val);
        } else {
          ((TextField) map.get(o)).setValue(val.toString());
        }
      }
    }

    save = new Button("Записать");
    content.addComponent(save);
    save.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            if (actionPerformed()) close();
          }
        });

    setContent(content);
  }
Example #22
0
  @PostConstruct
  public void PostConstruct() throws GeneralSecurityException {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    layout.addComponent(chooseLanguage);

    layout.addComponent(new Label(messageSource.getMessage("error_view.reload")));

    layout.addComponent(
        new Button(
            messageSource.getMessage("error_view.turn_off"),
            new Button.ClickListener() {
              @Override
              public void buttonClick(Button.ClickEvent event) {
                Notification.show("one");
              }
            }));

    layout.addComponent(
        new Button(
            messageSource.getMessage("main.go_back"),
            new Button.ClickListener() {
              @Override
              public void buttonClick(Button.ClickEvent event) {
                Page.getCurrent().setUriFragment("!" + MainView.NAME);
              }
            }));

    setContent(layout);
  }
 public MainScreen() {
   Label loginLabel =
       new Label("Welcome " + VaadinSession.getCurrent().getAttribute(String.class));
   HorizontalLayout menuBar = new HorizontalLayout(loginLabel);
   MessageTable table = new MessageTable();
   TextArea messageArea = new TextArea();
   messageArea.setWidth(100, PERCENTAGE);
   Button sendButton = new Button("Send");
   sendButton.addClickListener(new SendMessageClickListener(table, messageArea));
   HorizontalLayout lowerBar = new HorizontalLayout(messageArea, sendButton);
   lowerBar.setWidth(100, PERCENTAGE);
   lowerBar.setSpacing(true);
   VerticalLayout mainLayout = new VerticalLayout(menuBar, table, lowerBar);
   mainLayout.setSpacing(true);
   mainLayout.setMargin(true);
   mainLayout.setSizeFull();
   setCompositionRoot(mainLayout);
 }
Example #24
0
 public void replaceContainer(ComponentContainer newContainer, ComponentContainer newPosition) {
   ComponentContainer containerParent = (ComponentContainer) tabContainer.getParent();
   if (containerParent != null) {
     containerParent.removeComponent(tabContainer);
   }
   if (newPosition == null) newPosition = newContainer;
   newPosition.addComponent(tabContainer);
   contentWrapper.addComponent(newContainer);
 }
Example #25
0
  private void initLayout() {

    layout.setMargin(true);
    setContent(layout);

    form.setCaption("Employee Details ");
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("Name", new ObjectProperty<String>(""));
    item.addItemProperty("Address", new ObjectProperty<String>(""));

    ComboBox combobox = new ComboBox("Sex");
    combobox.setInvalidAllowed(true);
    combobox.setNullSelectionAllowed(false);
    combobox.addItem("Male");
    combobox.addItem("Female");
    item.addItemProperty("Age", new ObjectProperty<String>(""));
    item.addItemProperty("Email", new ObjectProperty<String>(""));
    item.addItemProperty("Mobile No", new ObjectProperty<String>(""));

    Form form = new Form();
    final Form reader = new Form();
    form.setCaption("Fill Your Details");
    form.setItemDataSource(item);
    reader.setItemDataSource(item);
    reader.setCaption("Your registation details");
    reader.setReadOnly(true);

    button.addClickListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {

            Label message = new Label("You are Registered");
            layout.addComponent(message);
            layout.addComponent(reader);
          }
        });
    layout.addComponent(form);

    final RichTextArea area = new RichTextArea();
    area.setValue("Add more details here");
    layout.addComponent(area);

    layout.addComponent(button);
  }
Example #26
0
 public void removeTab(String viewId) {
   Tab tabImpl = compMap.get(viewId);
   if (tabImpl != null) {
     ButtonTabImpl button = getButtonById(viewId);
     if (button != null) {
       navigatorContainer.removeComponent(button);
       compMap.remove(viewId);
     }
   }
 }
  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;
  }
Example #28
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();
        });
  }
  @Override
  public void attach() {
    super.attach();

    rootPanel = new Panel("Connect to...");
    rootPanel.addStyleName(ValoTheme.PANEL_WELL);
    rootPanel.setWidth("500px");
    rootPanel.setHeight("300px");
    recreateRootLayout();

    setSizeFull();
    addComponent(rootPanel);
    setComponentAlignment(rootPanel, Alignment.MIDDLE_CENTER);
  }
  private Component buildPreferencesTab() {
    VerticalLayout root = new VerticalLayout();
    root.setCaption("Preferences");
    root.setIcon(FontAwesome.COGS);
    root.setSpacing(true);
    root.setMargin(true);
    root.setSizeFull();

    Label message = new Label("Not implemented in this demo");
    message.setSizeUndefined();
    message.addStyleName(ValoTheme.LABEL_LIGHT);
    root.addComponent(message);
    root.setComponentAlignment(message, Alignment.MIDDLE_CENTER);

    return root;
  }