예제 #1
0
 private void removeWindowMenuItem(final RegisterStage registerStage) {
   windowMenu
       .getItems()
       .stream()
       .filter(item -> item.getUserData() == registerStage)
       .forEach(item -> windowMenu.getItems().remove(item));
 }
예제 #2
0
  @SuppressWarnings("unchecked")
  @Override
  public void initialize(URL location, ResourceBundle resources) {

    CheckMenuItem item1 = new CheckMenuItem("5 card stud");
    item1
        .selectedProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                mainApp.setiGameType(1);
              }
            });

    mnuGame.getItems().add(item1);

    CheckMenuItem item2 = new CheckMenuItem("5 card draw");
    item2
        .selectedProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                mainApp.setiGameType(2);
              }
            });

    mnuGame.getItems().add(item2);
  }
예제 #3
0
  private MenuBar initMenu() {
    MenuBar bar = new MenuBar();
    bar.setPadding(new Insets(5));
    bar.setStyle("-fx-background-color: #3C4346;");

    Menu menuTasks = new Menu("Tasks");
    Menu menuPeople = new Menu("People");
    Menu menuShop = new Menu("Shop");

    MenuItem itemCashRegister = new MenuItem("Cash Register");
    MenuItem itemStocker = new MenuItem("Stocker");
    itemCashRegister.setOnAction(e -> checkoutWindow());
    itemStocker.setOnAction(e -> stockerWindow());

    MenuItem itemEmployees = new MenuItem("Employees");
    MenuItem itemCustomers = new MenuItem("Customers");
    MenuItem itemIceCream = new MenuItem("Ice Cream");
    itemIceCream.setOnAction(e -> IceCreamWindow());
    itemEmployees.setOnAction(e -> employeesWindow());
    itemCustomers.setOnAction(e -> customerWindow());

    MenuItem itemOverview = new MenuItem("Shop Overview");
    MenuItem itemEnd = new MenuItem("End Game");
    itemOverview.setOnAction(e -> shopoverviewWindow());
    itemEnd.setOnAction(e -> endGame());

    menuTasks.getItems().addAll(itemCashRegister, itemStocker, itemIceCream);
    menuPeople.getItems().addAll(itemEmployees, itemCustomers);
    menuShop.getItems().addAll(itemOverview, itemEnd);

    bar.getMenus().addAll(menuTasks, menuPeople, menuShop);

    return bar;
  }
예제 #4
0
  @Override
  public Optional<Menu> getViewMenuItems() {
    Menu menu = null;

    if (stack instanceof Deck) {
      final Deck deck = (Deck) stack;
      if (menu == null) {
        menu = new Menu("Deck");
      }

      final MenuItem shuffle = new MenuItem("Shuffle");
      shuffle.setOnAction(
          (event) -> {
            deck.shuffle();
          });
      menu.getItems().add(shuffle);

      final Menu refresh = new Menu("Refresh from");
      context
          .getDiscards()
          .forEach(
              (target) -> {
                final MenuItem menuItem = new MenuItem(target.getName());
                menuItem.setOnAction(
                    (event) -> {
                      deck.shuffleAndRefresh(target);
                    });
                refresh.getItems().add(menuItem);
              });
      menu.getItems().add(refresh);
    }

    return Optional.ofNullable(menu);
  }
예제 #5
0
 private Menu createMenu() {
   Menu menu = new Menu();
   if (text != null) menu.setText(text);
   if (action != null) menu.setOnAction(action);
   menu.getItems().setAll(items);
   items = menu.getItems();
   return menu;
 }
예제 #6
0
 @EventListener
 public void onWorkspaceLoaded(WorkspaceLoadedEvent e) {
   recent.getItems().clear();
   service
       .getRecentlyUsedWorkspaces()
       .stream()
       .map(WorkspaceMenuItem::new)
       .forEach(recent.getItems()::add);
 }
  public MenuBarPrincipal() {
    Menu menuSistema = new Menu("Sistema");
    Menu menuCadastro = new Menu("Cadastro");
    Menu menuListar = new Menu("Listar");
    Menu menuAjuda = new Menu("Ajuda");

    MenuItem itemCadastrarRegra = new MenuItem("Cadastrar Regra...");
    itemCadastrarRegra.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent arg0) {
            try {
              TelaCadRegraController telaController =
                  new TelaCadRegraController(new TelaCadRegra());
              telaController.getView();
            } catch (SemVoosCadastradosException e) {
              Alert alertConf = new Alert(AlertType.ERROR);
              alertConf.setTitle("Sem Voos");
              alertConf.setHeaderText("Erro.");
              alertConf.setContentText(e.getMessage());
              alertConf.showAndWait();
            }
          }
        });

    MenuItem itemListarRegras = new MenuItem("Listar Regras...");
    itemListarRegras.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            Main.alterarTela(new TelaTabelaRegras());
          }
        });

    MenuItem itemInicio = new MenuItem("Inicio");
    itemInicio.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            Main.alterarTela(new TelaInicial());
          }
        });

    menuCadastro.getItems().addAll(itemCadastrarRegra);
    menuSistema.getItems().addAll(itemInicio);
    menuListar.getItems().addAll(itemListarRegras);

    getMenus().addAll(menuSistema, menuCadastro, menuListar, menuAjuda);
  }
예제 #8
0
  private void addWindowMenuItem(final RegisterStage registerStage) {
    final MenuItem menuItem = new MenuItem(registerStage.accountProperty().get().getName());
    menuItem.setUserData(registerStage);

    menuItem.setOnAction(
        event -> {
          final RegisterStage stage = (RegisterStage) menuItem.getUserData();
          stage.requestFocus();
        });

    registerStage.setOnHiding(event -> windowMenu.getItems().removeAll(menuItem));

    windowMenu.getItems().add(0, menuItem);
  }
예제 #9
0
  private MenuBar createMenuBar() {
    MenuBar retval = new MenuBar();

    // create menus to put into menu bar
    Menu loginMenu = new Menu("Login");
    loginMenu.getItems().addAll(login());
    Menu custMenu = new Menu("Customer");
    custMenu.getItems().addAll(onlinePurchase(), retrieveCart(), reviewOrders(), exitApp());
    Menu adminMenu = new Menu("Administrator");
    adminMenu.getItems().addAll(maintainCatalogs(), maintainProducts());

    // add menus to menubar
    retval.getMenus().addAll(loginMenu, custMenu, adminMenu);
    return retval;
  }
  public MenuBarController(MenuBar in) {
    this.menuBar = in;

    initFileMenu();
    initEditMenu();
    initWindowMenu();
    initHelpMenu();

    fileMenu
        .getItems()
        .addAll(openTestMenuItem, openMenuItem, saveMenuItem, preferencesMenuItem, quitMenuItem);
    editMenu.getItems().addAll(deleteMenuItem);
    windowMenu.getItems().addAll(codeWindowMenuItem, leftWindowMenuItem, rightWindowMenuItem);
    helpMenu.getItems().addAll(aboutMenuItem);
    menuBar.getMenus().addAll(fileMenu, editMenu, windowMenu, helpMenu);
  }
예제 #11
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // GameChanger changer = new GameChanger();

    Menu m = new Menu();
    m.setText("Games");

    tglGames = new ToggleGroup();

    for (GameRuleDomainModel gr : GameRuleBLL.getRules()) {

      RadioMenuItem mi = new RadioMenuItem();
      String strRuleName = gr.getRULENAME();
      mi.setToggleGroup(tglGames);
      mi.setText(strRuleName);
      // mi.setOnAction(changer);

      if (gr.getDEFAULTGAME() == 1) {
        mi.setSelected(true);
      }
      m.getItems().add(mi);
    }

    mb.getMenus().add(0, m);
  }
예제 #12
0
 private MenuBuilder(Menu menu) {
   this.items = menu.getItems();
   this.text = menu.getText();
   this.action = menu.getOnAction();
   menuObj = menu;
   ctxMenuObj = null;
 }
예제 #13
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    window = primaryStage;
    window.setTitle("The Title");

    // Edit menu
    Menu difficultyMenu = new Menu("Difficulty");

    ToggleGroup group = new ToggleGroup();
    RadioMenuItem easy = new RadioMenuItem("Easy");
    RadioMenuItem medium = new RadioMenuItem("Medium");
    RadioMenuItem hard = new RadioMenuItem("Hard");

    easy.setToggleGroup(group);
    medium.setToggleGroup(group);
    hard.setToggleGroup(group);

    hard.setSelected(false);
    hard.setOnAction(
        e -> {
          System.out.println("You selected hard");
        });

    difficultyMenu.getItems().addAll(easy, medium, hard);

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().addAll(difficultyMenu);

    BorderPane layout = new BorderPane();
    layout.setTop(menuBar);

    Scene scene = new Scene(layout, 500, 400);
    window.setScene(scene);
    window.show();
  }
  public void initLibrarianLayout() {
    ObservableList<Menu> menuList = this.menubar.getMenus();
    menuList.clear();

    Menu checkoutMenu = new Menu("Checkout");
    MenuItem checkoutBookItem = new MenuItem("checkout book");
    checkoutBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(PUBLICATION_CHECKOUT);
          }
        });

    //        MenuItem recordItem = new MenuItem("checkout record");
    //        recordItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("checkout record");
    //            }
    //        });

    ObservableList<MenuItem> itemList = checkoutMenu.getItems();
    itemList.add(checkoutBookItem);
    //        itemList.add(recordItem);
    menuList.add(checkoutMenu);
    showContentView(PUBLICATION_CHECKOUT);
  }
예제 #15
0
 private void writeClipMenuItemChildren(TreeItem<Clip> parentTreeItem, Menu parentMenu) {
   List<TreeItem<Clip>> children = parentTreeItem.getChildren();
   for (TreeItem<Clip> child : children) {
     if (child.getValue().isGroup()) {
       Menu menu = new Menu(child.getValue().getName());
       parentMenu.getItems().add(menu);
       writeClipMenuItemChildren(child, menu);
     } else {
       MenuItem menuItem = new MenuItem(child.getValue().getName());
       parentMenu.getItems().add(menuItem);
       menuItem.setOnAction(
           event -> {
             insertClip(child.getValue());
           });
     }
   }
 }
예제 #16
0
  private static void syncToggle() {
    final String last = preferences.get(LAST, Application.STYLESHEET_MODENA);

    for (final MenuItem menuItem : themesMenu.getItems()) {
      if (menuItem.getUserData() != null && menuItem.getUserData().equals(last)) {
        ((RadioMenuItem) menuItem).setSelected(true);
        break;
      }
    }
  }
예제 #17
0
  public LogMenu(TLP tlp) {
    logMenu = new Menu("Log");

    MenuItem showItem = new MenuItem("Show Logfile");
    showItem.setOnAction(new ShowListener(tlp.getBorderPane(), tlp));

    MenuItem killsItem = new MenuItem("Kills");
    killsItem.setOnAction(new KillsListener(tlp.getBorderPane(), tlp));

    logMenu.getItems().addAll(showItem, killsItem);
  }
  @Override
  public void postHandle(final FXComponentLayout layout) {

    layout.getRegisteredToolBar(ToolbarPosition.NORTH).addToCenter(new Button("WORKBENCH"));

    final JACPMenuBar menu = layout.getMenu();
    final Menu menuFile = new Menu("File");
    final Menu menuTests = new Menu("Tests");
    final Menu menuStyles = new Menu("Styles");
    menuFile.getItems().add(getHelpItem());
    // add style selection
    for (int i = 0; i < ApplicationLauncher.STYLES.length; i++) {
      menuStyles.getItems().add(getStyle(i));
    }

    menuTests.getItems().addAll(getTestMenuItems());
    menu.getMenus().addAll(menuFile, menuTests, menuStyles);
    // show windowButtons
    menu.registerWindowButtons();
  }
  public void initAdminLayout() {
    ObservableList<Menu> menus = menubar.getMenus();
    menus.clear();

    Menu menuMember = new Menu("Member");
    //        MenuItem addMemberItem = new MenuItem("add member");
    //        addMemberItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("add member");
    //            }
    //        });
    MenuItem memberListItem = new MenuItem("member list");
    memberListItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(MEMBER_OVERVIEW);
          }
        });

    Menu menuBook = new Menu("Book");
    MenuItem allBookItem = new MenuItem("all publication");
    allBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(ALL_PUBLICATION);
          }
        });

    menuBook.getItems().add(allBookItem);

    menuMember.getItems().add(memberListItem);
    //        menuMember.getItems().add(addMemberItem);

    menus.add(menuMember);
    menus.add(menuBook);
    showContentView(MEMBER_OVERVIEW);
  }
예제 #20
0
  @Override
  protected void addLeafToMenu(ShadowMenu sm, Menu m) {
    MenuItem item = new MenuItem(sm.getName());

    item.setOnAction(
        event -> {
          // ImageJFX.getThreadPool().submit(sm);

          //            context.inject(sm);
          threadService.run(sm);
        });
    m.getItems().add(item);
  }
  /*
   * sets up the functionality of the menubar
   */
  private void configureMenuBar() {

    fileMenu.getItems().addAll(fileNew, fileExit);

    menuBar.getMenus().addAll(fileMenu);

    this.setTop(menuBar);

    // sets up the user login
    fileNew.setOnAction(startNewAnalysis());

    // sets up the user exit
    fileExit.setOnAction(exitMenuClicked());
  }
예제 #22
0
  public static void addKnownThemes(@NotNull final Menu menu) {
    Objects.requireNonNull(menu);

    themesMenu = menu;

    for (final String[] theme : KNOWN_THEMES) {
      final RadioMenuItem radioMenuItem = new RadioMenuItem(theme[0]);
      radioMenuItem.setUserData(theme[1]);
      radioMenuItem.setOnAction(themeHandler);
      radioMenuItem.setToggleGroup(toggleGroup);

      themesMenu.getItems().add(radioMenuItem);
    }

    Platform.runLater(ThemeManager::syncToggle);
  }
예제 #23
0
 /**
  * Determines which rule is selected in the Games menu.
  *
  * <p>Iterates through the menus in the menu bar looking for the Games menu. Once found it
  * iterates through the menu items under Games looking for radio buttons. For every radio menu
  * item it finds it checks if it's been selected. If a selected one is found strRuleName is set
  * and the whole nest is broken out of and strRuleName is returned.
  *
  * @return
  */
 public String getRuleName() {
   String strRuleName = null;
   for (Menu m : mb.getMenus()) {
     if (m.getText() == "Games") {
       for (MenuItem mi : m.getItems()) {
         if (mi.getClass().equals(RadioMenuItem.class)) {
           RadioMenuItem rmi = (RadioMenuItem) mi;
           if (rmi.isSelected() == true) {
             strRuleName = rmi.getText();
             break;
           }
         }
       }
     }
   }
   return strRuleName;
 }
예제 #24
0
  public void initMenus(IController controller, ITask task) {
    this.getItems().clear();
    Menu assignTaskMenu = new Menu("Назначить ресурс");
    MenuItem getPropertiesMenuItem = new MenuItem("Свойства");
    MenuItem removeTaskMenuItem = new MenuItem("Удалить задачу");

    getPropertiesMenuItem.setOnAction(
        event -> {
          controller.setSelectedTask(task);
          //                taskPaneController.openPropertiesTaskWindow(); // TODO: 25.11.2015
          // исправить
        });
    removeTaskMenuItem.setOnAction(event -> controller.handleRemoveTask(task));
    this.getItems()
        .addAll(assignTaskMenu, getPropertiesMenuItem, removeTaskMenuItem); // заполняем меню

    this.setOnShowing(
        event ->
            refreshResourceMenu(
                assignTaskMenu.getItems(), task, controller.getProject().getResourceList()));
  }
예제 #25
0
 @Inject
 public WorkspaceMenu(RecentWorkspacesService service) {
   super(DefaultI18nContext.getInstance().i18n("_Workspace"));
   this.service = service;
   setId("workspaceMenu");
   MenuItem load = new MenuItem(DefaultI18nContext.getInstance().i18n("_Load"));
   load.setId("loadWorkspace");
   load.setOnAction(e -> loadWorkspace());
   MenuItem save = new MenuItem(DefaultI18nContext.getInstance().i18n("_Save"));
   save.setOnAction(e -> saveWorkspace());
   save.setId("saveWorkspace");
   recent = new Menu(DefaultI18nContext.getInstance().i18n("Recen_t"));
   recent.setId("recentWorkspace");
   service
       .getRecentlyUsedWorkspaces()
       .stream()
       .map(WorkspaceMenuItem::new)
       .forEach(recent.getItems()::add);
   getItems().addAll(load, save, new SeparatorMenuItem(), recent);
   eventStudio().addAnnotatedListeners(this);
 }
예제 #26
0
 public static void addMenuSeparator(Menu menu) {
   menu.getItems().add(new SeparatorMenuItem());
 }
예제 #27
0
 public static void addRadioMenuItem(Menu menu, String text, EventHandler<ActionEvent> action) {
   RadioMenuItem item = new RadioMenuItem(text);
   if (action != null) item.setOnAction(action);
   menu.getItems().add(item);
 }
예제 #28
0
  /**
   * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem
   * TextAreaHandler, beide sind in eine BorderPane eingebettet.
   */
  @Override
  protected Scene create_GUI() {

    // ServiceLocator und Translator werden gesetzt.
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();

    // Die MenuBar enthält die Sprachauswahl
    MenuBar menuBar = new MenuBar();
    menuFile = new Menu(t.getString("program.menu.file"));
    menuFileLanguage = new Menu(t.getString("program.menu.file.language"));
    menuFile.getItems().add(menuFileLanguage);

    for (Locale locale : sl.getLocales()) {
      MenuItem language = new MenuItem(locale.getLanguage());
      menuFileLanguage.getItems().add(language);
      language.setOnAction(
          event -> {
            sl.setTranslator(new Translator(locale.getLanguage()));
            updateTexts();
          });
    }

    BorderPane root = new BorderPane();
    root.setPrefSize(409, 219);

    menuBar.getMenus().addAll(menuFile);
    root.setTop(menuBar);

    /**
     * ______________________________________________________________________________________________
     * START OF GRIDPANE !!! ENTRYAREA !!!
     */

    // Serverentry Area
    GridPane entryArea = new GridPane();
    entryArea.setAlignment(Pos.CENTER);
    root.setCenter(entryArea);

    Label lblIP = new Label();
    lblIP.setText("IP: ");
    ;
    lblIP.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblIP, 0, 0);
    GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50));

    Label lblPort = new Label();
    lblPort.setText("Port: ");
    lblPort.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblPort, 0, 1);
    GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50));

    lblHostName = new Label();
    lblHostName.setAlignment(Pos.CENTER_LEFT);
    lblHostName.setId("lblHostName");
    entryArea.add(lblHostName, 0, 2);
    GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50));

    tfIP = new TextField();
    tfIP.setId("tfIP");
    tfIP.setEditable(false);
    entryArea.add(tfIP, 1, 0);
    GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0));

    tfPort = new TextField();
    tfPort.setId("tfPort");
    tfPort.setText("14000");
    tfPort.setPromptText("Bitte Portnummer eingeben.");
    entryArea.add(tfPort, 1, 1);
    GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0));

    btnStart = new Button();
    btnStart.setId("btnStart");
    btnStart.setText(t.getString("button.start"));
    entryArea.add(btnStart, 2, 0);
    GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50));

    btnClose = new Button();
    btnClose.setId("btnClose");
    btnClose.setText(t.getString("button.close"));
    entryArea.add(btnClose, 2, 1);
    GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50));

    /**
     * ______________________________________________________________________________________________
     * START OF !!! TEXTAREAHANDLER !!!
     */
    textAreaHandler = new TextAreaHandler();
    taLogger = textAreaHandler.getTextArea();
    taLogger.setId("taLogger");
    taLogger.setEditable(false);
    root.setBottom(taLogger);

    Scene scene = new Scene(root);

    return scene;
  }
예제 #29
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    /* create the menu (for the top of the user interface) */
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = new MenuItem("New", imageFile("images/new.png"));
    newMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+N"));
    fileMenu.getItems().add(newMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Open...", imageFile("images/open.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem saveMenuItem = new MenuItem("Save", imageFile("images/save.png"));
    fileMenu.getItems().add(saveMenuItem);
    MenuItem saveAsMenuItem = new MenuItem("Save As...", imageFile("images/save_as.png"));
    fileMenu.getItems().add(saveAsMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem exitMenuItem = new MenuItem("Exit", imageFile("images/exit.png"));
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+Q"));
    exitMenuItem.setOnAction(e -> System.exit(0));

    Menu editMenu = new Menu("Edit");
    editMenu.getItems().add(new MenuItem("Cut", imageFile("images/cut.png")));
    editMenu.getItems().add(new MenuItem("Copy", imageFile("images/copy.png")));
    editMenu.getItems().add(new MenuItem("Paste", imageFile("images/paste.png")));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().add(new MenuItem("About...", imageFile("images/about.png")));
    helpMenu.getItems().add(new SeparatorMenuItem());
    helpMenu.getItems().add(new MenuItem("Help...", imageFile("images/help.png")));

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().add(fileMenu);
    menuBar.getMenus().add(editMenu);
    menuBar.getMenus().add(helpMenu);
    primaryStage.setTitle("Lab08");
    // grid contains all of the textfeilds, labels , buttons, ect..
    GridPane grid = new GridPane();
    // the tableview puts all of our data into a exel like format
    TableView<StudentRecord> table = new TableView<>();
    table.setItems(DataSource.getAllMarks());
    table.setEditable(true);

    TableColumn<StudentRecord, String> IDColumn = null;
    IDColumn = new TableColumn<>("SID");
    IDColumn.setMinWidth(100);
    // the thing in quotes is what it will search for in the StudentRecords.java (MAKE SURE THERE IS
    // A GET FUNCTION FOR THAT VARIBALE)
    IDColumn.setCellValueFactory(new PropertyValueFactory<>("ID"));

    TableColumn<StudentRecord, Double> AssignmentColumn = null;
    AssignmentColumn = new TableColumn<>("Assignment");
    AssignmentColumn.setMinWidth(100);
    AssignmentColumn.setCellValueFactory(new PropertyValueFactory<>("Assign"));

    TableColumn<StudentRecord, Float> MidtermColumn = null;
    MidtermColumn = new TableColumn<>("Midterm");
    MidtermColumn.setMinWidth(100);
    MidtermColumn.setCellValueFactory(new PropertyValueFactory<>("Midterm"));

    TableColumn<StudentRecord, Float> FinalColumn = null;
    FinalColumn = new TableColumn<>("Final Exam");
    FinalColumn.setMinWidth(100);
    FinalColumn.setCellValueFactory(new PropertyValueFactory<>("Final"));

    TableColumn<StudentRecord, String> GradeColumn = null;
    GradeColumn = new TableColumn<>("Letter Grade");
    GradeColumn.setMinWidth(100);
    GradeColumn.setCellValueFactory(new PropertyValueFactory<>("Grade"));

    table.getColumns().add(IDColumn);
    table.getColumns().add(AssignmentColumn);
    table.getColumns().add(MidtermColumn);
    table.getColumns().add(FinalColumn);
    table.getColumns().add(GradeColumn);

    Label IDLabel = new Label("SID:");
    grid.add(IDLabel, 0, 0);
    TextField IDField = new TextField();
    IDField.setPromptText("SID");
    grid.add(IDField, 1, 0);

    Label AssignLabel = new Label("Assignments:");
    grid.add(AssignLabel, 2, 0);

    TextField AssignField = new TextField();
    AssignField.setPromptText("Assignment");
    grid.add(AssignField, 3, 0);

    Label MidLabel = new Label("Midterm:");
    grid.add(MidLabel, 0, 1);

    TextField midField = new TextField();
    midField.setPromptText("Midterm");
    grid.add(midField, 1, 1);

    Label FinalLabel = new Label("Final:");
    grid.add(FinalLabel, 2, 1);

    TextField FinalField = new TextField();
    FinalField.setPromptText("Final");
    grid.add(FinalField, 3, 1);

    Button AddButton = new Button("Add");
    AddButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            char Grade;
            String SID = IDField.getText();
            Float Assignment = Float.parseFloat(AssignField.getText());
            Float Midterm = Float.parseFloat(midField.getText());
            Float Final = Float.parseFloat(FinalField.getText());
            table.getItems().add(new StudentRecord(SID, Assignment, Midterm, Final));

            IDField.setText("");
            AssignField.setText("");
            midField.setText("");
            FinalField.setText("");
          }
        });
    grid.add(AddButton, 0, 2);

    layout = new BorderPane();
    layout.setTop(menuBar);
    layout.setCenter(table);
    layout.setBottom(grid);

    Scene scene = new Scene(layout);
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(10);
    grid.setHgap(10);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
예제 #30
0
  public void init() {
    currentEditor.addListener(
        (observable, oldValue, newValue) -> {
          canUndo.unbind();
          canRedo.unbind();
          if (newValue != null) {
            currentEditorIsXHTML.setValue(
                currentEditor.getValue().getMediaType().equals(MediaType.XHTML));
            canUndo.bind(currentEditor.getValue().canUndoProperty());
            canRedo.bind(currentEditor.getValue().canRedoProperty());
          } else {
            currentEditorIsXHTML.setValue(false);
            canUndo.setValue(false);
            canRedo.setValue(false);
          }
        });

    MenuItem separatorItem = new SeparatorMenuItem();
    // Html menu
    contextMenuXHTML = new ContextMenu();
    contextMenuXHTML.setAutoFix(true);
    contextMenuXHTML.setAutoHide(true);

    Menu clipsItem = new Menu("Clips");
    clipManager
        .getClipsRoot()
        .addEventHandler(
            TreeItem.<Clip>childrenModificationEvent(),
            event -> {
              clipsItem.getItems().clear();
              writeClipMenuItemChildren(clipManager.getClipsRoot(), clipsItem);
            });
    contextMenuXHTML.getItems().add(clipsItem);
    contextMenuXHTML.getItems().add(separatorItem);

    MenuItem itemRepairHTML = new MenuItem("HTML reparieren");
    itemRepairHTML.setOnAction(
        e -> {
          beautifyOrRepairHTML("repair");
        });
    contextMenuXHTML.getItems().add(itemRepairHTML);

    MenuItem itemBeautifyHTML = new MenuItem("HTML formatieren");
    itemBeautifyHTML.setOnAction(
        e -> {
          beautifyOrRepairHTML("format");
        });
    contextMenuXHTML.getItems().add(itemBeautifyHTML);

    contextMenuXHTML.getItems().add(separatorItem);

    MenuItem openInExternalBrowserItem = new MenuItem("In externem Browser öffnen");
    openInExternalBrowserItem.setOnAction(
        e -> {
          openInExternalBrowser(currentEditor);
        });
    contextMenuXHTML.getItems().add(openInExternalBrowserItem);

    // XML menu
    contextMenuXML = new ContextMenu();
    contextMenuXML.setAutoFix(true);
    contextMenuXML.setAutoHide(true);

    MenuItem generateUuidMenuItem = new MenuItem("Neue UUID generieren");
    generateUuidMenuItem.setOnAction(
        e -> {
          book.getMetadata().generateNewUuid();
          bookBrowserManager.refreshOpf();
        });
    contextMenuXML.getItems().add(generateUuidMenuItem);
    currentXMLResource.addListener(
        new ChangeListener<Resource>() {
          @Override
          public void changed(
              ObservableValue<? extends Resource> observable,
              Resource oldValue,
              Resource newValue) {
            if (newValue != null
                && currentXMLResource.get().mediaTypeProperty().getValue().equals(MediaType.OPF)) {
              generateUuidMenuItem.visibleProperty().setValue(true);
            } else {
              generateUuidMenuItem.visibleProperty().setValue(false);
            }
          }
        });

    MenuItem separatorItem2 = new SeparatorMenuItem();
    contextMenuXML.getItems().add(separatorItem2);
    separatorItem2.visibleProperty().bind(generateUuidMenuItem.visibleProperty());

    MenuItem itemRepairXML = new MenuItem("XML reparieren");
    itemRepairXML.setOnAction(
        e -> {
          beautifyOrRepairXML("repair");
        });
    contextMenuXML.getItems().add(itemRepairXML);

    MenuItem itemBeautifyXML = new MenuItem("XML formatieren");
    itemBeautifyXML.setOnAction(
        e -> {
          beautifyOrRepairXML("format");
        });
    contextMenuXML.getItems().add(itemBeautifyXML);

    // css menu
    contextMenuCSS = new ContextMenu();
    contextMenuCSS.setAutoFix(true);
    contextMenuCSS.setAutoHide(true);
    MenuItem formatCSSOneLineItem = new MenuItem("Styles in je einer Zeile formatieren");
    formatCSSOneLineItem.setOnAction(e -> beautifyCSS("one_line"));
    contextMenuCSS.getItems().add(formatCSSOneLineItem);

    MenuItem formatCSSMultipleLinesItem = new MenuItem("Styles in mehreren Zeilen formatieren");
    formatCSSMultipleLinesItem.setOnAction(e -> beautifyCSS("multiple_lines"));
    contextMenuCSS.getItems().add(formatCSSMultipleLinesItem);
  }