Search in sources :

Example 51 with ActionEvent

use of javafx.event.ActionEvent in project financial by greatkendy123.

the class LMController method exportClubOneKeyAction.

/**
 * 一键导出俱乐部帐单
 *
 * @param event
 */
public void exportClubOneKeyAction(ActionEvent event) {
    // 循环遍历每一个有数据的团队并导出
    ObservableList<String> obList = clubListView.getItems();
    if (!CollectUtil.isHaveValue(obList)) {
        ShowUtil.show("小林提示:没有俱乐部数据!不导出Excel哦!", 2);
        return;
    } else {
        // 2 遍历
        for (String teamId : obList) {
            clubListView.getSelectionModel().select(teamId);
            exportSingleClubAction(new ActionEvent());
            log.info("一键导出俱乐部帐单Excel: " + teamId);
        }
    }
}
Also used : ActionEvent(javafx.event.ActionEvent)

Example 52 with ActionEvent

use of javafx.event.ActionEvent in project financial by greatkendy123.

the class SMAutoController method initialize.

/**
 * DOM加载完后的事件
 */
@SuppressWarnings("unchecked")
@Override
public void initialize(URL location, ResourceBundle resources) {
    // 换行
    tokenArea.setWrapText(true);
    // 绑定列值属性
    MyController.bindCellValue(smAutoDate, smAutoPlayerId, smAutoPlayerName, smAutoPaiju, smAutoApplyAccount, smAutoIsTeamAvailabel, smAutoIsCurrentDay, smAutoIsNextDay, smAutoIsAgree, smAutoIsAgreeSuccess, smAutoAvailabel, smAutoTeamTotalAvailabel);
    // bindColorColumns(new TGLirunInfo(),tgLirunTotalProfit,
    // tgLirunTotalKaixiao, tgLirunATMCompany, tgLirunTGCompany,
    // tgLirunTeamProfit, tgLirunRestHeji, tgLirunHeji);
    // 初始化次日上码范围
    initNextDayRange();
    loadTokenAction(new ActionEvent());
}
Also used : ActionEvent(javafx.event.ActionEvent)

Example 53 with ActionEvent

use of javafx.event.ActionEvent 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 54 with ActionEvent

use of javafx.event.ActionEvent in project dwoss by gg-net.

the class CustomerSearchController method initialize.

@Override
public void initialize(URL url, ResourceBundle rb) {
    resultListView.setCellFactory(listView -> {
        return new ListCell<PicoCustomer>() {

            @Override
            protected void updateItem(PicoCustomer item, boolean empty) {
                super.updateItem(item, empty);
                // Platform.runLater(() -> { // WTF i need this, i don't know, but otherwise
                if (item == null || empty) {
                    setText("");
                } else {
                    setText(item.getShortDescription());
                }
            // });
            }
        };
    });
    // bind the checkboxes to the Set of SearchField
    bindCheckBoxes();
    // add contextmenu to listview
    resultListView.setContextMenu(buildContextMenu());
    CUSTOMER_TASK_SERVICE = new CustomerTaskService();
    observableCustomers = CUSTOMER_TASK_SERVICE.getPartialResults();
    resultListView.setItems(observableCustomers);
    searchButton.setOnAction((ActionEvent event) -> search());
    searchField.setOnKeyPressed((ke) -> {
        if (ke.getCode() == KeyCode.ENTER) {
            search();
        }
    });
    SEARCH_PROPERTY.bind(searchField.textProperty());
    // Needed, so the bar will fill the space, otherwise it keeps beeing small
    progressBar.setMaxWidth(MAX_VALUE);
    progressBar.setMaxHeight(MAX_VALUE);
    // hidde the HBox
    progressBar.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    progressIndicator.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    statusHbox.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    progressIndicator.setProgress(0);
    progressBar.setProgress(0);
    progressBar.progressProperty().bind(CUSTOMER_TASK_SERVICE.progressProperty());
    progressIndicator.progressProperty().bind(CUSTOMER_TASK_SERVICE.progressProperty());
    Ui.progress().observe(CUSTOMER_TASK_SERVICE);
}
Also used : CustomerTaskService(eu.ggnet.dwoss.customer.ui.CustomerTaskService) ActionEvent(javafx.event.ActionEvent) PicoCustomer(eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)

Example 55 with ActionEvent

use of javafx.event.ActionEvent in project dwoss by gg-net.

the class ShipmentUpdateStage method init.

private void init(Shipment s) {
    okButton.setOnAction((ActionEvent event) -> {
        shipment = getShipment();
        if (isValid())
            close();
    });
    cancelButton.setOnAction((ActionEvent event) -> {
        close();
    });
    idField = new TextField(Long.toString(s.getId()));
    idField.setDisable(true);
    shipIdField = new TextField(s.getShipmentId());
    Callback<ListView<TradeName>, ListCell<TradeName>> cb = new Callback<ListView<TradeName>, ListCell<TradeName>>() {

        @Override
        public ListCell<TradeName> call(ListView<TradeName> param) {
            return new ListCell<TradeName>() {

                @Override
                protected void updateItem(TradeName item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item == null || empty)
                        setText("Hersteller wählen...");
                    else
                        setText(item.getName());
                }
            };
        }
    };
    Set<TradeName> contractors = Dl.local().lookup(CachedMandators.class).loadContractors().all();
    ownerBox = new ComboBox<>(FXCollections.observableArrayList(contractors));
    ownerBox.setMaxWidth(MAX_VALUE);
    ownerBox.setCellFactory(cb);
    ownerBox.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends TradeName> observable, TradeName oldValue, TradeName newValue) -> {
        if (newValue == null)
            return;
        shipment.setContractor(newValue);
        manufacturerBox.getSelectionModel().select(newValue.getManufacturer());
    });
    ObservableList<TradeName> manufacturers = FXCollections.observableArrayList(TradeName.getManufacturers());
    manufacturerBox = new ComboBox<>(manufacturers);
    manufacturerBox.setMaxWidth(MAX_VALUE);
    manufacturerBox.setCellFactory(cb);
    SingleSelectionModel<TradeName> sm = ownerBox.getSelectionModel();
    if (s.getContractor() == null)
        sm.selectFirst();
    else
        sm.select(s.getContractor());
    if (shipment.getDefaultManufacturer() != null)
        manufacturerBox.getSelectionModel().select(shipment.getDefaultManufacturer());
    statusBox = new ComboBox<>(FXCollections.observableArrayList(Shipment.Status.values()));
    statusBox.setMaxWidth(MAX_VALUE);
    statusBox.getSelectionModel().select(s.getStatus() == null ? OPENED : s.getStatus());
    GridPane grid = new GridPane();
    grid.addRow(1, new Label("ID:"), idField);
    grid.addRow(2, new Label("Shipment ID:"), shipIdField);
    grid.addRow(3, new Label("Besitzer:"), ownerBox);
    grid.addRow(4, new Label("Hersteller:"), manufacturerBox);
    grid.addRow(5, new Label("Status"), statusBox);
    grid.setMaxWidth(MAX_VALUE);
    grid.vgapProperty().set(2.);
    grid.getColumnConstraints().add(0, new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.SOMETIMES, HPos.LEFT, false));
    grid.getColumnConstraints().add(1, new ColumnConstraints(100, 150, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));
    HBox hButtonBox = new HBox(okButton, cancelButton);
    hButtonBox.alignmentProperty().set(Pos.TOP_RIGHT);
    errorLabel.setWrapText(true);
    BorderPane rootPane = new BorderPane(grid, errorLabel, null, hButtonBox, null);
    this.setTitle(s.getId() > 0 ? "Shipment bearbeiten" : "Shipment anlegen");
    this.setScene(new Scene(rootPane));
    this.setResizable(false);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ActionEvent(javafx.event.ActionEvent) ObservableValue(javafx.beans.value.ObservableValue) Scene(javafx.scene.Scene) Callback(javafx.util.Callback)

Aggregations

ActionEvent (javafx.event.ActionEvent)171 EventHandler (javafx.event.EventHandler)61 Stage (javafx.stage.Stage)52 KeyFrame (javafx.animation.KeyFrame)47 Timeline (javafx.animation.Timeline)47 FXML (javafx.fxml.FXML)44 Alert (javafx.scene.control.Alert)36 Button (javafx.scene.control.Button)35 Label (javafx.scene.control.Label)35 MenuItem (javafx.scene.control.MenuItem)33 ContextMenu (javafx.scene.control.ContextMenu)25 File (java.io.File)24 Insets (javafx.geometry.Insets)24 Scene (javafx.scene.Scene)24 List (java.util.List)21 ObservableList (javafx.collections.ObservableList)21 Node (javafx.scene.Node)20 TextField (javafx.scene.control.TextField)20 Optional (java.util.Optional)18 FXCollections (javafx.collections.FXCollections)18