Search in sources :

Example 1 with VendorBean

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();
}
Also used : VendorBean(de.clearit.kindergarten.domain.VendorBean) PurchaseBean(de.clearit.kindergarten.domain.PurchaseBean) ArrayList(java.util.ArrayList)

Example 2 with VendorBean

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);
}
Also used : ResourceMap(com.jgoodies.application.ResourceMap) Format(java.text.Format) CommandValue(com.jgoodies.jsdl.core.CommandValue) DesktopManager(com.jgoodies.desktop.DesktopManager) ParsePosition(java.text.ParsePosition) Collectors(java.util.stream.Collectors) Application(com.jgoodies.application.Application) DefaultAppliance(de.clearit.kindergarten.desktop.DefaultAppliance) CommitCallback(com.jgoodies.desktop.CommitCallback) VendorBean(de.clearit.kindergarten.domain.VendorBean) DesktopFrame(com.jgoodies.desktop.DesktopFrame) FieldPosition(java.text.FieldPosition) DefaultDesktopFrame(de.clearit.kindergarten.desktop.DefaultDesktopFrame) VendorBean(de.clearit.kindergarten.domain.VendorBean) CommandValue(com.jgoodies.jsdl.core.CommandValue)

Example 3 with VendorBean

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;
}
Also used : VendorBean(de.clearit.kindergarten.domain.VendorBean)

Example 4 with VendorBean

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;
}
Also used : Format(java.text.Format) DefaultCompletion(com.jgoodies.completion.text.DefaultCompletion) Completion(com.jgoodies.completion.text.Completion) VendorBean(de.clearit.kindergarten.domain.VendorBean) ArrayList(java.util.ArrayList) DefaultCompletion(com.jgoodies.completion.text.DefaultCompletion)

Example 5 with VendorBean

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();
    }
}
Also used : VendorBean(de.clearit.kindergarten.domain.VendorBean) TaskPane(com.jgoodies.jsdl.core.pane.TaskPane) Action(com.jgoodies.application.Action)

Aggregations

VendorBean (de.clearit.kindergarten.domain.VendorBean)11 ArrayList (java.util.ArrayList)4 PurchaseBean (de.clearit.kindergarten.domain.PurchaseBean)3 VendorNumberBean (de.clearit.kindergarten.domain.VendorNumberBean)3 Collectors (java.util.stream.Collectors)3 Action (com.jgoodies.application.Action)2 PurchaseService (de.clearit.kindergarten.domain.PurchaseService)2 VendorService (de.clearit.kindergarten.domain.VendorService)2 PayoffDataInternal (de.clearit.kindergarten.domain.export.entity.PayoffDataInternal)2 PayoffDataInternalVendor (de.clearit.kindergarten.domain.export.entity.PayoffDataInternalVendor)2 PayoffDataReceipt (de.clearit.kindergarten.domain.export.entity.PayoffDataReceipt)2 PayoffSoldItemsData (de.clearit.kindergarten.domain.export.entity.PayoffSoldItemsData)2 Format (java.text.Format)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Application (com.jgoodies.application.Application)1 ResourceMap (com.jgoodies.application.ResourceMap)1 Completion (com.jgoodies.completion.text.Completion)1 DefaultCompletion (com.jgoodies.completion.text.DefaultCompletion)1 CommitCallback (com.jgoodies.desktop.CommitCallback)1