io.github.palexdev.virtualizedfx.list.VFXListState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtualizedfx Show documentation
Show all versions of virtualizedfx Show documentation
Alternative VirtualFlows for JavaFX
The newest version!
/*
* Copyright (C) 2024 Parisi Alessandro - [email protected]
* This file is part of VirtualizedFX (https://github.com/palexdev/VirtualizedFX)
*
* VirtualizedFX is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3 of the License,
* or (at your option) any later version.
*
* VirtualizedFX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with VirtualizedFX. If not, see .
*/
package io.github.palexdev.virtualizedfx.list;
import io.github.palexdev.mfxcore.base.beans.range.IntegerRange;
import io.github.palexdev.virtualizedfx.cells.base.VFXCell;
import io.github.palexdev.virtualizedfx.utils.IndexBiMap.StateMap;
import io.github.palexdev.virtualizedfx.utils.Utils;
import io.github.palexdev.virtualizedfx.utils.VFXCellsCache;
import javafx.scene.Node;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.SequencedMap;
/**
* Immutable object to represent the state of a {@link VFXList} in a specific moment in time. In other words, each and
* every state is given by a unique combination of the list's properties (in terms of values).
*
* The state carries three important information:
*
1) The range of items to display from the {@link VFXList#itemsProperty()}
*
2) The cells that are currently in the viewport
*
3) A flag that indicates whether cells have changed since last state
*
* Note that the data structure used to store the cells is particular, see {@link StateMap}.
*
* @see #INVALID
* @see StateMap
*/
// NullPointerException warnings due to special INVALID state
@SuppressWarnings({"DataFlowIssue", "rawtypes", "SameParameterValue"})
public class VFXListState> {
//================================================================================
// Static Properties
//================================================================================
/**
* Special instance of {@code VFXListState} used to indicate that no cells can be present in the viewport at
* a certain time. The reasons can be many, for example, no cell factory, invalid range, {@literal width/height <= 0}, etc...
*
* This and {@link #isEmpty()} are two total different things!!
*/
public static final VFXListState INVALID = new VFXListState<>() {
@Override
protected VFXCell
© 2015 - 2025 Weber Informatics LLC | Privacy Policy