Comments (11)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Since this was fixed in 842feb6, I'm closing this issue.
from flowless.
Related Issues (20)
- Modular application cannot find flowless HOT 1
- Error fetching URL: https://github.com/FXMisc/Flowless/#flowless/apidocs/
- VirtualFlow.java does not compile in OpenJDK 17 HOT 3
- Scrollbar thumb is too small HOT 1
- VirtualFlow GridPane HOT 10
- Changing styles of rows HOT 3
- Need new maintainer HOT 6
- Why happens to performance when Nodes are used for items in the VirtualFlow/createVertical? HOT 1
- Custom Editor, Multiple Custom Objects, adding HyperlinkSegment and ImageSegment
- Expandable cell problem HOT 2
- VirtualFlow doesn't resize cells properly when layout bounds changes depending on the Orientation. HOT 1
- Keyboard paging computation error while paging up
- VirtualizedScrollPane causes high CPU and GPU on idle with 125% screen scaling HOT 6
- Can't Get Clicked Item in List HOT 27
- Adding items too fast causes scroll when item list is empty HOT 1
- Introduce negative checks, just before each access. HOT 8
- Cell positioning
- org.fxmisc.flowless.CellListManager#getCellIfPresent HOT 1
- JavaFX 16 HOT 2
- JavaFX 17 breaks scrollbar behaviours in VirtualizedScrollPane HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flowless.