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();
    }
Пример #2
0
    @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;
    }
Пример #3
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);
  }
Пример #4
0
  public void addTab(
      Component component, String id, int level, String caption, String link, Resource resource) {
    if (!hasTab(id)) {
      final ButtonTabImpl button = new ButtonTabImpl(id, level, caption, link);

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

            @Override
            public void buttonClick(ClickEvent event) {
              if (!event.isCtrlKey() && !event.isMetaKey()) {
                if (selectedButton != button) {
                  clearTabSelection(true);
                  selectedButton = button;
                  selectedButton.addStyleName(TAB_SELECTED_STYLENAME);
                  selectedComp = compMap.get(button.getTabId());
                }
                fireTabChangeEvent(new SelectedTabChangeEvent(VerticalTabsheet.this));
              } else {
                Page.getCurrent().open(button.link, "_blank", false);
              }
            }
          });

      if (resource == null) {
        setDefaulButtonIcon(button, false);
      } else {
        button.setIcon(resource);
      }
      button.setStyleName(TAB_STYLENAME);
      button.setWidth("90%");

      if (button.getLevel() > 0) {
        int insertIndex = 0;
        for (int i = 0; i < navigatorContainer.getComponentCount(); i++) {
          ButtonTabImpl buttonTmp = (ButtonTabImpl) navigatorContainer.getComponent(i);
          if (buttonTmp.getLevel() > level) {
            break;
          } else {
            insertIndex++;
          }
        }
        navigatorContainer.addComponent(button, insertIndex);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      } else {
        navigatorContainer.addComponent(button);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      }

      TabImpl tabImpl = new TabImpl(id, caption, component);
      compMap.put(id, tabImpl);
    }
  }
Пример #5
0
  private com.vaadin.ui.Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(new CheckBox("Remember me", true));
    return loginPanel;
  }
  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);
  }
Пример #7
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);
  }
  @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
  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);
  }
Пример #10
0
  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
  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;
  }
Пример #12
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();
    }
  }
  @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();
    }
  }
  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);
  }
Пример #15
0
  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);
  }
Пример #16
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);
 }
Пример #17
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;
 }
Пример #18
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);
  }
Пример #19
0
  @PostConstruct
  public void PostConstruct() {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    HorizontalLayout usernameLayout = new HorizontalLayout();
    usernameLayout.setSpacing(true);
    usernameLayout.addComponent(new Label("Username:"******"Roles:"));
    userRolesLayout.addComponent(rolesLabel);

    layout.addComponent(usernameLayout);
    layout.addComponent(userRolesLayout);

    Link userView =
        new Link(
            "ROLE_USER View (disabled, if user doesn't have access)",
            new ExternalResource("#!" + RoleUserView.NAME));
    Link roleView =
        new Link(
            "ROLE_ADMIN View (disabled, if user doesn't have access)",
            new ExternalResource("#!" + RoleAdminView.NAME));

    userView.setEnabled(SpringSecurityHelper.hasRole("ROLE_USER"));
    roleView.setEnabled(SpringSecurityHelper.hasRole("ROLE_ADMIN"));

    layout.addComponent(userView);
    layout.addComponent(roleView);
    layout.addComponent(
        new Link(
            "ROLE_ADMIN View (throw exception, if user doesn't have access)",
            new ExternalResource("#!" + RoleAdminView.NAME)));

    layout.addComponent(new Link("Logout", new ExternalResource("/j_spring_security_logout")));

    setContent(layout);
  }
Пример #20
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);
  }
Пример #21
0
  public WindowTimtheobomon() {

    setCaption("Tìm theo bộ môn "); // Constants.USER_CAPTION) ;

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth(Constants.WIDTH_MAX, Sizeable.UNITS_PIXELS);
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(new leftSide());
    rContent = new VerticalLayout();
    rContent.setWidth("100%");

    mainLayout.addComponent(rContent);
    mainLayout.setExpandRatio(rContent, 1.0f);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setStyleName("bl-mainContent");
    v.addComponent(mainLayout);
    v.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);

    addComponent(new topLogin());
    addComponent(new topPanel());
    addComponent(new mainMenu());
    addComponent(v);
    addComponent(new bottom());

    // --------------------bl
    Label title = new Label("<center><h1>Tìm theo bộ môn<h1></center>", Label.CONTENT_XHTML);

    final BeanItemContainer<ResearchingBean> beans =
        new BeanItemContainer<ResearchingBean>(ResearchingBean.class);

    Table table = new Table("Tìm kiếm", beans);

    table.setWidth("100%");
    table.setPageLength(10);

    rContent.addComponent(title);
    rContent.addComponent(table);
  }
Пример #22
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);
   }
 }
    @Override
    public ComponentContainer getLayout() {
      VerticalLayout formLayout = new VerticalLayout();
      formLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

      Label organizationHeader =
          new Label(AppContext.getMessage(ContactI18nEnum.SECTION_DESCRIPTION));
      organizationHeader.setStyleName(UIConstants.H2_STYLE2);
      formLayout.addComponent(organizationHeader);

      informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);
      formLayout.addComponent(informationLayout.getLayout());

      addressLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);
      Label addressHeader = new Label(AppContext.getMessage(ContactI18nEnum.SECTION_ADDRESS));
      addressHeader.setStyleName(UIConstants.H2_STYLE2);
      formLayout.addComponent(addressHeader);
      formLayout.addComponent(addressLayout.getLayout());
      formLayout.addComponent(buildButtonControls());
      return formLayout;
    }
  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);
  }
Пример #25
0
  private void init() {
    VerticalLayout root = new VerticalLayout();

    header = new HorizontalLayout();

    tituloLbl.setStyleName("titlePanel");
    header.addComponent(tituloLbl);
    headerLayout = new HorizontalLayout();
    header.addComponent(headerLayout);

    header.setComponentAlignment(headerLayout, Alignment.MIDDLE_RIGHT);

    header.setStyleName("headerPanel");
    header.setWidth("100%");
    header.setHeight("50px");

    body = new VerticalLayout();
    body.setStyleName("bodyPanel");
    body.setWidth("100%");

    footer = new HorizontalLayout();
    footer.setStyleName("footerPanel");
    footerLayout = new HorizontalLayout();
    footer.addComponent(footerLayout);
    footer.setComponentAlignment(footerLayout, Alignment.MIDDLE_CENTER);

    footer.setWidth("100%");
    footer.setHeight("60px");

    root.addComponent(header);
    root.addComponent(body);
    root.addComponent(footer);

    root.setWidth("100%");

    setCompositionRoot(root);
  }
Пример #26
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();
          }
        });
  }
  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;
  }
  @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;
  }
Пример #29
0
  public WindowManagerTeacher() {

    setCaption("quan ly bo mon "); // Constants.USER_CAPTION) ;

    mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth(Constants.WIDTH_MAX, Sizeable.UNITS_PIXELS);
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(new leftSide());

    rContentList = new VerticalLayout();
    rContentList.setWidth("100%");
    mainLayout.addComponent(rContentList);
    mainLayout.setExpandRatio(rContentList, 1.0f);

    rContentModify = new rightContentAddNewTeacher(1);
    rContentModify.setWidth("100%");

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setStyleName("bl-mainContent");
    v.addComponent(mainLayout);
    v.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);

    addComponent(new topLogin());
    addComponent(new topPanel());
    addComponent(new mainMenu());
    addComponent(v);
    addComponent(new bottom());

    // --------------------bl
    Label title = new Label("<center><h1>Danh sách giang vien<h1></center>", Label.CONTENT_XHTML);

    table = new Table();
    table.setWidth("100%");
    table.setPageLength(20);

    rContentList.addComponent(title);
    rContentList.addComponent(table);

    Connection conn = null;
    Statement stmt = null;

    try {
      JDBCConnectionPool pool =
          new SimpleJDBCConnectionPool(
              JDBC_DRIVER,
              DB_URL + QlgiangvienApplication.DB_DBNAME,
              QlgiangvienApplication.DB_USER,
              QlgiangvienApplication.DB_PASS);

      String mysql = "SELECT * from GiangVien";

      TableQuery query = new TableQuery("GiangVien", pool);
      query.setVersionColumn("OPTLOCK");

      SQLContainer container = new SQLContainer(query);
      container.setAutoCommit(true);
      //          container.re
      table.setContainerDataSource(container);

      //           FreeformQuery query = new FreeformQuery(mysql, pool, "MaGV") ;

      //           container = new SQLContainer(query);

      //           table.setContainerDataSource(container) ;

      table.addGeneratedColumn(
          "Chinh Sua",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {
              final Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Chinh Sua",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          //              				rContentList.setVisible(false);
                          //              				rContentModify.setVisible(true);
                          System.out.println(item.toString());
                          rContentModify.setUpdateData(
                              item.getItemProperty("MaGV").getValue().toString());
                          mainLayout.removeComponent(rContentList);
                          mainLayout.addComponent(rContentModify);
                          mainLayout.setExpandRatio(rContentModify, 1.0f);
                        }
                      });

              return btnModify;
            }
          });
      confirmDelete();
      table.addGeneratedColumn(
          "Xoa",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {

              //            	   Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Xoa",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          if (subwindow.getParent() == null) {

                            getWindow().addWindow(subwindow);
                          }
                        }
                      });

              return btnModify;
            }
          });

    } catch (Exception e) {
      System.out.println("in right COntent: " + e.toString());
    }
  } // end of container
Пример #30
0
  @Override
  protected void init(VaadinRequest request) {
    setSizeFull();

    VerticalLayout layout = new VerticalLayout();

    List<Aircraft> message = aircraftService.list();
    Label label = new Label(message.toString());
    final TextField field = new TextField();
    Button button = new Button();

    button.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            aircraftService.create(field.getValue());
          }
        });
    HorizontalLayout fieldPanel = new HorizontalLayout();
    fieldPanel.addComponent(field);
    fieldPanel.addComponent(button);
    fieldPanel.addComponent(label);

    Table table = new Table();
    table.setRowHeaderMode(Table.RowHeaderMode.ID);
    table.setSizeFull();

    final BeanItemContainer<Booking> container = new BeanItemContainer<Booking>(Booking.class);
    container.addAll(bookingService.list());
    container.addNestedContainerProperty("flight.flightNumber");
    container.removeContainerProperty("flight");
    table.setContainerDataSource(container);

    HorizontalLayout toolbar = new HorizontalLayout();
    Button addButton = new Button("Add");
    addButton.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            FormLayout formLayout = new FormLayout();

            // Form for editing the bean
            final BeanFieldGroup<Booking> binder = new BeanFieldGroup<Booking>(Booking.class);
            binder.setBuffered(true);
            final Booking bean = new Booking();
            bean.setFlight(new Flight());
            binder.setItemDataSource(bean);
            formLayout.addComponent(binder.buildAndBind("Ticket", "ticket"));
            formLayout.addComponent(binder.buildAndBind("Flight Nr.", "flight.flightNumber"));

            Button save = new Button("Save");
            save.addClickListener(
                new Button.ClickListener() {
                  @Override
                  public void buttonClick(Button.ClickEvent event) {
                    try {
                      binder.commit();
                      container.addBean(bean);
                    } catch (FieldGroup.CommitException e) {
                      throw new RuntimeException(e.getMessage());
                    }
                  }
                });
            formLayout.addComponent(save);

            UI.getCurrent().addWindow(new Window("Edit Booking", formLayout));
          }
        });
    toolbar.addComponent(addButton);

    layout.addComponent(fieldPanel);
    layout.addComponent(toolbar);
    layout.addComponent(table);

    UI.getCurrent()
        .setErrorHandler(
            new ErrorHandler() {
              @Override
              public void error(com.vaadin.server.ErrorEvent event) {
                Notification.show(
                    event.getThrowable().getLocalizedMessage(), Notification.Type.ERROR_MESSAGE);
              }
            });
    setContent(layout);
  }