Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    mpnsk
    @mpnsk_gitlab
    If I get around I'll try dig up the appropriate issue google redirects to and comment to use a combobox, which is what I would have wanted to find yesterday :)
    Batgerel Enkhbat
    @ebatgerel
    Hello guys. How to fix import bugs in 8.9.0
    Christoph Frick
    @christoph-frick
    what are "import bugs"
    mpnsk
    @mpnsk_gitlab
    did anybody have any luck with using gradle for vaadin8?
    Christoph Frick
    @christoph-frick
    yes - and given how many times it works, i'd not say it was luck
    mpnsk
    @mpnsk_gitlab
    how did you create your build.gradle for that? I tried the getting the maven-archetype and generating a gradle project with build.gradle, but the project I get from that doesn't seem to compile the widgetset :/
    Christoph Frick
    @christoph-frick
    mpnsk
    @mpnsk_gitlab
    thanks!
    Snir Ben Yossef
    @snirben
    Hi all, i am new to vaddin.
    i am trying to add my sql data into the grid but for some reason the data only show the LastName the ID and FirstName wont apper.
    my code :
    public class MainView extends VerticalLayout {
        private CustomerService service ;
        public Customer customer = new Customer();
        private Binder<Customer> binder = new Binder<>(Customer.class);
    
        private Grid<Customer> grid = new Grid(Customer.class);
        private  Button save = new Button("Save", e -> {
            try {
                binder.writeBean(customer);
                saveCustomer();
                updateGrid();
                binder.readBean(new Customer());
            } catch (ValidationException ex) {
                ex.printStackTrace();
            }
        });
    
        public MainView(CustomerService service) {
            this.service = service;
    
            add(
                    new H1("הוסף לקוח"),
                   buildForm(),
                   grid
           );
           updateGrid(); // update the grid with the sql data
    
            setSizeFull();
    
    
        }
        private void saveCustomer() throws ValidationException {
    
            service.update(customer);
    
        }
        private Component buildForm() {
            TextField firstName = new TextField("First Name");
             TextField lastName = new TextField("Last Name");
    
           TextField id = new TextField("ID");
             TextField  company= new TextField("Company");
             TextField address = new TextField("Address");
             TextField phone = new TextField("phone");
            TextField created = new TextField("created");
             TextField email = new TextField("Email");
            Div errorsLayout = new Div();
    
    binder.forField(firstName)
            .bind(
                    Customer::getFirstName,Customer::setFirstName
            );
            binder.forField(lastName)
                    .bind(
                            Customer::getLastName,Customer::setLastName
                    );
    
    
    
            Button reload = new Button("reload", e ->{
                try{
                    binder.readBean(customer);
    
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            });
            // Configure UI components
            save.setThemeName("primary");
            // Wrap components in layouts
            HorizontalLayout formLayout = new HorizontalLayout(grid,firstName,lastName,save,reload);
            Div wrapperLayout = new Div(formLayout, errorsLayout);
            formLayout.setDefaultVerticalComponentAlignment(Alignment.BASELINE);
            wrapperLayout.setWidth("100%");
    
            grid.setColumnReorderingAllowed(true);
    
    
            return wrapperLayout;
    
        }
    
    
        private void updateGrid() {
    
            List<Customer> customers = service.findAll();
            grid.setItems(customers);
    
    
    
        }
    
        public List<Customer> findAll() {
            return jdbcTemplate.query(
                    "SELECT ID, FirstName, LastName FROM customer",
                (rs, rowNum) -> new Customer(rs.getLong("ID"),
                            rs.getString("FirstName"), rs.getString("LastName")));
    }
    Christoph Frick
    @christoph-frick
    the form stuff there is all unrelated? your grid does not show columns for id and firstName, but for lastName? or the columns are there, but they don't show content? If the later, are you sure, that the customers are loaded correctly (e.g. debugging findAll). If not, please also show us the Customer class
    Snir Ben Yossef
    @snirben
    columns are there but thay show only data on the lastname,
    customer class:
    package com.packagename.myapp.spring;
    
    public class Customer {
        private Long ID;
        private String FirstName;
        private String LastName;
        private String Phone;
        private String Email;
        private String Company;
        private String Address;
        private String Created;
    
    
        public Customer(Long id, String FirstName,String lastName,String company, String address, String phone, String email,String Created ) {
           this.ID=id;
            this.FirstName = FirstName;
            this.LastName = lastName;
            this.Phone = phone;
            this.Email = email;
            this.Company = company;
            this.Address = address;
            this.Created= Created;
    
        }
        public Customer(){}
    
        public Customer(String lastName) {
            this.LastName=lastName;
    
        }
        public Customer(Long id,String firstName,String lastName) {
            this.LastName=lastName;
    
        }
        public Customer(String firstName,String lastName){
            this.FirstName=firstName;
            this.LastName=lastName;
        }
    
    
        public String getFirstName() {
            return FirstName;
        }
    
        public void setFirstName(String firstName) {
            FirstName = firstName;
        }
    
        public String getLastName() {
            return LastName;
        }
    
        public void setLastName(String lastName) {
            LastName = lastName;
        }
    
        public String getPhone() {
            return Phone;
        }
    
        public void setPhone(String phone) {
            Phone = phone;
        }
    
        public String getEmail() {
            return Email;
        }
    
        public void setEmail(String email) {
            Email = email;
        }
    
        public String getCompany() {
            return Company;
        }
    
        public void setCompany(String company) {
            Company = company;
        }
    
        public String getAddress() {
            return Address;
        }
    
        public void setAddress(String address) {
            Address = address;
        }
    
        public Long getID() {
            return ID;
        }
    
        public void setID(Long ID) {
            this.ID = ID;
        }
    
        public String getCreated() {
            return Created;
        }
    
        public void setCreated(String created) {
            Created = created;
        }
    }
    and how can debugg only the find all command?
    i run it in my sql and it showes all data
    Christoph Frick
    @christoph-frick
    use the debugger of your IDE?
    or add a toString() on your Customer and just print the data out at the end
    oh there it is
    check your three argument c'tor - it lacks all the assignments
    (except lastname) - that's why it works
    Snir Ben Yossef
    @snirben
    oh, thank you!
    Christoph Frick
    @christoph-frick
    just to note it: the convention for fields is to name them starting with a lowercase character
    Snir Ben Yossef
    @snirben
    i see, ok. thank you very much!
    do you have and links to learn better coding in java vaadin spring boot?
    Christoph Frick
    @christoph-frick
    no clue for java (have not used it since the 1.2 days); for vaadin there book of vaadin which is full of examples and is a really good source for all vaadin. for spring check the web - i bet there are millions of tutorial etc out there. book of vaadin should also have a section about spring with vaadin
    Snir Ben Yossef
    @snirben
    ok thanks.
    Martigan88
    @Martigan88
    Hey! I have an odd issue with one of my grids. If you scroll up and down a couple times through the full data set (90ish items), it will eventually start mangling the data's order.
    Screen Shot 2019-10-18 at 2.41.04 PM.png
    Christoph Frick
    @christoph-frick
    unless this is a recent bug, it's most likely some fsckup with the stream or with identity
    Martigan88
    @Martigan88
    the stream within the data provider, or the rpc connection to the browser?
    Christoph Frick
    @christoph-frick
    the data provider
    Martigan88
    @Martigan88
    also... i've verified that the Equals and Hashcode are good
    in the fetch runnable, i query the database, print my results to the console, and then stream the list holding the results
    when i print to the console, the data looks good
    Christoph Frick
    @christoph-frick
    then i'd make sure, your count matches the results and your offset/limit works poperly
    Martigan88
    @Martigan88
    yeah, i checked that too :/
    i logged the queries that its running
    when i watch the console on my browser i see this sort of thing happening:
    Christoph Frick
    @christoph-frick
    never used push against a grid
    (i extrapolate that from atmosphere log messages, might be wrong here/)
    Martigan88
    @Martigan88
    receive element 1-40 via RPC
    show elements 0-9
    scroll down
    scroll up
    receive elements 1-4 via RPC
    show 1-4 followed by 1-3
    sorry, i was trying to type out the behavior im seeing, but its hard to put in text
    Christoph Frick
    @christoph-frick
    if the wtf is to big, isolate the problem. maybe it's a bug
    Martigan88
    @Martigan88
    sorry, if the what is too big?
    Christoph Frick
    @christoph-frick
    you heard me
    Martigan88
    @Martigan88
    are you saying that if the issue is too big , isolate the bug and report it?
    Christoph Frick
    @christoph-frick
    i am saying, that if have such a problem, if might help to isolate the problem. if you have just a grid, some push, and some data and the problem is there, its a bug and you can use that to report a bug with a minimal failing example. if that works, you have a problem in your actual code
    Siarhei Ivaniukovich
    @sergeblr
    Hello, can somebody help me with Vaadin 8 Button.addClickListener ? How to reassign listener? removeClickListener has deprecated in v8... For example, i have Button.addClickListener(event -> doSomethingLittle()); So i want to reassign it to doSomethingBig() only when something other happens, but i have not found replaceClickListener or something like this to reassign it
    Knoobie
    @knoobie
    You can use the Registration returned by addClickListener to remove the associated listener.
    Siarhei Ivaniukovich
    @sergeblr
    @knoobie damn it works, thanks!
    ... why removeClickListener deprecated...
    Pekka Hyvönen
    @pleku

    ... why removeClickListener deprecated...

    IIRC it was replaced by the registration handle that allows you to unregister whatever listener when needed and it was deemed much better API than having removeXYZListener everywhere.
    Even though things are deprecated in 8, those are not removed from it. But those (and other things) you cannot presume to be there in 10+

    Dani
    @Dinodanio
    Hello everyone. We try to multi select rows in a grid. We found the default multi-selection with the checkboxes/space, but want select one row by clicking on it and multi select rows by holding the ctrl/shift button + clicking. Is this possible in a way? (https://vaadin.com/docs/v8/framework/components/components-grid.html#components.grid.selection.multi)
    mpnsk
    @mpnsk_gitlab
    grid in v7 is like that
    Omar Shoukair
    @O.shoukair_gitlab
    @Dinodanio if (this.grid.getSelectedItems().contains(event.getItem())) {
    this.grid.deselect(event.getItem());
    } else {
    this.grid.select(event.getItem());
    }