Search in sources :

Example 1 with Operation

use of org.beanfabrics.support.Operation in project grafikon by jub77.

the class OutputPM method operationWriteBack.

@Operation(path = "writeBack")
public boolean operationWriteBack() {
    Output output = outputRef.get();
    if (output != null) {
        output.setName(name.getCurrentEdit().get());
        // template cannot be changed
        output.setSettings(attributes.getFinalAttributes());
        output.setSelection(selectionItems);
        output.setLocale(locale.getValue());
        output.setKey(key.getText());
    }
    return true;
}
Also used : Output(net.parostroj.timetable.model.Output) Operation(org.beanfabrics.support.Operation)

Example 2 with Operation

use of org.beanfabrics.support.Operation 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;
}
Also used : Company(net.parostroj.timetable.model.Company) Operation(org.beanfabrics.support.Operation)

Example 3 with Operation

use of org.beanfabrics.support.Operation in project grafikon by jub77.

the class OutputPM method operationCreate.

@Operation(path = "create")
public boolean operationCreate() {
    TrainDiagram diagram = diagramRef != null ? diagramRef.get() : null;
    if (diagram != null) {
        newOutput = diagram.getPartFactory().createOutput(IdGenerator.getInstance().getId());
        newOutput.setName(LocalizedString.fromString(name.getCurrentEdit().get().translate()));
        newOutput.setTemplate(templates.getValue());
        newOutput.setLocale(locale.getValue());
        newOutput.setKey(key.getText());
    }
    return true;
}
Also used : TrainDiagram(net.parostroj.timetable.model.TrainDiagram) Operation(org.beanfabrics.support.Operation)

Example 4 with Operation

use of org.beanfabrics.support.Operation in project grafikon by jub77.

the class RegionPM method ok.

@Operation(path = "ok")
public boolean ok() {
    Region region = regionRef.get();
    if (region != null) {
        // write back
        region.setAttribute(Region.ATTR_LOCALE, locale.getValue());
        region.setName(ObjectsUtil.checkAndTrim(name.getText()));
        region.setSuperRegion(this.superRegion.getValue());
        region.setFreightColorRegion(colorRegion.getBoolean());
        // color mapping
        Map<FreightColor, Region> map = new EnumMap<>(FreightColor.class);
        for (ColorMappingPM cMapping : colorMap) {
            FreightColor mColor = cMapping.color.getValue();
            Region mRegion = cMapping.region.getValue();
            if (mColor != null && mRegion != null) {
                map.put(mColor, mRegion);
            }
        }
        region.setFreightColorMap(map);
    }
    return true;
}
Also used : Region(net.parostroj.timetable.model.Region) FreightColor(net.parostroj.timetable.model.FreightColor) EnumMap(java.util.EnumMap) Operation(org.beanfabrics.support.Operation)

Example 5 with Operation

use of org.beanfabrics.support.Operation in project grafikon by jub77.

the class EngineClassPM method ok.

@Operation(path = "ok")
public void ok() {
    EngineClass engineClass = reference != null ? reference.get() : null;
    if (engineClass != null) {
        // write values back
        engineClass.setName(name.getText());
        engineClass.setGroupKey(ObjectsUtil.checkAndTrim(groupKey.getText()));
    }
}
Also used : EngineClass(net.parostroj.timetable.model.EngineClass) Operation(org.beanfabrics.support.Operation)

Aggregations

Operation (org.beanfabrics.support.Operation)5 EnumMap (java.util.EnumMap)1 Company (net.parostroj.timetable.model.Company)1 EngineClass (net.parostroj.timetable.model.EngineClass)1 FreightColor (net.parostroj.timetable.model.FreightColor)1 Output (net.parostroj.timetable.model.Output)1 Region (net.parostroj.timetable.model.Region)1 TrainDiagram (net.parostroj.timetable.model.TrainDiagram)1