this.originView = originView;
}
+ public RegionView getRegionView() {
+ return regionView;
+ }
+
public void setRegionView(RegionView regionView) {
this.regionView = regionView;
}
-
/**
* @return
*/
public void actionPerformed(ActionEvent actionEvent) {
//TODO: one can implement a smarter way of getting all inputs values inside the main panel.
String firstname = this.getFirstnameView().getTextField().getText();
- String country = null;
- if (this.getOriginView().getComboBox().getSelectedIndex() != -1)
- country = (String) this.getOriginView().getComboBox().getSelectedObjects()[0];
+ String countryName = null;
+ if (this.getRegionView().getTree().getLastSelectedPathComponent() != null)
+ countryName = this.getRegionView().getTree().getLastSelectedPathComponent().toString();
+ /*if (this.getOriginView().getComboBox().getSelectedIndex() != -1)
+ countryName = (String) this.getOriginView().getComboBox().getSelectedObjects()[0];*/
Integer size = (Integer) this.getSizeView().getSpinner().getValue();
Integer weight = (Integer) this.getWeightView().getComboBox().getSelectedItem();
String eye_color = (String) this.getEyeView().getColorsList().getSelectedValue();
- if (firstname.equals("") || country == null || eye_color == null) {
+ if (firstname.equals("") || countryName == null || eye_color == null) {
JOptionPane.showMessageDialog(this,
"Some required fields are missing.",
"Error",
JOptionPane.ERROR_MESSAGE);
} else {
this.getPersonObj().setFirstname(new Firstname(firstname));
- this.getPersonObj().setOrigin(new Origin(country));
+ //this.getPersonObj().setOrigin(new Origin(countryName));
+ this.getPersonObj().setCountry(new Country(countryName));
this.getPersonObj().setPersonSize(new Size(size));
this.getPersonObj().setWeight(new Weight(weight));
this.getPersonObj().setEye(new Eye(eye_color));