/* * Sets up the default configuration */ public UserBorderPane() { // sets up the appropriate functionality for the menu configureMenuBar(); // When a certain key is pressed this.addEventHandler(KeyEvent.KEY_PRESSED, this); // adds the tabs to the left of the screen contentTab.setSide(Side.LEFT); // adds tab pane to the center this.setCenter(contentTab); }
@Override public Node showView() { Tab tab = new Tab("View Heat CHart : Search"); try { VBox main = ViewLayout.getMainVBox("View Heat Chart", "Details"); final ObservableList<HeatChartMaster> mailboxData = FXCollections.observableArrayList(); main.getChildren() .addAll(SearchBoxUtil.getHeatChartSearchBox("Heat Chart Number", mailboxData)); final TableView<HeatChartMaster> tableMailbox = TableUtil.createSearchHeatChartTable(); main.getChildren().add(ControlsUtil.makeScrollable(tableMailbox)); tableMailbox.setItems(mailboxData); tableMailbox.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getClickCount() == 2) { HeatChartMaster selHeatChart = tableMailbox.getSelectionModel().getSelectedItem(); if (selHeatChart != null) { createViewTab(selHeatChart); } } } }); EventHandler<ActionEvent> viewHeatChartEventHandler = new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { HeatChartMaster heatChart = tableMailbox.getSelectionModel().getSelectedItem(); if (heatChart != null) { createViewTab(heatChart); } } }; tableMailbox.setContextMenu( TableContextMenu.getViewHeatChartContextMenu(viewHeatChartEventHandler)); tab.setContent(ControlsUtil.makeScrollable(main)); tab.setClosable(false); pane.getTabs().add(tab); pane.setSide(Side.TOP); return pane; } catch (HibernateException e) { LoggerUtil.getLogger().debug(e); Alert.showAlert( Context.getWindowStage(), "Error", "Error", "Some error occured. Details...\n" + e.getMessage()); return new ErrorView().showView(); } catch (MalformedURLException ex) { LoggerUtil.getLogger().debug(ex); Alert.showAlert( Context.getWindowStage(), "Error", "Error", "Some error occured. Details...\n" + ex.getMessage()); return new ErrorView().showView(); } }
@Override public void start(Stage primaryStage) { final boolean closable = false; final Tab titleTab = new Tab("", new TitlePane()); titleTab.setStyle(style); titleTab.setClosable(closable); /** ******** Run Tab ********* */ final Tab runZonesTab = new Tab("Run Zones", new RunThresholdPane()); runZonesTab.setClosable(closable); final Tab runPacesTab = new Tab("Run Paces", new RunPacesPane()); runPacesTab.setClosable(closable); final Tab runEstimatesTab = new Tab("Estimates", new RunEstimatesPane(ModelUtil.newEstimatesModel())); runEstimatesTab.setClosable(closable); final Tab runVDotTab = new Tab("VDot"); runVDotTab.setClosable(closable); runVDotTab.setDisable(true); final TabPane runTabs = new TabPane(); runTabs.getTabs().addAll(runZonesTab, runPacesTab, runEstimatesTab, runVDotTab); final Tab runToolsTab = new Tab("Run Tools", runTabs); runToolsTab.setClosable(closable); /** ******** Bike Tab ********* */ final Tab bikeZonesTab = new Tab("Bike Zones", new BikeThresholdPane()); bikeZonesTab.setClosable(closable); final Tab bikePowerTab = new Tab("Power Zones", new BikePowerPane()); bikePowerTab.setClosable(closable); final Tab bikeAerodynamicsTab = new Tab("Aerodynamics", new AerodynamicsPane()); bikeAerodynamicsTab.setClosable(closable); final Tab bikeGearRatioTab = new Tab("Gear Ratio", new GearsPane()); bikeGearRatioTab.setClosable(closable); final Tab bikeTimeSavingsTab = new Tab("Time Savings", new TimeSavingsPane()); bikeTimeSavingsTab.setClosable(closable); final TabPane bikeTabs = new TabPane(bikeZonesTab, bikePowerTab, bikeAerodynamicsTab, bikeGearRatioTab); final Tab bikeToolsTab = new Tab("Bike Tools", bikeTabs); bikeToolsTab.setClosable(false); /** ******** Swim Tab ********* */ final Tab swimCSSTab = new Tab("CSS", new CSSPane(ModelUtil.newCSSMOdel())); swimCSSTab.setClosable(closable); final Tab swimEstimatesTab = new Tab("Estimates", new SwimEstimatesPane(ModelUtil.newEstimatesModel())); swimEstimatesTab.setClosable(closable); final TabPane swimTabs = new TabPane(); swimTabs.getTabs().addAll(swimCSSTab, swimEstimatesTab); Tab swimToolsTab = new Tab("Swim Tools", swimTabs); swimToolsTab.setClosable(false); /** ******** Utils Tab ********* */ final Tab progressionTab = new Tab("Progression", new ProgressionPane(ProgressionModel.newInstance())); progressionTab.setClosable(false); final ContextMenu progressionContextMenu = new ContextMenu(); progressionContextMenu.setOnShowing(e -> System.out.println("Showing: " + e)); progressionContextMenu.setOnShown(e -> System.out.println("Shown: " + e)); MenuItem progressionMenuItem1 = new MenuItem(); progressionMenuItem1.setText("About"); progressionMenuItem1.setOnAction(e -> System.out.println("About: " + e)); MenuItem progressionMenuItem2 = new MenuItem(); progressionMenuItem2.setText("..."); progressionMenuItem2.setOnAction(e -> System.out.println(": " + e)); progressionContextMenu.getItems().addAll(progressionMenuItem1, progressionMenuItem2); progressionTab.setContextMenu(progressionContextMenu); final Tab scheduleTab = new Tab("Schedule"); scheduleTab.setClosable(false); scheduleTab.setDisable(true); final Tab rpeTab = new Tab("RPE", new RPETextPane()); rpeTab.setClosable(false); final Tooltip progressionTooltip = new Tooltip(); progressionTooltip.setText("Calculates progression times in number of weeks"); progressionTab.setTooltip(progressionTooltip); progressionTooltip.setOnShowing(e -> System.out.println("Progression Tooltip: " + e)); progressionTooltip.setOnShown(e -> System.out.println("Progression Tooltip: " + e)); final TabPane utilTabPane = new TabPane(scheduleTab, rpeTab, progressionTab); final Tab utilTab = new Tab("Utils", utilTabPane); utilTab.setClosable(false); final Tooltip utilTooltip = new Tooltip(); utilTab.setTooltip(utilTooltip); utilTooltip.setText("Helpful utilities for workouts"); /* Create main tab menu */ TabPane root = new TabPane(); root.setSide(Side.LEFT); root.getTabs().addAll(titleTab, runToolsTab, bikeToolsTab, swimToolsTab, utilTab); Scene scene = new Scene(root, 800, 500); scene.getStylesheets().add(STYLESHEET_PATH); primaryStage.setResizable(false); primaryStage.setTitle("Tri App"); primaryStage.setScene(scene); primaryStage.show(); }