Coder Social home page Coder Social logo

Comments (11)

TomasMikula avatar TomasMikula commented on August 20, 2024

Here's a proposal: define

interface Virtualized {
    Val<Double> totalWidthEstimateProperty();
    Val<Double> totalHeightEstimateProperty();
    Var<Double> estimatedScrollXProperty();
    Var<Double> estimatedScrollYProperty();
}

that represents a virtualized component. Make VirtualFlowContent implement that interface. Implement

class VirtualizedScrollPane<T extends Virtualized> extends Virtualized {

    VirtualizedScrollPane(T content) { /* ... */ }

    public T getContent() { /* ... */ }

    // ...
}

VirtualizedScrollPane will basically be a slimmed down version of current VirtualFlow. It just adds scrollbars to any Virtualized content.

I guess we can then rename VirtualFlowContent to VirtualFlow. We will then have factory methods that return VirtualizedScrollPane<VirtualFlow> (~VirtualFlow with scrollbars) and also factory methods that return bare VirtualFlow (without scrollbars).

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

If I'm understanding you correctly:

Old Name New Name Changes (old names used)
VirtuallFlowContent VirtualFlow VirtualFlowContent without scroll bars
VirtualFlow VirtualizedScrollPane VirtualFlowContent with scroll bars

from flowless.

TomasMikula avatar TomasMikula commented on August 20, 2024

The current VirtualFlowContent already is without scrollbars.

VirtualizedScrollPane is meant to be a general component that adds scrollbars to Virtualized content. It shouldn't have anything specific to VirtualFlow(Content). I would operate on just the Virtualized interface.

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

Shouldn't VirtualizedScrollPane's generic be <V extends VirtualFlow>? Otherwise, won't the code getChildren().addAll(content, hbar, vbar); throw a compiler error because Virtualized doesn't extend Node?

from flowless.

TomasMikula avatar TomasMikula commented on August 20, 2024

You are right, but then it should be <V extends Node & Virtualized>, so that we don't restrict it only to VirtualFlow (so that we can also embed a scrollbar-free StyledTextArea in a VirtualizedScrollPane after we make StyledTextArea extend Virtualized).

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

Ok. That clarifies things.
Just for clarification, should Virtualized include things other than the scrolling API? For example:

public interface Virtualized<T, C extends Cell<T, ?>> {
    // scrolling API
    Val<Double> totalWidthEstimateProperty();
    Val<Double> totalHeightEstimateProperty();
    Var<Double> estimatedScrollXProperty();
    Var<Double> estimatedScrollYProperty();
    void setEstimatedScrollX(double value);
    void setEstimatedScrollY(double value);
    double getEstimatedScrollX();
    double getEstimatedScrollY();
    void scrollXToPixel(double pixel);
    void scrollYToPixel(double pixel);
    // and other scrolling-related API....

    // and API for other stuff that was in VirtualFlowContent and 
    //    proxied via VirtualFlow (old names respectively)
    C getCellFor(int itemIndex);
    Optional<C> getCellIfVisible(int itemIndex);
    Orientation getContentBias();
    VirtualFlowHit<C> hit(double x, double y);
    void show(double viewportOffset);
    // and so on...
}

from flowless.

TomasMikula avatar TomasMikula commented on August 20, 2024

No, the other API should not be there. Virtualized content doesn't have to be a flow of cells, as happens to be the case for VirtualFlow.

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

Ok. Thanks for the clarification. So one would use something like the following code to do stuff:

VirtualizedScrollPane vsPane = new VirtualizedScrollPane(VirtualFlow.createHorizontal(args));
vsPane.getContent().setEstimatedScrollX(40);
vsPane.getContent().show(30);
// or more likely...
VirtualFlow content = (VirtualFlow) vsPane.getContent()
content.cellToViewport(cell, bounds)
// etc....

from flowless.

TomasMikula avatar TomasMikula commented on August 20, 2024

Yes. I don't like type casting, though. getContent() should return the type parameter V, which in this case will be a VirtualFlow.

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

Right. I was thinking in terms of generics, not an instance of a class that uses generics, which would thus know what class its generic value V represents.

from flowless.

JordanMartinez avatar JordanMartinez commented on August 20, 2024

Since this was fixed in 842feb6, I'm closing this issue.

from flowless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.