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;
}
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;
}
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;
}
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;
}
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()));
}
}
Aggregations