Search in sources :

Example 1 with OutputTemplate

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);
}
Also used : OutputTemplate(net.parostroj.timetable.model.OutputTemplate)

Example 2 with OutputTemplate

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);
}
Also used : OutputTemplate(net.parostroj.timetable.model.OutputTemplate) Attachment(net.parostroj.timetable.model.Attachment)

Example 3 with OutputTemplate

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);
}
Also used : OutputTemplate(net.parostroj.timetable.model.OutputTemplate)

Example 4 with OutputTemplate

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;
    });
}
Also used : ObjectWithId(net.parostroj.timetable.model.ObjectWithId) OutputTemplate(net.parostroj.timetable.model.OutputTemplate)

Example 5 with OutputTemplate

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);
}
Also used : Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) OutputTemplate(net.parostroj.timetable.model.OutputTemplate) ArrayList(java.util.ArrayList)

Aggregations

OutputTemplate (net.parostroj.timetable.model.OutputTemplate)9 ArrayList (java.util.ArrayList)2 Attachment (net.parostroj.timetable.model.Attachment)2 LSException (net.parostroj.timetable.model.ls.LSException)2 IOException (java.io.IOException)1 Date (java.util.Date)1 ZipEntry (java.util.zip.ZipEntry)1 Wrapper (net.parostroj.timetable.gui.wrappers.Wrapper)1 EngineClass (net.parostroj.timetable.model.EngineClass)1 LocalizedString (net.parostroj.timetable.model.LocalizedString)1 ObjectWithId (net.parostroj.timetable.model.ObjectWithId)1 Output (net.parostroj.timetable.model.Output)1 Route (net.parostroj.timetable.model.Route)1 TextItem (net.parostroj.timetable.model.TextItem)1 TimetableImage (net.parostroj.timetable.model.TimetableImage)1 Train (net.parostroj.timetable.model.Train)1 TrainType (net.parostroj.timetable.model.TrainType)1 TrainTypeCategory (net.parostroj.timetable.model.TrainTypeCategory)1 TrainsCycle (net.parostroj.timetable.model.TrainsCycle)1 DiagramChangeSet (net.parostroj.timetable.model.changes.DiagramChangeSet)1