use of net.parostroj.timetable.model.OutputTemplate in project grafikon by jub77.
the class TrainDiagramBuilder method setOutputTemplate.
public void setOutputTemplate(LSOutputTemplate lsOutputTemplate) throws LSException {
OutputTemplate template = lsOutputTemplate.createOutputTemplate(diagram.getPartFactory(), diagram::getObjectById, flsAttachments);
diagram.getOutputTemplates().add(template);
}
use of net.parostroj.timetable.model.OutputTemplate in project grafikon by jub77.
the class FileLoadSaveAttachments method load.
public void load(ZipInputStream zipInput, ZipEntry entry) throws IOException {
String ref = entry.getName().substring(location.length());
Pair<LSAttachment, OutputTemplate> pair = templateMap.get(ref);
byte[] bytes = ByteStreams.toByteArray(zipInput);
Attachment attachment = getAttachment(pair, bytes);
pair.second.getAttachments().add(attachment);
}
use of net.parostroj.timetable.model.OutputTemplate in project grafikon by jub77.
the class LibraryBuilder method importOutputTemplate.
public LibraryItem importOutputTemplate(String id, String name) {
OutputTemplate template = factory.createOutputTemplate(id);
template.setKey(name);
return addImpl(template, LibraryItemType.OUTPUT_TEMPLATE);
}
use of net.parostroj.timetable.model.OutputTemplate in project grafikon by jub77.
the class EditOutputDialog method setPresentationModel.
@Override
public void setPresentationModel(final OutputPM pModel) {
provider.setPresentationModel(pModel);
pModel.setOperationEditSelection(() -> {
Collection<? extends ObjectWithId> currentSelection = pModel.getSelection();
ElementSelectionDialog<ObjectWithId> dialog = new ElementSelectionDialog<>(this, true);
OutputTemplate template = pModel.getEditedOutput().getTemplate();
Collection<ObjectWithId> collection = template.getSelectionType().extract(template.getDiagram(), ObjectWithId.class);
dialog.setLocationRelativeTo(this);
List<ObjectWithId> newSelection = dialog.selectElements(collection, currentSelection);
if (newSelection != null) {
if (newSelection.isEmpty()) {
newSelection = null;
}
pModel.updateSelection(newSelection);
}
return true;
});
}
use of net.parostroj.timetable.model.OutputTemplate in project grafikon by jub77.
the class OutputPM method initNew.
public void initNew(TrainDiagram diagram) {
diagramRef = new WeakReference<>(diagram);
outputRef = null;
templates.getOptions().clear();
name.init(null, null);
List<Wrapper<OutputTemplate>> wrappers = new ArrayList<>();
for (OutputTemplate template : diagram.getOutputTemplates()) {
wrappers.add(Wrapper.getWrapper(template));
}
Collections.sort(wrappers);
for (Wrapper<OutputTemplate> wrapper : wrappers) {
templates.addValue(wrapper.getElement(), wrapper.toString());
}
if (!wrappers.isEmpty()) {
templates.setValue(wrappers.get(0).getElement());
}
locale.setValue(null);
}
Aggregations