Search in sources :

Example 26 with Subscribe

use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.

the class DialogsScreen method onInpDlgActionsBtnClick.

// end::create-input-dialog-params[]
// tag::create-input-dialog-actions[]
@Subscribe("inpDlgActionsBtn")
public void onInpDlgActionsBtnClick(Button.ClickEvent event) {
    dialogs.createInputDialog(this).withCaption("Enter some values").withParameters(InputParameter.stringParameter("name").withCaption("Name")).withActions(InputDialogAction.action("confirm").withCaption("Confirm").withPrimary(true).withHandler(actionEvent -> {
        InputDialog dialog = actionEvent.getInputDialog();
        // <2>
        String name = dialog.getValue("name");
        // <3>
        dialog.closeWithDefaultAction();
    // process entered values...
    }), InputDialogAction.action("refuse").withCaption("Refuse").withValidationRequired(false).withHandler(actionEvent -> actionEvent.getInputDialog().closeWithDefaultAction())).show();
}
Also used : InputDialog(io.jmix.ui.app.inputdialog.InputDialog) Subscribe(io.jmix.ui.screen.Subscribe)

Example 27 with Subscribe

use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.

the class SerialChartJsonTitle method onInit.

@Subscribe
private void onInit(InitEvent event) {
    ListDataProvider serialChartDataProvider = new ListDataProvider();
    int[] serialChartData = { 5, 7, 6, 9, 7, 8, 5, 6, 4, 6, 5, 7, 4, 5, 3, 4, 2, 0 };
    for (int i = 0; i < serialChartData.length; i++) {
        serialChartDataProvider.addItem(graphData(serialChartData[i]));
    }
    serialChart.setDataProvider(serialChartDataProvider);
    // end::json-title1[]
    // tag::json[]
    serialChart.setNativeJson("{\n" + " \"titles\": [\n" + " {\n" + " \"size\": 15,\n" + " \"text\": \"Chart Title\"\n" + " }\n" + " ]\n" + "}");
// end::json[]
// tag::json-title2[]
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) Subscribe(io.jmix.ui.screen.Subscribe)

Example 28 with Subscribe

use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.

the class StackedareaChart method onInit.

@Subscribe
private void onInit(InitEvent event) {
    ListDataProvider dataProvider = new ListDataProvider();
    dataProvider.addItem(transportCount(1994, 1587, 650, 121));
    dataProvider.addItem(transportCount(1995, 1567, 683, 146));
    dataProvider.addItem(transportCount(1996, 1617, 691, 138));
    dataProvider.addItem(transportCount(1997, 1630, 642, 127));
    dataProvider.addItem(transportCount(1998, 1660, 699, 105));
    dataProvider.addItem(transportCount(1999, 1683, 721, 109));
    dataProvider.addItem(transportCount(2000, 1691, 737, 112));
    dataProvider.addItem(transportCount(2001, 1298, 680, 101));
    dataProvider.addItem(transportCount(2002, 1275, 664, 97));
    dataProvider.addItem(transportCount(2003, 1246, 648, 93));
    dataProvider.addItem(transportCount(2004, 1318, 697, 111));
    dataProvider.addItem(transportCount(2005, 1213, 633, 87));
    dataProvider.addItem(transportCount(2006, 1199, 621, 79));
    dataProvider.addItem(transportCount(2007, 1110, 210, 81));
    dataProvider.addItem(transportCount(2008, 1165, 232, 75));
    dataProvider.addItem(transportCount(2009, 1145, 219, 88));
    dataProvider.addItem(transportCount(2010, 1163, 201, 82));
    dataProvider.addItem(transportCount(2011, 1180, 285, 87));
    dataProvider.addItem(transportCount(2012, 1159, 277, 71));
    chart.setDataProvider(dataProvider);
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) Subscribe(io.jmix.ui.screen.Subscribe)

Example 29 with Subscribe

use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.

the class CurrencyFieldScreen method onInit.

@Subscribe
public void onInit(InitEvent event) {
    // InstanceContainer initialization. It is usually done automatically if the screen is
    // inherited from StandardEditor and is used as an entity editor.
    Product product = metadata.create(Product.class);
    productDc.setItem(product);
}
Also used : Product(ui.ex1.entity.Product) Subscribe(io.jmix.ui.screen.Subscribe)

Example 30 with Subscribe

use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.

the class FileStorageUploadFieldScreen method onManuallyControlledFieldFileUploadSucceed.

@Subscribe("manuallyControlledField")
public void onManuallyControlledFieldFileUploadSucceed(SingleFileUploadField.FileUploadSucceedEvent event) {
    // <1>
    File file = temporaryStorage.getFile(manuallyControlledField.getFileId());
    if (file != null) {
        notifications.create().withCaption("File is uploaded to temporary storage at " + file.getAbsolutePath()).show();
    }
    // <2>
    // <3>
    FileRef fileRef = temporaryStorage.putFileIntoStorage(manuallyControlledField.getFileId(), event.getFileName());
    manuallyControlledField.setValue(fileRef);
    notifications.create().withCaption("Uploaded file: " + manuallyControlledField.getFileName()).show();
}
Also used : FileRef(io.jmix.core.FileRef) File(java.io.File) Subscribe(io.jmix.ui.screen.Subscribe)

Aggregations

Subscribe (io.jmix.ui.screen.Subscribe)79 Report (io.jmix.reports.entity.Report)8 Screen (io.jmix.ui.screen.Screen)8 ListDataProvider (io.jmix.ui.data.impl.ListDataProvider)5 UiController (io.jmix.ui.screen.UiController)5 UiDescriptor (io.jmix.ui.screen.UiDescriptor)5 UUID (java.util.UUID)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 ReportOutputDocument (com.haulmont.yarg.reporting.ReportOutputDocument)4 FileRef (io.jmix.core.FileRef)4 BigDecimal (java.math.BigDecimal)4 Date (java.util.Date)4 List (java.util.List)4 Order (test_support.entity.sales.Order)4 Metadata (io.jmix.core.Metadata)3 Visit (io.jmix.petclinic.entity.visit.Visit)3 UiReportRunContext (io.jmix.reportsui.runner.UiReportRunContext)3 FilterCondition (io.jmix.ui.entity.FilterCondition)3 GroupFilterCondition (io.jmix.ui.entity.GroupFilterCondition)3 LogicalFilterCondition (io.jmix.ui.entity.LogicalFilterCondition)3