private void clearTabGezinInvoer() {
   // todo opgave 3
   cbOuder1Invoer.getSelectionModel().clearSelection();
   cbOuder2Invoer.getSelectionModel().clearSelection();
   tfHuwelijkInvoer.clear();
   tfScheidingInvoer.clear();
 }
Ejemplo n.º 2
0
  @Override
  protected void activate() {
    currencyComboBox.setItems(model.getTradeCurrencies());
    currencyComboBox.getSelectionModel().select(model.getTradeCurrency());
    currencyComboBox.setVisibleRowCount(Math.min(currencyComboBox.getItems().size(), 25));
    currencyComboBox.setOnAction(
        e -> {
          model.onSetTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
          updateChartData();
        });

    model.getOfferBookListItems().addListener(changeListener);
    tradeCurrencySubscriber =
        EasyBind.subscribe(
            model.tradeCurrency,
            newValue -> {
              String code = newValue.getCode();
              areaChart.setTitle("Offer book for " + newValue.getName());
              priceColumnLabel.set("Price (" + code + "/BTC)");
              volumeColumnLabel.set("Volume (" + code + ")");
              xAxis.setLabel(priceColumnLabel.get());
              xAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(xAxis, "", ""));
            });

    buyOfferTableView.setItems(model.getBuyOfferList());
    sellOfferTableView.setItems(model.getSellOfferList());

    updateChartData();
  }
  private void showPersoon(Persoon persoon) {
    if (persoon == null) {
      clearTabPersoon();
    } else {
      tfPersoonNr.setText(persoon.getNr() + "");
      tfVoornamen.setText(persoon.getVoornamen());
      tfTussenvoegsel.setText(persoon.getTussenvoegsel());
      tfAchternaam.setText(persoon.getAchternaam());
      tfGeslacht.setText(persoon.getGeslacht().toString());
      tfGebDatum.setText(StringUtilities.datumString(persoon.getGebDat()));
      tfGebPlaats.setText(persoon.getGebPlaats());
      if (persoon.getOuderlijkGezin() != null) {
        cbOuderlijkGezin.getSelectionModel().select(persoon.getOuderlijkGezin());
      } else {
        cbOuderlijkGezin.getSelectionModel().clearSelection();
      }
      // todo opgave 3

      this.alsOuderBetrokkenIn =
          FXCollections.observableArrayList(persoon.getAlsOuderBetrokkenIn());

      ArrayList<Persoon> pList = new ArrayList<Persoon>();
      for (Gezin g : persoon.getAlsOuderBetrokkenIn()) {
        pList.addAll(g.getKinderen());
      }

      this.kinderen = FXCollections.observableArrayList(pList);

      lvAlsOuderBetrokkenBij.setItems(this.getAlsOuderBetrokkenIn());
    }
  }
Ejemplo n.º 4
0
  private void cleanFieldValues() {
    Random random = new Random();
    String level = String.valueOf(1 + random.nextInt(99));
    levelField.setText(level);

    messageLabel.setText(Constants.EMPTY_STRING);
    characterNameField.setText(Constants.EMPTY_STRING);
    classBox.getSelectionModel().clearSelection();
    characterRaceBox.getSelectionModel().clearSelection();
  }
 private void clearTabPersoonInvoer() {
   // todo opgave 3
   tfVoornamenInvoer.clear();
   tfTussenvoegselInvoer.clear();
   tfAchternaamInvoer.clear();
   cbGeslachtInvoer.getSelectionModel().clearSelection();
   tfGeboortedatumInvoer.clear();
   tfGeboorteplaatsInvoer.clear();
   cbOuderlijkGezinInvoer.getSelectionModel().clearSelection();
 }
 private void clearTabPersoon() {
   cbPersonen.getSelectionModel().clearSelection();
   tfPersoonNr.clear();
   tfVoornamen.clear();
   tfTussenvoegsel.clear();
   tfAchternaam.clear();
   tfGeslacht.clear();
   tfGebDatum.clear();
   tfGebPlaats.clear();
   cbOuderlijkGezin.getSelectionModel().clearSelection();
   lvAlsOuderBetrokkenBij.setItems(FXCollections.emptyObservableList());
 }
Ejemplo n.º 7
0
  public void addCharacterBtn_Click(ActionEvent actionEvent) {

    Integer slotsAvailable = getUser().getCharacterSlots();
    Integer slotsUsed = getUser().getCharacters().size();

    boolean isValidated;
    boolean characterNameExists;

    String characterName = characterNameField.getText();

    String characterRace = (String) characterRaceBox.getSelectionModel().getSelectedItem();
    String characterClass = (String) classBox.getSelectionModel().getSelectedItem();
    String characterLevel = levelField.getText();

    isValidated = validateText(characterName, characterRace, characterClass, characterLevel);
    characterNameExists = findCharacter(characterName);

    if (isValidated && !characterNameExists) {

      setTitle(Constants.CHARACTER_SCENE_HEADER.toUpperCase());
      showWindow(true, false);

      Character character =
          new Character(
              characterName, characterClass, characterRace, Integer.parseInt(characterLevel));

      getUser().setCharacter(character);

      boolean isAdded = getUserService().updateUser(getUser());

      if (isAdded) {
        createCharacter(character);

        String slotLabelText = String.valueOf(slotsAvailable - slotsUsed - 1);
        slotLabel.setText(slotLabelText);
      }
    }

    messageLabel.setText(
        slotsAvailable < slotsUsed
            ? "All  slots are in use!"
            : !isValidated
                ? "All fields are required!"
                : characterNameExists
                    ? String.format("Sorry, but %s already exist. Try another!", characterName)
                    : Constants.EMPTY_STRING);
  }
 private void clearTabGezin() {
   // todo opgave 3
   cbGezinnen.getSelectionModel().clearSelection();
   tfGezinNr.clear();
   tfOuder1.clear();
   tfOuder2.clear();
   tfHuwelijk.clear();
   tfScheiding.clear();
   lvKinderen.setItems(FXCollections.emptyObservableList());
 }
  public void okGezinInvoer(Event evt) {
    Persoon ouder1 = (Persoon) cbOuder1Invoer.getSelectionModel().getSelectedItem();
    if (ouder1 == null) {
      showDialog("Warning", "eerste ouder is niet ingevoerd");
      return;
    }
    Persoon ouder2 = (Persoon) cbOuder2Invoer.getSelectionModel().getSelectedItem();
    Calendar huwdatum;
    try {
      huwdatum = StringUtilities.datum(tfHuwelijkInvoer.getText());
    } catch (IllegalArgumentException exc) {
      showDialog("Warning", "huwelijksdatum :" + exc.getMessage());
      return;
    }
    Gezin g;
    if (huwdatum != null) {
      g = getAdministratie().addHuwelijk(ouder1, ouder2, huwdatum);
      if (g == null) {
        showDialog("Warning", "Invoer huwelijk is niet geaccepteerd");
      } else {
        Calendar scheidingsdatum;
        try {
          scheidingsdatum = StringUtilities.datum(tfScheidingInvoer.getText());
          if (scheidingsdatum != null) getAdministratie().setScheiding(g, scheidingsdatum);
        } catch (IllegalArgumentException exc) {
          showDialog("Warning", "scheidingsdatum :" + exc.getMessage());
        }
      }
    } else {
      g = getAdministratie().addOngehuwdGezin(ouder1, ouder2);
      if (g == null) {
        showDialog("Warning", "Invoer ongehuwd gezin is niet geaccepteerd");
      }
    }

    if (g != null) {
      this.gezinnen.add(g);
    }

    this.clearTabGezinInvoer();
  }
Ejemplo n.º 10
0
  public AddDeviceWidget(@NotNull DeviceController deviceController, @NotNull ActorRef tmServer) {
    super(I.addDevice());
    this.tmServer = tmServer;
    this.deviceController = deviceController;
    ObservableList<DeviceTypeInfo> deviceTypes =
        FXCollections.observableArrayList(new ModelDeviceTypeInfo(), new MavlinkDeviceTypeInfo());
    Label typeLabel = new Label(I.deviceType());
    ComboBox<DeviceTypeInfo> deviceTypeComboBox = new ComboBox<>(deviceTypes);

    Group deviceTypeConfigPane = new Group();

    Runnable deviceTypeSelectAction =
        () -> {
          deviceTypeConfigPane.getChildren().clear();
          deviceTypeComboBox
              .getSelectionModel()
              .getSelectedItem()
              .getTypedConfigFormNode()
              .ifPresent((n) -> deviceTypeConfigPane.getChildren().add(n));
        };

    deviceTypeComboBox.setOnAction(e -> deviceTypeSelectAction.run());
    deviceTypeComboBox.getSelectionModel().selectFirst();
    deviceTypeSelectAction.run();

    Button addButton = new Button(I.add());
    addButton.setOnAction(
        (e) ->
            deviceController
                .getDeviceRegistry()
                .getDevices()
                .addAll(deviceTypeComboBox.getSelectionModel().getSelectedItem().newDevice()));
    VBox box = new VBox(typeLabel, deviceTypeComboBox, deviceTypeConfigPane, addButton);
    box.setAlignment(Pos.CENTER_LEFT);
    box.setSpacing(5);
    setContent(box);
  }
  @FXML
  void fromComboBoxAction(ActionEvent event) {
    // fromComboBox.setItems(options);
    /*
    if(fromClicked && toClicked && !lastClicked.equals("from")){
        fromBoxList.setAll(options);
        toBoxList.setAll(options);
        toClicked=false;
        System.out.println("both combo box has been clicked");
    }
    */

    /*System.out.println("now fromBoxList of size "+ fromBoxList.size()+ " will be setAll()");
    fromComboBox.setItems(fromBoxList);
    */

    // fromComboBox=new ComboBox(fromBoxList);
    String s = (String) fromComboBox.getValue();
    c.setFrom(s);

    if (fromComboBox.getValue() == toComboBox.getValue()) {
      toComboBox
          .getSelectionModel()
          .clearSelection(); // to clear the selected option in the other combo box, because the
                             // starting point and destination can't be the same
      c.setTo(null);
      // toComboBox.setButtonCell(null);
      // toComboBox.valueProperty().set(null);
      // toComboBox.getSelectionModel().clearSelection();
    }

    // System.out.println(s.getClass());
    // System.out.println(s);
    System.out.println("from " + s);

    // temp.remove(s);
    /*
    fromClicked=true;
    fromCombo=s;
    lastClicked="from";
    //options.removeAll(s);
    if(fromClicked && !toClicked){
        toBoxList.remove(fromCombo);
        System.out.println("removing "+fromCombo+" from the list and after removing, the size of the toBoxList= "+toBoxList.size());
        toComboBox.setItems(toBoxList);
    }
    */
  }
Ejemplo n.º 12
0
  public void actionAdd(ActionEvent actionEvent) {
    try {
      MyBox tmpMyBox = listMyBoxName.getMyBox(cbName.getSelectionModel().getSelectedItem());
      tmpMyBox.setNumberOfSubject(Integer.valueOf(txtCount.getText()));

      if (listMyBox.contains(tmpMyBox)) {
        listMyBox.delete(tmpMyBox);
      }
      listMyBox.add(tmpMyBox);

    } catch (NullPointerException e) {
      DialogManager.showInfoDialog("Ошибка!", "Выберите наименование");
    } catch (NumberFormatException e) {
      DialogManager.showInfoDialog("Ошибка!", "Укажите количество предметов");
    }
  }
 public void addSkillFilter(ActionEvent event) {
   final Skill skill = skillFilterComboBox.getSelectionModel().getSelectedItem();
   SkillFilter skillFilter = new SkillFilter();
   skillFilter.setSkill(skill);
   String minValueText = skillFilterMinValueComponent.getText();
   skillFilter.setMinValue(
       (minValueText == null || minValueText.isEmpty()) ? null : Integer.parseInt(minValueText));
   String maxValueText = skillFilterMaxValueComponent.getText();
   skillFilter.setMaxValue(
       (maxValueText == null || maxValueText.isEmpty()) ? null : Integer.parseInt(maxValueText));
   skillFiltersTableView.getItems().add(skillFilter);
   // We don't need to update #skillFiltersMatcher because of the biding
   // betwen skillFiltersMatcher' matchers and the items of
   // skillFiltersTableView
   updateOfficialFiltersResult();
 }
  public void setOuders(Event evt) {
    if (tfPersoonNr.getText().isEmpty()) {
      return;
    }
    Gezin ouderlijkGezin = (Gezin) cbOuderlijkGezin.getSelectionModel().getSelectedItem();
    if (ouderlijkGezin == null) {
      return;
    }

    int nr = Integer.parseInt(tfPersoonNr.getText());
    Persoon p = getAdministratie().getPersoon(nr);
    this.personen.remove(p);
    Gezin g = getAdministratie().getGezin(ouderlijkGezin.getNr());
    this.gezinnen.remove(g);
    getAdministratie().setOuders(p, ouderlijkGezin);
    g = getAdministratie().getGezin(ouderlijkGezin.getNr());
    this.gezinnen.add(g);
    p = getAdministratie().getPersoon(nr);
    this.personen.add(p);
  }
  @FXML
  public void registrarArticulo(ActionEvent e) {
    Articulo art = new Articulo();
    cruds = new CRUDArticulos();
    boolean registrado;
    int indiceCategoria = cmbCategorias.getSelectionModel().getSelectedIndex() + 1;
    art.setNombre(tfNombreArticulo.getText());
    art.setMarca(tfMarca.getText());
    art.setDescripcion_estado(txaDescripcion.getText());
    art.setEstado(true);

    RadioButton chk = (RadioButton) acceso.getSelectedToggle();
    if (chk.getText().equals("Prestable")) art.setAcceso(true);
    else art.setAcceso(false);

    art.setIdcategoria(indiceCategoria);
    registrado = cruds.registrarArticulo(art);
    System.out.println(art.getIdcategoria() + "" + art.isAcceso());

    if (registrado) JOptionPane.showMessageDialog(null, "algo salio mal menor");
    else JOptionPane.showMessageDialog(null, "se ha registrado con exito menor");
  }
 public void selectPersoon(Event evt) {
   Persoon persoon = (Persoon) cbPersonen.getSelectionModel().getSelectedItem();
   showPersoon(persoon);
 }
Ejemplo n.º 17
0
  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;
  }
Ejemplo n.º 18
0
 @NotNull
 @Override
 public Device newDevice() {
   switch (routeComboBox.getSelectionModel().getSelectedIndex()) {
     case 1:
       return new Device(
           new FlyingDeviceModelExchangeController(
               tmServer,
               new Coordinates(55.973579, 37.412816, 300.),
               new Route(
                   2,
                   SimplifiedRouteKind.AUTO,
                   true,
                   0,
                   50,
                   "Model 2 route",
                   new RoutePoint(55.930206, 37.518173, 1000., 60., 1),
                   new RoutePoint(55.751958, 37.618155, 1000., 60.),
                   new RoutePoint(55.520834, 37.549276, 2000., 60.),
                   new RoutePoint(55.724031, 37.272329, 3000., 60.),
                   new RoutePoint(55.916189, 37.846193, 500., 40.),
                   new RoutePoint(56.31033, 38.130507, 5000., 100., 8))));
     case 2:
       return new Device(
           new FlyingDeviceModelExchangeController(
               tmServer,
               new Coordinates(33.944054, -118.413939, 0.0),
               new Route(
                   3,
                   SimplifiedRouteKind.AUTO,
                   true,
                   0,
                   50,
                   "Model 3 route",
                   new RoutePoint(40.774221, -73.872793, 1000.0, 1200.0, 1),
                   new RoutePoint(48.728777, 2.365703, 1000.0, 1200.0),
                   new RoutePoint(55.973552, -118.413939, 1000.0, 1200.0),
                   new RoutePoint(39.91886, 116.385471, 1200.0, 1200.0),
                   new RoutePoint(35.72109, 139.690143, 4000.0, 1200.0),
                   new RoutePoint(33.944054, -118.413939, 4000.0, 1200.0, 8))));
     case 3:
       double infStartLatGrad = 55.75435, infStartLongGrad = 37.622864, radiusGrad = 0.1;
       int segments = 20;
       List<RoutePoint> infRoute = new ArrayList<>();
       for (int i = 0; i < segments; i++) {
         double angleRad = Math.toRadians(180. - i * 360. / segments);
         infRoute.add(
             new RoutePoint(
                 infStartLatGrad + radiusGrad * Math.sin(angleRad),
                 infStartLongGrad + radiusGrad + radiusGrad * Math.cos(angleRad),
                 500.0,
                 60.0));
       }
       for (int i = 0; i < segments; i++) {
         double angleRad = Math.toRadians(i * 360.0 / segments);
         infRoute.add(
             new RoutePoint(
                 infStartLatGrad + radiusGrad * Math.sin(angleRad),
                 infStartLongGrad - radiusGrad + radiusGrad * Math.cos(angleRad),
                 500.0,
                 60.0));
       }
       return new Device(
           new FlyingDeviceModelExchangeController(
               tmServer,
               new Coordinates(55.75435, 37.622864, 0.0),
               new Route(4, SimplifiedRouteKind.AUTO, true, 0, 50, "Model 4 route", infRoute)));
     default:
       return new Device(new FlyingDeviceModelExchangeController(tmServer));
   }
 }
Ejemplo n.º 19
0
 ModelDeviceTypeInfo() {
   routeComboBox = new ComboBox<>();
   routeComboBox.getItems().addAll(I.caucasus(), I.moscow(), I.transContinental(), I.infinity());
   routeComboBox.getSelectionModel().selectFirst();
   vBox = new VBox(new Label(I.route()), routeComboBox);
 }
  public IndividualLifeBarTitledPane(final IndividualLifeBar individualLifeBar) {
    this.individualLifeBar = individualLifeBar;

    setText("Configuração LifeBar de Objeto");

    VBox layout = new VBox();

    GridPane gridPane = new GridPane();

    ColumnConstraints col1 = new ColumnConstraints();
    col1.setPercentWidth(40);
    ColumnConstraints col2 = new ColumnConstraints();
    col2.setPercentWidth(30);
    ColumnConstraints col3 = new ColumnConstraints();
    col3.setPercentWidth(30);
    gridPane.getColumnConstraints().addAll(col1, col2, col3);

    Label label = new Label("Objeto");
    gridPane.add(label, 0, 0);

    boxLabelObjects = new ComboBox<String>();
    boxLabelObjects.getItems().addAll(individualLifeBar.getWorld().getObjectIds());

    if (individualLifeBar.getOwnerId() != null) {
      boxLabelObjects.getSelectionModel().select(individualLifeBar.getOwnerId());
    }

    boxLabelObjects.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            for (String label : individualLifeBar.getWorld().getObjectIds()) {
              if (!boxLabelObjects.getItems().contains(label)) {
                boxLabelObjects.getItems().add(label);
              }
            }
          }
        });

    boxLabelObjects.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            individualLifeBar.setOwner(boxLabelObjects.getValue());
          }
        });

    gridPane.add(boxLabelObjects, 1, 0);
    layout.getChildren().add(gridPane);

    Separator separator = new Separator(Orientation.HORIZONTAL);
    separator.setPadding(new Insets(5, 0, 5, 0));
    layout.getChildren().add(separator);
    layout.setPadding(new Insets(5));

    lifeBarPane = new LifebarPane(individualLifeBar);
    layout.getChildren().add(lifeBarPane);
    ScrollPane scroll = new ScrollPane(layout);
    scroll.setFitToWidth(true);
    setContent(scroll);
  }
Ejemplo n.º 21
0
  private void Save() {

    // Family Information
    String inputedDate = dateField.getText();
    LocalDate dateissued = datePicker.getValue();
    int residencyYr = Integer.parseInt(yrResidency.getText());
    int numofchildren = Integer.parseInt(numofChildrenF.getText());
    String name = Name.getText().trim();
    String lastname = LastName.getText().trim();
    String middleName = MidlleName.getText().trim();

    String spousename = SpouseName.getText().trim();
    String age = agefield.getText();
    String maritalStatus = maritalCBox.getSelectionModel().getSelectedItem().toString();
    String barangay = barangayCb.getSelectionModel().getSelectedItem().toString();
    String gender = genderCB.getSelectionModel().getSelectedItem().toString();
    String address = addressF.getText();

    // poverty factors
    String hasOtherIncome = otherIncomeCbox.getSelectionModel().getSelectedItem().toString();
    String isBelow8k = below8kCbox.getSelectionModel().getSelectedItem().toString();
    String ownership = ownershipCbox.getSelectionModel().getSelectedItem().toString();
    String occupancy = occupancyCBox.getSelectionModel().getSelectedItem().toString();
    String isunderEmployed = "";
    ChildrenSchoolCategory childrenScl = null;

    if (!childrenSchlCBox.getSelectionModel().isEmpty()) {
      childrenScl = (ChildrenSchoolCategory) childrenSchlCBox.getSelectionModel().getSelectedItem();
    }

    if (underEmployedCBox.getSelectionModel().isEmpty()) {
      isunderEmployed = "";
    } else {
      isunderEmployed = underEmployedCBox.getSelectionModel().getSelectedItem().toString();
    }

    FamilyInfo familyInfo =
        new FamilyInfo(
            inputedDate,
            dateissued,
            residencyYr,
            numofchildren,
            name,
            lastname,
            middleName,
            spousename,
            age,
            maritalStatus,
            barangay,
            gender,
            address,
            clientID);

    FamilyPoverty familyPoverty =
        new FamilyPoverty(
            hasOtherIncome,
            isBelow8k,
            ownership,
            occupancy,
            isunderEmployed,
            childrenScl,
            dateissued,
            Utility.getCurrentMonth());

    family = new Family(familyInfo, familyPoverty);

    // send data to clientWindow
    familyFormListener.handle(family);

    //  Doesn't clear data unless notification is falls
    if (!Controller.isNotified) {
      clear();
    }
  }
Ejemplo n.º 22
0
  /* 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 */
  }