Package javafx.scene

Examples of javafx.scene.Node


    /**
     * Do it.
     */
    public void sliceNode(final List<Node> nodes, final WaveBase wave) {
        final Node node = nodes.get(0);
        final long start = System.currentTimeMillis();

        if (node != null) {
            if (node instanceof ImageView) {
                this.imageProperty.set(((ImageView) node).getImage());
            } else {
                final WritableImage wi = node.snapshot(new SnapshotParameters(), null);
                this.imageProperty.set(wi);
            }
        }

        final double width = getImage().getWidth();
View Full Code Here


              .withEndTime(TestUtil.quickParseCalendarFromDateTime("2014-01-01T12:00:00.000"))
              .withAppointmentGroup(appointmentGroupMap.get("group01"))
            );
    });
       
    Node n = (Node)find("#RegularAppointmentPane1");
    //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.XYWH);
    new AssertNode(n).assertXYWH(0.5, 419.5, 125.0, 84.0, 0.01);
    //TestUtil.sleep(3000);
  }
View Full Code Here

              .withWholeDay(true)
            );
    });
     
    {
      Node n = (Node)find("#WholedayAppointmentPane1");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.XYWH);
      new AssertNode(n).assertXYWH(0.5, 0.0, 5.0, 1006.0, 0.01);
    }
    {
      Node n = (Node)find("#AppointmentHeaderPane1");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.XYWH);
      new AssertNode(n).assertXYWH(0.0, 23.94140625, 135.21763392857142, 20.9609375, 0.01);
    }
    //TestUtil.sleep(3000);
  }
View Full Code Here

              .withAppointmentGroup(appointmentGroupMap.get("group01"))
          );
    });
       
    {
      Node n = (Node)find("#RegularAppointmentPane1");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.A.XYWH);
      new AssertNode(n).assertXYWH(0.5, 419.5, 110.0, 84.0, 0.01);
    }
    {
      Node n = (Node)find("#RegularAppointmentPane2");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.A.XYWH);
      new AssertNode(n).assertXYWH(62.5, 461.5, 63.0, 84.0, 0.01);
    }
    //TestUtil.sleep(3000);
  }
View Full Code Here

    Assert.assertEquals(1, agenda.appointments().size() );
    Assert.assertEquals(true, agenda.appointments().get(0).isWholeDay().booleanValue() );

    // this not only checks if the appointment was changed, but also if it was rerendered
    {
      Node n = (Node)find("#WholedayAppointmentPane1");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.XYWH);
      new AssertNode(n).assertXYWH(0.5, 0.0, 5.0, 1006.0, 0.01);
    }
    {
      Node n = (Node)find("#AppointmentHeaderPane1");
      //AssertNode.generateSource("n", n, null, false, jfxtras.test.AssertNode.A.XYWH);
      new AssertNode(n).assertXYWH(0.0, 23.94140625, 135.21763392857142, 20.9609375, 0.01);
    }
    //TestUtil.sleep(3000);
  }
View Full Code Here

                textField.setText( getSkinnable().getPrefix() + getSkinnable().getStringConverter().toString(lValue) + getSkinnable().getPostfix() );
            }
            else
            {
                // get node for this value
                Node lNode = getSkinnable().getCellFactory().call( getSkinnable() );
            }
  }
View Full Code Here

   
    // if not editable
    if (getSkinnable().isEditable() == false)
    {
      // use the cell factory
      Node lNode = getSkinnable().getCellFactory().call(getSkinnable());
      //lNode.setStyle("-fx-border-color: blue;");
      valueHolderNode.setCenter(lNode);
      if (lNode.getStyleClass().contains("value") == false) lNode.getStyleClass().add("value");
      if (lNode.getStyleClass().contains("readonly") == false) lNode.getStyleClass().add("readonly");
    }
    else
    {
      // use the textfield
      if (textField == null)
View Full Code Here

    }

    private void initMouseEventHandlers() {

        getSkinnable().onMousePressedProperty().set((EventHandler<MouseEvent>) (MouseEvent event) -> {
            final Node n = control;

            final double parentScaleX = n.getParent().
                    localToSceneTransformProperty().getValue().getMxx();
            final double parentScaleY = n.getParent().
                    localToSceneTransformProperty().getValue().getMyy();

            mouseX = event.getSceneX();
            mouseY = event.getSceneY();

            nodeX = n.getLayoutX() * parentScaleX;
            nodeY = n.getLayoutY() * parentScaleY;

            if (control.isMoveToFront()) {
                control.toFront();
            }
        });

        //Event Listener for MouseDragged
        getSkinnable().onMouseDraggedProperty().set((EventHandler<MouseEvent>) (MouseEvent event) -> {
            final Node n = control;

            final double parentScaleX = n.getParent().
                    localToSceneTransformProperty().getValue().getMxx();
            final double parentScaleY = n.getParent().
                    localToSceneTransformProperty().getValue().getMyy();

            final double scaleX = n.localToSceneTransformProperty().
                    getValue().getMxx();
            final double scaleY = n.localToSceneTransformProperty().
                    getValue().getMyy();

            Bounds boundsInScene =
                    control.localToScene(control.getBoundsInLocal());

            double sceneX = boundsInScene.getMinX();
            double sceneY = boundsInScene.getMinY();

            double offsetX = event.getSceneX() - mouseX;
            double offsetY = event.getSceneY() - mouseY;

            if (resizeMode == ResizeMode.NONE && control.isMovable()) {

                nodeX += offsetX;
                nodeY += offsetY;

                double scaledX = nodeX * 1 / parentScaleX;
                double scaledY = nodeY * 1 / parentScaleY;

                double offsetForAllX = scaledX - n.getLayoutX();
                double offsetForAllY = scaledY - n.getLayoutY();

                n.setLayoutX(scaledX);
                n.setLayoutY(scaledY);

                dragging = true;


            } else {

                double width = n.getBoundsInLocal().getMaxX()
                        - n.getBoundsInLocal().getMinX();
                double height = n.getBoundsInLocal().getMaxY()
                        - n.getBoundsInLocal().getMinY();

                if (RESIZE_TOP) {
//                        System.out.println("TOP");

                    double insetOffset = getSkinnable().getInsets().getTop() / 2;

                    double yDiff =
                            sceneY / parentScaleY
                            + insetOffset
                            - event.getSceneY() / parentScaleY;

                    double newHeight = control.getPrefHeight() + yDiff;

                    if (newHeight > control.minHeight(0)) {
                        control.setLayoutY(control.getLayoutY() - yDiff);
                        control.setPrefHeight(newHeight);
                    }
                }
                if (RESIZE_LEFT) {
//                        System.out.println("LEFT");

                    double insetOffset = getSkinnable().getInsets().getLeft() / 2;

                    double xDiff = sceneX / parentScaleX
                            + insetOffset
                            - event.getSceneX() / parentScaleX;

                    double newWidth = control.getPrefWidth() + xDiff;

                    if (newWidth > Math.max(control.minWidth(0),
                            control.getContentPane().minWidth(0))) {
                        control.setLayoutX(control.getLayoutX() - xDiff);
                        control.setPrefWidth(newWidth);
                    } else {
                        //
                    }
                }

                if (RESIZE_BOTTOM) {
//                        System.out.println("BOTTOM");

                    double insetOffset = getSkinnable().getInsets().getBottom() / 2;

                    double yDiff = event.getSceneY() / parentScaleY
                            - sceneY / parentScaleY - insetOffset;

                    double newHeight = yDiff;

                    newHeight = Math.max(
                            newHeight, control.minHeight(0));

                    if (newHeight < control.maxHeight(0)) {
                        control.setPrefHeight(newHeight);
                    }
                }
                if (RESIZE_RIGHT) {

                    double insetOffset = getSkinnable().getInsets().getRight() / 2;

                    double xDiff = event.getSceneX() / parentScaleX
                            - sceneX / parentScaleY - insetOffset;

                    double newWidth = xDiff;

                    newWidth = Math.max(
                            newWidth,
                            Math.max(control.getContentPane().minWidth(0),
                            control.minWidth(0)));

                    if (newWidth < control.maxWidth(0)) {
                        control.setPrefWidth(newWidth);
                    }
                }
            }

            mouseX = event.getSceneX();
            mouseY = event.getSceneY();
        });

        getSkinnable().onMouseClickedProperty().set((EventHandler<MouseEvent>) (MouseEvent event) -> {
            dragging = false;
        });

        getSkinnable().onMouseMovedProperty().set((EventHandler<MouseEvent>) (MouseEvent t) -> {
            if (control.isMinimized() || !control.isResizableWindow()) {

                RESIZE_TOP = false;
                RESIZE_LEFT = false;
                RESIZE_BOTTOM = false;
                RESIZE_RIGHT = false;

                resizeMode = ResizeMode.NONE;

                return;
            }

            final Node n = control;

            final double parentScaleX = n.getParent().localToSceneTransformProperty().getValue().getMxx();
            final double parentScaleY = n.getParent().localToSceneTransformProperty().getValue().getMyy();

            final double scaleX = n.localToSceneTransformProperty().getValue().getMxx();
            final double scaleY = n.localToSceneTransformProperty().getValue().getMyy();

            final double border = control.getResizableBorderWidth() * scaleX;

            double diffMinX = Math.abs(n.getLayoutBounds().getMinX() - t.getX() + getSkinnable().getInsets().getLeft());
            double diffMinY = Math.abs(n.getLayoutBounds().getMinY() - t.getY() + getSkinnable().getInsets().getTop());
            double diffMaxX = Math.abs(n.getLayoutBounds().getMaxX() - t.getX() - getSkinnable().getInsets().getRight());
            double diffMaxY = Math.abs(n.getLayoutBounds().getMaxY() - t.getY() - getSkinnable().getInsets().getBottom());

            boolean left = diffMinX * scaleX < Math.max(border, getSkinnable().getInsets().getLeft() / 2 * scaleX);
            boolean top = diffMinY * scaleY < Math.max(border, getSkinnable().getInsets().getTop() / 2 * scaleY);
            boolean right = diffMaxX * scaleX < Math.max(border, getSkinnable().getInsets().getRight() / 2 * scaleX);
            boolean bottom = diffMaxY * scaleY < Math.max(border, getSkinnable().getInsets().getBottom() / 2 * scaleY);

            RESIZE_TOP = false;
            RESIZE_LEFT = false;
            RESIZE_BOTTOM = false;
            RESIZE_RIGHT = false;

            if (left && !top && !bottom) {
                n.setCursor(Cursor.W_RESIZE);
                resizeMode = ResizeMode.LEFT;
                RESIZE_LEFT = true;
            } else if (left && top && !bottom) {
                n.setCursor(Cursor.NW_RESIZE);
                resizeMode = ResizeMode.TOP_LEFT;
                RESIZE_LEFT = true;
                RESIZE_TOP = true;
            } else if (left && !top && bottom) {
                n.setCursor(Cursor.SW_RESIZE);
                resizeMode = ResizeMode.BOTTOM_LEFT;
                RESIZE_LEFT = true;
                RESIZE_BOTTOM = true;
            } else if (right && !top && !bottom) {
                n.setCursor(Cursor.E_RESIZE);
                resizeMode = ResizeMode.RIGHT;
                RESIZE_RIGHT = true;
            } else if (right && top && !bottom) {
                n.setCursor(Cursor.NE_RESIZE);
                resizeMode = ResizeMode.TOP_RIGHT;
                RESIZE_RIGHT = true;
                RESIZE_TOP = true;
            } else if (right && !top && bottom) {
                n.setCursor(Cursor.SE_RESIZE);
                resizeMode = ResizeMode.BOTTOM_RIGHT;
                RESIZE_RIGHT = true;
                RESIZE_BOTTOM = true;
            } else if (top && !left && !right) {
                n.setCursor(Cursor.N_RESIZE);
                resizeMode = ResizeMode.TOP;
                RESIZE_TOP = true;
            } else if (bottom && !left && !right) {
                n.setCursor(Cursor.S_RESIZE);
                resizeMode = ResizeMode.BOTTOM;
                RESIZE_BOTTOM = true;
            } else {
                n.setCursor(Cursor.DEFAULT);
                resizeMode = ResizeMode.NONE;
            }

            control.autosize();
        });
View Full Code Here

         * componenti grafici nella classe passatagli che deve utilizzare le
         * annotazioni di InjectNode se desiderato.
         */
        Utility.log("INJECTOR load - resource: " + resource + " - toInject: " + toInject);

        Node node = null;
        T t = loadJFXUI(resource);

        /**
         * Recupero tutte le variabili.
         */
        Field[] fields = toInject.getClass().getDeclaredFields();
        if (fields != null) {
            for (Field f : fields) {
                try {

                    String __field_val_name = f.getName();

                    // Se l'annotazione e' presente allora faccio un lookup
                    // (ricerco il componente) e lo inietto nella classe
                    // passata come parametro.
                    if (f.isAnnotationPresent(InjectNode.class) && null != __field_val_name) {
                        if (node == null && t instanceof Node) {
                            node = (Node) t;
                        }

                        f.setAccessible(true);

                        // Ricerco il componente.
                        @SuppressWarnings("null")
                        Node n = node.lookup("#" + __field_val_name);

                        if (n != null) {
                            f.set(toInject, n);
                        } else {
View Full Code Here

                Tab tab = new Tab(RBLoader.ll(title));
                tab.setId(plugin.getId());
                tab.setClosable(false);

                Node node = plugin.getGuiEditor();

                // Se ha una grafica allora inserisco il tab.
                if (node != null) {
                    tab.setContent(node);
                    __tabbed.getTabs().add(tab);
View Full Code Here

TOP

Related Classes of javafx.scene.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.