de.rpgframework.jfx.DataItemDetailsPane Maven / Gradle / Ivy
package de.rpgframework.jfx;
import java.lang.System.Logger.Level;
import java.util.function.BiConsumer;
import java.util.function.Function;
import org.prelle.javafx.NodeWithTitle;
import org.prelle.javafx.ResponsiveControl;
import org.prelle.javafx.ResponsiveControlManager;
import org.prelle.javafx.WindowMode;
import de.rpgframework.character.RuleSpecificCharacterObject;
import de.rpgframework.genericrpg.data.Choice;
import de.rpgframework.genericrpg.data.ComplexDataItem;
import de.rpgframework.genericrpg.data.ComplexDataItemValue;
import de.rpgframework.genericrpg.data.DataItem;
import de.rpgframework.genericrpg.modification.Modification;
import de.rpgframework.genericrpg.modification.ModificationChoice;
import de.rpgframework.genericrpg.modification.ModifiedObjectType;
import de.rpgframework.genericrpg.requirements.Requirement;
import de.rpgframework.jfx.skin.DataItemDetailsPaneSkin;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Control;
import javafx.scene.control.Skin;
import javafx.scene.image.Image;
/**
* @author prelle
*
*/
@SuppressWarnings("rawtypes")
public class DataItemDetailsPane extends Control implements ResponsiveControl {
private final static String DEFAULT_STYLE_CLASS = "item-details-pane";
@FXML
private ObjectProperty model = new SimpleObjectProperty<>();
private ObservableList items = FXCollections.emptyObservableList();
private ObjectProperty> imageConverter = new SimpleObjectProperty<>();
private ObjectProperty> modifConverter = new SimpleObjectProperty<>();
private ObjectProperty> refTypeConverter = new SimpleObjectProperty<>();
private ObjectProperty> choiceConverter = new SimpleObjectProperty<>();
private ObjectProperty> decisionHandler = new SimpleObjectProperty<>();
private ObjectProperty> modDecisionHandler = new SimpleObjectProperty<>();
private ObjectProperty customNode1 = new SimpleObjectProperty<>();
private ObjectProperty customNode2 = new SimpleObjectProperty<>();
private ObjectProperty selectedItem = new SimpleObjectProperty();
private ObjectProperty> showChoicesWithValue = new SimpleObjectProperty<>();
private ObjectProperty showHelpFor = new SimpleObjectProperty();
private ObjectProperty layoutMode = new SimpleObjectProperty<>(WindowMode.EXPANDED);
private BooleanProperty showDecisionColumn = new SimpleBooleanProperty(false);
private BooleanProperty showStatsColumn = new SimpleBooleanProperty(true);
private BooleanProperty showModificationsInDescription = new SimpleBooleanProperty(true);
private transient Function reqR;
private transient Function modR;
//-------------------------------------------------------------------
/**
*/
public DataItemDetailsPane(Function reqR, Function modR) {
getStyleClass().add(DEFAULT_STYLE_CLASS);
this.reqR = reqR;
this.modR = modR;
if (ResponsiveControlManager.getCurrentMode()!=null)
layoutMode.set(ResponsiveControlManager.getCurrentMode());
}
//-------------------------------------------------------------------
/**
* @see javafx.scene.control.Control#createDefaultSkin()
*/
@Override
public Skin> createDefaultSkin() {
return new DataItemDetailsPaneSkin(this,reqR,modR);
}
//-------------------------------------------------------------------
public ObjectProperty modelProperty() { return model;}
public RuleSpecificCharacterObject getModel() { return model.get();}
public DataItemDetailsPane setModel(RuleSpecificCharacterObject value) { model.set(value); return this;}
// //-------------------------------------------------------------------
// public ObjectProperty> showChoicesWithValueProperty() { return showChoicesWithValue;}
public ComplexDataItemValue getShowChoicesWithValue() { return showChoicesWithValue.get();}
// public DataItemDetailsPane setShowChoicesWithValue(ComplexDataItemValue value) { showChoicesWithValue.set(value); return this;}
//-------------------------------------------------------------------
public ObjectProperty selectedItemProperty() { return selectedItem;}
public T getSelectedItem() { return selectedItem.get();}
public DataItemDetailsPane setSelectedItem(T value) { selectedItem.set(value); return this;}
//-------------------------------------------------------------------
public ObservableList itemsProperty() { return items;}
//-------------------------------------------------------------------
public ObjectProperty> imageConverterProperty() { return imageConverter;}
public Function getImageConverter() { return imageConverter.get();}
public DataItemDetailsPane setImageConverter(Function value) { imageConverter.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty> modificationConverterProperty() { return modifConverter;}
public Function getModificationConverter() { return modifConverter.get();}
public DataItemDetailsPane setModificationConverter(Function value) { modifConverter.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty> referenceTypeConverterProperty() { return refTypeConverter;}
public Function getReferenceTypeConverter() { return refTypeConverter.get();}
public DataItemDetailsPane setReferenceTypeConverter(Function value) { refTypeConverter.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty> choiceConverterProperty() { return choiceConverter;}
public Function getChoiceConverter() { return choiceConverter.get();}
public DataItemDetailsPane setChoiceConverter(Function value) { choiceConverter.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty> decisionHandlerProperty() { return decisionHandler;}
public BiConsumer getDecisionHandler() { return decisionHandler.get();}
public DataItemDetailsPane setDecisionHandler(BiConsumer value) { decisionHandler.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty> modDecisionHandlerProperty() { return modDecisionHandler;}
public BiConsumer getModDecisionHandler() { return modDecisionHandler.get();}
public DataItemDetailsPane setModDecisionHandler(BiConsumer value) { modDecisionHandler.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty customNode1Property() { return customNode1;}
public NodeWithTitle getCustomNode1() { return customNode1.get();}
public DataItemDetailsPane setCustomNode1(NodeWithTitle value) { customNode1.set(value); return this;}
//-------------------------------------------------------------------
public ObjectProperty customNode2Property() { return customNode2;}
public NodeWithTitle getCustomNode2() { return customNode2.get();}
public DataItemDetailsPane setCustomNode2(NodeWithTitle value) { customNode2.set(value); return this;}
//--------------------------------------------------------------------
public BooleanProperty showDecisionColumnProperty() { return showDecisionColumn; }
public Boolean isShowDecisionColumn() { return showDecisionColumn.get(); }
public DataItemDetailsPane setShowDecisionColumn(Boolean value) { showDecisionColumn.set(value); return this; }
//--------------------------------------------------------------------
public BooleanProperty showStatsColumnProperty() { return showStatsColumn; }
public Boolean isShowStatsColumn() { return showStatsColumn.get(); }
public DataItemDetailsPane setShowStatsColumn(Boolean value) { showStatsColumn.set(value); return this; }
//--------------------------------------------------------------------
public BooleanProperty showModificationsInDescriptionProperty() { return showModificationsInDescription; }
public Boolean isShowModificationsInDescription() { return showModificationsInDescription.get(); }
public DataItemDetailsPane setShowModificationsInDescription(Boolean value) { showModificationsInDescription.set(value); return this; }
//-------------------------------------------------------------------
public ObjectProperty layoutModeProperty() { return layoutMode;}
//-------------------------------------------------------------------
public ObjectProperty showHelpForProperty() { return showHelpFor;}
public DataItemDetailsPane setShowHelpFor(DataItem value) { showHelpFor.set(value); return this;}
//-------------------------------------------------------------------
/**
* @see org.prelle.javafx.ResponsiveControl#setResponsiveMode(org.prelle.javafx.WindowMode)
*/
@Override
public void setResponsiveMode(WindowMode value) {
RPGFrameworkJavaFX.logger.log(Level.WARNING, getId()+": mode changed to "+value);
layoutMode.set(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy