Search in sources :

Example 1 with HtmlPane

use of eu.ggnet.dwoss.util.HtmlPane in project dwoss by gg-net.

the class CustomerSearchController method buildContextMenu.

/**
 * Build a ContextMenu for ListView of the search results for a better navigation
 *
 * @return ContextMenu the filled ContextMenu
 */
private ContextMenu buildContextMenu() {
    // Create a ContextMenu
    ContextMenu contextMenu = new ContextMenu();
    MenuItem viewCustomer = new MenuItem("Detailansicht");
    MenuItem viewCompleteCustomer = new MenuItem("Detailansicht inc. aller Mandatendetails");
    MenuItem editCustomer = new MenuItem("Bearbeiten");
    // adding actions to the context menu
    viewCustomer.setOnAction((ActionEvent event) -> {
        // open toHtml(String matchcode, DefaultCustomerSalesdata defaults)
        if (resultListView.getSelectionModel().getSelectedItem() == null)
            return;
        PicoCustomer selectedCustomer = resultListView.getSelectionModel().getSelectedItem();
        Ui.exec(() -> {
            Ui.build(statusHbox).title("Kunde mit Mandant").fx().show(() -> Css.toHtml5WithStyle(AGENT.findCustomerAsMandatorHtml(selectedCustomer.getId())), () -> new HtmlPane());
        });
    });
    viewCompleteCustomer.setOnAction((ActionEvent event) -> {
        // open toHtml(String salesRow, String comment)
        if (resultListView.getSelectionModel().getSelectedItem() == null)
            return;
        PicoCustomer selectedCustomer = resultListView.getSelectionModel().getSelectedItem();
        Ui.exec(() -> {
            Ui.build(statusHbox).title("Kunden Ansicht").fx().show(() -> Css.toHtml5WithStyle(AGENT.findCustomerAsHtml(selectedCustomer.getId())), () -> new HtmlPane());
        });
    });
    editCustomer.setOnAction((ActionEvent event) -> {
        if (resultListView.getSelectionModel().getSelectedItem() == null)
            return;
        PicoCustomer picoCustomer = resultListView.getSelectionModel().getSelectedItem();
        Ui.exec(() -> {
            Customer customer = Ui.progress().call(() -> AGENT.findByIdEager(Customer.class, picoCustomer.getId()));
            if (!customer.isValid()) {
                Ui.build(resultListView).title("Fehlerhafter Datensatz").alert().message("Kundendaten sind invalid (aktuell normal): " + customer.getViolationMessage()).show(AlertType.WARNING);
            } else if (customer.isSimple()) {
                L.info("Edit Simple Customer {}", customer.getId());
                Optional<CustomerContinue> result = Ui.build(resultListView).fxml().eval(() -> customer, CustomerSimpleController.class).opt();
                if (!result.isPresent())
                    return;
                Reply<Customer> reply = Dl.remote().lookup(CustomerAgent.class).store(result.get().simpleCustomer);
                if (!Ui.failure().handle(reply))
                    return;
                if (!result.get().continueEnhance)
                    return;
                Ui.build(statusHbox).fxml().eval(() -> reply.getPayload(), CustomerEnhanceController.class).opt().ifPresent(c -> Ui.build(statusHbox).alert("Would store + " + c));
            } else if (customer.isBusiness()) {
                L.info("Edit (Complex) Customer {}", customer.getId());
                Ui.build(statusHbox).fxml().eval(() -> customer, CustomerEnhanceController.class).opt().ifPresent(c -> Ui.build(statusHbox).alert("Would store + " + c));
            }
        });
    });
    // add MenuItemes to ContextMenu
    contextMenu.getItems().addAll(viewCustomer, viewCompleteCustomer, editCustomer);
    return contextMenu;
}
Also used : java.util(java.util) Initializable(javafx.fxml.Initializable) javafx.scene.control(javafx.scene.control) URL(java.net.URL) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) CustomerContinue(eu.ggnet.dwoss.customer.ui.neo.CustomerSimpleController.CustomerContinue) Ui(eu.ggnet.saft.Ui) PicoCustomer(eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer) Dl(eu.ggnet.saft.Dl) AlertType(eu.ggnet.saft.core.ui.AlertType) READY(javafx.concurrent.Worker.State.READY) CustomerAgent(eu.ggnet.dwoss.customer.ee.CustomerAgent) KeyCode(javafx.scene.input.KeyCode) HBox(javafx.scene.layout.HBox) Logger(org.slf4j.Logger) Css(eu.ggnet.dwoss.rules.Css) CustomerTaskService(eu.ggnet.dwoss.customer.ui.CustomerTaskService) eu.ggnet.saft.api.ui(eu.ggnet.saft.api.ui) FXML(javafx.fxml.FXML) ActionEvent(javafx.event.ActionEvent) MAX_VALUE(java.lang.Double.MAX_VALUE) SearchField(eu.ggnet.dwoss.customer.ee.entity.Customer.SearchField) FxSaft(eu.ggnet.saft.core.ui.FxSaft) Reply(eu.ggnet.saft.api.Reply) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) ObservableList(javafx.collections.ObservableList) StringProperty(javafx.beans.property.StringProperty) HtmlPane(eu.ggnet.dwoss.util.HtmlPane) PicoCustomer(eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) ActionEvent(javafx.event.ActionEvent) Reply(eu.ggnet.saft.api.Reply) PicoCustomer(eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer) HtmlPane(eu.ggnet.dwoss.util.HtmlPane)

Example 2 with HtmlPane

use of eu.ggnet.dwoss.util.HtmlPane in project dwoss by gg-net.

the class UnitAvailabilityViewCask method resultListMouseClicked.

// </editor-fold>//GEN-END:initComponents
private void resultListMouseClicked(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_resultListMouseClicked
    if (evt.getClickCount() != 2)
        return;
    UnitShard us = resultList.getSelectedValue();
    if (us == null || us.getAvailable() == null)
        return;
    Ui.exec(() -> {
        Ui.build().id(us.getRefurbishedId()).fx().show(() -> Dl.remote().lookup(UnitOverseer.class).toDetailedHtml(us.getRefurbishedId(), Dl.local().lookup(Guardian.class).getUsername()), () -> new HtmlPane());
    });
}
Also used : UnitShard(eu.ggnet.dwoss.uniqueunit.api.UnitShard) Guardian(eu.ggnet.saft.core.auth.Guardian) HtmlPane(eu.ggnet.dwoss.util.HtmlPane)

Example 3 with HtmlPane

use of eu.ggnet.dwoss.util.HtmlPane in project dwoss by gg-net.

the class ReturnsReportViewComponent method reportLineTableMouseClicked.

// </editor-fold>//GEN-END:initComponents
private void reportLineTableMouseClicked(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_reportLineTableMouseClicked
    if (evt.getClickCount() != 2)
        return;
    int convertRowIndexToModel = reportLineTable.convertRowIndexToModel(reportLineTable.getSelectedRow());
    Ui.exec(() -> {
        Ui.build().parent(this).fx().show(() -> model.getLines().get(convertRowIndexToModel).getReportLine().toHtml(), () -> new HtmlPane());
    });
}
Also used : HtmlPane(eu.ggnet.dwoss.util.HtmlPane)

Example 4 with HtmlPane

use of eu.ggnet.dwoss.util.HtmlPane in project dwoss by gg-net.

the class HtmlPaneTryout method main.

public static void main(String[] args) {
    UiCore.startSwing(() -> new JLabel("Main Application"));
    Ui.exec(() -> {
        Ui.build().fx().show(() -> "<h1>Hallo HTML Pane</h1>", () -> new HtmlPane());
    });
}
Also used : JLabel(javax.swing.JLabel) HtmlPane(eu.ggnet.dwoss.util.HtmlPane)

Example 5 with HtmlPane

use of eu.ggnet.dwoss.util.HtmlPane in project dwoss by gg-net.

the class GenerateOnePriceAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Ui.build().title("Bitte SopoNr eingeben :").dialog().eval(() -> {
            TextInputDialog dialog = new TextInputDialog();
            dialog.setContentText("Bitte SopoNr eingeben :");
            return dialog;
        }).opt().filter(s -> !StringUtils.isBlank(s)).map(r -> ReplyUtil.wrap(() -> Dl.remote().lookup(Exporter.class).onePrice(r))).filter(Ui.failure()::handle).map(Reply::getPayload).ifPresent(p -> Ui.build().modality(WINDOW_MODAL).title("SopoNr").fx().show(() -> Css.toHtml5WithStyle(PriceEngineResultFormater.toSimpleHtml(p)), () -> new HtmlPane()));
    });
}
Also used : Css(eu.ggnet.dwoss.rules.Css) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) CREATE_ONE_PRICE(eu.ggnet.dwoss.rights.api.AtomicRight.CREATE_ONE_PRICE) Ui(eu.ggnet.saft.Ui) ActionEvent(java.awt.event.ActionEvent) StringUtils(org.apache.commons.lang3.StringUtils) Dl(eu.ggnet.saft.Dl) ReplyUtil(eu.ggnet.dwoss.common.ReplyUtil) TextInputDialog(javafx.scene.control.TextInputDialog) Reply(eu.ggnet.saft.api.Reply) WINDOW_MODAL(javafx.stage.Modality.WINDOW_MODAL) HtmlPane(eu.ggnet.dwoss.util.HtmlPane) PriceEngineResultFormater(eu.ggnet.dwoss.price.engine.support.PriceEngineResultFormater) HtmlPane(eu.ggnet.dwoss.util.HtmlPane) TextInputDialog(javafx.scene.control.TextInputDialog)

Aggregations

HtmlPane (eu.ggnet.dwoss.util.HtmlPane)7 Css (eu.ggnet.dwoss.rules.Css)2 Dl (eu.ggnet.saft.Dl)2 Ui (eu.ggnet.saft.Ui)2 Reply (eu.ggnet.saft.api.Reply)2 Guardian (eu.ggnet.saft.core.auth.Guardian)2 ReplyUtil (eu.ggnet.dwoss.common.ReplyUtil)1 CustomerAgent (eu.ggnet.dwoss.customer.ee.CustomerAgent)1 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)1 SearchField (eu.ggnet.dwoss.customer.ee.entity.Customer.SearchField)1 PicoCustomer (eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)1 CustomerTaskService (eu.ggnet.dwoss.customer.ui.CustomerTaskService)1 CustomerContinue (eu.ggnet.dwoss.customer.ui.neo.CustomerSimpleController.CustomerContinue)1 PriceEngineResultFormater (eu.ggnet.dwoss.price.engine.support.PriceEngineResultFormater)1 CREATE_ONE_PRICE (eu.ggnet.dwoss.rights.api.AtomicRight.CREATE_ONE_PRICE)1 UnitShard (eu.ggnet.dwoss.uniqueunit.api.UnitShard)1 Authorisation (eu.ggnet.saft.api.auth.Authorisation)1 eu.ggnet.saft.api.ui (eu.ggnet.saft.api.ui)1 AccessableAction (eu.ggnet.saft.core.auth.AccessableAction)1 AlertType (eu.ggnet.saft.core.ui.AlertType)1