de.rpgframework.jfx.fxml.RPGFrameworkScreenLoader Maven / Gradle / Ivy
package de.rpgframework.jfx.fxml;
import java.io.IOException;
import java.util.Collection;
import java.util.ResourceBundle;
import java.util.function.Function;
import java.util.function.Supplier;
import org.prelle.javafx.FlexibleApplication;
import org.prelle.javafx.Page;
import de.rpgframework.genericrpg.data.DataItem;
import de.rpgframework.genericrpg.modification.Modification;
import de.rpgframework.genericrpg.requirements.Requirement;
import de.rpgframework.jfx.ADescriptionPane;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ListCell;
/**
* @author prelle
*
*/
public class RPGFrameworkScreenLoader {
// //-------------------------------------------------------------------
// public static VBox loadGenericDescriptionBox(DataItem item, Function resolver) {
// FXMLLoader loader = new FXMLLoader(
// RPGFrameworkScreenLoader.class.getResource("GenericDescriptionVBox.fxml"),
// ResourceBundle.getBundle("de.rpgframework.jfx.fxml.GenericDescriptionVBox")
// );
// FXMLLoader.setDefaultClassLoader(FlexibleApplication.class.getClassLoader());
// VBox ret;
// try {
// ret = loader.load();
// ((GenericDescriptionBoxController)loader.getController()).setData(item, resolver);
// } catch (IOException e) {
// ret = new VBox();
// }
// ret.setId("description-box");
// return ret;
// }
//
// //-------------------------------------------------------------------
// @SuppressWarnings("unchecked")
// public static Page loadFilteredListPage(Function resolver, Supplier> listProvider) throws IOException {
// FXMLLoader loader = new FXMLLoader(
// RPGFrameworkScreenLoader.class.getResource("FilteredListPage.fxml"),
// ResourceBundle.getBundle("de.rpgframework.jfx.FilteredListPage")
// );
// FXMLLoader.setDefaultClassLoader(FlexibleApplication.class.getClassLoader());
// Page ret = loader.load();
// ret.setId("filtered");
// ((FilteredListPageController)loader.getController()).setComponent(
// ret,
// listProvider, resolver
// );
// return ret;
// }
//-------------------------------------------------------------------
@SuppressWarnings("unchecked")
public static Page loadExtendedFilteredListPage(
Function resolver,
Function mResolver,
Supplier> listProvider,
Class> lcClazz,
Class> dpClazz) throws IOException {
FXMLLoader loader = new FXMLLoader(
RPGFrameworkScreenLoader.class.getResource("FilteredListPage.fxml"),
ResourceBundle.getBundle("de.rpgframework.jfx.FilteredListPage")
);
ExtendedFilteredListPageController controller = new ExtendedFilteredListPageController<>();
loader.setController(controller);
FXMLLoader.setDefaultClassLoader(FlexibleApplication.class.getClassLoader());
Page ret = loader.load();
ret.setId("filtered");
controller.setComponent(
ret,
listProvider, resolver, mResolver,
lcClazz, dpClazz
);
return ret;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy