@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);
   }
 }
Example #2
0
 public <T extends Object> void revealElement(
     final T element, final EntryCall<? super T> entryCall, final IEditorPart editor) {
   final Runnable _function =
       () -> {
         try {
           Scene _scene = this.canvas.getScene();
           double _width = _scene.getWidth();
           boolean _equals = (_width == 0);
           if (_equals) {
             Scene _scene_1 = this.canvas.getScene();
             ReadOnlyDoubleProperty _widthProperty = _scene_1.widthProperty();
             final ChangeListener<Number> _function_1 =
                 new ChangeListener<Number>() {
                   @Override
                   public void changed(
                       final ObservableValue<? extends Number> p, final Number o, final Number n) {
                     Scene _scene = FXDiagramTab.this.canvas.getScene();
                     ReadOnlyDoubleProperty _widthProperty = _scene.widthProperty();
                     _widthProperty.removeListener(this);
                     FXDiagramTab.this.<T>revealElement(element, entryCall, editor);
                   }
                 };
             _widthProperty.addListener(_function_1);
           } else {
             Scene _scene_2 = this.canvas.getScene();
             double _height = _scene_2.getHeight();
             boolean _equals_1 = (_height == 0);
             if (_equals_1) {
               Scene _scene_3 = this.canvas.getScene();
               ReadOnlyDoubleProperty _heightProperty = _scene_3.heightProperty();
               final ChangeListener<Number> _function_2 =
                   new ChangeListener<Number>() {
                     @Override
                     public void changed(
                         final ObservableValue<? extends Number> p,
                         final Number o,
                         final Number n) {
                       Scene _scene = FXDiagramTab.this.canvas.getScene();
                       ReadOnlyDoubleProperty _heightProperty = _scene.heightProperty();
                       _heightProperty.removeListener(this);
                       FXDiagramTab.this.<T>revealElement(element, entryCall, editor);
                     }
                   };
               _heightProperty.addListener(_function_2);
             } else {
               this.<T>doRevealElement(element, entryCall, editor);
             }
           }
         } catch (final Throwable _t) {
           if (_t instanceof Exception) {
             final Exception exc = (Exception) _t;
             exc.printStackTrace();
             Display _current = Display.getCurrent();
             Shell _activeShell = _current.getActiveShell();
             StringConcatenation _builder = new StringConcatenation();
             _builder.append("Error showing element in FXDiagram:");
             _builder.newLine();
             String _message = exc.getMessage();
             _builder.append(_message, "");
             _builder.newLineIfNotEmpty();
             _builder.append("See log for details.");
             _builder.newLine();
             MessageDialog.openError(_activeShell, "Error", _builder.toString());
           } else {
             throw Exceptions.sneakyThrow(_t);
           }
         }
       };
   Platform.runLater(_function);
 }