Search in sources :

Example 1 with UnitCollection

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection in project dwoss by gg-net.

the class TreeTableController method getUnitCollections.

private ObservableList<TreeItem<DataWrapper>> getUnitCollections(Product product) {
    ObservableList<TreeItem<DataWrapper>> result = FXCollections.observableArrayList();
    for (UnitCollection uc : loadUnitCollections(product)) {
        TreeItem<DataWrapper> item = new TreeItem<>();
        UnitCollectionWrapper unitCollectionWrapper = new UnitCollectionWrapper(item, uc);
        item.setValue(unitCollectionWrapper);
        result.add(item);
    }
    return result;
}
Also used : UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) TreeItem(javafx.scene.control.TreeItem)

Example 2 with UnitCollection

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection in project dwoss by gg-net.

the class UnitCollectionGenerator method generateUnitCollections.

public List<UnitCollection> generateUnitCollections() {
    List<UnitCollection> collections = new ArrayList<>();
    for (int i = 0; i < names.size(); i++) {
        UnitCollection uc = new UnitCollection();
        uc.setNameExtension(names.get(i));
        uc.setSalesChannel(SalesChannel.RETAILER);
        uc.setDescriptionExtension("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
        uc.setPrice(PriceType.SALE, 350.00, "comment");
        for (int j = 0; j < 3; j++) {
            uc.getUnits().add(uuGen.makeUniqueUnit(tradeName.get(rand.nextInt(tradeName.size())), productGroup.get(rand.nextInt(productGroup.size()))));
        }
        collections.add(uc);
    }
    return collections;
}
Also used : UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection)

Example 3 with UnitCollection

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection in project dwoss by gg-net.

the class AssignmentController method addUnitCollection.

@FXML
private void addUnitCollection() {
    final PicoProduct selectedProduct = productList.getSelectionModel().getSelectedItem();
    if (selectedProduct == null)
        return;
    Ui.exec(() -> {
        Ui.build(root).fxml().eval(() -> new UnitCollection(), UnitCollectionEditorController.class).opt().map(dto -> Dl.remote().lookup(UniqueUnitAgent.class).createOnProduct(selectedProduct.getId(), dto, Dl.local().lookup(Guardian.class).getUsername())).filter(Ui.failure()::handle).map(Reply::getPayload).ifPresent(uc -> {
            unitCollectionList.getItems().add(uc);
        });
    });
}
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) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) PicoProduct(eu.ggnet.dwoss.uniqueunit.api.PicoProduct) FXML(javafx.fxml.FXML)

Example 4 with UnitCollection

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection in project dwoss by gg-net.

the class UnitCollectionGenerator method generateUnitCollections.

public List<UnitCollection> generateUnitCollections() {
    List<UnitCollection> collections = new ArrayList<>();
    for (int i = 0; i < names.size(); i++) {
        UnitCollection uc = new UnitCollection();
        uc.setNameExtension(names.get(i));
        uc.setSalesChannel(SalesChannel.RETAILER);
        uc.setDescriptionExtension("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
        uc.setPrice(PriceType.SALE, 350.00, "comment");
        for (int j = 0; j < 3; j++) {
            uc.getUnits().add(uuGen.makeUniqueUnit(tradeName.get(rand.nextInt(tradeName.size())), productGroup.get(rand.nextInt(productGroup.size()))));
        }
        collections.add(uc);
    }
    return collections;
}
Also used : UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection)

Example 5 with UnitCollection

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection in project dwoss by gg-net.

the class UnitCollectionEditorTryout method main.

/**
 * The main() method is ignored in correctly deployed JavaFX application.
 * main() serves only as fallback in case the application can not be
 * launched through deployment artifacts, e.g., in IDEs with limited FX
 * support. NetBeans ignores main().
 *
 * @param args the command line arguments
 * @throws java.lang.InterruptedException
 */
public static void main(String[] args) throws InterruptedException {
    UnitCollectionGenerator ucg = new UnitCollectionGenerator();
    UnitCollection uc = ucg.generateUnitCollections().get(0);
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton run = new JButton("OpenUi");
    run.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> uc, UnitCollectionEditorController.class).opt().ifPresent(System.out::println);
        });
    });
    JPanel p = new JPanel();
    p.add(run);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) UnitCollectionGenerator(tryout.stub.UnitCollectionGenerator) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) JButton(javax.swing.JButton)

Aggregations

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