use of de.clearit.kindergarten.domain.VendorBean in project kindergarten by clear-group-ausbildung.
the class PurchaseHomeModel method filterPurchases.
private void filterPurchases() {
VendorBean selectedVendor = getVendorList().getSelection();
List<PurchaseBean> filteredOrAllPurchases = new ArrayList<>();
if (alleVerkaeufer().equals(selectedVendor)) {
filteredOrAllPurchases.addAll(SERVICE.getAll());
} else {
filteredOrAllPurchases.addAll(SERVICE.getAll().stream().filter(bean -> selectedVendor.getVendorNumbers().stream().map(VendorNumberBean::getVendorNumber).collect(Collectors.toList()).contains(bean.getVendorNumber())).collect(Collectors.toList()));
}
getSelectionInList().getList().clear();
getSelectionInList().getList().addAll(filteredOrAllPurchases);
refreshSummary();
}
use of de.clearit.kindergarten.domain.VendorBean in project kindergarten by clear-group-ausbildung.
the class VendorAppliance method newVendor.
// Public API *************************************************************
public void newVendor(String title, final CommitCallback<VendorBean> outerCallback) {
final VendorBean newVendor = new VendorBean();
final CommitCallback<CommandValue> callback = result -> outerCallback.committed(result == CommandValue.OK ? newVendor : null);
VendorEditorModel model = new VendorEditorModel(newVendor, callback);
openVendorEditor(title, model);
}
use of de.clearit.kindergarten.domain.VendorBean in project kindergarten by clear-group-ausbildung.
the class VendorEditorModel method fromCurrentValues.
private VendorBean fromCurrentValues() {
VendorBean bean = new VendorBean();
bean.setFirstName((String) getBufferedValue(VendorBean.PROPERTY_FIRST_NAME));
bean.setLastName((String) getBufferedValue(VendorBean.PROPERTY_LAST_NAME));
bean.setPhoneNumber((String) getBufferedValue(VendorBean.PROPERTY_PHONE_NUMBER));
bean.getVendorNumbers().addAll(selectionInList.getList());
return bean;
}
use of de.clearit.kindergarten.domain.VendorBean in project kindergarten by clear-group-ausbildung.
the class VendorFieldSearchProcessor method search.
/**
* {@inheritDoc}
*/
@Override
public // ignored
boolean search(// ignored
String content, // ignored
int caretPosition, CompletionPublisher publisher, CompletionState state) {
String trimmedContent = content.trim();
sleep(1000);
Format format = new VendorAppliance.ExtrasHTMLFormat();
List<VendorBean> vendors = new ArrayList<>(VendorService.getInstance().getAll());
// Check the name
for (Iterator<VendorBean> i = vendors.iterator(); i.hasNext(); ) {
VendorBean vendor = i.next();
String name = vendor.getFirstName();
sleep(100);
if (UIFStringUtils.startsWithIgnoreCase(name, trimmedContent)) {
Completion completion = new DefaultCompletion(name, null, null, format.format(vendor), null, 0, name.equals(content), CaretPosition.END);
publisher.publish(completion);
i.remove();
}
}
// Check the display string
for (Iterator<VendorBean> i = vendors.iterator(); i.hasNext(); ) {
VendorBean vendor = i.next();
String display = getDisplayString(vendor);
sleep(100);
if (display.equals(trimmedContent)) {
Completion completion = new DefaultCompletion(display, null, null, format.format(vendor), null, 0, true, CaretPosition.END);
publisher.publish(completion);
i.remove();
}
}
return true;
}
use of de.clearit.kindergarten.domain.VendorBean in project kindergarten by clear-group-ausbildung.
the class VendorHomeModel method deleteItem.
@Action(enabled = false)
public void deleteItem(ActionEvent e) {
VendorBean vendor = getSelection();
String mainInstruction = RESOURCES.getString("deleteItem.mainInstruction", vendor.getLastName() + ", " + vendor.getFirstName());
TaskPane pane = new TaskPane(MessageType.QUESTION, mainInstruction, CommandValue.YES, CommandValue.NO);
pane.setPreferredWidth(PreferredWidth.MEDIUM);
pane.showDialog(e, RESOURCES.getString("deleteItem.title"));
if (pane.getCommitValue() == CommandValue.YES) {
SERVICE.delete(vendor);
postChangeHandler.onPostDelete();
}
}
Aggregations