Example #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();
  }
 private void setGridColumnProperties() {
   grid.getColumn(STATUS).setRenderer(new StatusRenderer());
   grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer());
   grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, SPUILabelDefinitions.NAME_VERSION, REASON);
   setColumnWidth();
   grid.getColumn(SPUILabelDefinitions.NAME_VERSION)
       .setHeaderCaption(i18n.get("upload.swModuleTable.header"));
   grid.setFrozenColumnCount(5);
 }
  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);
  }
  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);
  }
  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();
  }