Exemplo n.º 1
0
  public static Parent loadFXML(Object ctrl, String fxml, Node root) throws IOException {
    FXMLLoader loader = new FXMLLoader(CooFileUtil.getResourceURL(fxml));

    if (root != null) {
      loader.setRoot(root);
    }

    loader.setController(ctrl);
    return loader.load();
  }
Exemplo n.º 2
0
 public TabsController() {
   FXMLLoader loader = new FXMLLoader(getClass().getResource(COMMAND_BAR_LAYOUT_FXML));
   loader.setController(this);
   loader.setRoot(this);
   try {
     loader.load();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 3
0
 private void createGui() {
   try {
     final FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("TimePicker.fxml"));
     fxmlLoader.setRoot(this);
     fxmlLoader.setController(this);
     fxmlLoader.load();
     getStylesheets().add(getClass().getResource("TimePicker.css").toExternalForm());
   } catch (final IOException e) {
     e.printStackTrace();
   }
 }
 /**
  * 戦闘ログ詳細のフェーズの艦船のコンストラクタ
  *
  * @param chara キャラクター
  */
 public BattleDetailPhaseShip(Chara chara) {
   this.chara = chara;
   try {
     FXMLLoader loader = InternalFXMLLoader.load("logbook/gui/battle_detail_phase_ship.fxml");
     loader.setRoot(this);
     loader.setController(this);
     loader.load();
   } catch (IOException e) {
     LoggerHolder.LOG.error("FXMLのロードに失敗しました", e);
   }
 }
Exemplo n.º 5
0
  private void init() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("View.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
  }
Exemplo n.º 6
0
  /**
   * Creates a new MainView with the given fxmlFileName. The fxml file has to be in the same
   * namespace as the MainView.
   *
   * @param fxmlFileName the name of the fxml file to be loaded.
   */
  public MenuBarView(final String fxmlFileName) {
    final FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(fxmlFileName));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
  }
Exemplo n.º 7
0
  public HUD_3_2_1_Controller() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FXML_HUD_simple.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
  }
 private void loadFXML() {
   FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("EntryTask.fxml"));
   fxmlLoader.setRoot(this);
   fxmlLoader.setController(this);
   try {
     fxmlLoader.load();
   } catch (IOException e) {
     // TODO 自動生成された catch ブロック
     e.printStackTrace();
   }
 }
  public FavoritesMenuPane() {
    FXMLLoader loader =
        new FXMLLoader(getClass().getResource("../../view/menupanes/FavoritesMenuPane.fxml"));

    loader.setRoot(this);
    loader.setController(this);
    try {
      loader.load();
    } catch (IOException excpt) {
      throw new RuntimeException(excpt);
    }
  }
Exemplo n.º 10
0
  public IntegerTextField() {

    FXMLLoader loader = new FXMLLoader(getClass().getResource("IntegerTextField.fxml"));
    loader.setRoot(this);
    loader.setController(this);

    try {
      loader.load();
    } catch (final IOException exception) {
      throw new RuntimeException(exception);
    }
  }
Exemplo n.º 11
0
 public MediaListView(ResourceBundle bundle) throws IOException {
   String fxml = "/fxml/MediaListView.fxml";
   FXMLLoader loader = new FXMLLoader(getClass().getResource(fxml));
   loader.setResources(bundle);
   loader.setRoot(this);
   try {
     loader.load();
   } catch (IOException e) {
     log.error("Failed to load {}. {}", fxml, e.getMessage());
     throw e;
   }
   controller = (MediaListController) loader.getController();
 }
Exemplo n.º 12
0
  /** constructs a new editing pane and loads the FXML into the main stage */
  public EditingPane() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/layouts/EditingLayout.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);
    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }

    type.setItems(typeOptions);

    backgroundSelected();
  }
  public InteractionsListController() {
    logger.entry();
    FXMLLoader fxmlLoader =
        new FXMLLoader(getClass().getResource("/fxml/customcontrol/InteractionsList.fxml"));
    fxmlLoader.setController(this);
    fxmlLoader.setRoot(this);
    try {
      fxmlLoader.load();

    } catch (IOException ex) {
      logger.log(Level.FATAL, ex.getMessage(), ex);
    }
    logger.exit();
  }
Exemplo n.º 14
0
  public DeckListView() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/DeckListView.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }

    newDeckButton.setOnAction(
        actionEvent -> NotificationProxy.sendNotification(GameNotification.CREATE_NEW_DECK));
    setCache(true);
  }
Exemplo n.º 15
0
  public PreviewsView(EventBus eventBus) {
    checkNotNull(eventBus);

    this.eventBus = eventBus;
    this.previewedSockets = new ArrayList<>();

    try {
      FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Previews.fxml"));
      fxmlLoader.setRoot(this);
      fxmlLoader.setController(this);
      fxmlLoader.load();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    this.eventBus.register(this);
  }
Exemplo n.º 16
0
  public HudPane() {
    FXMLLoader view = new FXMLLoader(Main.class.getResource("/view/ConfigHudComponent.fxml"));
    view.setRoot(this);
    view.setController(this);
    try {
      view.load();
    } catch (IOException e) {
      e.printStackTrace();
    }

    txtWid.setMaxMin(0, 1);
    txtHei.setMaxMin(0, 1);
    txtRelY.setMaxMin(0, 1);
    txtRelX.setMaxMin(0, 1);

    setHandler();
  }
Exemplo n.º 17
0
  @Override
  protected void initView() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("player_row.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (playerInfo.getPlayerType().equals(PlayerType.HUMAN)) {
      aiComboBox.setVisible(false);
      playerDescription.setText(UserManager.INSTANCE.getCurrentUser().getUsername());
    } else {
      playerDescription.setText("Computer");
    }

    aiComboBox.disableProperty().set(true);
  }
Exemplo n.º 18
0
    public ImageViewerPane() {
      FXMLLoader loader =
          new FXMLLoader(
              getClass().getResource("/image_view.fxml"),
              null,
              new JavaFXBuilderFactory(),
              type -> BeanFactory.getInstance().getBean(type));
      loader.setRoot(this);
      loader.setController(this);

      try {
        loader.load();
      } catch (IOException e) {
        Dialogs.create()
            .owner(tabPane)
            .title("Bild anzeigen")
            .masthead(null)
            .message("Fehler beim Öffnen eines Bildes.")
            .showException(e);
        logger.error("", e);
      }
    }
Exemplo n.º 19
0
  public CodeTab(TabPane pane, String className, String displayName) {
    this.className = className;
    this.setText(CLASS_PATH_SEPARATOR_PATTERN.matcher(displayName).replaceAll("."));

    pane.getTabs().add(this);

    FXMLLoader loader = new FXMLLoader(ClassLoader.getSystemResource("fxml/CodeTab.fxml"));
    loader.setResources(Main.getResourceBundle());
    loader.setRoot(this);
    loader.setController(this);

    try {
      loader.load();
    } catch (IOException e) {
      e.printStackTrace();
    }

    CODE_TABS.put(className, this);
    getTabPane().getSelectionModel().select(this);

    this.setOnClosed(event -> CODE_TABS.remove(this.getClassName()));
  }
  public StructuresContainer() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("structurescontainer.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
      fxmlLoader.load();
      // button events

      nextBGButton.setOnMouseClicked(event -> setBg(1));

      prevBGButton.setOnMouseClicked(event -> setBg(-1));

      nextFGButton.setOnMouseClicked(event -> setFg(1));

      prevFGButton.setOnMouseClicked(event -> setFg(-1));

      nextDGButton.setOnMouseClicked(event -> setDg(1));

      prevDGButton.setOnMouseClicked(event -> setDg(-1));
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
  }
Exemplo n.º 21
0
  public void buildForm() {
    try {
      URL location = getClass().getResource("/com/webfront/app/fxml/LedgerEntryForm.fxml");
      ResourceBundle resources = ResourceBundle.getBundle("com.webfront.app.bank");
      FXMLLoader loader = new FXMLLoader(location, resources);

      btnOk.setDefaultButton(true);
      btnCancel.setCancelButton(true);

      stage = new Stage();
      scene = new Scene(this);
      stage.setScene(scene);
      stage.setTitle("Item Detail");

      loader.setRoot(this);
      loader.setController(this);
      loader.load();

      ObservableList<Category> cList = view.getCategoryManager().getCategories();

      ObservableList<Account> accountList =
          javafx.collections.FXCollections.observableArrayList(Bank.accountList);
      accountList
          .stream()
          .forEach(
              (acct) -> {
                accountNum.getItems().add(acct.getId());
              });

      for (Category c : cList) {
        // Category parent = c.getParent();
        Integer parent = c.getParent();
        categoryMap.put(c.getDescription(), c);
        if (parent == 0) {
          primaryCat.getItems().add(c.getDescription());
        } else if (oldItem != null) {
          if (oldItem.getPrimaryCat() != null) {
            if (parent == oldItem.getPrimaryCat().getId()) {
              subCat.getItems().add(c.getDescription());
            }
          }
        }
      }

      if (oldItem != null) {
        if (oldItem.getSubCat() != null) {
          Category c = oldItem.getSubCat();
          if (c != null) {
            String desc = c.getDescription();
            if (!subCat.getItems().contains(desc)) {
              subCat.getItems().add(desc);
            }
            subCat.setValue(c.getDescription());
          }
        }
      }

      primaryCat
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  String newCat = newValue.toString();
                  if (categoryMap.containsKey(newCat)) {
                    if (oldItem.getId() != null) {
                      Category c = categoryMap.get(newCat);
                      String sqlStmt =
                          "SELECT * FROM categories WHERE parent = " + Integer.toString(c.getId());
                      sqlStmt += " order by description";
                      ObservableList<Category> subCatList =
                          view.getCategoryManager().getCategories(sqlStmt);
                      subCat.getItems().clear();
                      subCatMap.clear();
                      for (Category cat2 : subCatList) {
                        subCatMap.put(cat2.getDescription(), cat2);
                      }
                      subCat.getItems().addAll(subCatMap.keySet());
                      if (oldItem.getPrimaryCat() == null) {
                        oldItem.setPrimaryCat(c);
                        btnOk.setDisable(false);
                      }
                      if (!oldItem.getPrimaryCat().getDescription().equals(primaryCat.getValue())) {
                        oldItem.setPrimaryCat(c);
                        btnOk.setDisable(false);
                      }
                    }
                  }
                }
              });

      subCat
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (newValue != null) {
                    String newCat = newValue.toString();
                    if (subCatMap.containsKey(newCat)) {
                      if (oldItem != null) {
                        oldItem.setSubCat(subCatMap.get(newCat));
                        btnOk.setDisable(false);
                      }
                    }
                  }
                }
              });

      transDescription.setOnKeyPressed(
          new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
              if (!transDescription.getText().equals(oldItem.getTransDesc())) {
                oldItem.setTransDesc(transDescription.getText());
                btnOk.setDisable(false);
              }
            }
          });

      transDescription
          .textProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (!oldValue.equals(newValue)) {
                    btnOk.setDisable(false);
                  }
                }
              });

      checkNum.setOnKeyPressed(
          new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
              if (event.getCode() == KeyCode.TAB) {
                if (!checkNum.getText().equals(oldItem.getCheckNum())) {
                  oldItem.setCheckNum(checkNum.getText());
                  btnOk.setDisable(false);
                }
              }
            }
          });

      transAmt
          .textProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (!oldValue.equals(newValue)) {
                    btnOk.setDisable(false);
                  }
                }
              });

      distView.setPrefSize(857.0, 175.0);
      paymentDetail.setPrefSize(857.0, 175.0);
      distView.getChildren().add(paymentDetail);
      stage.show();

    } catch (IOException ex) {
      Logger.getLogger(LedgerForm.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Exemplo n.º 22
0
  public MusicSegmentController(final String name, float length, double width, String audioPath) {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/com/view/musicSegment.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    this.setId(Controller.userName + Controller.musicSegmentIndex);
    this.setPadding(InsetsBuilder.create().left(10).top(10).build());

    this.audioPath = audioPath;
    this.name = name;
    this.length = length;
    this.width = width;

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
    // this.setId(name + "MusicSegmentComponent");
    if (name != null) {
      musicSegmentName.setText("(" + length + " ms)");
    }
    musicSegmentRectangle.widthProperty().bind(this.widthProperty());
    // musicSegmentRectangle.setWidth(width);
    musicSegmentName.setMinWidth(width);
    musicSegmentName.setMaxWidth(width);
    this.setWidth(width);
    this.setMaxWidth(width);
    this.setMinWidth(width);
    dragRectangle =
        new Rectangle(
            musicSegmentRectangle.getWidth(),
            musicSegmentRectangle.getHeight(),
            musicSegmentRectangle.getFill());
    // this.setPadding(InsetsBuilder.create().left(10).right(10).build());

    this.setOnMouseEntered(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            musicSegmentActions.setVisible(true);
            FadeTransition fadeTransition =
                new FadeTransition(Duration.millis(200), musicSegmentActions);
            fadeTransition.setFromValue(0.0);
            fadeTransition.setToValue(1.0);
            fadeTransition.play();
          }
        });

    this.setOnMouseExited(
        new EventHandler<MouseEvent>() {

          public void handle(MouseEvent mouseEvent) {
            FadeTransition fadeTransition =
                new FadeTransition(Duration.millis(200), musicSegmentActions);
            fadeTransition.setFromValue(1.0);
            fadeTransition.setToValue(0.0);
            fadeTransition.play();
          }
        });

    this.setOnDragDetected(
        new EventHandler<MouseEvent>() {
          public void handle(MouseEvent event) {
            System.out.println("Drag entered music segment");

            /* drag was detected, start a drag-and-drop gesture*/
            /* allow any transfer mode */
            Dragboard db = musicSegmentName.startDragAndDrop(TransferMode.COPY);

            /* Put a string on a dragboard */
            ClipboardContent content = new ClipboardContent();
            content.putString(musicSegmentName.getText());
            db.setContent(content);

            event.consume();
          }
        });

    Media media = new Media(new File(audioPath).toURI().toString());
    mediaPlayer = MediaPlayerBuilder.create().media(media).build();

    btnPlayMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            mediaPlayer.play();
          }
        });

    btnStopMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            mediaPlayer.pause();
          }
        });

    btnDeleteMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            // Group group = (Group) getController().getParent();
            // group.getChildren().remove(getController());
            if (Controller.getTracksArea().getChildren().remove(getController())) {
              System.out.println("Music segment deleted");
            } else {
              System.out.println("music segment could not be deleted");
            }
          }
        });
  }