@Override
  public void handlePerspective(
      final Message<Event, Object> action, final PerspectiveLayout perspectiveLayout) {
    if (action.messageBodyEquals(MessageUtil.INIT)) {

      perspectiveLayout.registerRootComponent(createRoot());
      GridPane.setVgrow(perspectiveLayout.getRootComponent(), Priority.ALWAYS);
      GridPane.setHgrow(perspectiveLayout.getRootComponent(), Priority.ALWAYS);

      // register left panel
      perspectiveLayout.registerTargetLayoutComponent("content0", this.content1);
      perspectiveLayout.registerTargetLayoutComponent("content1", this.content2);
      perspectiveLayout.registerTargetLayoutComponent("content2", this.content3);
      ApplicationLauncherPerspectiveMessaginTest.latch.countDown();
    } else {
      if (counter.get() > 1) {
        counter.decrementAndGet();
        context.send("id10", "message");
      } else {
        System.out.println("Perspective id12: FINISH");
        if (wait.getCount() > 0) wait.countDown();
        if (PerspectiveMessagingTestP1.wait.getCount() > 0) context.send("id10", "message");
      }
    }
  }
  @FXML
  void initialize() {
    getAllImageViewsForButtons();
    configureWidthHeightForImageViews();
    configureButtons();
    contentPane.setAlignment(Pos.CENTER);

    // show all customers and all employees
    titleLabel.setText("All Customers and All Employees");
    TableView table = new TableView();

    TableColumn fnCol = new TableColumn("First Name");
    fnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn lnCol = new TableColumn("Last Name");
    lnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn emailCol = new TableColumn("email");
    emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));

    table.getColumns().addAll(fnCol, lnCol, emailCol);

    ObservableList<Person> data =
        FXCollections.observableArrayList(operation.getAllCustomersAndEmployees());
    table.setItems(data);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    contentPane.getChildren().add(table);
  }
Example #3
0
 public static RadioButton addRadioButton(GridPane gridPane, int rowIndex, String title) {
   RadioButton radioButton = new RadioButton(title);
   GridPane.setRowIndex(radioButton, rowIndex);
   GridPane.setColumnIndex(radioButton, 1);
   gridPane.getChildren().add(radioButton);
   return radioButton;
 }
Example #4
0
 public void makeBoard(Cell[][] cells) {
   if (stageGridPane != null) {
     // Устанавливаем размер клетки
     stageGridPane.getColumnConstraints().add(new ColumnConstraints(10));
     stageGridPane.getRowConstraints().add(new RowConstraints(10));
     if (cells[0][0] == null) {
       fillCircuit();
     }
     // Заполняем массив клеток основного поля и выводим его на экран
     for (int i = 1; i < cells.length - 1; i++) {
       stageGridPane.addRow(i);
       for (int j = 1; j < cells[0].length - 1; j++) {
         stageGridPane.addColumn(j);
         Cell tempRect = new Cell(10, 10, Color.WHITE, i, j);
         if (cells[i][j] == null) {
           stageGridPane.add(cells[i][j] = tempRect, i, j);
         } else {
           if (cells[i][j].isRoad) {
             cells[i][j].setFill(Color.BLUE);
           }
         }
         cells[i][j].setStroke(Color.BLACK);
         cells[i][j].setOnMouseClicked(
             t -> {
               switch (CellType.getValue()) {
                 case "Wall":
                   if (tempRect.getFill() == Color.BLACK) {
                     tempRect.setFill(Color.WHITE);
                     tempRect.isBlocked = false;
                   } else {
                     tempRect.setFill(Color.BLACK);
                     tempRect.isBlocked = true;
                   }
                   break;
                 case "Start":
                   if (tempRect.getFill() == Color.GREEN) {
                     tempRect.setFill(Color.WHITE);
                     start = null;
                   } else if (start == null) {
                     tempRect.setFill(Color.GREEN);
                     start = tempRect;
                   }
                   break;
                 case "End":
                   if (tempRect.getFill() == Color.RED) {
                     tempRect.setFill(Color.WHITE);
                     finish = null;
                   } else if (finish == null) {
                     tempRect.setFill(Color.RED);
                     finish = tempRect;
                   }
                   break;
               }
             });
       }
     }
   } else {
     System.err.print("stageGridPane is null");
   }
 }
  @Override
  public void start(final Stage primaryStage) throws Exception {
    final int w = 200;
    final int l = 5;
    final int size = w / l;
    final GridPane g = new GridPane();
    g.setPrefSize(w, w);

    final TooltipBehavior behavior = new TooltipBehavior();
    // マウスが乗ってから0.1秒後に表示
    behavior.setOpenDuration(new Duration(100));
    // ずっと表示
    behavior.setHideDuration(Duration.INDEFINITE);
    // マウスが放れてから0.3秒後に非表示
    behavior.setLeftDuration(new Duration(300));

    for (int y = 0; y < l; y++) {
      for (int x = 0; x < l; x++) {
        final Rectangle r = createNode(size);
        g.add(r, x, y);

        // 色をツールチップで表示する
        final Tooltip tooltip = new Tooltip(r.getFill().toString());
        // インストール
        behavior.install(r, tooltip);

        // 普通の動作との違いが見てみたい人は↑をコメントにして
        // ↓をコメント解除してみてください
        // Tooltip.install(r,tooltip);
      }
    }

    primaryStage.setScene(new Scene(g));
    primaryStage.show();
  }
Example #6
0
  public void initSeats(int numSeats, int numColumns) {
    row = 0;
    columns = 0;
    countSeats = 0;

    SeatShape.columns = numColumns;
    gridPane.hgapProperty().unbind();
    gridPane.hgapProperty().bind(bus.widthProperty().divide(numColumns).divide(8));

    seatsList.clear();
    gridPane.getChildren().clear();

    while (columns < numColumns) {
      while (row < NUM_ROWS + 1) {
        if (countSeats < numSeats) {
          SeatShape seatsShape = new SeatShape(countSeats + 1, gridPane.hgapProperty(), bus);
          if (row != 2) {
            countSeats++;
            seatsList.add(seatsShape);
          } else {
            seatsShape.setVisible(false);
          }
          seatsShape.setOnMouseClicked(
              (MouseEvent evt) -> {
                ((SeatShape) evt.getSource()).toogle();
              });
          gridPane.add(seatsShape, columns, row);
        }

        row++;
      }
      row = 0;
      columns++;
    }
  }
  // Add new account form
  private void addNewAccount() {
    paymentAccountsListView.getSelectionModel().clearSelection();
    removeAccountRows();
    addAccountButton.setDisable(true);
    accountTitledGroupBg =
        addTitledGroupBg(root, ++gridRow, 1, "Create new account", Layout.GROUP_DISTANCE);

    if (paymentMethodForm != null) {
      FormBuilder.removeRowsFromGridPane(root, 3, paymentMethodForm.getGridRow() + 1);
      GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
    }
    gridRow = 2;
    paymentMethodForm = getPaymentMethodForm(PaymentMethod.BLOCK_CHAINS);
    if (paymentMethodForm != null) {
      paymentMethodForm.addFormForAddAccount();
      gridRow = paymentMethodForm.getGridRow();
      Tuple2<Button, Button> tuple2 =
          add2ButtonsAfterGroup(root, ++gridRow, "Save new account", "Cancel");
      saveNewAccountButton = tuple2.first;
      saveNewAccountButton.setOnAction(
          event -> onSaveNewAccount(paymentMethodForm.getPaymentAccount()));
      saveNewAccountButton.disableProperty().bind(paymentMethodForm.allInputsValidProperty().not());
      Button cancelButton = tuple2.second;
      cancelButton.setOnAction(event -> onCancelNewAccount());
      GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
    }
  }
 public FormPane() {
   setContent(grid);
   vbarPolicyProperty().set(ScrollBarPolicy.AS_NEEDED);
   setStyle("-fx-background-color:inherit;");
   grid.setHgap(5);
   grid.setVgap(5);
 }
Example #9
0
  private void clickc(int a) {
    double x = iv[a].getX();
    double y = iv[a].getY();
    double x1 = iv[ep].getX();
    double y1 = iv[ep].getY();
    gpane.getChildren().remove(iv[a]);
    gpane.getChildren().remove(iv[ep]);
    iv[a].setViewport(rct[ep]);
    String ab = iv[a].getId();

    iv[a].setId(iv[ep].getId());
    iv[ep].setViewport(rct[a]);
    iv[ep].setId(ab);
    gpane.getChildren().add(iv[ep]);
    iv[ep].setX(x);
    iv[ep].setY(y);
    gpane.getChildren().add(iv[a]);
    iv[a].setX(x1);
    iv[a].setY(y1);
    Rectangle2D rctTemp = new Rectangle2D(0, 0, 0, 0);
    rctTemp = rct[ep];
    rct[ep] = rct[a];
    rct[a] = rctTemp;
    ep = a;
  }
Example #10
0
 /** Sets the events for each label in the grid. */
 private void setEvents() {
   for (Label label : labels) {
     label.setOnMouseClicked(
         event -> {
           int index = gridPane.getRowIndex(label);
           chosenPlugin[0] = plugins.get(index).get(0);
           curIndex = index;
           chosenPlugin[1] = plugins.get(index).get(1);
           chosenPreview = preview.get(index).get(0);
           description = appData.get(index).get(1);
           goToNextScreen("/fxml/PluginInfo.fxml");
         });
   }
   for (ImageView image : iconsView) {
     image.setOnMouseClicked(
         event -> {
           int index = gridPane.getRowIndex(image);
           chosenPlugin[0] = plugins.get(index).get(0);
           curIndex = index;
           chosenPlugin[1] = plugins.get(index).get(1);
           chosenPreview = preview.get(index).get(0);
           description = appData.get(index).get(1);
           goToNextScreen("/fxml/PluginInfo.fxml");
         });
   }
 }
Example #11
0
  @Override
  protected BorderPane getPane() {

    BorderPane pane = new BorderPane();
    GridPane paneFullTime = new GridPane();

    paneFullTime.setAlignment(Pos.CENTER);
    paneFullTime.setPadding(new Insets(11, 12, 13, 14));
    paneFullTime.setHgap(5.5);
    paneFullTime.setVgap(5.5);

    paneFullTime.add(text, 0, 0);
    paneFullTime.add(tfSSN, 1, 0);

    paneFullTime.add(arrNonCreditChBox[0], 0, 2);
    paneFullTime.add(arrNonCreditChBox[1], 0, 3);
    paneFullTime.add(arrNonCreditChBox[2], 0, 4);
    paneFullTime.add(submitBt, 1, 5);

    pane.setCenter(paneFullTime);

    submitBt.setOnAction(
        e -> {
          checkingRequirements();
          connectToDB();
          submitToDB();
          pane.setCenter(new Congratulation().getPane());
        });
    return pane;
  }
Example #12
0
 private GridPane initContent() {
   GridPane pane = new GridPane();
   Canvas canvas = new Canvas(200, 200);
   pane.add(canvas, 0, 0);
   this.drawShapes(canvas.getGraphicsContext2D());
   return pane;
 }
  @Test
  public void testImageInsertion() throws Exception {
    imageProvider.addImage(new ImageData("test", "/de/ks/images/keymap.jpg"));

    InsertImage command = adocEditor.getCommand(InsertImage.class);
    command.collectImages();
    SelectImageController selectImageController = command.getSelectImageController();
    for (Future<?> future : selectImageController.getLoadingFutures()) {
      future.get();
    }
    activityController.waitForTasks();
    FXPlatform.waitForFX();
    assertEquals(1, selectImageController.getImagePane().getChildren().size());

    FXPlatform.invokeLater(
        () -> {
          GridPane grid =
              (GridPane) command.getSelectImageController().getImagePane().getChildren().get(0);
          Button node = (Button) grid.getChildren().get(0);
          node.getOnAction().handle(null);
        });

    assertThat(
        adocEditor.editor.getText(),
        Matchers.containsString("image::file:////de/ks/images/keymap.jpg"));
  }
Example #14
0
  private void updateChildren(boolean useButtons) {
    hboxLayout.getChildren().clear();
    hboxLayout.getChildren().addAll(createChildren(useButtons));

    vboxLayout.getChildren().clear();
    vboxLayout.getChildren().addAll(createChildren(useButtons));

    flowLayout.getChildren().clear();
    flowLayout.getChildren().addAll(createChildren(useButtons));

    List<Node> contents1 = createChildren(useButtons);
    gridLayout.getChildren().clear();
    gridLayout.add(contents1.get(0), 0, 0);
    gridLayout.add(contents1.get(1), 1, 0);
    gridLayout.add(contents1.get(2), 0, 1, 2, 1);

    List<Node> contents = createChildren(useButtons);
    borderLayout.getChildren().clear();
    borderLayout.setLeft(contents.get(0));
    borderLayout.setTop(contents.get(1));
    borderLayout.setRight(contents.get(2));
    borderLayout.setBottom(contents.get(3));
    borderLayout.setCenter(contents.get(4));

    stackLayout.getChildren().clear();
    stackLayout.getChildren().addAll(createChildren(useButtons));

    tileLayout.getChildren().clear();
    tileLayout.getChildren().addAll(createChildren(useButtons));
  }
Example #15
0
 public void setMitjas(String tipus, double result, String unitats) {
   mitjas.setHeaderText("Càlcul de la mitja de la " + tipus);
   Label label1 = new Label(String.format("%.2f", result) + " " + unitats);
   GridPane grid = new GridPane();
   grid.add(label1, 1, 1);
   mitjas.getDialogPane().setContent(grid);
 }
Example #16
0
 public static Label addLabel(GridPane gridPane, int rowIndex, String title, double top) {
   Label label = new Label(title);
   GridPane.setRowIndex(label, rowIndex);
   GridPane.setMargin(label, new Insets(top, 0, 0, 0));
   gridPane.getChildren().add(label);
   return label;
 }
Example #17
0
 public static void removeRowsFromGridPane(GridPane gridPane, int fromGridRow, int toGridRow) {
   Set<Node> nodes = new CopyOnWriteArraySet<>(gridPane.getChildren());
   nodes
       .stream()
       .filter(e -> GridPane.getRowIndex(e) >= fromGridRow && GridPane.getRowIndex(e) <= toGridRow)
       .forEach(e -> gridPane.getChildren().remove(e));
 }
Example #18
0
 public static GridPane looArvutiLaud() {
   GridPane arvutiRuudustik = looRuudustik();
   for (Laev laev : Laevastik.arvutijaLaevad) {
     for (int i = 0; i < laev.laevaPikkus; i++) {
       String koordinaat = laev.laevaKoordinaadid.get(i);
       if (koordinaat.length()
           < 3) { // tuleneb laevade paigutamise loogikast. Ruudustik on suurem kui 10
         int rida = Integer.parseInt(String.valueOf(koordinaat.charAt(1)));
         int veerg = tahed.indexOf(koordinaat.charAt(0));
         Rectangle ruut = new Rectangle(50, 50, Color.TRANSPARENT);
         ruut.setId("laev");
         ruut.setStroke(Color.BLACK);
         arvutiRuudustik.add(ruut, rida - 1, veerg);
       } else {
         int veerg = tahed.indexOf(koordinaat.charAt(0));
         int rida = 10;
         Rectangle ruut = new Rectangle(50, 50, Color.TRANSPARENT);
         ruut.setId("laev");
         ruut.setStroke(Color.BLACK);
         arvutiRuudustik.add(ruut, rida - 1, veerg);
       }
     }
   }
   return arvutiRuudustik;
 }
Example #19
0
  public void open() throws IOException {

    paneCenter.getChildren().clear();

    String station = (String) cbStations.getValue();

    File f = new File("database\\" + station + "\\status.txt");
    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    paneCenter.add(new Label("Last seen : " + (br.readLine())), 0, 0);

    for (int i = 1; i < count; i++) {
      paneCenter.add(new Label(br.readLine()), 0, i);
    }
    br.close();
    fr2.close();

    addQuantityToCB();
  }
Example #20
0
 public void init() {
   dob.setPrefWidth(200);
   GridPane grid = new GridPane();
   grid.addRow(0, new Label("First Name:"), firstNameFld);
   grid.addRow(1, new Label("Last Name:"), lastNameFld);
   grid.addRow(2, new Label("DOB:"), dob);
   this.setContent(grid);
 }
 /**
  * Private method to handle all removing and reinstating of listviews in the display.
  *
  * @param add Boolean to describe whether we are adding (reinstating) or removing.
  * @param debug Boolean to describe which listView we are reinstating or removing. True for
  *     debugListView, false for lineNumberListView.
  */
 private void addOrRemoveDebugOrLineNumberColumn(boolean add, boolean debug) {
   int lv = debug ? 0 : 1;
   int size = add ? 30 : 0;
   gridPane.getColumnConstraints().get(lv).setMinWidth(size);
   gridPane.getColumnConstraints().get(lv).setMaxWidth(size);
   gridPane.getColumnConstraints().get(lv).setPrefWidth(size);
   refresh();
 }
Example #22
0
 public static Button addButton(GridPane gridPane, int rowIndex, String title) {
   Button button = new Button(title);
   button.setDefaultButton(true);
   GridPane.setRowIndex(button, rowIndex);
   GridPane.setColumnIndex(button, 1);
   gridPane.getChildren().add(button);
   return button;
 }
  private void addContent() {
    addMultilineLabel(
        gridPane,
        ++rowIndex,
        "Please use that only in emergency case if you cannot access your fund from the UI.\n"
            + "Before you use this tool, you should backup your data directory. After you have successfully transferred your wallet balance, remove"
            + " the db directory inside the data directory to start with a newly created and consistent data structure.\n"
            + "Please make a bug report on Github so that we can investigate what was causing the problem.",
        10);

    Coin totalBalance = walletService.getAvailableBalance();
    boolean isBalanceSufficient = totalBalance.compareTo(FeePolicy.TX_FEE) >= 0;
    addressTextField =
        addLabelTextField(
                gridPane,
                ++rowIndex,
                "Your available wallet balance:",
                formatter.formatCoinWithCode(totalBalance),
                10)
            .second;
    Tuple2<Label, InputTextField> tuple =
        addLabelInputTextField(gridPane, ++rowIndex, "Your destination address:");
    addressInputTextField = tuple.second;

    emptyWalletButton = new Button("Empty wallet");
    emptyWalletButton.setDefaultButton(isBalanceSufficient);
    emptyWalletButton.setDisable(
        !isBalanceSufficient && addressInputTextField.getText().length() > 0);
    emptyWalletButton.setOnAction(
        e -> {
          if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
            if (walletService.getWallet().isEncrypted()) {
              walletPasswordPopup
                  .onClose(() -> blurAgain())
                  .onAesKey(aesKey -> doEmptyWallet(aesKey))
                  .show();
            } else {
              doEmptyWallet(null);
            }
          }
        });

    closeButton = new Button("Cancel");
    closeButton.setOnAction(
        e -> {
          hide();
          closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
        });

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(emptyWalletButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
  }
Example #24
0
 public static Button addButtonAfterGroup(GridPane gridPane, int rowIndex, String title) {
   Button button = new Button(title);
   button.setDefaultButton(true);
   GridPane.setRowIndex(button, rowIndex);
   GridPane.setColumnIndex(button, 1);
   GridPane.setMargin(button, new Insets(15, 0, 0, 0));
   gridPane.getChildren().add(button);
   return button;
 }
 private void setUpStepTextField() {
   Label label = new Label("Podaj krok: ");
   step = new TextField();
   step.setPromptText("Podaj krok");
   GridPane.setMargin(step, new Insets(10, 50, 10, 50));
   GridPane.setMargin(label, new Insets(50, 50, 10, 50));
   gridPane.add(label, 0, 0);
   gridPane.add(step, 0, 1);
 }
Example #26
0
 private static Node ruutLaual(
     GridPane kasutjaRuudustik, int rida, int veerg) { // gridpaneist vastava ruudu tuvastamine
   for (Node node : kasutjaRuudustik.getChildren()) {
     if (GridPane.getColumnIndex(node) == veerg && GridPane.getRowIndex(node) == rida) {
       return node;
     }
   }
   return null;
 }
Example #27
0
  private GridPane createLoadingIndicator() {
    GridPane grid = createGridPane();
    ProgressIndicator loadingIndicator = new ProgressIndicator();
    Label labelLoading = new Label("Waiting for login");
    grid.add(loadingIndicator, 0, 0);
    grid.add(labelLoading, 0, 1);

    return grid;
  }
Example #28
0
 public static CheckBox addCheckBox(
     GridPane gridPane, int rowIndex, String checkBoxTitle, double top) {
   CheckBox checkBox = new CheckBox(checkBoxTitle);
   GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
   GridPane.setRowIndex(checkBox, rowIndex);
   GridPane.setColumnIndex(checkBox, 1);
   gridPane.getChildren().add(checkBox);
   return checkBox;
 }
Example #29
0
  private GridPane createGridPane() {
    GridPane grid = new GridPane();
    grid.setHgap(hGap);
    grid.setVgap(vGap);
    grid.setPadding(new Insets(topOffset, rightOffset, bottomOffset, leftOffset));
    grid.setAlignment(Pos.CENTER);

    return grid;
  }
Example #30
0
 public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top) {
   Label label = new Label(text);
   label.setWrapText(true);
   GridPane.setHalignment(label, HPos.LEFT);
   GridPane.setRowIndex(label, rowIndex);
   GridPane.setColumnSpan(label, 2);
   GridPane.setMargin(label, new Insets(top, 0, 0, 0));
   gridPane.getChildren().add(label);
   return label;
 }