use of net.parostroj.timetable.model.Attributes in project grafikon by jub77.
the class AttributesPanel method stopEditing.
public Attributes stopEditing() {
if (attributesTableModel != null) {
TableCellEditor editor = attributesTable.getCellEditor();
if (editor != null) {
editor.stopCellEditing();
}
Attributes attributes = attributesTableModel.stopEditing();
attributesTableModel = null;
attributesTable.setModel(new DefaultTableModel());
return attributes;
} else {
return null;
}
}
use of net.parostroj.timetable.model.Attributes in project grafikon by jub77.
the class ModelAttributesPM method init.
public void init(Attributes attributes, String category, Function<String, String> nameTranslation) {
Attributes oldValue = this.attributes;
this.attributes = attributes;
this.category = category;
this.nameTranslation = nameTranslation;
this.getPropertyChangeSupport().firePropertyChange("attributes", oldValue, this.attributes);
}
use of net.parostroj.timetable.model.Attributes in project grafikon by jub77.
the class LoadFilter4d21 method checkDiagram.
@Override
public void checkDiagram(TrainDiagram diagram, ModelVersion version) {
if (version.compareTo(new ModelVersion(4, 21, 0)) <= 0) {
// convert route unit...
Attributes attributes = diagram.getAttributes();
if (attributes.containsKey(TrainDiagram.ATTR_ROUTE_LENGTH_UNIT)) {
// try to convert to length unit
String lUnitStr = attributes.get(TrainDiagram.ATTR_ROUTE_LENGTH_UNIT, String.class);
LengthUnit lUnit = LengthUnit.getByKey(lUnitStr);
attributes.setRemove(TrainDiagram.ATTR_ROUTE_LENGTH_UNIT, lUnit);
}
}
if (version.compareTo(new ModelVersion(4, 21, 1)) <= 0) {
// convert train name templates (common)
diagram.getTrainsData().setTrainNameTemplate(convertForAbbreviation(diagram.getTrainsData().getTrainNameTemplate()));
diagram.getTrainsData().setTrainCompleteNameTemplate(convertForAbbreviation(diagram.getTrainsData().getTrainCompleteNameTemplate()));
// in train types
for (TrainType type : diagram.getTrainTypes()) {
type.setTrainNameTemplate(convertForAbbreviation(type.getTrainNameTemplate()));
type.setTrainCompleteNameTemplate(convertForAbbreviation(type.getTrainCompleteNameTemplate()));
}
}
}
Aggregations