PrinterSection.java
package ui.entities.config;
import jakarta.persistence.Access;
import jakarta.persistence.AccessType;
import jakarta.persistence.Embeddable;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import libsidplay.components.printer.PrinterConnection;
import libsidplay.components.printer.PrinterModel;
import libsidplay.config.IPrinterSection;
import sidplay.ini.converter.BeanToStringConverter;
import ui.common.properties.ShadowField;
import static sidplay.ini.IniDefaults.*;
@Embeddable
@Access(AccessType.PROPERTY)
public class PrinterSection implements IPrinterSection {
private ShadowField<BooleanProperty, Boolean> printerOn = new ShadowField<>(SimpleBooleanProperty::new,
DEFAULT_PRINTER_ON);
@Override
public boolean isPrinterOn() {
return printerOn.get();
}
@Override
public void setPrinterOn(boolean printerOn) {
this.printerOn.set(printerOn);
}
public final BooleanProperty printerOnProperty() {
return printerOn.property();
}
private ShadowField<ObjectProperty<PrinterModel>, PrinterModel> printerModel = new ShadowField<>(
SimpleObjectProperty::new, DEFAULT_PRINTER_MODEL);
@Override
@Enumerated(EnumType.STRING)
public PrinterModel getPrinterModel() {
return printerModel.get();
}
@Override
public void setPrinterModel(PrinterModel model) {
printerModel.set(model);
}
public final ObjectProperty<PrinterModel> printerModelProperty() {
return printerModel.property();
}
private ShadowField<ObjectProperty<PrinterConnection>, PrinterConnection> printerConnection = new ShadowField<>(
SimpleObjectProperty::new, DEFAULT_PRINTER_CONNECTION);
@Override
@Enumerated(EnumType.STRING)
public PrinterConnection getPrinterConnection() {
return printerConnection.get();
}
@Override
public void setPrinterConnection(PrinterConnection connection) {
printerConnection.set(connection);
}
public final ObjectProperty<PrinterConnection> printerConnectionProperty() {
return printerConnection.property();
}
@Override
public final String toString() {
return BeanToStringConverter.toString(this);
}
}