Exemplo n.º 1
0
  @RequestMapping(value = "/getComboxs")
  @ResponseBody
  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
  public JSONArray getFuncMenuTops(@RequestParam("codetablename") String codetablename) {
    //		System.out.println("-----------" + voName);
    //		System.out.println("-----------" + code);
    //		System.out.println("-----------" + name);

    List<OptionObject> cacheList = CacheService.getCachelist(codetablename);
    // System.out.println("=================" + cache.get(voName));
    // System.out.println("=================" +
    // cache.get(voName).getObjectValue());

    JSONArray arrays = new JSONArray();
    if (cacheList != null && cacheList.size() > 0) {
      for (int i = 0; i < cacheList.size(); i++) {
        OptionObject optionObject = cacheList.get(i);
        ComboBox bo = new ComboBox();
        bo.setKey(optionObject.getKey());
        bo.setValue(optionObject.getValue());
        bo.setKeyvalue(optionObject.getKeyvalue());
        arrays.add(bo);
      }
    }
    // String jsonString = JSONValue.toJSONString(l1);
    // System.out.println("-----------" + arrays);
    return arrays;
  }
 private void clearTabGezinInvoer() {
   // todo opgave 3
   cbOuder1Invoer.getSelectionModel().clearSelection();
   cbOuder2Invoer.getSelectionModel().clearSelection();
   tfHuwelijkInvoer.clear();
   tfScheidingInvoer.clear();
 }
Exemplo n.º 3
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {

    ImageView backImgBtnLayout =
        createImageBtnLayout(
            Constants.BACK_IMAGE_PATH, Constants.BACK_IMAGE_WIDTH, Constants.BACK_IMAGE_HEIGHT);
    backBtn.setGraphic(backImgBtnLayout);
    ImageView addImgBtnLayout =
        createImageBtnLayout(
            Constants.ADD_BUTTON_IMAGE_PATH, Constants.ADD_IMAGE_WIDTH, Constants.ADD_IMAGE_HEIGHT);
    addButton.setGraphic(addImgBtnLayout);

    cancelBtn.setOnAction(
        event -> {
          showWindow(true, false);
          setTitle(Constants.CHARACTER_SCENE_HEADER.toUpperCase());
        });

    levelField.setEditable(false);

    classBox.setItems(
        FXCollections.observableArrayList(
            "Guardin",
            "Assassin",
            "Archmage",
            "Necromancer",
            "Prophet",
            "Shaman",
            "Druid",
            "Ranger"));
    characterRaceBox.setItems(
        FXCollections.observableArrayList(
            "Human", "Gnome", "Dwarf", "Elf", "Eladin", "Tiefling", "Deva", "Goliath"));
  }
  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());
    }
  }
Exemplo n.º 5
0
 @UiHandler("importButton")
 public void onImportClicked(SelectionEvent<Item> event) {
   if (deviceCombo.getValue() == null) {
     new AlertMessageBox(i18n.error(), i18n.errFillFields()).show();
   } else {
     new ImportDialog(deviceCombo.getValue()).show();
   }
 }
Exemplo n.º 6
0
  public void initProviders() throws DataBaseException {
    providers = dao.getProviders();
    selectProviderCb.getItems().clear();

    for (Provider provider : providers) {
      selectProviderCb.getItems().add(provider.getName());
    }
    selectProviderCb.setValue(providers.get(0).getName());
  }
Exemplo n.º 7
0
 @Override
 public void onAnything() {
   Device oldDevice = deviceCombo.getValue();
   if (oldDevice != null) {
     deviceCombo.setValue(deviceStore.findModel(oldDevice));
   } else if (deviceStore.size() == 1) {
     deviceCombo.setValue(deviceStore.get(0));
   }
 }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO 自動生成されたメソッド・スタブ
    addOption.setOnAction(
        event -> {
          for (int i = 0; i < cmb.size(); i++) {
            //				System.out.println(cmb.get(i).getValue());
            if (cmb.get(i).getValue() == null) {
              break;
            } else if (i == cmb.size() - 1) {
              addTask.setDisable(false);
            }
          }
        });

    addTask.setOnAction(
        event -> {
          try {
            String url = webView.getEngine().getLocation();
            System.out.println(url);
            Document document = Jsoup.connect(url).get();

            Elements input = document.select("input");

            Map params = new HashMap<String, String>();
            for (ComboBox cmbx : cmb) {
              ValuePair vp = (ValuePair) cmbx.getValue();
              params.put(vp.getName(), vp.getvalue());
            }
            //				System.out.println(input.select("[name=shop_bid]").first());
            //				System.out.println(input.select("[name=shop_bid]").first().val());
            params.put("shop_bid", input.select("[name=shop_bid]").first().val());
            params.put("item_id", input.select("[name=item_id]").first().val());
            params.put("__event", input.select("[name=__event]").first().val());
            params.put("units", "1");

            Map map = new HashMap<String, Long>();

            //				System.out.println(document.select("#stime").size());
            if (document.select("#stime").size() != 0) {
              System.out.println(document.select("#stime"));
              map.put("stime", Long.parseLong((input.select("#stime").first().val())));
              map.put("etime", Long.parseLong((input.select("#etime").first().val())));
            } else {
              map = null;
            }

            BuyTask task = new BuyTask(url, params, map);
            task.call();
            this.getScene().getWindow().hide();
          } catch (Exception e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
          }
        });
  }
Exemplo n.º 9
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();
 }
Exemplo n.º 11
0
 protected Params getParams() {
   return new Params(
       params.getModuleId(),
       (String) testNameCombo.getValue(),
       params.getCommitId(),
       params.getRunNumber(),
       (Metric) metricCombo.getValue(),
       Integer.parseInt((String) percentileCombo.getValue()),
       (FailureType) failureCombo.getValue());
 }
  public void init() {
    /*
    Image img1 = new Image(TermProjectMain.class.getResourceAsStream("bkash.png"));
    bkash.setImage(img1);
    Image img2 = new Image(TermProjectMain.class.getResourceAsStream("sure cash.png"));
    sureCash.setImage(img2);
    Image img3 = new Image(TermProjectMain.class.getResourceAsStream("dutch bangla.png"));
    DBBL.setImage(img3);
    Image img4 = new Image(TermProjectMain.class.getResourceAsStream("mastercard.png"));
    masterCard.setImage(img4);
    Image img5 = new Image(TermProjectMain.class.getResourceAsStream("visa.png"));
    visa.setImage(img5);
    */

    // fromBoxList.setAll(options);
    // toBoxList.setAll(options);
    // fromComboBox.getItems().addAll(fromBoxList);
    c = new clientInfo();

    fromComboBox.getItems().addAll(options);

    // toComboBox.getItems().addAll(toBoxList);
    toComboBox.getItems().addAll(options);

    fromComboBox.setVisibleRowCount(4);
    toComboBox.setVisibleRowCount(4);

    // the code fragment below ensures that no day before today is selected from the datePicker by
    // disabling the selecting option for those days and marking them in pink color
    final Callback<DatePicker, DateCell> dayCellFactory =
        new Callback<DatePicker, DateCell>() {
          @Override
          public DateCell call(final DatePicker datePicker) {
            return new DateCell() {
              @Override
              public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if (item.isBefore(LocalDate.now())) {
                  setDisable(true);
                  setStyle("-fx-background-color: #ffc0cb;");
                }
              }
            };
          }
        };
    datePick.setDayCellFactory(dayCellFactory);
    datePick.setEditable(false);

    final ToggleGroup group = new ToggleGroup();
    ACradioButton.setToggleGroup(group);
    nonACradioButton.setToggleGroup(group);
  }
 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());
 }
  public void testDisplay() throws Exception {
    Window uispecDialog = createUISpecWindow(JOB_WITH_GOOD_PARAMS);

    assertEquals("This build requires parameters", uispecDialog.getTitle());

    assertTrue(uispecDialog.getCheckBox("integrationTest").isSelected());

    ComboBox envCombo = uispecDialog.getComboBox("environment");
    assertTrue(envCombo.contains("development", "integration", "acceptance", "production"));
    assertTrue(envCombo.selectionEquals("development"));
    assertTrue(StringUtils.isEmpty(uispecDialog.findSwingComponent(JTextField.class).getText()));

    assertTrue(uispecDialog.getButton("OK").isEnabled());
  }
Exemplo n.º 15
0
  @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();
  }
  @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);
    }
    */
  }
 public void iniciarCategorias() {
   cruds = new CRUDArticulos();
   categorias = cruds.traerCategorias();
   for (int i = 0; i < categorias.size(); i++) {
     cmbCategorias.getItems().add(categorias.get(i).getNombre());
   }
 }
Exemplo n.º 18
0
  public void open() throws IOException {

    paneCenter.getChildren().clear();

    String station = (String) cbStations.getValue();

    File f = new File("database\\" + station + "\\status.txt");
    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    paneCenter.add(new Label("Last seen : " + (br.readLine())), 0, 0);

    for (int i = 1; i < count; i++) {
      paneCenter.add(new Label(br.readLine()), 0, i);
    }
    br.close();
    fr2.close();

    addQuantityToCB();
  }
Exemplo n.º 19
0
  private void initComponents(boolean force) {
    if (!force && combo.getStore().getCount() > 0) {
      return;
    }

    mask("Loading asset types...");
    service.getSearchables(
        new AsyncCallback<List<MetaAsset>>() {
          public void onFailure(Throwable caught) {
            GWT.log("Could not load searchable asset types.", caught);
            unmask();
            MessageBox.info("Operation failed", "Could not load searchable asset types.", null);
          }

          public void onSuccess(List<MetaAsset> result) {
            GWT.log("Loaded " + result.size() + " searchable asset types.", null);

            if (result.isEmpty()) {
              MessageBox.info("No searchable types", "No searchable asset types exist.", null);
              return;
            }

            List<BeanModel> models = convertToModels(result);
            combo.getStore().add(models);
            combo.setValue(models.get(0));

            unmask();

            //				layout();
            setWidth(getWidth() + 1);
            setWidth(getWidth() - 1);
          }
        });
  }
Exemplo n.º 20
0
  private void submitSearch() {
    List<ModelData> query = new ArrayList<ModelData>();

    for (Field<?> field : formFields) {
      ModelData md = new BaseModelData();
      MetaField mf = findField(field.getName());

      if (mf == null
          || !enabledFields.containsKey(mf.getName())
          || field.getValue() == null
          || field.getValue().toString().length() == 0
          || !field.isValid()) {
        GWT.log("Will not submit field " + field.getName() + ".", null);
        continue;
      }

      md.set("field", mf);
      md.set("value", field.getValue());

      query.add(md);
    }

    GWT.log("Submitting search with " + query.size() + " query elements.", null);

    AppEvent evt = new AppEvent(ApplicationEvents.SUBMIT_ADVANCED_SEARCH, query);
    evt.setData("asset", combo.getValue().getBean());
    Dispatcher.forwardEvent(evt);
  }
Exemplo n.º 21
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 initializeAssignmentListViewAndFilters() {
    final ListBinding<PersonnelAssignment> filteredAssignementBinding =
        new ListBinding<PersonnelAssignment>() {
          final ObjectBinding<ObservableList<PersonnelAssignment>> internalBinding =
              Bindings.select(
                  assignmentsFilterComboBox.getSelectionModel().selectedItemProperty(),
                  "assignments");

          {
            bind(internalBinding);
          }

          @Override
          protected ObservableList<PersonnelAssignment> computeValue() {
            return internalBinding.get();
          }

          @Override
          public Spliterator<PersonnelAssignment> spliterator() {
            return super.spliterator();
          }
        };

    assigmentsListView.itemsProperty().bind(filteredAssignementBinding);
    assigmentsListView.setCellFactory(
        new PropertyListCellFactory<PersonnelAssignment>("name", null));

    assignmentsFilterComboBox.getItems().clear();
    assignmentsFilterComboBox.getItems().addAll(assignementFilters);
    assignmentsFilterComboBox.setCellFactory(
        new PropertyListCellFactory<AssignementFilter>("name", null));
    assignmentsFilterComboBox.setButtonCell(
        new ListCell<AssignementFilter>() {
          @Override
          protected void updateItem(AssignementFilter item, boolean empty) {
            super.updateItem(item, empty);
            if (textProperty().isBound()) {
              textProperty().unbind();
            }
            if (item != null || !empty) {
              textProperty().bind(item.nameProperty());
            }
          }
        });
  }
Exemplo n.º 23
0
 /**
  * Sets the Calendar min and max years
  *
  * @param minYear the min year
  * @param maxYear the max year
  */
 public void setYearRange(int minYear, int maxYear) {
   if (minYear > maxYear) {
     throw new IllegalArgumentException("Max year should be bigger or equal than min year!");
   }
   // The year combobox may not exist in the current context
   if (year != null) {
     Object previouslySelectedYear = year.getSelectedItem();
     Vector years = new Vector();
     for (int i = maxYear; i >= minYear; i--) {
       years.addElement("" + i);
     }
     ListModel yearModel = new DefaultListModel(years);
     year.setModel(yearModel);
     if (years.contains(previouslySelectedYear)) {
       year.setSelectedItem(previouslySelectedYear);
     }
   }
 }
Exemplo n.º 24
0
 void componentChanged() {
   java.util.Calendar cal = java.util.Calendar.getInstance(tmz);
   cal.set(java.util.Calendar.YEAR, mv.getYear());
   cal.set(java.util.Calendar.MONTH, mv.getMonth());
   cal.set(java.util.Calendar.DAY_OF_MONTH, mv.getDayOfMonth());
   if (month != null) {
     month.getParent().revalidate();
   }
 }
Exemplo n.º 25
0
  private void initLayout() {

    layout.setMargin(true);
    setContent(layout);

    form.setCaption("Employee Details ");
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("Name", new ObjectProperty<String>(""));
    item.addItemProperty("Address", new ObjectProperty<String>(""));

    ComboBox combobox = new ComboBox("Sex");
    combobox.setInvalidAllowed(true);
    combobox.setNullSelectionAllowed(false);
    combobox.addItem("Male");
    combobox.addItem("Female");
    item.addItemProperty("Age", new ObjectProperty<String>(""));
    item.addItemProperty("Email", new ObjectProperty<String>(""));
    item.addItemProperty("Mobile No", new ObjectProperty<String>(""));

    Form form = new Form();
    final Form reader = new Form();
    form.setCaption("Fill Your Details");
    form.setItemDataSource(item);
    reader.setItemDataSource(item);
    reader.setCaption("Your registation details");
    reader.setReadOnly(true);

    button.addClickListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {

            Label message = new Label("You are Registered");
            layout.addComponent(message);
            layout.addComponent(reader);
          }
        });
    layout.addComponent(form);

    final RichTextArea area = new RichTextArea();
    area.setValue("Add more details here");
    layout.addComponent(area);

    layout.addComponent(button);
  }
Exemplo n.º 26
0
 @UiHandler("loadButton")
 public void onLoadClicked(SelectEvent event) {
   archiveHandler.onLoad(
       deviceCombo.getValue(),
       getCombineDate(fromDate, fromTime),
       getCombineDate(toDate, toTime),
       !disableFilter.getValue(),
       snapToRoads.getValue(),
       new ArchiveStyle(style));
 }
 private void clearTabGezin() {
   // todo opgave 3
   cbGezinnen.getSelectionModel().clearSelection();
   tfGezinNr.clear();
   tfOuder1.clear();
   tfOuder2.clear();
   tfHuwelijk.clear();
   tfScheiding.clear();
   lvKinderen.setItems(FXCollections.emptyObservableList());
 }
Exemplo n.º 28
0
  public SearchFormPanel() {

    ListStore<BeanModel> comboStore = new ListStore<BeanModel>();
    combo = new ComboBox<BeanModel>();
    combo.setStore(comboStore);
    combo.setFieldLabel("Asset type");
    combo.setDisplayField("name");
    combo.setTypeAhead(true);
    combo.setForceSelection(true);
    combo.setTriggerAction(ComboBox.TriggerAction.ALL);
    // combo.setWidth(150);
    combo.addSelectionChangedListener(
        new SelectionChangedListener<BeanModel>() {
          public void selectionChanged(SelectionChangedEvent<BeanModel> se) {
            prepareForm((MetaAsset) combo.getValue().getBean());
          }
        });

    Button btnSearch = new Button("Search");
    btnSearch.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent be) {
            submitSearch();
          }
        });

    form = new FormPanel();
    form.setHeaderVisible(false);
    form.setBodyBorder(false);
    form.setScrollMode(Style.Scroll.AUTOY);
    // form.setWidth(300);

    HBoxLayout layout = new HBoxLayout();
    layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
    ContentPanel topPanel = new ContentPanel(layout);
    topPanel.setHeaderVisible(false);
    topPanel.setFrame(true);
    topPanel.setHeight(40);
    topPanel.add(new Text("Asset type: "));
    HBoxLayoutData layoutData = new HBoxLayoutData(0, 2, 0, 2);
    topPanel.add(combo, layoutData);
    topPanel.add(btnSearch);

    setHeading("Advanced search");
    setLayout(new FitLayout());
    setFrame(true);
    setTopComponent(topPanel);
    add(form);

    /*
    addListener(Events.Expand, new Listener<BaseEvent>() {
    	public void handleEvent(BaseEvent be) {
    		initComponents(false);
    	}
    });*/
    initComponents(false);
  }
  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();
  }
Exemplo n.º 30
0
  public void open(File f) {
    Properties open = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream(f);
      open.load(input);

      selectProviderCb.setValue(open.getProperty("provider"));
      selectGrainCb.setValue(open.getProperty("grain"));
      weightTf.setText(open.getProperty("weight"));
      infoTa.setText(open.getProperty("info"));

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        String propertyName = entry.getKey();
        TextField tf = entry.getValue();
        CheckBox cb = propertiesCb.get(propertyName);

        tf.setText(open.getProperty(propertyName));
        if (open.getProperty(propertyName + "_ENABLED").equals("ON")) {
          tf.setDisable(false);
          cb.setSelected(true);
        } else {
          tf.setDisable(true);
          cb.setSelected(false);
        }
      }

      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу открыть файл");
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }