@Override
 public void doActivate() {
   super.doActivate();
   final Procedure1<Text> _function =
       (Text it) -> {
         String _name = this.getName();
         it.setText(_name);
         TooltipExtensions.setTooltip(it, "Zoom to reveal content");
       };
   ObjectExtensions.<Text>operator_doubleArrow(this.label, _function);
   boolean _equals = Objects.equal(this.innerDiagram, null);
   if (_equals) {
     String _name = this.getName();
     String _plus = ("No inner diagram set on node " + _name);
     String _plus_1 = (_plus + ". LOD behavior deactivated");
     LevelOfDetailDiagramNode.LOG.severe(_plus_1);
   } else {
     XDiagram _diagram = CoreExtensions.getDiagram(this);
     ViewportTransform _viewportTransform = _diagram.getViewportTransform();
     ReadOnlyDoubleProperty _scaleProperty = _viewportTransform.scaleProperty();
     final ChangeListener<Number> _function_1 =
         (ObservableValue<? extends Number> prop, Number oldVal, Number newVal) -> {
           Bounds _boundsInLocal = this.getBoundsInLocal();
           final Bounds bounds = this.localToScene(_boundsInLocal);
           double _width = bounds.getWidth();
           double _height = bounds.getHeight();
           final double area = (_width * _height);
           if ((area <= 100000)) {
             this.label.setVisible(true);
             this.innerDiagramGroup.setVisible(false);
             this.pane.setBackgroundPaint(RectangleBorderPane.DEFAULT_BACKGROUND);
           } else {
             this.label.setVisible(false);
             this.innerDiagramGroup.setVisible(true);
             this.innerDiagram.activate();
             final Procedure1<DiagramScaler> _function_2 =
                 (DiagramScaler it) -> {
                   Bounds _layoutBounds = this.label.getLayoutBounds();
                   double _width_1 = _layoutBounds.getWidth();
                   double _plus_2 = (_width_1 + 40);
                   it.setWidth(_plus_2);
                   Bounds _layoutBounds_1 = this.label.getLayoutBounds();
                   double _height_1 = _layoutBounds_1.getHeight();
                   double _plus_3 = (_height_1 + 20);
                   it.setHeight(_plus_3);
                   it.activate();
                 };
             ObjectExtensions.<DiagramScaler>operator_doubleArrow(this.diagramScaler, _function_2);
             Paint _backgroundPaint = this.innerDiagram.getBackgroundPaint();
             this.pane.setBackgroundPaint(_backgroundPaint);
           }
         };
     _scaleProperty.addListener(_function_1);
   }
 }
예제 #2
0
 protected <T extends Object> void doRevealElement(
     final T element, final EntryCall<? super T> entryCall, final IEditorPart editor) {
   XDiagram _diagram = this.root.getDiagram();
   final InterpreterContext interpreterContext = new InterpreterContext(_diagram);
   entryCall.execute(element, this.configInterpreter, interpreterContext);
   CommandStack _commandStack = this.root.getCommandStack();
   interpreterContext.executeCommands(_commandStack);
   final IMappedElementDescriptor<T> descriptor = this.<T, Object>createMappedDescriptor(element);
   XDiagram _diagram_1 = interpreterContext.getDiagram();
   ObservableList<XNode> _nodes = _diagram_1.getNodes();
   XDiagram _diagram_2 = interpreterContext.getDiagram();
   ObservableList<XConnection> _connections = _diagram_2.getConnections();
   Iterable<XDomainObjectShape> _plus = Iterables.<XDomainObjectShape>concat(_nodes, _connections);
   final Function1<XDomainObjectShape, Boolean> _function =
       (XDomainObjectShape it) -> {
         DomainObjectDescriptor _domainObjectDescriptor = it.getDomainObjectDescriptor();
         return Boolean.valueOf(Objects.equal(_domainObjectDescriptor, descriptor));
       };
   final XDomainObjectShape centerShape =
       IterableExtensions.<XDomainObjectShape>findFirst(_plus, _function);
   CommandStack _commandStack_1 = this.root.getCommandStack();
   ParallelAnimationCommand _parallelAnimationCommand = new ParallelAnimationCommand();
   final Procedure1<ParallelAnimationCommand> _function_1 =
       (ParallelAnimationCommand it) -> {
         boolean _needsLayoutCommand = interpreterContext.needsLayoutCommand();
         if (_needsLayoutCommand) {
           Layouter _layouter = new Layouter();
           XDiagram _diagram_3 = interpreterContext.getDiagram();
           Duration _millis = DurationExtensions.millis(500);
           LazyCommand _createLayoutCommand =
               _layouter.createLayoutCommand(LayoutType.DOT, _diagram_3, _millis, centerShape);
           it.operator_add(_createLayoutCommand);
         }
         final Function1<XShape, Boolean> _function_2 =
             (XShape it_1) -> {
               return Boolean.valueOf(Objects.equal(it_1, centerShape));
             };
         SelectAndRevealCommand _selectAndRevealCommand =
             new SelectAndRevealCommand(this.root, _function_2);
         it.operator_add(_selectAndRevealCommand);
       };
   ParallelAnimationCommand _doubleArrow =
       ObjectExtensions.<ParallelAnimationCommand>operator_doubleArrow(
           _parallelAnimationCommand, _function_1);
   _commandStack_1.execute(_doubleArrow);
 }
예제 #3
0
 protected void refreshUpdateState() {
   XDiagram _diagram = this.root.getDiagram();
   final ReconcileBehavior behavior =
       _diagram.<ReconcileBehavior>getBehavior(ReconcileBehavior.class);
   boolean _notEquals = (!Objects.equal(behavior, null));
   if (_notEquals) {
     this.refreshDirtyState(behavior);
   }
   final ArrayList<XShape> allShapes = CollectionLiterals.<XShape>newArrayList();
   XDiagram _diagram_1 = this.root.getDiagram();
   ObservableList<XNode> _nodes = _diagram_1.getNodes();
   Iterables.<XShape>addAll(allShapes, _nodes);
   XDiagram _diagram_2 = this.root.getDiagram();
   ObservableList<XConnection> _connections = _diagram_2.getConnections();
   Iterables.<XShape>addAll(allShapes, _connections);
   final Consumer<XShape> _function =
       (XShape it) -> {
         ReconcileBehavior _behavior = it.<ReconcileBehavior>getBehavior(ReconcileBehavior.class);
         if (_behavior != null) {
           this.refreshDirtyState(_behavior);
         }
       };
   allShapes.forEach(_function);
 }
 public <T extends Object, U extends Object> XDiagram createDiagram(
     final T diagramObject,
     final DiagramMapping<T> diagramMapping,
     final boolean isOnDemand,
     final InterpreterContext context) {
   XDiagram _xblockexpression = null;
   {
     boolean _isApplicable = diagramMapping.isApplicable(diagramObject);
     boolean _not = (!_isApplicable);
     if (_not) {
       return null;
     }
     final IMappedElementDescriptor<T> descriptor =
         this.<T>getDescriptor(diagramObject, diagramMapping);
     boolean _equals = Objects.equal(descriptor, null);
     if (_equals) {
       return null;
     }
     XDiagram _diagram = context.getDiagram();
     DomainObjectDescriptor _domainObjectDescriptor = _diagram.getDomainObjectDescriptor();
     final boolean replaceDiagram = (!Objects.equal(_domainObjectDescriptor, descriptor));
     context.setIsReplaceRootDiagram(replaceDiagram);
     XDiagram _xifexpression = null;
     if (replaceDiagram) {
       _xifexpression = diagramMapping.createDiagram(descriptor);
     } else {
       _xifexpression = context.getDiagram();
     }
     final XDiagram diagram = _xifexpression;
     InterpreterContext _xifexpression_1 = null;
     if (replaceDiagram) {
       _xifexpression_1 = new InterpreterContext(diagram, context);
     } else {
       _xifexpression_1 = context;
     }
     final InterpreterContext newContext = _xifexpression_1;
     if (isOnDemand) {
       diagram.setLayoutOnActivate(true);
       final Procedure1<XDiagram> _function =
           (XDiagram it) -> {
             final Function1<T, Object> _function_1 =
                 (T domainObject) -> {
                   Object _xblockexpression_1 = null;
                   {
                     this.<T>populateDiagram(diagramMapping, domainObject, newContext);
                     newContext.directlyApplyChanges();
                     XRoot _root = CoreExtensions.getRoot(diagram);
                     final CommandStack commandStack = _root.getCommandStack();
                     newContext.executeCommands(commandStack);
                     _xblockexpression_1 = null;
                   }
                   return _xblockexpression_1;
                 };
             descriptor.<Object>withDomainObject(_function_1);
           };
       diagram.setContentsInitializer(_function);
     } else {
       this.<T>populateDiagram(diagramMapping, diagramObject, newContext);
     }
     _xblockexpression = diagram;
   }
   return _xblockexpression;
 }