de.rpgframework.jfx.DataItemListPane Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rpgframework-javafx Show documentation
Show all versions of rpgframework-javafx Show documentation
JavaFX extensions for the RPGFramework
The newest version!
package de.rpgframework.jfx;
import java.util.List;
import java.util.function.Function;
import de.rpgframework.genericrpg.data.DataItem;
import de.rpgframework.genericrpg.modification.Modification;
import de.rpgframework.genericrpg.requirements.Requirement;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
/**
* Provide a spinner to browse through a list of data items
* and add additional information
*
* @author prelle
*
*/
public class DataItemListPane extends DataItemPane {
@FXML
private ObjectProperty selectedItem = new SimpleObjectProperty<>();
private ListView list;
//-------------------------------------------------------------------
public DataItemListPane(Function reqR, Function modR) {
super(reqR,modR);
initComponents();
initLayout();
initInteractivity();
}
//-------------------------------------------------------------------
private void initComponents() {
list = new ListView();
}
//-------------------------------------------------------------------
private void initLayout() {
setSelectorNode(list);
}
//-------------------------------------------------------------------
private void initInteractivity() {
heightProperty().addListener( (ov,o,n) -> recalculateSpinnerHeight());
widthProperty().addListener( (ov,o,n) -> recalculateSpinnerHeight());
selectedItem.bind(list.getSelectionModel().selectedItemProperty());
}
//-------------------------------------------------------------------
private void recalculateSpinnerHeight() {
list.setPrefHeight(getHeight());
}
//-------------------------------------------------------------------
public void setItems(List data) {
list.getItems().setAll(data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy