use of eu.ggnet.dwoss.customer.ee.entity.Communication in project dwoss by gg-net.
the class CommunicationUpdateTryout method main.
public static void main(String[] args) {
Communication comm = new Communication(Type.MOBILE, "040123456789");
JButton close = new JButton("Schliessen");
close.addActionListener(e -> Ui.closeWindowOf(close));
JButton editButton = new JButton("Edit");
editButton.addActionListener(ev -> {
if (comm.getViolationMessage() != null) {
System.out.println("Communication ViolationMessages: " + comm.getViolationMessage());
}
Ui.exec(() -> {
Ui.build().fxml().eval(() -> comm, CommunicationUpdateController.class).opt().ifPresent(System.out::println);
});
});
JButton addButton = new JButton("Add");
addButton.addActionListener(ev -> {
Ui.exec(() -> {
Ui.build().fxml().eval(() -> new Communication(), CommunicationUpdateController.class).opt().ifPresent(System.out::println);
});
});
JPanel p = new JPanel();
p.add(editButton);
p.add(addButton);
p.add(close);
UiCore.startSwing(() -> p);
}
use of eu.ggnet.dwoss.customer.ee.entity.Communication in project dwoss by gg-net.
the class CommunicationUpdateController method getCommunication.
/**
* Get the Communication back
*/
private Communication getCommunication() {
Communication c = new Communication();
c.setType(commtypbox.getSelectionModel().getSelectedItem());
c.setIdentifier(identifer.getText());
return c;
}
use of eu.ggnet.dwoss.customer.ee.entity.Communication in project dwoss by gg-net.
the class CustomerSimpleController method getSimpleCustomer.
private SimpleCustomer getSimpleCustomer() throws IllegalStateException {
SimpleCustomer sc = new SimpleCustomer();
sc.setTitle(titleTextField.getText());
sc.setFirstName(firstNameTextField.getText());
sc.setLastName(lastNameTextField.getText());
sc.setStreet(streetTextField.getText());
sc.setZipCode(zipcodeTextField.getText());
sc.setCity(cityTextField.getText());
sc.setIsoCountry(countryTextField.getText());
if (StringUtils.isNotBlank(mobileTextField.getText())) {
Communication communication = new Communication(Type.MOBILE, mobileTextField.getText());
if (communication.getViolationMessage() != null)
throw new IllegalStateException(communication.getViolationMessage());
sc.setMobilePhone(mobileTextField.getText());
}
if (StringUtils.isNotBlank(landLineTextField.getText())) {
Communication communication = new Communication(Type.PHONE, landLineTextField.getText());
if (communication.getViolationMessage() != null)
throw new IllegalStateException(communication.getViolationMessage());
sc.setLandlinePhone(landLineTextField.getText());
}
if (StringUtils.isNotBlank(emailTextField.getText())) {
Communication communication = new Communication(Type.EMAIL, emailTextField.getText());
if (communication.getViolationMessage() != null)
throw new IllegalStateException(communication.getViolationMessage());
sc.setEmail(emailTextField.getText());
}
sc.setSex(genderChoiseBox.getSelectionModel().getSelectedItem());
sc.setSource(sourceChoiseBox.getSelectionModel().getSelectedItem());
sc.setCompanyName(companyNameTextField.getText());
sc.setTaxId(ustIdTextField.getText());
sc.setComment(commentTextArea.getText());
return sc;
}
use of eu.ggnet.dwoss.customer.ee.entity.Communication in project dwoss by gg-net.
the class CommunicationTest method testValidPhonenumber.
@Test
public void testValidPhonenumber() {
Communication makeValidCommunication = makeValidCommunication();
makeValidCommunication.setType(PHONE);
makeValidCommunication.setIdentifier("0401234567");
assertThat(makeValidCommunication.getViolationMessage()).as("Communication with valid phonenumber").isNull();
}
use of eu.ggnet.dwoss.customer.ee.entity.Communication in project dwoss by gg-net.
the class CommunicationTest method makeValidCommunication.
public static Communication makeValidCommunication() {
Communication validCommunication = new Communication(EMAIL, "max.mustermann@gmail.com");
assertThat(validCommunication.getViolationMessage()).as("valid Communication").isNull();
return validCommunication;
}
Aggregations