Ejemplo n.º 1
0
  public static void startValueSetAnimation(final Pane parent) {
    final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle();
    Insets margin = BorderPane.getMargin(parent);
    if (margin == null) {
      margin = new Insets(0);
    }
    rectangle
        .widthProperty()
        .bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight()));
    rectangle
        .heightProperty()
        .bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom()));
    rectangle.setFill(Color.rgb(0, 150, 201));
    parent.getChildren().add(rectangle);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);
    rectangle.setEffect(bb);

    FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle);
    ft.setFromValue(0.2);
    ft.setToValue(0.8);
    ft.setCycleCount(2);
    ft.setAutoReverse(true);
    ft.play();
    ft.setOnFinished(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            parent.getChildren().remove(rectangle);
          }
        });
  }
Ejemplo n.º 2
0
  public Grid(final int rowNo, final int columnNo, final Pane container) {
    super();
    this.container = container;

    this.columnNumber = columnNo;
    this.rowNumber = rowNo;

    container
        .widthProperty()
        .addListener(
            new ChangeListener<Number>() {

              public void changed(
                  ObservableValue<? extends Number> observableValue,
                  Number number,
                  Number widthNo) {
                recalculateMinoSize();
              }
            });

    container
        .heightProperty()
        .addListener(
            new ChangeListener<Number>() {

              public void changed(
                  ObservableValue<? extends Number> observableValue,
                  Number number,
                  Number heightNo) {
                recalculateMinoSize();
              }
            });

    recalculateMinoSize();
  }
Ejemplo n.º 3
0
  private Pane buildUpperArea() {

    Pane up = new Pane();
    up.prefHeightProperty().bind(this.heightProperty());
    up.prefWidthProperty().bind(this.widthProperty());

    TableView<DebateDetails> table = new TableView<DebateDetails>();
    table.prefHeightProperty().bind(up.heightProperty());
    table.prefWidthProperty().bind(up.widthProperty());

    final Label label = new Label("Debate Tournament");
    label.setFont(new Font("Arial", 20));

    table.setEditable(false);

    table.getChildrenUnmodifiable().clear();
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<DebateDetails, String> divCol = new TableColumn<DebateDetails, String>("Division");
    divCol.setCellValueFactory(new PropertyValueFactory<>("division"));

    TableColumn<DebateDetails, String> teamCountCol =
        new TableColumn<DebateDetails, String>("Team Count");
    teamCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("teamCount")));

    TableColumn<DebateDetails, String> debCountCol =
        new TableColumn<DebateDetails, String>("Debate Count");
    debCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("totalMatch")));

    TableColumn<DebateDetails, String> debCompCol =
        new TableColumn<DebateDetails, String>("Debates Completed ");
    debCompCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchCompleted")));

    TableColumn<DebateDetails, String> debRemCol =
        new TableColumn<DebateDetails, String>("Upcoming Debates");
    debRemCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchRemaining")));

    final ObservableList<DebateDetails> data =
        FXCollections.observableArrayList(TeamManager.getDebateDetails());

    table.setItems(data);
    table.getColumns().add(divCol);
    table.getColumns().add(teamCountCol);
    table.getColumns().add(debCountCol);
    table.getColumns().add(debCompCol);
    table.getColumns().add(debRemCol);

    final VBox vbox = new VBox();
    vbox.setSpacing(5);
    vbox.setPadding(new Insets(10, 0, 0, 10));
    vbox.getChildren().addAll(label, table);
    up.getChildren().add(vbox);

    return up;
  }
Ejemplo n.º 4
0
  public void setMode(Mode mode) {
    if (mode != this.mode) {
      Mode previousMode = this.mode;
      this.mode = mode;
      log.info(String.format("Dock mode is now %s", mode));
      switch (mode) {
        case LAUNCHERS:
          rebuildIcons();
          setAvailable();
          flinger.recentre();
          break;
        case UPDATE:
          try {
            // Starting an update, so hide the all other windows
            hideIfShowing(signInPopup);
            hideIfShowing(optionsPopup);
            hideIfShowing(resourceGroupPopup);
            setAvailable();
            updateScene =
                (Update)
                    context.openScene(
                        Update.class, Configuration.getDefault().isVertical() ? "Vertical" : null);
            Scene scn = updateScene.getScene();
            scn.setFill(new Color(0, 0, 0, 0));

            /*
             * The update popup will get future update events, but it
             * needs this one to initialize
             */
            updateScene.initUpdate(appsToUpdate, previousMode);

            Parent sceneRoot = scn.rootProperty().get();
            scn.setRoot(new Group());

            if (cfg.isVertical())
              ((VBox) sceneRoot).minWidthProperty().bind(shortcuts.heightProperty());
            else ((HBox) sceneRoot).minHeightProperty().bind(shortcuts.widthProperty());

            flinger.getContent().getChildren().clear();
            flinger.getContent().getChildren().add(sceneRoot);
          } catch (IOException ioe) {
            log.error("Failed to load update scene.", ioe);
          }
          break;
        case IDLE:
          flinger.getContent().getChildren().clear();
          setAvailable();
          break;
        default:
          throw new UnsupportedOperationException();
      }
    }
  }
Ejemplo n.º 5
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());
  }
Ejemplo n.º 6
0
  @Override
  public void start(Stage stage) {
    Pane p1 = this.getCSSStyledPane();
    Pane p2 = this.getObjectStyledPane();

    p1.setLayoutX(10);
    p1.setLayoutY(10);

    // Place p2 20px right to p1
    p2.layoutYProperty().bind(p1.layoutYProperty());
    p2.layoutXProperty().bind(p1.layoutXProperty().add(p1.widthProperty()).add(20));

    Pane root = new Pane(p1, p2);
    root.setPrefSize(240, 70);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Setting Background Fills for a Region");
    stage.show();
    stage.sizeToScene();
  }
Ejemplo n.º 7
0
  private void listenOnPane2dResize() {
    view2DController.initProperties();

    pane2D.widthProperty().addListener(view2DController.getWidthChangeListener());
    pane2D.heightProperty().addListener(view2DController.getHeightChangeListener());
  }
Ejemplo 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) {

     }
    }
    */

  }