Exemple #1
0
  private void configureComponents() {

    // Chargement des données.
    Init uniqueinstance = Init.getInit();
    uniqueinstance.chargementinitial();

    contactList.setContainerDataSource(Vehicule.getVehicules());
    contactList1.setContainerDataSource(Vehicule.getVehiculesPrixBas());
    contactList2.setContainerDataSource(Visiteur.getVisiteur());
    contactList3.setContainerDataSource(Affectation.getAffectation());

    // contactTable.setContainerDataSource(new BeanItemContainer<>( Vehicule.class));
    contactList.setColumnOrder("marque", "modele", "prix"); // choisir l'ordre des colonnes
    contactList.removeColumn("id");
    contactList1.setColumnOrder("marque", "modele", "prix"); // choisir l'ordre des colonnes
    contactList1.removeColumn("id"); // masquer la colonne
    // contactList.setSelectionMode(Grid.SelectionMode.SINGLE);

    contactList2.setColumnOrder("id", "prenom", "nom", "marque"); // choisir l'ordre des colonnes
    contactList3.setColumnOrder("id", "dateAffection", "nom", "marque");

    contactList.setSizeFull();
    contactList1.setSizeFull();
    contactList2.setSizeFull();
    contactList3.setSizeFull();
  }
Exemple #2
0
  private void listTasks() {

    grid.setContainerDataSource(
        new BeanItemContainer<>(
            Task.class,
            (Collection<? extends Task>) repo.findAll(new PageRequest(1, 1)).getContent()));
  }
  private void configureComponents() {
    keyList.setContainerDataSource(new BeanItemContainer<>(Key.class));
    keyList.setColumnOrder("name", "type");
    keyList.removeColumn("value");
    keyList.setStyleName(ValoTheme.TABLE_SMALL);

    keyList.setSelectionMode(Grid.SelectionMode.SINGLE);
    keyList.addSelectionListener(
        e -> {
          Key key = (Key) keyList.getSelectedRow();
          editForm.edit(key);
        });
    keyList.setEditorEnabled(false);
  }
  @Override
  public void updateGrid(Set<Subtitle> subs) {
    BeanItemContainer<Subtitle> subsContainer = new BeanItemContainer<>(Subtitle.class, subs);
    GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(subsContainer);
    gpc.addGeneratedProperty(
        "delete",
        new PropertyValueGenerator<String>() {
          @Override
          public String getValue(Item item, Object itemId, Object propertyId) {
            return "Delete";
          }

          @Override
          public Class<String> getType() {
            return String.class;
          }
        });
    grid.setContainerDataSource(gpc);
    downloadButton.setEnabled(subs != null && subs.size() > 0);
  }
  @SuppressWarnings("unchecked")
  public void populateUserRules() {

    System.out.println("Populating user rules");

    this.userRules = service.getUserRules(userId);

    configureRulesContainer();

    for (UserRule u : userRules) {
      if (u == null) continue;

      Item newItem = rulesContainer.getItem(rulesContainer.addItem());
      newItem.getItemProperty("userId").setValue(u.getUserId());
      newItem.getItemProperty("ruleId").setValue(u.getRuleId());
      newItem.getItemProperty("ruleName").setValue(u.getRuleName());
      newItem.getItemProperty("merchant").setValue(u.getMerchant());
      newItem.getItemProperty("amount").setValue(u.getAmount());
      newItem.getItemProperty("noOfTransactions").setValue(u.getNoOfTransactions());
      newItem.getItemProperty("noOfDays").setValue(u.getNoOfDays());
    }

    userRulesGrid.setContainerDataSource(rulesContainer);
  }
  @SuppressWarnings("unchecked")
  private void populateUsers() {

    if (users == null) {
      return;
    }

    configureContainer();

    for (User u : users) {
      if (u == null) continue;

      Item newItem = container.getItem(container.addItem());
      newItem.getItemProperty("creditCardNo").setValue(u.getCreditCardNo());
      newItem.getItemProperty("userId").setValue(u.getUserId());
      newItem.getItemProperty("firstname").setValue(u.getFirstname());
      newItem.getItemProperty("lastname").setValue(u.getLastname());
      newItem.getItemProperty("cityName").setValue(u.getCityName());
      newItem.getItemProperty("stateName").setValue(u.getStateName());
      newItem.getItemProperty("gender").setValue(u.getGender());
    }

    userGrid.setContainerDataSource(container);
  }
  public GestionNotificacion() {
    super();
    setMargin(true);
    setSpacing(true);
    setSizeFull();
    HorizontalL h1 = new HorizontalL();
    id = new CampoRuc();
    razonSocial = new CampoRazonSocial();
    razonSocial.setWidth("320px");
    direccion = new CampoDireccion();
    direccion.setWidth("450px");
    correoElectronico = new CampoCorreoElectronico();
    correoElectronico.setWidth("260px");

    tipoIdentificacion = new ComboBox();
    tipoIdentificacion.addItem("04");
    tipoIdentificacion.addItem("05");
    tipoIdentificacion.addItem("06");
    tipoIdentificacion.addItem("07");
    tipoIdentificacion.addItem("08");
    tipoIdentificacion.setItemCaption("04", "RUC");
    tipoIdentificacion.setItemCaption("05", "CEDULA");
    tipoIdentificacion.setItemCaption("06", "PASAPORTE");
    tipoIdentificacion.setItemCaption("07", "CONSUMIDOR FINAL");
    tipoIdentificacion.setItemCaption("08", "IDENTIFICADOR EXTERIOR");
    tipoIdentificacion.setNullSelectionAllowed(false);
    tipoIdentificacion.setValue("04");
    tipoIdentificacion.setWidth("140px");

    h1.addComponent(tipoIdentificacion, id);
    h1.addComponent("Razón Social", razonSocial);
    // h1.addComponent("Dirección",direccion);
    h1.addComponent("Email", correoElectronico);
    botonAnadir = new BotonAnadir();

    addComponent(h1);
    setComponentAlignment(h1, Alignment.TOP_CENTER);
    HorizontalL h2 = new HorizontalL();
    h2.addComponent("direccion", direccion);
    h2.addComponent(botonAnadir);
    addComponent(h2);

    grid = new Grid();
    beanItemC = new BeanItemContainer<DemografiaCliente>(DemografiaCliente.class);
    grid.setContainerDataSource(beanItemC);
    //		DemografiaCliente d=new DemografiaCliente();
    //		beanItemC.addBean(d);
    grid.removeColumn("entidadEmisora");
    grid.getColumn("id").setHeaderCaption("Identificacion");
    grid.setColumnOrder("razonSocial", "identificacion", "direccion", "correoElectronico");
    grid.setSizeFull();
    grid.removeColumn("tipoIdentificacion");
    grid.removeColumn("id");
    botonCancelar = new BotonCancelar();

    addComponent(grid);
    addComponent(botonCancelar);
    setComponentAlignment(botonCancelar, Alignment.BOTTOM_RIGHT);
    setComponentAlignment(h2, Alignment.TOP_CENTER);
    setExpandRatio(h1, 1);
    setExpandRatio(h2, 1);
    setExpandRatio(grid, 8);
    setExpandRatio(botonCancelar, 1);
    nuevoDato = new DemografiaCliente();
    beanItem = new BeanItem<DemografiaCliente>(nuevoDato);
    fg = new FieldGroup();
    fg.setItemDataSource(beanItem);
  }
  @Override
  public void refresh() {
    keyList.setContainerDataSource(new BeanItemContainer<>(Key.class, service.findAll("")));

    editForm.setVisible(false);
  }
  private void configureComponents() {
    configureContainer();
    configureRulesContainer();

    fieldSearch.setNullSelectionAllowed(false);
    fieldSearch.addItem("cc_no");
    fieldSearch.addItem("user_id");
    fieldSearch.addItem("first");
    fieldSearch.addItem("last");
    fieldSearch.addItem("city");
    fieldSearch.addItem("state");
    fieldSearch.setValue("first");

    userGrid.setContainerDataSource(container);
    userGrid.setColumnOrder(
        "creditCardNo", "userId", "firstname", "lastname", "cityName", "stateName", "gender");
    userGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
    userGrid.addSelectionListener(
        new SelectionListener() {

          @Override
          public void select(SelectionEvent event) {
            Item item = userGrid.getContainerDataSource().getItem(userGrid.getSelectedRow());

            if (item != null) {
              userId = item.getItemProperty("userId").getValue().toString();
              populateUserRules();
            }
          }
        });
    userRulesGrid.setContainerDataSource(rulesContainer);
    userRulesGrid.setColumnOrder(
        "userId", "ruleName", "merchant", "amount", "noOfTransactions", "noOfDays");
    userRulesGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
    userRulesGrid.addSelectionListener(
        new SelectionListener() {

          @Override
          public void select(SelectionEvent event) {}
        });
    filterCCNo.addTextChangeListener(
        new TextChangeListener() {

          @Override
          public void textChange(TextChangeEvent event) {
            String filterValue = event.getText();

            users = service.searchUser(fieldSearch.getValue().toString(), filterValue);
            populateUsers();
          }
        });

    addUserRuleButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            Item item = userGrid.getContainerDataSource().getItem(userGrid.getSelectedRow());

            if (item != null) {

              userId = item.getItemProperty("userId").getValue().toString();
              UserRuleWindow sub = new UserRuleWindow(userId);
              // Add it to the root component
              getUI().addWindow(sub);
              populateUserRules();
            }
          }
        });
    editUserRuleButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            Item item =
                userRulesGrid.getContainerDataSource().getItem(userRulesGrid.getSelectedRow());

            if (item != null) {

              UserRule userRule =
                  service.getUserRule(
                      item.getItemProperty("userId").getValue().toString(),
                      item.getItemProperty("ruleId").getValue().toString());

              UserRuleWindow sub = new UserRuleWindow(userRule);

              getUI().addWindow(sub);
              populateUserRules();
            }
          }
        });
    deleteUserRuleButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            Item item =
                userRulesGrid.getContainerDataSource().getItem(userRulesGrid.getSelectedRow());

            if (item != null) {
              userId = item.getItemProperty("userId").getValue().toString();
              service.deleteUserRule(userId, item.getItemProperty("ruleId").getValue().toString());
              populateUserRules();
            }
          }
        });

    populateUsers();
  }