Search in sources :

Example 1 with PicoUnit

use of eu.ggnet.dwoss.uniqueunit.api.PicoUnit in project dwoss by gg-net.

the class RedTapeView method initFxComponents.

private void initFxComponents() {
    final JFXPanel jfxp = new JFXPanel();
    positionFxPanel.add(jfxp, BorderLayout.CENTER);
    Platform.runLater(() -> {
        SelectionEnhancer<Position> selectionEnhancer = (selected) -> {
            if (selected != null && selected.getType() == UNIT)
                return Arrays.asList(new PicoUnit(selected.getUniqueUnitId(), selected.getName()));
            return Collections.EMPTY_LIST;
        };
        selector = Ops.seletor(Position.class, selectionEnhancer);
        BorderPane pane = new BorderPane();
        Scene scene = new Scene(pane, javafx.scene.paint.Color.ALICEBLUE);
        final ListView<Position> positionsFxList = new ListView<>();
        MultipleSelectionModel<Position> selectionModel = positionsFxList.getSelectionModel();
        selectionModel.setSelectionMode(SelectionMode.SINGLE);
        selectionModel.selectedItemProperty().addListener((ob, o, n) -> {
            selector.selected(n);
        });
        positionsFxList.setCellFactory(new PositionListCell.Factory());
        positionsFxList.setItems(positions);
        positionsFxList.setContextMenu(FxOps.contextMenuOf(selectionModel, selectionEnhancer));
        positionsFxList.setOnMouseClicked(FxOps.defaultMouseEventOf(selectionModel));
        /*
             positionsFxList.setOnMouseClicked((evt) -> {
             if ( positionsFxList.getSelectionModel().isEmpty() ) return;
             if ( evt.getButton() != PRIMARY ) return;
             if ( evt.getClickCount() != 2 ) return;
             HtmlDialog d = new HtmlDialog(RedTapeView.this, ModalityType.MODELESS);
             d.setText(controller.getDetailedPositionToHtml(positionsFxList.getSelectionModel().getSelectedItem()));
             d.setVisible(true);
             });
             */
        pane.setCenter(positionsFxList);
        jfxp.setScene(scene);
    });
}
Also used : Scene(javafx.scene.Scene) CustomerUpi(eu.ggnet.dwoss.customer.upi.CustomerUpi) java.util(java.util) javafx.scene.control(javafx.scene.control) eu.ggnet.saft.core.ops(eu.ggnet.saft.core.ops) URL(java.net.URL) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) JFXPanel(javafx.embed.swing.JFXPanel) eu.ggnet.dwoss.redtapext.ee.state(eu.ggnet.dwoss.redtapext.ee.state) DocumentStringRenderer(eu.ggnet.dwoss.redtapext.ui.cao.common.DocumentStringRenderer) ListSelectionEvent(javax.swing.event.ListSelectionEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) eu.ggnet.dwoss.util(eu.ggnet.dwoss.util) Logger(org.slf4j.Logger) CustomerService(eu.ggnet.dwoss.customer.opi.CustomerService) DossierTableView(eu.ggnet.dwoss.redtapext.ui.cao.dossierTable.DossierTableView) CustomerMetaData(eu.ggnet.dwoss.customer.opi.CustomerMetaData) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) ComponentPlacement(javax.swing.LayoutStyle.ComponentPlacement) eu.ggnet.saft.api.ui(eu.ggnet.saft.api.ui) java.awt(java.awt) Platform(javafx.application.Platform) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) PropertyChangeListener(java.beans.PropertyChangeListener) java.awt.event(java.awt.event) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) UNIT(eu.ggnet.dwoss.rules.PositionType.UNIT) javax.swing.border(javax.swing.border) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) PositionListCell(eu.ggnet.dwoss.redtapext.ui.cao.common.PositionListCell) ListSelectionListener(javax.swing.event.ListSelectionListener) eu.ggnet.saft(eu.ggnet.saft) javax.swing(javax.swing) JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) PositionListCell(eu.ggnet.dwoss.redtapext.ui.cao.common.PositionListCell) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) Scene(javafx.scene.Scene)

Example 2 with PicoUnit

use of eu.ggnet.dwoss.uniqueunit.api.PicoUnit in project dwoss by gg-net.

the class ConsumerFactoryOfStockTransactions method of.

@Override
public List<DescriptiveConsumer<PicoUnit>> of(PicoUnit t) {
    StockAgent stockAgent = Dl.remote().lookup(StockAgent.class);
    StockUnit su = stockAgent.findStockUnitByUniqueUnitIdEager(t.uniqueUnitId);
    if (su == null || su.isInTransaction())
        return Collections.EMPTY_LIST;
    Guardian guardian = Dl.local().lookup(Guardian.class);
    if (!guardian.hasRight(CREATE_TRANSACTION_FOR_SINGLE_UNIT))
        return Collections.EMPTY_LIST;
    return stockAgent.findAll(Stock.class).stream().filter(s -> !s.equals(su.getStock())).map(destination -> {
        return new DescriptiveConsumer<>("Umfuhr von " + su.getStock().getName() + " nach " + destination.getName(), (PicoUnit t1) -> {
            Ui.exec(() -> {
                Ui.build().dialog().eval(() -> new CreateQuestionModel(su, destination, "Umfuhr direkt durch Nutzer erzeugt"), () -> new CreateQuestionView()).opt().map(v -> ReplyUtil.wrap(() -> Dl.remote().lookup(StockTransactionProcessor.class).perpareTransfer(v.stockUnits, v.destination.getId(), Dl.local().lookup(Guardian.class).getUsername(), v.comment))).filter(Ui.failure()::handle).ifPresent(u -> Ui.build().alert("Umfuhr angelegt"));
            });
        });
    }).collect(Collectors.toList());
}
Also used : StockTransactionProcessor(eu.ggnet.dwoss.stock.ee.StockTransactionProcessor) DescriptiveConsumer(eu.ggnet.saft.core.ops.DescriptiveConsumer) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) Ui(eu.ggnet.saft.Ui) Collectors(java.util.stream.Collectors) Dl(eu.ggnet.saft.Dl) StockAgent(eu.ggnet.dwoss.stock.ee.StockAgent) Guardian(eu.ggnet.saft.core.auth.Guardian) List(java.util.List) ReplyUtil(eu.ggnet.dwoss.common.ReplyUtil) Stock(eu.ggnet.dwoss.stock.ee.entity.Stock) DescriptiveConsumerFactory(eu.ggnet.saft.core.ops.DescriptiveConsumerFactory) CREATE_TRANSACTION_FOR_SINGLE_UNIT(eu.ggnet.dwoss.rights.api.AtomicRight.CREATE_TRANSACTION_FOR_SINGLE_UNIT) Collections(java.util.Collections) StockAgent(eu.ggnet.dwoss.stock.ee.StockAgent) Guardian(eu.ggnet.saft.core.auth.Guardian) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit)

Example 3 with PicoUnit

use of eu.ggnet.dwoss.uniqueunit.api.PicoUnit in project dwoss by gg-net.

the class UnitViewTryout method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    final SpecGenerator GEN = new SpecGenerator();
    final List<ProductSpec> productSpecs = new ArrayList<>();
    final Map<String, ProductModel> productModels = new HashMap<>();
    final Map<String, ProductSeries> productSeries = new HashMap<>();
    final Map<String, ProductFamily> productFamily = new HashMap<>();
    final List<Product> products = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        ProductSpec spec = GEN.makeSpec();
        productSpecs.add(spec);
        products.add(new Product(spec.getModel().getFamily().getSeries().getGroup(), spec.getModel().getFamily().getSeries().getBrand(), spec.getPartNo(), spec.getModel().getName()));
        productModels.putIfAbsent(spec.getModel().getName(), spec.getModel());
        productFamily.putIfAbsent(spec.getModel().getFamily().getName(), spec.getModel().getFamily());
        productSeries.putIfAbsent(spec.getModel().getFamily().getSeries().getName(), spec.getModel().getFamily().getSeries());
    }
    // final Product product = new Product(spec.getModel().getFamily().getSeries().getGroup(),
    // spec.getModel().getFamily().getSeries().getBrand(), spec.getPartNo(), spec.getModel().getName());
    Dl.remote().add(Mandators.class, new Mandators() {

        @Override
        public Mandator loadMandator() {
            return Mandator.builder().defaultMailSignature(null).smtpConfiguration(null).mailTemplateLocation(null).company(CompanyGen.makeCompany()).dossierPrefix("DW").documentIntermix(null).documentIdentifierGeneratorConfigurations(new EnumMap<>(DocumentType.class)).build();
        }

        @Override
        public DefaultCustomerSalesdata loadSalesdata() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ReceiptCustomers loadReceiptCustomers() {
            return ReceiptCustomers.builder().build();
        }

        @Override
        public SpecialSystemCustomers loadSystemCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Contractors loadContractors() {
            return new Contractors(EnumSet.allOf(TradeName.class), TradeName.getManufacturers());
        }

        @Override
        public PostLedger loadPostLedger() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ShippingTerms loadShippingTerms() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(SpecAgent.class, new SpecAgent() {

        @Override
        public ProductSpec findProductSpecByPartNoEager(String partNo) {
            return productSpecs.stream().filter(p -> Objects.equals(partNo, p.getPartNo())).findFirst().orElse(null);
        }

        // <editor-fold defaultstate="collapsed" desc="Unneeded Methods">
        @Override
        public <T> long count(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            if (entityClass.equals(ProductSpec.class))
                return (List<T>) productSpecs;
            else if (entityClass.equals(ProductSeries.class))
                return (List<T>) new ArrayList<>(productSeries.values());
            else if (entityClass.equals(ProductFamily.class))
                return (List<T>) new ArrayList<>(productFamily.values());
            else if (entityClass.equals(ProductModel.class))
                return (List<T>) new ArrayList<>(productModels.values());
            return Collections.emptyList();
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            return findAll(entityClass);
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            return findAll(entityClass, start, amount);
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(UnitSupporter.class, new UnitSupporter() {

        @Override
        public boolean isRefurbishIdAvailable(String refurbishId) {
            return Pattern.matches("([2-8][0-9]{4}|A1[0-9]{3})", refurbishId);
        }

        @Override
        public boolean isSerialAvailable(String serial) {
            if (serial == null)
                return true;
            return !serial.startsWith("AAAA");
        }

        @Override
        public String findRefurbishIdBySerial(String serial) {
            if (serial == null)
                return null;
            if (serial.startsWith("B"))
                return "12345";
            return null;
        }
    });
    Dl.remote().add(UniqueUnitAgent.class, new UniqueUnitAgent() {

        @Override
        public Product findProductByPartNo(String partNo) {
            return products.stream().filter(p -> Objects.equals(partNo, p.getPartNo())).findFirst().orElse(null);
        }

        // <editor-fold defaultstate="collapsed" desc="Unneeded Methods">
        @Override
        public UniqueUnit findUnitByIdentifierEager(UniqueUnit.Identifier type, String identifier) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> long count(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Product findProductByPartNoEager(String partNo) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public CategoryProduct createOrUpdate(CategoryProductDto dto, String username) throws NullPointerException {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        // </editor-fold>
        @Override
        public Reply<Void> deleteCategoryProduct(long id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> addToUnitCollection(PicoUnit unit, long unitCollectionId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> unsetUnitCollection(PicoUnit unit) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<UnitCollection> createOnProduct(long productId, UnitCollectionDto dto, String username) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<UnitCollection> update(UnitCollectionDto dto, String username) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> delete(UnitCollection dto) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(ProductProcessor.class, new ProductProcessorStub());
    UnitController controller = new UnitController();
    UnitModel model = new UnitModel();
    model.setContractor(ONESELF);
    model.setMode(ACER);
    controller.setModel(model);
    final UnitView view = new UnitView(null);
    view.setModel(model);
    controller.setView(view);
    view.setController(controller);
    controller.init();
    // To Model
    view.setVisible(true);
    System.out.println("View canceled ? " + view.isCancel());
    System.out.println(view.getUnit());
    System.out.println(model.getProduct());
    System.out.println(model.getOperation());
    System.out.println(model.getOperationComment());
}
Also used : ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) UIManager(javax.swing.UIManager) java.util(java.util) TradeName(eu.ggnet.dwoss.rules.TradeName) ONESELF(eu.ggnet.dwoss.rules.TradeName.ONESELF) CategoryProductDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.CategoryProductDto) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) Dl(eu.ggnet.saft.Dl) UnitCollectionDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.UnitCollectionDto) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) DocumentType(eu.ggnet.dwoss.rules.DocumentType) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) UnitSupporter(eu.ggnet.dwoss.receipt.ee.UnitSupporter) Mandators(eu.ggnet.dwoss.mandator.Mandators) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) SpecAgent(eu.ggnet.dwoss.spec.ee.SpecAgent) eu.ggnet.dwoss.mandator.api.value(eu.ggnet.dwoss.mandator.api.value) SpecGenerator(eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator) ProductProcessor(eu.ggnet.dwoss.receipt.ee.ProductProcessor) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) Reply(eu.ggnet.saft.api.Reply) ACER(eu.ggnet.dwoss.rules.TradeName.ACER) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) Pattern(java.util.regex.Pattern) LockModeType(javax.persistence.LockModeType) ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) UnitCollectionDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.UnitCollectionDto) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Mandators(eu.ggnet.dwoss.mandator.Mandators) LockModeType(javax.persistence.LockModeType) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) UnitSupporter(eu.ggnet.dwoss.receipt.ee.UnitSupporter) SpecAgent(eu.ggnet.dwoss.spec.ee.SpecAgent) SpecGenerator(eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) DocumentType(eu.ggnet.dwoss.rules.DocumentType) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) CategoryProductDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.CategoryProductDto) Reply(eu.ggnet.saft.api.Reply)

Example 4 with PicoUnit

use of eu.ggnet.dwoss.uniqueunit.api.PicoUnit in project dwoss by gg-net.

the class AssignmentController method unassignUnit.

@FXML
private void unassignUnit(ActionEvent event) {
    List<UniqueUnit> selected = assignedUnitsList.getSelectionModel().getSelectedItems();
    if (!selected.isEmpty()) {
        for (UniqueUnit uu : selected) {
            Optional.of(Dl.remote().lookup(UniqueUnitAgent.class).unsetUnitCollection(new PicoUnit(uu.getId(), "RefurbishedId=" + uu.getRefurbishId()))).filter(r -> {
                return Ui.failure().handle(r);
            }).ifPresent(c -> {
                unassignedUnitsList.getItems().add(uu);
                assignedUnitsList.getItems().remove(uu);
            });
        }
        unassignedUnitsList.getSelectionModel().clearSelection();
    }
}
Also used : EventHandler(javafx.event.EventHandler) Title(eu.ggnet.saft.api.ui.Title) java.util(java.util) Initializable(javafx.fxml.Initializable) ListView(javafx.scene.control.ListView) URL(java.net.URL) ListCell(javafx.scene.control.ListCell) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) MULTIPLE(javafx.scene.control.SelectionMode.MULTIPLE) Ui(eu.ggnet.saft.Ui) Dl(eu.ggnet.saft.Dl) FxController(eu.ggnet.saft.api.ui.FxController) StockApi(eu.ggnet.dwoss.stock.api.StockApi) PicoProduct(eu.ggnet.dwoss.uniqueunit.api.PicoProduct) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) javafx.scene.input(javafx.scene.input) Logger(org.slf4j.Logger) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) Guardian(eu.ggnet.saft.core.auth.Guardian) ActionEvent(javafx.event.ActionEvent) Reply(eu.ggnet.saft.api.Reply) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) ObservableValue(javafx.beans.value.ObservableValue) BorderPane(javafx.scene.layout.BorderPane) ChangeListener(javafx.beans.value.ChangeListener) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) FXML(javafx.fxml.FXML)

Example 5 with PicoUnit

use of eu.ggnet.dwoss.uniqueunit.api.PicoUnit in project dwoss by gg-net.

the class AssignmentController method assignUnit.

@FXML
private void assignUnit(ActionEvent event) {
    List<UniqueUnit> selected = unassignedUnitsList.getSelectionModel().getSelectedItems();
    UnitCollection selectedCollection = unitCollectionList.getSelectionModel().getSelectedItem();
    if (!selected.isEmpty()) {
        for (UniqueUnit uu : selected) {
            Dl.remote().lookup(UniqueUnitAgent.class).addToUnitCollection(new PicoUnit(uu.getId(), "RefurbishedId=" + uu.getRefurbishId()), selectedCollection.getId());
            assignedUnitsList.getItems().add(uu);
            unassignedUnitsList.getItems().remove(uu);
        }
        unassignedUnitsList.getSelectionModel().clearSelection();
    }
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) FXML(javafx.fxml.FXML)

Aggregations

PicoUnit (eu.ggnet.dwoss.uniqueunit.api.PicoUnit)6 UniqueUnitAgent (eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent)4 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)4 UnitCollection (eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection)4 Dl (eu.ggnet.saft.Dl)4 java.util (java.util)4 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)3 Ui (eu.ggnet.saft.Ui)3 Reply (eu.ggnet.saft.api.Reply)3 Guardian (eu.ggnet.saft.core.auth.Guardian)3 URL (java.net.URL)3 Collectors (java.util.stream.Collectors)3 FXCollections (javafx.collections.FXCollections)3 FXML (javafx.fxml.FXML)3 StockApi (eu.ggnet.dwoss.stock.api.StockApi)2 PicoProduct (eu.ggnet.dwoss.uniqueunit.api.PicoProduct)2 FxController (eu.ggnet.saft.api.ui.FxController)2 Title (eu.ggnet.saft.api.ui.Title)2 List (java.util.List)2 ChangeListener (javafx.beans.value.ChangeListener)2