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.base.CommandBuilder;
10 import org.simantics.structural.synchronization.base.ModuleUpdateContext;
11 import org.simantics.structural.synchronization.base.ModuleUpdaterBase;
12 import org.simantics.structural.synchronization.base.PropertyUpdateRule;
13 import org.simantics.structural.synchronization.base.Solver;
15 public class LineUpdater extends ModuleUpdaterBase<SheetLineComponent> {
17 public LineUpdater(String id) {
19 addPropertyUpdateRule(new PropertyUpdateRule<SheetLineComponent>() {
22 public String getPropertyName() {
27 public void apply(ModuleUpdateContext<SheetLineComponent> context, boolean isCreating,
28 Map<String, Variant> propertyMap, Map<String, Collection<String>> connectionMap, Variant value) {
30 LineCommandBuilder builder = context.<LineCommandBuilder>getConcreteCommand();
32 LineContentBean valuee = (LineContentBean) value.getValue(LineContentBean.BINDING);
33 builder.bean = valuee;
34 } catch (AdaptException e) {
36 } catch (ClassCastException e) {
39 // if (valuee instanceof LineContentBean)
42 // System.err.println("valuee is instanceof " + valuee.getClass().getSimpleName() + " " + valuee);
50 public CommandBuilder createAddCommandBuilder(String name) {
51 return new LineCommandBuilder(name, false);
55 public CommandBuilder createUpdateCommandBuilder(String name) {
56 return new LineCommandBuilder(name, true);