Assembly64Column.java
package ui.entities.config;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.xml.bind.annotation.XmlTransient;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import sidplay.ini.converter.BeanToStringConverter;
import ui.common.properties.ShadowField;
@Entity
@Access(AccessType.PROPERTY)
public class Assembly64Column {
private Integer id;
public Assembly64Column() {
}
public Assembly64Column(Assembly64Column assembly64Column) {
setColumnType(assembly64Column.getColumnType());
setWidth(assembly64Column.getWidth());
}
public Assembly64Column(Assembly64ColumnType assembly64ColumnType) {
setColumnType(assembly64ColumnType);
setWidth(assembly64ColumnType.getDefaultWidth());
}
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@XmlTransient
@JsonIgnore
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
private final ShadowField<ObjectProperty<Assembly64ColumnType>, Assembly64ColumnType> columnType = new ShadowField<>(
SimpleObjectProperty::new, null);
@Enumerated(EnumType.STRING)
public Assembly64ColumnType getColumnType() {
return columnType.get();
}
public void setColumnType(Assembly64ColumnType columnType) {
this.columnType.set(columnType);
}
public final ObjectProperty<Assembly64ColumnType> columnTypeProperty() {
return columnType.property();
}
private final ShadowField<DoubleProperty, Number> width = new ShadowField<>(
number -> new SimpleDoubleProperty(number.floatValue()), 0);
public double getWidth() {
return width.get().doubleValue();
}
public void setWidth(double width) {
this.width.set(width);
}
public final DoubleProperty widthProperty() {
return width.property();
}
@Override
public final String toString() {
return BeanToStringConverter.toString(this);
}
}