update
This commit is contained in:
@@ -18,6 +18,15 @@ import edu.bookocontacts.model.PhoneNumber;
|
|||||||
|
|
||||||
public class ControlDDXDialog extends Dialog<Contact> {
|
public class ControlDDXDialog extends Dialog<Contact> {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField tfFirstName;
|
||||||
|
@FXML
|
||||||
|
private TextField tfLastName;
|
||||||
|
@FXML
|
||||||
|
private TextField tfPhoneNo;
|
||||||
|
@FXML
|
||||||
|
private TextField tfEmail;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TextField tfStreet;
|
private TextField tfStreet;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -54,11 +63,17 @@ public class ControlDDXDialog extends Dialog<Contact> {
|
|||||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "setResultConverter called.");
|
Logger.getLogger(getClass().getName()).log(Level.INFO, "setResultConverter called.");
|
||||||
Callback<ButtonType, Contact> aRC = (buttonType) -> {
|
Callback<ButtonType, Contact> aRC = (buttonType) -> {
|
||||||
if (buttonType == ButtonType.OK) {
|
if (buttonType == ButtonType.OK) {
|
||||||
if (getStreet().isEmpty() || getCity().isEmpty() || getState().isEmpty() || getZip().isEmpty()) {
|
|
||||||
|
if (getFirstName().isBlank() && (getEmail().isBlank() || getPhoneNumber().isBlank())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (getFirstName().isBlank() || getStreet().isEmpty() || getCity().isEmpty() || getState().isEmpty()
|
||||||
|
|| getZip().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Contact(getFirstName(), getLastName(), new PhoneNumber(getPhoneNumber()),
|
return new Contact(getFirstName(), getLastName(), new PhoneNumber(getPhoneNumber()),
|
||||||
new EmailAddress(getEmailAddress()), new Address(getStreet(), getCity(), getState(), getZip()));
|
new EmailAddress(getEmail()), new Address(getStreet(), getCity(), getState(), getZip()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
@@ -77,7 +92,7 @@ public class ControlDDXDialog extends Dialog<Contact> {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEmailAddress() {
|
private String getEmail() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,30 +29,30 @@
|
|||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="First Name:" />
|
<Label text="First Name:" />
|
||||||
<TextField promptText="First Name" GridPane.columnIndex="1" />
|
<TextField id="txFirstName" promptText="First Name" GridPane.columnIndex="1" />
|
||||||
<Label text="Last Name:" GridPane.rowIndex="1" />
|
<Label text="Last Name:" GridPane.rowIndex="1" />
|
||||||
<TextField promptText="Last Name" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
<TextField id="tfLastName" promptText="Last Name" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<Label text="Phone No:" underline="true" GridPane.rowIndex="2" >
|
<Label text="Phone No:" underline="true" GridPane.rowIndex="2">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="12.0" />
|
<Font name="System Bold" size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<TextField promptText="Phone Number" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
<TextField id="tfPhoneNo" promptText="Phone Number" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||||
<Label text="Email:" GridPane.rowIndex="3" />
|
<Label text="Email:" GridPane.rowIndex="3" />
|
||||||
<TextField promptText="Email Address" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
<TextField id="tfEmail" promptText="Email Address" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||||
<Label text="Address:" underline="true" GridPane.rowIndex="4">
|
<Label text="Address:" underline="true" GridPane.rowIndex="4">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="12.0" />
|
<Font name="System Bold" size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Separator GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
<Separator GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||||
<TextField promptText="Street" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
<TextField id="tfStreet" promptText="Street" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets top="4.0" />
|
<Insets top="4.0" />
|
||||||
</GridPane.margin></TextField>
|
</GridPane.margin></TextField>
|
||||||
<TextField promptText="City" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
<TextField id="tfCity" promptText="City" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||||
<TextField promptText="State" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
<TextField id="tfState" promptText="State" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
||||||
<TextField promptText="Zip" GridPane.columnIndex="1" GridPane.rowIndex="7" />
|
<TextField id="tfZip" promptText="Zip" GridPane.columnIndex="1" GridPane.rowIndex="7" />
|
||||||
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user