public Options(Browser b) { // combo boxing ypicker.getItems().addAll("No CSV file selected"); xpicker.getItems().addAll("No CSV file selected"); colorpicker.getItems().addAll("No CSV file selected"); typepicker.getItems().addAll("Regular Scatter", "Voronoi Tesselation", "Centroids"); ypicker.setPromptText("Assert Y Axis"); xpicker.setPromptText("Assert X Axis"); colorpicker.setPromptText("Assert Color Scale"); typepicker.setPromptText("Type of visualization"); getChildren().addAll(xpicker, ypicker, colorpicker, typepicker, btn); btn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { b.xAxisInput = xpicker.getValue(); b.yAxisInput = ypicker.getValue(); b.type = typepicker.getValue(); b.color = colorpicker.getValue(); b.refresh(); } }); }
private void initXmlList() { xmlLoader = new ComboBox<String>(); xmlLoader.setPromptText("XML File to Load"); xmlLoader.setEditable(true); xmlLoader.setLayoutX( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "xml-x"))); xmlLoader.setLayoutY( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "xml-y"))); xmlLoader.setVisibleRowCount(3); root.getChildren().add(xmlLoader); }
@FXML private void initialize() { createListMyBox(); cbName.setPromptText("Выберите наименование..."); cbName.setItems(listMyBoxName.getListName()); tableColName.setCellValueFactory(new PropertyValueFactory<MyBox, String>("name")); tableColNumOfSubject.setCellValueFactory( new PropertyValueFactory<MyBox, Integer>("numberOfSubject")); tableColCount.setCellValueFactory(new PropertyValueFactory<MyBox, Integer>("countBox")); tableColVolume.setCellValueFactory(new PropertyValueFactory<MyBox, Double>("volume")); tableView.setItems(listMyBox.getListMyBox()); labelKoef.setText("Коэффициент заполнения: " + String.valueOf(koef * 100 + "%")); initLisners(); }
private void initializeWorkflowProcessesComboBox() { workflowProcessesComboBox.setEditable(false); workflowProcessesComboBox.setPromptText("Select Workflow Process"); workflowProcessesComboBox.setCellFactory( (p) -> { final ListCell<WorkflowProcess> cell = new ListCell<WorkflowProcess>() { @Override protected void updateItem(WorkflowProcess a, boolean bln) { super.updateItem(a, bln); if (a != null) { setText(a.getText()); } else { setText(null); } } }; return cell; }); workflowProcessesComboBox.setButtonCell( new ListCell<WorkflowProcess>() { @Override protected void updateItem(WorkflowProcess t, boolean bln) { super.updateItem(t, bln); if (bln) { setText(""); initiateButton.setDisable(true); } else { setText(t.getText()); initiateButton.setDisable(!isDataRequiredForInitiateOk()); } } }); workflowProcessesComboBox.setOnAction( (event) -> { LOG.trace( "workflowProcessesComboBox event (selected: " + workflowProcessesComboBox.getSelectionModel().getSelectedItem() + ")"); initiateButton.setDisable(!isDataRequiredForInitiateOk()); }); }
public Node buildNuclideCtrl() { VBox vbox = new VBox(); vbox.getStyleClass().add("infobar"); Text title = new Text("Nuclide"); title.getStyleClass().add("title"); _filters.getStyleClass().add("nuclide"); _filters.setPromptText("filter"); _filters.setEditable(true); _filters.setItems(_nuclideFilterNames); _filters.valueProperty().addListener(o -> selectNuclideFilter(_filters.getValue())); vbox.getChildren().addAll(title, _filters); ; return vbox; }
@Override public void initialize() { currencyComboBox = new ComboBox<>(); currencyComboBox.setPromptText("Select currency"); currencyComboBox.setConverter( new StringConverter<TradeCurrency>() { @Override public String toString(TradeCurrency tradeCurrency) { return tradeCurrency.getCodeAndName(); } @Override public TradeCurrency fromString(String s) { return null; } }); Label currencyLabel = new Label("Currency:"); HBox currencyHBox = new HBox(); currencyHBox.setSpacing(5); currencyHBox.setPadding(new Insets(10, -20, 0, 20)); currencyHBox.setAlignment(Pos.CENTER_LEFT); currencyHBox.getChildren().addAll(currencyLabel, currencyComboBox); createChart(); Tuple2<TableView<Offer>, VBox> tupleBuy = getOfferTable(Offer.Direction.BUY); Tuple2<TableView<Offer>, VBox> tupleSell = getOfferTable(Offer.Direction.SELL); buyOfferTableView = tupleBuy.first; sellOfferTableView = tupleSell.first; HBox hBox = new HBox(); hBox.setSpacing(30); hBox.setAlignment(Pos.CENTER); hBox.getChildren().addAll(tupleBuy.second, tupleSell.second); root.getChildren().addAll(currencyHBox, areaChart, hBox); }
private GridPane getTopPane() { topPane = new GridPane(); // Top pane Label DateL = new Label("Date"); Label surveyDateL = new Label("Surveyed Date"); Label NameL = new Label("Name"); Label spouseNameL = new Label("Spouse Name"); Label addressL = new Label("Address"); Label ageL = new Label("Age"); Label yearofResidencyL = new Label("Year of Residency"); Label numofChildrenL = new Label("Number of Children"); // search nodes declaration // topPane nodes declaration dateField = new TextField(Utility.getCurrentDate()); datePicker = new DatePicker(); Name = new TextField(); SpouseName = new TextField(); agefield = new TextField(); addressF = new TextField(); yrResidency = new TextField(); numofChildrenF = new TextField(); // nodes initialization dateField.setAlignment(Pos.CENTER); dateField.setDisable(true); numofChildrenF.setText("0"); Name.setPromptText("First Name"); LastName.setPromptText("Last Name"); MidlleName.setPromptText("Middle Name"); SpouseName.setPromptText("Spouse Full Name"); agefield.setPromptText("35"); addressF.setPromptText("e.g 12345 Manga st. Mabalacat"); yrResidency.setPromptText("e.g 2012"); numofChildrenF.setPromptText("Number of children"); SpouseName.setDisable(true); maritalCBox = new ComboBox(getMaritalStatus()); barangayCb = new ComboBox(getBarangayListModel()); genderCB = new ComboBox(getGender()); maritalCBox.setPrefWidth(140); maritalCBox.setPromptText("Marital Status"); maritalCBox.setEditable(false); genderCB.setPromptText("Gender"); genderCB.setPrefWidth(140); barangayCb.setPromptText("Barangay"); barangayCb.setEditable(false); // --------------------- Layouting ----------------------------/// int indexYTop = 0; topPane.setConstraints(topTitleL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.TOP); indexYTop++; topPane.setConstraints(DateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(dateField, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); topPane.setConstraints(barangayCb, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); indexYTop++; topPane.setConstraints(surveyDateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(datePicker, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); bottomPane.setConstraints(maritalCBox, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); indexYTop++; bottomPane.setConstraints(yearofResidencyL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); bottomPane.setConstraints(yrResidency, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); bottomPane.setConstraints(genderCB, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); indexYTop++; bottomPane.setConstraints(numofChildrenL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); bottomPane.setConstraints(numofChildrenF, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(ageL, 4, indexYTop, 1, 1, HPos.RIGHT, VPos.CENTER); topPane.setConstraints(agefield, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); indexYTop++; topPane.setConstraints(NameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(Name, 1, indexYTop, 3, 1, HPos.CENTER, VPos.CENTER); topPane.setConstraints(LastName, 4, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); topPane.setConstraints(MidlleName, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER); indexYTop++; topPane.setConstraints(spouseNameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(SpouseName, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER); indexYTop++; topPane.setConstraints(addressL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER); topPane.setConstraints(addressF, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER); dateField.setPrefColumnCount(6); agefield.setPrefColumnCount(6); // adding nodes to the top gridpane topPane .getChildren() .addAll( topTitleL, DateL, dateField, surveyDateL, datePicker, barangayCb, yearofResidencyL, yrResidency, maritalCBox, numofChildrenL, numofChildrenF, genderCB, NameL, Name, LastName, MidlleName, ageL, agefield, spouseNameL, SpouseName, addressL, addressF); addTopComponentListeners(); return topPane; }
public VBox getPane() { gp = new GridPane(); gp.setVgap(VERTICAL_GAP); gp.setHgap(HORIZ_GAP); gp.setPadding(new Insets(0, 0, 3, 0)); Random rand = new Random(); questionnaireCode = Integer.toString(rand.nextInt()); // hard coded questions for example Question ques1 = new Question( "111", "Employees need to be supervised closely or they are not likely to do their work", "Quality Type A"); Question ques2 = new Question( "202", "Providing guidance without pressure it they key to being a good leader", "Quality Type B"); Question ques3 = new Question( "097", "Most workers want frequent and supportive communication from their leaders", "Style Type A"); Question ques4 = new Question("125", "People are basically competent and do a good job", "Style Type B"); Question ques5 = new Question( "222", "Most workers want frequent and supportive communication from their leaders", "Quality Type A"); Question ques6 = new Question("021", "Most employees feel insecure about their work", "Style Type A"); Question ques7 = new Question( "435", "The leader is the chief judge of the achievements of the group", "Style Type A"); Question ques8 = new Question( "544", "Leaders should allow subordinates to appraise their own work", "Quality Type B"); Question ques9 = new Question( "787", "Employees must be part of the decision-making process", "Style Type B"); data = FXCollections.observableArrayList(); // Add a new question Label quesName = new Label("New Question:"); String lastCode = Question.lastCode(); int nextCode = Integer.parseInt(lastCode) + 1; final String newCode = Integer.toString(nextCode); TextField newQuestion = new TextField(); newQuestion.setPromptText("Question Text"); newQuestion.setMinWidth(350); // later to be a cell factory ComboBox<String> typeCombo = new ComboBox<String>(); typeCombo.getItems().addAll("Quality A", "Quality B", "Style A", "Style B"); typeCombo.setPromptText("Question Type:"); // Button to add new questions Button addQuesButton = new Button("Add Question"); gp.setHalignment(addQuesButton, HPos.RIGHT); addQuesButton.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // if (addQuesButton.isSelected()) { // data.add(new Question(newCode, newQuestion.getText(), typeCombo.getValue())); // qName.clear(); newQuestion.clear(); } }); Label quesChoose = new Label("Select a Question:"); // choose question in db ComboBox<String> quesCombo = new ComboBox<String>(); // to display existing questions in system: quesCombo.setPromptText("Existing Questions:"); TreeMap<String, Question> questionMap = new TreeMap<String, Question>(); for (Map.Entry<String, Question> entry : Question.getQuesMap().entrySet()) { String key = entry.getKey(); Question value = entry.getValue(); questionMap.put(entry.getValue().getQuestionText(), value); String question = value.getQuestionText(); quesCombo.getItems().add(question); } // to create a new question Button chooseQues = new Button("Add Question"); gp.setHalignment(chooseQues, HPos.RIGHT); chooseQues.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // data.add(questionMap.get(quesCombo.getValue())); // reset combo box // quesCombo.setPromptText("Existing Questions:"); } }); Label or = new Label("OR"); gp.add(quesName, 0, 0); gp.add(newQuestion, 1, 0); gp.add(typeCombo, 2, 0); gp.add(addQuesButton, 3, 0); gp.add(or, 0, 1); gp.add(quesChoose, 0, 2); gp.add(quesCombo, 1, 2); gp.add(chooseQues, 3, 2); // Create a table with columns to display Organization information TableView<Question> table = new TableView<Question>(); table.setEditable(true); TableColumn<Question, String> actionDelete = new TableColumn<Question, String>("Remove"); actionDelete.setCellValueFactory(new PropertyValueFactory<Question, String>("OrgCode")); // Create button to delete records Callback<TableColumn<Question, String>, TableCell<Question, String>> deleteColumnCellFactory = new Callback<TableColumn<Question, String>, TableCell<Question, String>>() { @Override public TableCell call(final TableColumn param) { final TableCell cell = new TableCell() { @Override public void updateItem(Object item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { final Button deleteButton = new Button("Remove"); deleteButton.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { param.getTableView().getSelectionModel().select(getIndex()); Question item = table.getSelectionModel().getSelectedItem(); // if (orgCode != null) { // Confirmation of record deletion Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("ALERT"); alert.setHeaderText( "Please confirm that you would like to delete this record"); // alert.setContentText("Are you ok with this?"); ButtonType buttonTypeOne = new ButtonType("Cancel"); ButtonType buttonTypeTwo = new ButtonType("OK"); alert .showAndWait() .ifPresent( response -> { if (response == ButtonType.OK) { // code to // delete // record data.remove(item); table.getSelectionModel().clearSelection(); } else { return; } }); // } } }); setGraphic(deleteButton); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } } }; return cell; } }; // Add delete button to table cell actionDelete.setCellFactory(deleteColumnCellFactory); TableColumn<Question, String> quesCode = new TableColumn<Question, String>("Code"); quesCode.setMinWidth(50); quesCode.setCellValueFactory(new PropertyValueFactory<Question, String>("questionCode")); TableColumn<Question, String> quesText = new TableColumn<Question, String>("Text"); quesText.setMinWidth(600); quesText.setCellValueFactory(new PropertyValueFactory<Question, String>("questionText")); TableColumn<Question, String> quesType = new TableColumn<Question, String>("Type"); quesType.setMinWidth(150); quesType.setCellValueFactory(new PropertyValueFactory<Question, String>("questionType")); // Set the items from the ArrayList into the table table.setItems(data); table.getColumns().addAll(actionDelete, quesCode, quesText, quesType); table.setVisible(true); Button showQuestionnaire = new Button("Save This Questionnaire and View"); gp.setHalignment(showQuestionnaire, HPos.RIGHT); showQuestionnaire.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // MainMenu.addMap(questionnaireCode, data); qv = new QuestionnaireView(data); MainMenu.changePane(qv.getPane()); } }); // Create a vertical box that will display the table and search area vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(label, gp, table, showQuestionnaire); return vbox; }
private BorderPane webViewScene() { url = new TextField(); url.setPrefWidth(800); browser = new WebView(); engine = browser.getEngine(); url.setText(fileUrl); engine.load(fileUrl); history = browser.getEngine().getHistory(); backButton = new Button(null, new ImageView(new Image("res/BrowserIcons/back.png"))); backButton.setOnAction( (ActionEvent e) -> { if (!checkIntConnection(defaultUrl)) { alert(); } else browser.getEngine().load(goBack()); }); backButton.addEventHandler( MouseEvent.MOUSE_ENTERED, event -> backButton.setEffect(new DropShadow())); backButton.addEventHandler(MouseEvent.MOUSE_EXITED, event -> backButton.setEffect(null)); forwardButton = new Button(null, new ImageView(new Image("res/BrowserIcons/forward.png"))); forwardButton.setOnAction( (ActionEvent e) -> { if (!checkIntConnection(defaultUrl)) { alert(); } else browser.getEngine().load(goForward()); }); forwardButton.addEventHandler( MouseEvent.MOUSE_ENTERED, event -> forwardButton.setEffect(new DropShadow())); forwardButton.addEventHandler(MouseEvent.MOUSE_EXITED, event -> forwardButton.setEffect(null)); reloadButton = new Button(null, new ImageView(new Image("res/BrowserIcons/reload.png"))); reloadButton.setOnAction( event -> { if (!checkIntConnection(defaultUrl)) { alert(); } else browser.getEngine().reload(); }); reloadButton.addEventHandler( MouseEvent.MOUSE_ENTERED, event -> reloadButton.setEffect(new DropShadow())); reloadButton.addEventHandler(MouseEvent.MOUSE_EXITED, event -> reloadButton.setEffect(null)); goButton = new Button(null, new ImageView(new Image("res/BrowserIcons/go.jpg"))); goButton.setOnAction( event -> { // adding the http or https prefix if user didn't type it if (!checkIntConnection(defaultUrl)) { alert(); } else { if (url.getText().length() > 7 && (url.getText(0, 7).equals("http://") || url.getText(0, 8).equals("https://"))) { browser.getEngine().load(url.getText()); } else if (url.getText().length() > 7 && !url.getText(0, 7).equals("http://")) { browser.getEngine().load("http://" + url.getText()); } else { browser.getEngine().load("https://" + url.getText()); } } }); goButton.addEventHandler( MouseEvent.MOUSE_ENTERED, event -> goButton.setEffect(new DropShadow())); goButton.addEventHandler(MouseEvent.MOUSE_EXITED, event -> goButton.setEffect(null)); webHistoryComboBox = new ComboBox(); webHistoryComboBox.setPromptText("Web History"); webHistoryComboBox.setPrefWidth(200); webHistoryComboBox.setOnAction( event -> { // Navigate to the link in the history index int offset = webHistoryComboBox.getSelectionModel().getSelectedIndex() - history.getCurrentIndex(); history.go(offset); }); // Displying browse history in a combo box history .getEntries() .addListener( (ListChangeListener<WebHistory.Entry>) c -> { c.next(); for (WebHistory.Entry e : c.getRemoved()) webHistoryComboBox.getItems().remove(e.getUrl()); for (WebHistory.Entry e : c.getAddedSubList()) webHistoryComboBox.getItems().add(e.getUrl()); }); // Enabling and Disabling back and forward buttons browser .getEngine() .getLoadWorker() .stateProperty() .addListener( (observable, oldValue, newValue) -> { if (!browser.getEngine().getHistory().getEntries().isEmpty()) { int index = browser.getEngine().getHistory().getCurrentIndex(); url.setText(browser.getEngine().getHistory().getEntries().get(index).getUrl()); if (index == 0) { backButton.setDisable(true); } else { backButton.setDisable(false); } if (browser.getEngine().getHistory().getEntries().size() == 1) { forwardButton.setDisable(true); } else if (index < browser.getEngine().getHistory().getEntries().size() - 2) { forwardButton.setDisable(false); } else if (index < browser.getEngine().getHistory().getEntries().size() - 1) { forwardButton.setDisable(false); } else if (index == browser.getEngine().getHistory().getEntries().size() - 1) { forwardButton.setDisable(true); } } }); progress.setPrefSize(25, 25); progress.visibleProperty().bind(browser.getEngine().getLoadWorker().runningProperty()); BorderPane border = new BorderPane(); HBox topBar = new HBox(); topBar.setAlignment(Pos.CENTER); topBar.setSpacing(10); topBar.setPadding(new Insets(10, 10, 10, 10)); topBar .getChildren() .addAll( progress, reloadButton, url, goButton, backButton, forwardButton, webHistoryComboBox); border.setTop(topBar); border.setCenter(browser); border.setPrefHeight(Screen.getPrimary().getVisualBounds().getHeight()); border.setPrefWidth(Screen.getPrimary().getVisualBounds().getWidth()); return border; }
/* ADMIN SCENE */ public void start(Stage primaryStage) throws Exception { /** Done by Marco */ primaryStage.setTitle("PubFinder"); primaryStage.setResizable(false); PubDataAccessor.PubDataAccessor(); /*Welcome scene*/ WelcomeScene.welcomeScene(); welcomeScene = WelcomeScene.welcomeScene; /*Welcome scene*/ /** End of Marcos Work */ /** Done by Shafiq and Anotnino */ /* Admin add scene*/ AdminAddScene.adminAddscene(); adminAddScene = AdminAddScene.adminAddScene; /* Admin add scene*/ /*Admin login scene*/ AdminLoginScene.adminloginscene(); adminLoginScene = AdminLoginScene.adminLoginScene; /*Admin login scene*/ /*Admin choice scene*/ AdminChoiceScene.adminchoicescene(); adminChoiceScene = AdminChoiceScene.adminChoiceScene; /*Admin choice scene*/ /* Admin Edit Scene*/ adminEditScene = AdminEditScene.editScene; /* Admin Edit Scene*/ /** End of Shafiq and Anotonino's Work */ /*Pub button scene*/ pubLayout = new StackPane(); /** Done by Ahmad */ searchNameInput = new TextField(); searchNameInput.setId("search-field"); searchNameInput.setPromptText("NAME"); /** End of Ahmad's Work */ searchStreetInput = new TextField(); searchStreetInput.setId("search-field"); searchStreetInput.setPromptText("STREET"); searchAgeInput = new TextField(); searchAgeInput.setId("search-field"); searchAgeInput.setPromptText("AGE"); /** Done by Aseel */ CheckBox searchStudentDiscount = new CheckBox("DISCOUNTS"); CheckBox searchBySpecialEvents = new CheckBox("EVENTS"); CheckBox searchWithoutFees = new CheckBox("NO FEES"); searchStudentDiscount.setId("check-search"); searchBySpecialEvents.setId("check-search"); searchWithoutFees.setId("check-search"); ComboBox searchByRating = new ComboBox( FXCollections.observableArrayList( "\uF005", "\uF005\uF005", "\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005\uF005")); searchByRating.setTooltip(new Tooltip("RATING")); searchByRating.setPromptText("RATING"); searchByRating.setId("combo-search"); ComboBox searchByArea = new ComboBox( FXCollections.observableArrayList( "All", "Avenyn", "Linné", "Haga", "Järntorget", "Magasinsgatan", "Vasastaden", "Gamlestaden", "Heden", "Masthugget", "Stigberget", "Other")); searchByArea.setTooltip(new Tooltip("AREA")); searchByArea.setPromptText("AREA"); searchByArea.setId("combo-search"); /** End of Aseel's Work */ /** Done by Marco */ pubLayout.setId("pubs"); search = new Button("SEARCH"); search.setId("button-search"); GridPane inputGrid = new GridPane(); inputGrid.setMaxHeight(100); inputGrid.setHgap(10); inputGrid.setVgap(10); inputGrid.setId("searchGrid"); StackPane.setAlignment(inputGrid, Pos.TOP_LEFT); StackPane.setAlignment(search, Pos.TOP_RIGHT); /** End of Marco's Work */ search.setOnAction(e -> searchForPubs()); /** Done by Ahmad */ searchNameInput.setOnKeyReleased( event1 -> { if (event1.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Marco */ searchStreetInput.setOnKeyReleased( event2 -> { if (event2.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Marco's Work */ /** Done by Ahmad */ searchAgeInput.setOnKeyReleased( event3 -> { if (event3.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Shafiq & Anotnino */ searchStudentDiscount.setOnAction( event4 -> { if (searchStudentDiscount.isSelected()) { discount = 1; } if (!searchStudentDiscount.isSelected()) { discount = 0; } }); searchWithoutFees.setOnAction( event5 -> { if (searchWithoutFees.isSelected()) { fee = 0; } if (!searchWithoutFees.isSelected()) { fee = 1; } }); searchBySpecialEvents.setOnAction( event6 -> { if (searchBySpecialEvents.isSelected()) { searchEvent = true; } if (!searchBySpecialEvents.isSelected()) { searchEvent = false; } }); searchByRating.setOnAction( event7 -> { if (searchByRating.getSelectionModel().isSelected(0)) { numberOfStars = 1; } else if (searchByRating.getSelectionModel().isSelected(1)) { numberOfStars = 2; } else if (searchByRating.getSelectionModel().isSelected(2)) { numberOfStars = 3; } else if (searchByRating.getSelectionModel().isSelected(3)) { numberOfStars = 4; } else if (searchByRating.getSelectionModel().isSelected(4)) { numberOfStars = 5; } }); /** End of Shafiq and Anotino's Work */ /** Done by Aseel and Antonino */ searchByArea.setOnAction( event8 -> { if (searchByArea.getSelectionModel().isSelected(0)) { area_checker = 2; } if (searchByArea.getSelectionModel().isSelected(1)) { area = 0; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(2)) { area = 2; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(3)) { area = 3; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(4)) { area = 4; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(5)) { area = 5; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(6)) { area = 6; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(7)) { area = 7; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(8)) { area = 8; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(9)) { area = 9; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(10)) { area = 10; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(11)) { area = 11; area_checker = 1; } }); /** End of Aeel and Antonino's Work */ /** Done by marco */ ScrollPane pubScroll = new ScrollPane(); pubScroll.setId("scroll"); pubScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); pubScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubs = new GridPane(); pubScroll.setContent(pubs); pubs.setId("pub-grid"); pubs.setAlignment(Pos.CENTER); pubLayout.getChildren().add(pubScroll); inputGrid.add(searchNameInput, 1, 1); inputGrid.add(searchStreetInput, 2, 1); inputGrid.add(searchAgeInput, 3, 1); inputGrid.add(searchByRating, 4, 1); inputGrid.add(searchByArea, 5, 1); inputGrid.add(searchStudentDiscount, 6, 1); inputGrid.add(searchBySpecialEvents, 7, 1); inputGrid.add(searchWithoutFees, 8, 1); pubLayout.getChildren().add(inputGrid); pubLayout.getChildren().add(search); noPub = new Label("No pubs found"); searchForPubs(); pubScene = new Scene(pubLayout, 1000, 600); pubScene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub button scene*/ /*Pub scene*/ ScrollPane pubPageLayout = new ScrollPane(); pubPageLayout.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setFitToWidth(true); pubPageLayout.setContent(xPane); xPane.setId("pubScene"); pubPageLayout.setId("gej"); star.setId("starButton"); eventLabel.setId("eventLabel"); /*Items*/ xPane.add(back, 1, 1); back.setId("button-logout"); back.setOnAction( (event) -> { primaryStage.setScene(pubScene); xPane .getChildren() .removeAll(description, rating, overlay, pubName, map, star, rates, events); descriptionGrid .getChildren() .removeAll(age, open, address, type, discountForStudents, entranceFees); events.getChildren().removeAll(eventDescriptionGrid); eventDescriptionGrid.getChildren().removeAll(eventLabel, eventPane); eventPane.getChildren().removeAll(eventGrid); eventGrid.getChildren().removeAll(eventName, eventDescription); star.setText("0 \uF08A"); star.setStyle( "#starButton{-fx-text-fill: #fff;} #starButton:hover{-fx-text-fill: #fff;}"); }); /** End of Marco's work */ /** Done by Shafiq & Antonino */ star.setOnAction( event -> { int rate = PubDataAccessor.checkRate(this.id); int rateUpdate = rate + 1; /** End of Shafiq & Antonino's Work */ /** Done by marco */ star.setText((rateUpdate) + " \uF004"); PubDataAccessor.updateRate(this.id); star.setStyle("-fx-text-fill: #731a2b;"); }); overlay.setHeight(header.getFitHeight()); overlay.setWidth(header.getFitWidth() + 24); overlay.setX(0); overlay.setY(0); overlay.fillProperty().set(javafx.scene.paint.Color.rgb(115, 26, 43, 0.3)); pubPage = new Scene(pubPageLayout, 1000, 600); pubPage.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub scene*/ primaryStage.setScene(welcomeScene); primaryStage.show(); Main.primaryStage = primaryStage; /** End of Marcos work */ }