private void addWorkflowAnimation(String workflowClass, String workflowInstanceId, long time) {
    Optional<AnimationPartBase> animationOpt =
        searchAnimationRunningAt(workflowInstanceId, time, time + DEFAULT_TOTAL_ANNIMATION_TIME);
    if (animationOpt.isPresent()) {
      animationOpt.get().endTime = time + DEFAULT_TOTAL_ANNIMATION_TIME;
    } else {
      Optional<Double> ypos =
          getFreeYslot(
              time,
              time + DEFAULT_TOTAL_ANNIMATION_TIME,
              EventAnimationBase.EVENT_HEIGHT + 15 + 35,
              false,
              Arrays.<Class<? extends AnimationPartBase>>asList(WorkflowAnimation.class));
      if (ypos.isPresent()) {
        double xpos =
            animationPane.getWidth() / 2
                - animationPane.getWidth() / 4
                - WorkflowAnimation.WIDTH / 2;

        animations.add(
            new WorkflowAnimation(
                workflowClass,
                new AnimationPartParameter(
                    time,
                    time + DEFAULT_TOTAL_ANNIMATION_TIME,
                    workflowInstanceId,
                    xpos,
                    ypos.get(),
                    xpos,
                    ypos.get())));
      }
    }
  }
  private void addAdapterAnimation(String adapterName, long time) {
    Optional<AnimationPartBase> animationOpt =
        searchAnimationRunningAt(adapterName, time, time + DEFAULT_TOTAL_ANNIMATION_TIME);
    if (animationOpt.isPresent()) {
      animationOpt.get().endTime = time + DEFAULT_TOTAL_ANNIMATION_TIME;
    } else {
      Optional<Double> ypos =
          getFreeYslot(
              time,
              time + DEFAULT_TOTAL_ANNIMATION_TIME,
              AdapterAnimation.ADAPTER_HEIGHT + 20,
              false,
              Arrays.<Class<? extends AnimationPartBase>>asList(AdapterAnimation.class));
      if (ypos.isPresent()) {
        double xpos = animationPane.getWidth() / 2 - AdapterAnimation.ADAPTER_WIDTH / 2;

        animations.add(
            new AdapterAnimation(
                new AnimationPartParameter(
                    time,
                    time + DEFAULT_TOTAL_ANNIMATION_TIME,
                    adapterName,
                    xpos,
                    ypos.get(),
                    xpos,
                    ypos.get())));
      }
    }
  }
Esempio n. 3
0
  @Override
  public Object eval(Environment env) {

    Sprite sprite = env.getSprite();
    Bounds spriteBounds = sprite.getBoundsInLocal();
    Pane parent = (AnchorPane) sprite.getParent();

    // x軸への動きしか想定しない
    double rCollision =
        parent.getWidth() - sprite.getTranslateX() - env.getX() - spriteBounds.getWidth();
    double lCollision = sprite.getTranslateX() + env.getX();

    if (rCollision < 0 || lCollision < 0) {
      return TRUE;
    }

    return FALSE;
  }
  public void registerLayer(Class<? extends Layer> clazz, Layer layer, Node layerNode) {
    layers.put(clazz, layer);

    if (layerNode != null) {
      pane.getChildren().add(layerNode);
      layerNode.toFront();

      hvalueProperty()
          .addListener(
              (ov, n, o) ->
                  layerNode
                      .translateXProperty()
                      .set(o.doubleValue() * (pane.getWidth() - getViewportBounds().getWidth())));
      vvalueProperty()
          .addListener(
              (ov, n, o) ->
                  layerNode
                      .translateYProperty()
                      .set(o.doubleValue() * (pane.getHeight() - getViewportBounds().getHeight())));
    }
  }
Esempio n. 5
0
  @Override // Override the start method in the Application class
  public void start(Stage primaryStage) throws Exception {
    Text text = new Text(20.0, 20.0, "JavaFx Programming");

    ScrollBar sbHorizontal = new ScrollBar();
    ScrollBar sbVertical = new ScrollBar();
    sbVertical.setOrientation(Orientation.VERTICAL);

    // Create a text in a pane
    Pane paneForText = new Pane();
    paneForText.getChildren().addAll(text);

    // Create a border pane to hold text and scroll bars
    BorderPane pane = new BorderPane();
    pane.setCenter(paneForText);
    pane.setRight(sbVertical);
    pane.setBottom(sbHorizontal);

    // Listener for horizontal scroll bar value change
    sbHorizontal
        .valueProperty()
        .addListener(
            observable -> {
              text.setX(sbHorizontal.getValue() * paneForText.getWidth() / sbHorizontal.getMax());
            });

    // Listener for vertical scroll bar value change
    sbVertical
        .valueProperty()
        .addListener(
            observable -> {
              text.setY(sbVertical.getValue() * paneForText.getHeight() / sbVertical.getMax());
            });

    // Create a scene and place it in the stage
    Scene scene = new Scene(pane, 450.0, 170.0);
    primaryStage.setTitle("ScrollBarDemo"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage
  }
Esempio n. 6
0
  /** initialize secondary structure view items */
  private void initSecondaryView() {
    // clear the secondary structure pane on initialization
    pane2D.getChildren().clear();

    if (view2DController.getGraph2d() != null) {
      pane2D.widthProperty().removeListener(view2DController.getWidthChangeListener());
      pane2D.heightProperty().removeListener(view2DController.getHeightChangeListener());
    }

    view2DController.initGraph2d(
        rnaSequence3D.extractString(),
        rnaSequence3D.getNucleotides().size(),
        rnaSequence3D.computeWCBonds(),
        (int) pane2D.getWidth(),
        (int) pane2D.getHeight());

    listenOnPane2dResize();
    view2DController.setScaleBinding(pane2D.widthProperty(), pane2D.heightProperty());

    view2DController.getGraph2d().setSelectionModel(selectionModel);
    pane2D.getChildren().add(view2DController.getGraph2d());
  }
 private double getAnimationPaneWidth() {
   return animationPane.getWidth();
 }
Esempio n. 8
0
  @SuppressWarnings("deprecation")
  @Override
  public void start(Stage primaryStage) {

    try {

      FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("SubmissionsSystem.fxml"));

      AnchorPane page = (AnchorPane) fxmlLoader.load();
      Scene scene = new Scene(page);
      primaryStage.setScene(scene);
      primaryStage.setTitle("Submissions System - Diploma Project");
      primaryStage.show();

      System.out.println(counterW);
      System.out.println(counterH);

      SubmissionsSystem controller = fxmlLoader.getController();
      Pane codePane = controller.getCodeText();
      SwingNode swingNode = new SwingNode();
      JPanel cp = new JPanel(new GridBagLayout());
      setCodePane(
          swingNode, cp, (int) (codePane.getWidth() / 10), (int) (codePane.getHeight() / 10));
      codePane.getChildren().add(swingNode);

      codePane
          .widthProperty()
          .addListener(
              new ChangeListener<Number>() {
                @Override
                public void changed(
                    ObservableValue<? extends Number> observable,
                    Number oldValue,
                    Number newValue) {
                  codePane.getChildren().clear();
                  SwingNode swingNode = new SwingNode();
                  JPanel cp = new JPanel(new GridBagLayout());
                  RSyntaxTextArea textArea =
                      new RSyntaxTextArea(newValue.intValue() / 10, 45); // 32,45
                  textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
                  textArea.setCodeFoldingEnabled(true);
                  textArea.setAntiAliasingEnabled(true);
                  textArea.doLayout();
                  RTextScrollPane sp = new RTextScrollPane(textArea);
                  sp.setFoldIndicatorEnabled(true);
                  cp.add(sp);

                  swingNode.setContent(cp);
                }
              });
      //            codePane.heightProperty().addListener(new ChangeListener<Number>() {
      //                @Override
      //                public void changed(ObservableValue<? extends Number> observable, Number
      // oldValue, Number newValue) {
      //                	codePane.getChildren().remove(swingNode);
      //                	cp.removeAll();
      //                	//setCodePane(swingNode, cp, (int)(codePane.getWidth())/10,
      // newValue.intValue()/10);
      //                	//codePane.getChildren().add(swingNode);
      //                	//System.out.println(counterH++);
      //                }
      //            });

    } catch (Exception ex) {
      Logger.getLogger(JavaFXMain.class.getName()).log(Level.SEVERE, null, ex);
    }

    /*
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Open Resource File");
    fileChooser.getExtensionFilters().addAll(
            new ExtensionFilter("Text Files", "*.txt"),
            new ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif"),
            new ExtensionFilter("Audio Files", "*.wav", "*.mp3", "*.aac"),
            new ExtensionFilter("All Files", "*.*"));
    File selectedFile = fileChooser.showOpenDialog(primaryStage);
    if (selectedFile != null) {
    	try {
    		Desktop desktop = Desktop.getDesktop();
         desktop.open(file);
     } catch (IOException ex) {

     }
    }
    */

  }