1 package org.simantics.spreadsheet.graph.synchronization;
3 import java.util.Collection;
6 import org.simantics.databoard.adapter.AdaptException;
7 import org.simantics.databoard.binding.mutable.Variant;
8 import org.simantics.spreadsheet.graph.function.LineContentBean;
9 import org.simantics.structural.synchronization.utils.CommandBuilder;
10 import org.simantics.structural.synchronization.utils.ModuleUpdateContext;
11 import org.simantics.structural.synchronization.utils.ModuleUpdaterBase;
12 import org.simantics.structural.synchronization.utils.PropertyUpdateRule;
14 public class LineUpdater extends ModuleUpdaterBase<SheetLineComponent> {
16 public LineUpdater(String id) {
18 addPropertyUpdateRule(new PropertyUpdateRule<SheetLineComponent>() {
21 public String getPropertyName() {
26 public void apply(ModuleUpdateContext<SheetLineComponent> context, boolean isCreating,
27 Map<String, Variant> propertyMap, Map<String, Collection<String>> connectionMap, Variant value) {
29 LineCommandBuilder builder = context.<LineCommandBuilder>getConcreteCommand();
31 LineContentBean valuee = (LineContentBean) value.getValue(LineContentBean.BINDING);
32 builder.bean = valuee;
33 } catch (AdaptException e) {
35 } catch (ClassCastException e) {
38 // if (valuee instanceof LineContentBean)
41 // System.err.println("valuee is instanceof " + valuee.getClass().getSimpleName() + " " + valuee);
49 public CommandBuilder createAddCommandBuilder(String name) {
50 return new LineCommandBuilder(name, false);
54 public CommandBuilder createUpdateCommandBuilder(String name) {
55 return new LineCommandBuilder(name, true);