vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 730 forks source link

Initial scrolling to programmatically selected tree node does not work in V8 anymore (Vaadin 8.1.5, IE 11) #10197

Open Petikoch opened 7 years ago

Petikoch commented 7 years ago

I migrated the following V7 example

package example_v7;

import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

import java.util.stream.IntStream;

@Widgetset("com.vaadin.v7.Vaadin7WidgetSet")
@SpringUI
public class SelectedTreeNodeScrollingIssueV7UI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        com.vaadin.v7.ui.Tree tree = new com.vaadin.v7.ui.Tree();

        tree.addItem("Mercury");
        tree.addItem("Venus");
        tree.addItem("Earth");
        tree.addItem("MorePlanets");
        IntStream.rangeClosed(1, 100).forEach(value -> {
            final String itemId = "Planet" + value;
            tree.addItem(itemId);
            tree.setParent(itemId, "MorePlanets");
        });
        tree.addItem("EvenMorePlanets");
        IntStream.rangeClosed(1, 100).forEach(value -> {
            final String itemId = "AnotherPlanet" + value;
            tree.addItem(itemId);
            tree.setParent(itemId, "EvenMorePlanets");
        });

        Panel panel = new Panel(tree);
        panel.setWidth("50%");
        panel.setHeight("50%");

        tree.expandItem("EvenMorePlanets");
        tree.select("AnotherPlanet50"); //HERE HERE HERE!

        VerticalLayout verticalLayout = new VerticalLayout(panel);
        verticalLayout.setWidth("100%");
        verticalLayout.setHeight("100%");

        setContent(verticalLayout);
    }
}

to V8

package example_v8;

import com.vaadin.data.TreeData;
import com.vaadin.data.provider.TreeDataProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Tree;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

import java.util.stream.IntStream;

@SpringUI
public class SelectedTreeNodeScrollingIssueV8UI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        TreeData<String> treeData = new TreeData<>();
        treeData.addItem(null, "Mercury");
        treeData.addItem(null, "Venus");
        treeData.addItem(null, "Earth");
        treeData.addItem(null, "MorePlanets");
        IntStream.rangeClosed(1, 100).forEach(value -> treeData.addItem("MorePlanets", "Planet" + value));
        treeData.addItem(null, "EvenMorePlanets");
        IntStream.rangeClosed(1, 100).forEach(value -> treeData.addItem("EvenMorePlanets", "AnotherPlanet" + value));

        TreeDataProvider<String> inMemoryDataProvider = new TreeDataProvider<>(treeData);
        Tree<String> tree = new Tree<>(inMemoryDataProvider);

        Panel panel = new Panel(tree);
        panel.setHeight("50%");
        panel.setWidth("50%");

        tree.expand("EvenMorePlanets");
        tree.select("AnotherPlanet50"); //HERE HERE HERE!

        VerticalLayout verticalLayout = new VerticalLayout(panel);
        verticalLayout.setWidth("100%");
        verticalLayout.setHeight("100%");

        setContent(verticalLayout);
    }
}

In the V7 version, the UI opens and I immediately see the selected node, the scrollbar is at the "right position" (around the middle).

In the V8 version, the scrollbar is at the top and I first must scroll down to see the selected node.

It would be nice to have the V7 behaviour also in V8. We have a tree in a "selection window popup" where the user can pick a node. Before the "selection window popup" opens, the current value is "pre-selected" programmatically.

I also don't see a workaround, because I don't see a way to scroll the tree programmatically.

Petikoch commented 7 years ago

Related: https://github.com/vaadin/framework/issues/10196

stale[bot] commented 6 years ago

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

Petikoch commented 6 years ago

I just checked if it is still an issue also in latest - 8.3.2 - vaadin (IE 11): Yes, it is.

Why is it important to fix? a) It's an annoying bug in V8 b) It worked in V7

stale[bot] commented 6 years ago

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

Petikoch commented 6 years ago

I just checked if it is still an issue also in latest - 8.5.1 - vaadin (IE 11): Yes, it is.

Why is it important to fix? a) It's an annoying bug in V8 b) It worked in V7

stale[bot] commented 5 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

Petikoch commented 5 years ago

The issue is still there with the latest vaadin Framework 8 release

TatuLund commented 5 years ago

The Tree component in V8 is different component from V7 counterpart. This is unimplemented feature of it. It is partly related to https://github.com/vaadin/framework/issues/9266, which would be probably needed in implementation and also as well to this https://github.com/vaadin/framework/pull/11399