]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SheetClass.java.keep
Prevent unnecessary read transaction for synch master typical handle
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagram / SheetClass.java.keep
1 /*******************************************************************************
2  * Copyright (c) 2007- VTT Technical Research Centre of Finland.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     VTT Technical Research Centre of Finland - initial API and implementation
10  *******************************************************************************/
11 package org.simantics.modeling.ui.diagram;
12
13 import java.awt.BasicStroke;
14 import java.awt.Color;
15 import java.awt.Font;
16 import java.awt.FontMetrics;
17 import java.awt.Graphics2D;
18 import java.awt.Rectangle;
19 import java.awt.Shape;
20 import java.awt.geom.AffineTransform;
21 import java.awt.geom.Path2D;
22 import java.awt.geom.Point2D;
23 import java.awt.geom.Rectangle2D;
24 import java.util.Collection;
25 import java.util.EnumSet;
26 import java.util.Map;
27
28 import javax.swing.table.TableModel;
29
30 import org.simantics.g2d.diagram.IDiagram;
31 import org.simantics.g2d.element.ElementClass;
32 import org.simantics.g2d.element.ElementHints;
33 import org.simantics.g2d.element.ElementUtils;
34 import org.simantics.g2d.element.IElement;
35 import org.simantics.g2d.element.SceneGraphNodeKey;
36 import org.simantics.g2d.element.handler.ElementHandler;
37 import org.simantics.g2d.element.handler.FillColor;
38 import org.simantics.g2d.element.handler.InternalSize;
39 import org.simantics.g2d.element.handler.LifeCycle;
40 import org.simantics.g2d.element.handler.Move;
41 import org.simantics.g2d.element.handler.Outline;
42 import org.simantics.g2d.element.handler.Rotate;
43 import org.simantics.g2d.element.handler.Scale;
44 import org.simantics.g2d.element.handler.SceneGraph;
45 import org.simantics.g2d.element.handler.StaticSymbol;
46 import org.simantics.g2d.element.handler.Text;
47 import org.simantics.g2d.element.handler.Transform;
48 import org.simantics.g2d.element.handler.impl.BorderColorImpl;
49 import org.simantics.g2d.element.handler.impl.FillColorImpl;
50 import org.simantics.g2d.element.handler.impl.SimpleElementLayers;
51 import org.simantics.g2d.element.handler.impl.StaticSymbolImpl;
52 import org.simantics.g2d.element.handler.impl.TextEditorImpl;
53 import org.simantics.g2d.element.handler.impl.TextImpl;
54 import org.simantics.g2d.elementclass.MonitorHandler;
55 import org.simantics.g2d.image.Image;
56 import org.simantics.g2d.image.ProviderUtils;
57 import org.simantics.g2d.image.impl.AbstractImage;
58 import org.simantics.g2d.utils.Alignment;
59 import org.simantics.scenegraph.Node;
60 import org.simantics.scenegraph.g2d.G2DParentNode;
61 import org.simantics.spreadsheet.Model;
62 import org.simantics.utils.datastructures.cache.IFactory;
63 import org.simantics.utils.datastructures.cache.IProvider;
64 import org.simantics.utils.datastructures.cache.ProvisionException;
65 import org.simantics.utils.datastructures.hints.IHintContext.Key;
66 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
67
68 /**
69  * @author Tuukka Lehtonen
70  */
71 public class SheetClass {
72
73     static final Font        FONT                      = Font.decode("Helvetica 10");
74
75     public static final Key  KEY_MODEL = new KeyOf(Model.class, "MODEL");
76     public static final Key  KEY_TABLE_MODEL = new KeyOf(TableModel.class, "TABLE_MODEL");
77
78     public static final Key  KEY_MONITOR_RESOURCE_PATH = new KeyOf(Collection.class, "MONITOR_RESOURCE_PATH");
79     public static final Key  KEY_MONITOR_SUBSTITUTIONS = new KeyOf(Map.class, "MONITOR_SUBSTITUTIONS");
80     public static final Key  KEY_MONITOR_GC            = new KeyOf(Graphics2D.class, "MONITOR_GC");
81     public static final Key  KEY_MONITOR_HEIGHT        = new KeyOf(Double.class, "MONITOR_HEIGHT");
82     public static final Key  KEY_MONITOR_FONT_METRICS  = new KeyOf(FontMetrics.class, "MONITOR_FONT_METRICS");
83     public static final Key  KEY_NUMBER_FORMAT             = new KeyOf(String.class, "NUMBER_FORMAT");
84
85     /**
86      * If this hint is defined, the monitor will force its x-axis to match this
87      * angle. If this hint doesn't exist, the monitor will not force x-axis
88      * orientation.
89      */
90     public static final Key  KEY_DIRECTION             = new KeyOf(Double.class, "MONITOR_DIRECTION");
91
92     public static final Key  KEY_SG_NODE             = new SceneGraphNodeKey(Node.class, "MONITOR_SG_NODE");
93
94     final static BasicStroke STROKE                    = new BasicStroke(1.0f);
95
96     public final static Alignment DEFAULT_HORIZONTAL_ALIGN  = Alignment.CENTER;
97     public final static Alignment DEFAULT_VERTICAL_ALIGN    = Alignment.CENTER;
98     public final static String DEFAULT_NUMBER_FORMAT    = "0.0###";
99
100     public final static Color     DEFAULT_FILL_COLOR        = new Color(224, 224, 224);
101     public final static Color     DEFAULT_BORDER_COLOR      = Color.BLACK;
102
103     public final static double    DEFAULT_HORIZONTAL_MARGIN = 5.0;
104     public final static double    DEFAULT_VERTICAL_MARGIN   = 2.5;
105
106     static Alignment getHorizontalAlignment(IElement e) {
107         return ElementUtils.getHintOrDefault(e, ElementHints.KEY_HORIZONTAL_ALIGN, DEFAULT_HORIZONTAL_ALIGN);
108     }
109
110     static Alignment getVerticalAlignment(IElement e) {
111         return ElementUtils.getHintOrDefault(e, ElementHints.KEY_VERTICAL_ALIGN, DEFAULT_VERTICAL_ALIGN);
112     }
113
114     static String getNumberFormat(IElement e) {
115         return ElementUtils.getHintOrDefault(e, KEY_NUMBER_FORMAT, DEFAULT_NUMBER_FORMAT);
116     }
117
118     static void setNumberFormat(IElement e, String format) {
119         ElementUtils.setOrRemoveHint(e, KEY_NUMBER_FORMAT, DEFAULT_NUMBER_FORMAT);
120     }
121
122     static double getHorizontalMargin(IElement e) {
123         return DEFAULT_HORIZONTAL_MARGIN;
124     }
125
126     static double getVerticalMargin(IElement e) {
127         return DEFAULT_VERTICAL_MARGIN;
128     }
129
130     static Font getFont(IElement e) {
131         return ElementUtils.getHintOrDefault(e, ElementHints.KEY_FONT, FONT);
132     }
133
134     public static class MonitorHandlerImpl implements MonitorHandler {
135         private static final long          serialVersionUID = -4258875745321808416L;
136         public static final MonitorHandler INSTANCE         = new MonitorHandlerImpl();
137     }
138
139     static class Initializer implements LifeCycle {
140         private static final long serialVersionUID = 4404942036933073584L;
141
142         IElement parentElement;
143         Map<String, String> substitutions;
144         Collection<Object> path;
145         boolean hack;
146
147         Initializer(IElement parentElement, Map<String, String> substitutions, Collection<Object> path, boolean hack) {
148             this.parentElement = parentElement;
149             this.substitutions = substitutions;
150             this.path = path;
151             this.hack = hack;
152         }
153
154         @Override
155         public void onElementActivated(IDiagram d, IElement e) {
156
157             if(!hack) {
158
159                 hack = true;
160
161                 Point2D parentPos = ElementUtils.getPos(parentElement);
162                 Point2D thisPos = ElementUtils.getPos(e);
163
164                 Move move = e.getElementClass().getSingleItem(Move.class);
165                 move.moveTo(e, thisPos.getX() - parentPos.getX(), thisPos.getY() - parentPos.getY());
166
167             }
168
169         }
170         @Override
171         public void onElementCreated(IElement e) {
172             if(parentElement != null) e.setHint(ElementHints.KEY_PARENT_ELEMENT, parentElement);
173             if(substitutions != null) e.setHint(KEY_MONITOR_SUBSTITUTIONS, substitutions);
174             if(path != null) e.setHint(KEY_MONITOR_RESOURCE_PATH, path);
175
176             e.setHint(KEY_DIRECTION, 0.0);
177             e.setHint(KEY_NUMBER_FORMAT, DEFAULT_NUMBER_FORMAT);
178             //e.setHint(KEY_HORIZONTAL_ALIGN, Alignment.LEADING);
179             //e.setHint(KEY_VERTICAL_ALIGN, Alignment.LEADING);
180         }
181         @Override
182         public void onElementDeactivated(IDiagram d, IElement e) {
183         }
184         @Override
185         public void onElementDestroyed(IElement e) {
186         }
187     };
188
189     static String finalText(IElement e) {
190
191         Text t = e.getElementClass().getAtMostOneItemOfClass(Text.class);
192         assert(t != null);
193         String text = t.getText(e);
194         if(text == null) return null;
195         Map<String, String> substitutions = e.getHint(KEY_MONITOR_SUBSTITUTIONS);
196         if(substitutions != null) {
197             // TODO: slow as hell
198             for(Map.Entry<String, String> entry : substitutions.entrySet()) {
199                 if (entry.getValue() != null) {
200                     text = text.replace(entry.getKey(), entry.getValue());
201                 } else {
202                     text = text.replace(entry.getKey(), "<null>");
203                 }
204             }
205         }
206
207         return text;
208     }
209
210     public static void update(IElement e) {
211         SheetSGNode node = e.getElementClass().getAtMostOneItemOfClass(SheetSGNode.class);
212         node.update(e);
213     }
214
215     public static void cleanup(IElement e) {
216         SheetSGNode node = e.getElementClass().getAtMostOneItemOfClass(SheetSGNode.class);
217         node.cleanup(e);
218     }
219
220     public static String editText(IElement e) {
221
222         Text t = e.getElementClass().getAtMostOneItemOfClass(Text.class);
223         assert(t != null);
224         String text = "#v1";
225         if(text == null) return null;
226         Map<String, String> substitutions = e.getHint(KEY_MONITOR_SUBSTITUTIONS);
227         if(substitutions != null) {
228             // TODO: slow as hell
229             for(Map.Entry<String, String> entry : substitutions.entrySet()) {
230                 if (entry.getValue() != null) {
231                     text = text.replace(entry.getKey(), entry.getValue());
232                 } else {
233                     text = text.replace(entry.getKey(), "<null>");
234                 }
235             }
236         }
237
238         return text;
239     }
240
241     static final Rectangle2D DEFAULT_BOX = new Rectangle2D.Double(0, 0, 0, 0);
242
243     static Shape createMonitor(IElement e) {
244         Alignment hAlign = getHorizontalAlignment(e);
245         Alignment vAlign = getVerticalAlignment(e);
246         double hMargin = getHorizontalMargin(e);
247         double vMargin = getVerticalMargin(e);
248
249         String text = finalText(e);
250         if(text == null) {
251             return align(hMargin, vMargin, hAlign, vAlign, DEFAULT_BOX);
252         }
253
254         Graphics2D g = e.getHint(KEY_MONITOR_GC);
255         if(g == null) {
256             return align(hMargin, vMargin, hAlign, vAlign, DEFAULT_BOX);
257         }
258
259         Font f = getFont(e);
260         FontMetrics fm   = g.getFontMetrics(f);
261         Rectangle2D rect = fm.getStringBounds(text, g);
262
263         return align(hMargin, vMargin, hAlign, vAlign, rect);
264     }
265
266     static Shape align(double hMargin, double vMargin, Alignment hAlign, Alignment vAlign, Rectangle2D rect) {
267         //System.out.println("align: " + hMargin + ", " + vMargin + ", " + hAlign + ", " + vAlign + ": " + rect);
268         double tx = align(hMargin, hAlign, rect.getMinX(), rect.getMaxX());
269         double ty = align(vMargin, vAlign, rect.getMinY(), rect.getMaxY());
270         //System.out.println("    translate: " + tx + " "  + ty);
271         double nw = rect.getWidth() + 2*hMargin;
272         double nh = rect.getHeight() + 2*vMargin;
273         return makePath(tx + rect.getMinX(), ty + rect.getMinY(), nw, nh);
274     }
275
276     static double align(double margin, Alignment align, double min, double max) {
277         double s = max - min;
278         switch (align) {
279             case LEADING:
280                 return -min;
281             case TRAILING:
282                 return -s - 2 * margin - min;
283             case CENTER:
284                 return -0.5 * s - margin - min;
285             default:
286                 return 0;
287         }
288     }
289
290     static Path2D makePath(double x, double y, double w, double h) {
291         Path2D path = new Path2D.Double();
292         path.moveTo(x, y);
293         path.lineTo(x+w, y);
294         path.lineTo(x+w, y+h);
295         path.lineTo(x, y+h);
296         path.closePath();
297         return path;
298     }
299
300     public static final Shape BOX_SHAPE = new Rectangle(-1, -1, 2, 2);
301
302     public static class SheetSGNode implements SceneGraph, InternalSize, Outline {
303         
304         private static final long serialVersionUID = -5823585015844593347L;
305
306         static final SheetSGNode INSTANCE = new SheetSGNode();
307
308         @Override
309         public void init(final IElement e, final G2DParentNode parent) {
310             // Create node if it doesn't exist yet
311             SheetNode node = (SheetNode)e.getHint(KEY_SG_NODE);
312             if(node == null || node.getBounds() == null || node.getParent() != parent) {
313                 node = parent.addNode(ElementUtils.generateNodeId(e), SheetNode.class);
314                 e.setHint(KEY_SG_NODE, node);
315                 Model model = e.getHint(KEY_MODEL);
316                 TableModel tableModel = e.getHint(KEY_TABLE_MODEL);
317                 node.init(model, tableModel);
318                 System.out.println(parent);
319                 node.setSize(500, 220);
320             }
321             update(e);
322         }
323
324         public void update(IElement e) {
325             
326 //            String value = null;
327
328             final Text t = e.getElementClass().getAtMostOneItemOfClass(Text.class);
329             assert(t != null);
330             String text = finalText(e);
331
332 //            System.out.println("monitorclass text = " + text);
333 //
334 //            if(text != null) {
335 //                Map<String, String> substitutions = e.getHint(KEY_MONITOR_SUBSTITUTIONS);
336 //                for(Map.Entry<String, String> entry : substitutions.entrySet()) {
337 //                   System.out.println("substitute " + entry.getKey() + " -> " + entry.getValue());
338 //                    text.replace(entry.getKey(), entry.getValue());
339 //                }
340 //            }
341 //            key = text;
342 //            if(substitutions != null) {
343 //                value = substitutions.get("#v1");
344 //                if(substitutions.containsKey("#u1")) {
345 //                    value += substitutions.get("#u1");
346 //                }
347 //            }
348
349 //            SheetNode node = (SheetNode) e.getHint(KEY_SG_NODE);
350 //            if (node != null && text != null) {
351 //                node.setText(text);
352 //                Collection<?> path = e.getHint(KEY_MONITOR_RESOURCE_PATH);
353 //                if (path != null && !path.isEmpty()) {
354 //                    node.setEditable(true);
355 //                } else {
356 //                    node.setEditable(false);
357 //                }
358 //            }
359             
360         }
361
362         @Override
363         public void cleanup(IElement e) {
364             SheetNode node = (SheetNode)e.removeHint(KEY_SG_NODE);
365             if (node != null)
366                 node.remove();
367         }
368
369         @Override
370         public Rectangle2D getBounds(IElement e, Rectangle2D size) {
371             Rectangle2D shape = new Rectangle2D.Double(0, 0, 0, 0);
372
373             SheetNode node = (SheetNode)e.getHint(KEY_SG_NODE);
374             if(node != null && node.getBounds() != null) {
375                 shape = node.getBounds().getBounds2D();
376             }
377
378             if(size != null) size.setRect(shape);
379             return shape;
380         }
381
382         @Override
383         public Shape getElementShape(IElement e) {
384             Shape shape = new Rectangle2D.Double(0, 0, 0, 0);
385
386             SheetNode node = (SheetNode)e.getHint(KEY_SG_NODE);
387             if(node != null && node.getBounds() != null) {
388                 shape = node.getBounds();
389             }
390
391             return shape;
392         }
393
394     }
395
396     public static class Transformer implements Transform, Move, Rotate, Scale {
397
398         private static final long serialVersionUID = -3704887325602085677L;
399
400         public static final Transformer INSTANCE = new Transformer(null);
401
402         Double aspectRatio;
403
404         public Transformer() {
405             this(null);
406         }
407
408         public Transformer(Double aspectRatio) {
409             this.aspectRatio = aspectRatio;
410         }
411
412         @Override
413         public Double getFixedAspectRatio(IElement e) {
414             return aspectRatio;
415         }
416
417         @Override
418         public Point2D getScale(IElement e) {
419             AffineTransform at = e.getHint(ElementHints.KEY_TRANSFORM);
420             return _getScale(at);
421         }
422
423         @Override
424         public void setScale(IElement e, Point2D newScale) {
425             // Doesn't work for monitors.
426             Point2D oldScale = getScale(e);
427             double sx = newScale.getX() / oldScale.getX();
428             double sy = newScale.getY() / oldScale.getY();
429             AffineTransform at = e.getHint(ElementHints.KEY_TRANSFORM);
430             at = new AffineTransform(at);
431             at.scale(sx, sy);
432             e.setHint(ElementHints.KEY_TRANSFORM, at);
433         }
434
435         @Override
436         public Point2D getMaximumScale(IElement e) {
437             return null;
438         }
439
440         @Override
441         public Point2D getMinimumScale(IElement e) {
442             return null;
443         }
444
445         private static Point2D _getScale(AffineTransform at) {
446             double m00 = at.getScaleX();
447             double m11 = at.getScaleY();
448             double m10 = at.getShearY();
449             double m01 = at.getShearX();
450             // Project unit vector to canvas
451             double sx = Math.sqrt(m00 * m00 + m10 * m10);
452             double sy = Math.sqrt(m01 * m01 + m11 * m11);
453             return new Point2D.Double(sx, sy);
454         }
455
456         @Override
457         public void rotate(IElement e, double theta, Point2D origin) {
458             if (Double.isNaN(theta)) return;
459             theta = Math.toDegrees(theta);
460             Double angle = e.getHint(KEY_DIRECTION);
461             double newAngle = angle != null ? angle+theta : theta;
462             newAngle = Math.IEEEremainder(newAngle, 360.0);
463             e.setHint(KEY_DIRECTION, newAngle);
464         }
465
466         @Override
467         public double getAngle(IElement e) {
468             Double angle = e.getHint(KEY_DIRECTION);
469             return angle != null ? Math.toRadians(angle) : 0;
470         }
471
472         @Override
473         public Point2D getPosition(IElement e) {
474             AffineTransform at = e.getHint(ElementHints.KEY_TRANSFORM);
475             Point2D p = new Point2D.Double(at.getTranslateX(), at.getTranslateY());
476             return p;
477         }
478
479         @Override
480         public void moveTo(IElement e, double x, double y) {
481             AffineTransform origAt = e.getHint(ElementHints.KEY_TRANSFORM);
482             double oldX = origAt.getTranslateX();
483             double oldY = origAt.getTranslateY();
484             AffineTransform move = AffineTransform.getTranslateInstance(x-oldX, y-oldY);
485             AffineTransform at2 = new AffineTransform(origAt);
486             at2.preConcatenate(move);
487             e.setHint(ElementHints.KEY_TRANSFORM, at2);
488         }
489
490         @Override
491         public AffineTransform getTransform(IElement e) {
492             AffineTransform at = e.getHint(ElementHints.KEY_TRANSFORM);
493
494             IElement parentElement = e.getHint(ElementHints.KEY_PARENT_ELEMENT);
495             if (parentElement == null)
496                 return at;
497
498             Transform parentTransform = parentElement.getElementClass().getSingleItem(Transform.class);
499             assert(parentTransform!=null);
500
501             AffineTransform result = (AffineTransform)at.clone();
502             result.preConcatenate(parentTransform.getTransform(parentElement));
503
504             return result;
505         }
506
507         @Override
508         public void setTransform(IElement e, AffineTransform at) {
509             e.setHint(ElementHints.KEY_TRANSFORM, at.clone());
510         }
511
512 //        @Override
513 //        public void onElementActivated(IDiagram d, IElement e) {
514 //        }
515 //
516 //        @Override
517 //        public void onElementCreated(IElement e) {
518 //            e.setHint(ElementHints.KEY_TRANSFORM, new AffineTransform());
519 //        }
520 //
521 //        @Override
522 //        public void onElementDeactivated(IDiagram d, IElement e) {
523 //        }
524 //
525 //        @Override
526 //        public void onElementDestroyed(IElement e) {
527 //                      List<SceneGraph> nodeHandlers = e.getElementClass().getItemsByClass(SceneGraph.class);
528 //                      for(SceneGraph n : nodeHandlers) {
529 //                              System.out.println("element gone:"+e);
530 //                              n.cleanup(e);
531 //                      }
532 //        }
533     }
534
535     static class MonitorImageFactory implements IFactory<Image> {
536
537         @Override
538         public Image get() throws ProvisionException {
539             return new AbstractImage() {
540                 Shape path = align(DEFAULT_HORIZONTAL_MARGIN, DEFAULT_VERTICAL_MARGIN, DEFAULT_HORIZONTAL_ALIGN, DEFAULT_VERTICAL_ALIGN,
541                         new Rectangle2D.Double(0, 0, 50, 22));
542
543                 @Override
544                 public Rectangle2D getBounds() {
545                     return path.getBounds2D();
546                 }
547
548                 @Override
549                 public EnumSet<Feature> getFeatures() {
550                     return EnumSet.of(Feature.Vector);
551                 }
552
553                 @Override
554                 public Shape getOutline() {
555                     return path;
556                 }
557
558                 @Override
559                 public Node init(G2DParentNode parent) {
560                     SheetNode node = parent.getOrCreateNode(""+hashCode(), SheetNode.class);
561 //                    node.setText("");
562 //                    node.setSize(50, 22);
563                     node.setTransform(new AffineTransform());
564                     return node;
565                 }
566             };
567         }
568     }
569
570     static final IProvider<Image> MONITOR_IMAGE =
571         ProviderUtils.reference(
572                 ProviderUtils.cache(
573                         ProviderUtils.rasterize(
574                                 new MonitorImageFactory()
575                         )));
576
577     static final StaticSymbol MONITOR_SYMBOL = new StaticSymbolImpl( MONITOR_IMAGE.get() );
578
579     static final FillColor FILL_COLOR = new FillColorImpl(DEFAULT_FILL_COLOR);
580
581     public static final ElementClass MONITOR_CLASS =
582         ElementClass.compile(
583                 MonitorHandlerImpl.INSTANCE,
584                 Transformer.INSTANCE,
585                 BorderColorImpl.BLACK,
586                 FILL_COLOR,
587                 SheetSGNode.INSTANCE,
588                 TextImpl.INSTANCE,
589                 TextEditorImpl.INSTANCE,
590                 SimpleElementLayers.INSTANCE,
591                 MONITOR_SYMBOL
592         );
593
594     // staticScale{X,Y} define the scale of the static monitor image
595     public static ElementClass create(IElement parentElement, Map<String, String> substitutions, Collection<Object> path, double staticScaleX, double staticScaleY, ElementHandler... extraHandlers) {
596         // Bit of a hack to be able to define the scale
597         IProvider<Image> staticMonitorSymbolProvider = ProviderUtils.reference(
598                 ProviderUtils.cache(
599                         ProviderUtils
600                         .rasterize(
601                                 new MonitorImageFactory())));
602         StaticSymbol staticMonitorSymbol = new StaticSymbolImpl( staticMonitorSymbolProvider.get() );
603         return ElementClass.compile(
604                 new Initializer(parentElement, substitutions, path, parentElement != null ? false : true),
605                 MonitorHandlerImpl.INSTANCE,
606                 Transformer.INSTANCE,
607                 BorderColorImpl.BLACK,
608                 FILL_COLOR,
609                 SheetSGNode.INSTANCE,
610                 TextImpl.INSTANCE,
611                 TextEditorImpl.INSTANCE,
612                 SimpleElementLayers.INSTANCE,
613                 staticMonitorSymbol
614         ).newClassWith(extraHandlers);
615     }
616
617 }