use of net.parostroj.timetable.model.Company in project grafikon by jub77.
the class LSCompany method createCompany.
public Company createCompany(TrainDiagram diagram) throws LSException {
Company company = diagram.getPartFactory().createCompany(id);
company.getAttributes().add(attributes.createAttributes(diagram::getObjectById));
return company;
}
use of net.parostroj.timetable.model.Company in project grafikon by jub77.
the class EditCompaniesDialog method createNew.
@Override
protected Company createNew(String name) {
TrainDiagramPartFactory factory = element.getPartFactory();
Company newCompany = factory.createCompany(factory.createId());
newCompany.setAbbr(name);
return newCompany;
}
use of net.parostroj.timetable.model.Company in project grafikon by jub77.
the class CompanyImport method importObjectImpl.
@Override
protected ObjectWithId importObjectImpl(ObjectWithId o) {
// check class
if (!(o instanceof Company))
return null;
Company importedCompany = (Company) o;
// check existence
Company checkedCompany = this.getCompany(importedCompany);
if (checkedCompany != null) {
String message = "company already exists";
this.addError(importedCompany, message);
log.debug("{}: {}", message, checkedCompany);
return null;
}
// create new company
Company company = getDiagram().getPartFactory().createCompany(this.getId(importedCompany));
company.getAttributes().add(this.importAttributes(importedCompany.getAttributes()));
// add to diagram
this.getDiagram().getCompanies().add(company);
this.addImportedObject(company);
log.trace("Successfully imported company: {}", company);
return company;
}
use of net.parostroj.timetable.model.Company in project grafikon by jub77.
the class CompanyPM method ok.
@Operation(path = "ok")
public boolean ok() {
Company company = companyRef.get();
if (company != null) {
// write back
company.setName(ObjectsUtil.checkAndTrim(name.getText()));
company.setAttribute(Company.ATTR_PART_NAME, ObjectsUtil.checkAndTrim(part.getText()));
company.setLocale(locale.getValue());
company.setAbbr(ObjectsUtil.checkAndTrim(abbr.getText()));
}
return true;
}
use of net.parostroj.timetable.model.Company in project grafikon by jub77.
the class StationTimetablesExtractor method getStationTimetables.
public List<StationTimetable> getStationTimetables() {
List<StationTimetable> result = new LinkedList<>();
for (Node node : nodes) {
StationTimetable timetable = new StationTimetable(node.getName());
timetable.setType(node.getType());
// regions + company
Set<Region> regions = node.getRegions();
if (!regions.isEmpty()) {
timetable.setRegions(regions.stream().map(RegionInfo::convert).collect(Collectors.toList()));
}
Company company = node.getAttribute(Node.ATTR_COMPANY, Company.class);
if (company != null) {
timetable.setCompany(CompanyInfo.convert(company));
}
// process rows ...
for (TimeInterval interval : this.collectIntervals(node)) {
if (techTime || !interval.isTechnological()) {
timetable.getRows().add(this.createRow(interval));
}
}
result.add(timetable);
}
return result;
}
Aggregations