Search in sources :

Example 1 with ItemTrackingAction

use of io.jmix.ui.action.ItemTrackingAction in project jmix-docs by Haulmont.

the class SubscriptionBrowse method onBeforeShow.

@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
    Action buildTemplateAction = new ItemTrackingAction("buildTemplateAction").withHandler(actionPerformedEvent -> onBuildTemplateClick());
    subscriptionsTable.addAction(buildTemplateAction);
    bTempBtn.setAction(buildTemplateAction);
}
Also used : ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) Action(io.jmix.ui.action.Action) ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction)

Example 2 with ItemTrackingAction

use of io.jmix.ui.action.ItemTrackingAction in project jmix by jmix-framework.

the class AbstractComponentLoader method loadActionConstraint.

protected void loadActionConstraint(Action action, Element element) {
    if (action instanceof Action.HasSecurityConstraint) {
        Action.HasSecurityConstraint itemTrackingAction = (Action.HasSecurityConstraint) action;
        Attribute operationTypeAttribute = element.attribute("constraintEntityOp");
        if (operationTypeAttribute != null) {
            EntityOp operationType = EntityOp.fromId(operationTypeAttribute.getValue());
            itemTrackingAction.setConstraintEntityOp(operationType);
        }
    }
}
Also used : Action(io.jmix.ui.action.Action) ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) BaseAction(io.jmix.ui.action.BaseAction) Attribute(org.dom4j.Attribute) EntityOp(io.jmix.core.security.EntityOp)

Example 3 with ItemTrackingAction

use of io.jmix.ui.action.ItemTrackingAction in project jmix by jmix-framework.

the class EntityInspectorBrowser method createWipeOutAction.

private Action createWipeOutAction(Table table) {
    ListAction action = new ItemTrackingAction(WIPE_OUT_ACTION_ID).withCaption(messages.getMessage(EntityInspectorBrowser.class, "wipeOut")).withHandler(event -> showWipeOutDialog());
    action.setTarget(table);
    return action;
}
Also used : ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) ListAction(io.jmix.ui.action.ListAction)

Example 4 with ItemTrackingAction

use of io.jmix.ui.action.ItemTrackingAction in project jmix by jmix-framework.

the class EntityInspectorBrowser method createRestoreAction.

private Action createRestoreAction(Table table) {
    ListAction action = new ItemTrackingAction(RESTORE_ACTION_ID).withCaption(messages.getMessage(EntityInspectorBrowser.class, "restore")).withHandler(event -> showRestoreDialog());
    action.setTarget(table);
    return action;
}
Also used : ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) ListAction(io.jmix.ui.action.ListAction)

Example 5 with ItemTrackingAction

use of io.jmix.ui.action.ItemTrackingAction in project jmix-docs by Haulmont.

the class TableScreen method onInit.

// end::inject-tableClick[]
// tag::onInit-start[]
@Subscribe
public void onInit(InitEvent event) {
    // end::onInit-start[]
    customersTable.addGeneratedColumn("aaa", entity -> null);
    // tag::add-base-action[]
    customersTable.addAction(new AboutSingleAction());
    // end::add-base-action[]
    // tag::add-ItemTrackingAction[]
    customersTable.addAction(new ItemTrackingAction("about") {

        @Nullable
        @Override
        public String getCaption() {
            return "About";
        }

        @Override
        public void actionPerform(Component component) {
            notifications.create().withCaption("Hello " + customersTable.getSelected().iterator().next()).withType(Notifications.NotificationType.TRAY).show();
        }
    });
    // end::add-ItemTrackingAction[]
    // tag::table-set-style-name[]
    tableBorderless.setStyleName(ThemeClassNames.TABLE_BORDERLESS);
    // end::table-set-style-name[]
    // tag::column-value-provider[]
    printableTableExcelExport.addColumnValueProvider("firstName", context -> {
        // <1>
        Customer customer = context.getEntity();
        return "Name: " + customer.getFirstName();
    });
    // end::column-value-provider[]
    printableTableExcelExport.addColumnValueProvider("fullName", context -> {
        Customer customer = context.getEntity();
        return customer.getFirstName() + " " + customer.getLastName();
    });
    // tag::table-add-printable[]
    /*printableTable.addPrintable("firstName", new Table.Printable<Customer, String>() {
            @Override
            public String getValue(Customer item) {
                return "Name: " + item.getFirstName();
            }
        });*/
    // end::table-add-printable[]
    // tag::printable-column-generator[]
    /*printableTable.addGeneratedColumn("fullName", new Table.PrintableColumnGenerator<Customer, String>() {
            @Override
            public String getValue(Customer item) {
                return item.getFirstName() + " " + item.getLastName();
            }

            @Override
            public Component generateCell(Customer entity) {
                Label label = uiComponents.create(Label.NAME);
                label.setValue(entity.getFirstName() + " " + entity.getLastName());
                return label;
            }
        });*/
    // end::printable-column-generator[]
    // tag::item-click-action[]
    tableClick.setItemClickAction(new BaseAction("itemClickAction").withHandler(actionPerformedEvent -> {
        Customer customer = tableClick.getSingleSelected();
        if (customer != null) {
            notifications.create().withCaption("Item clicked for: " + customer.getFirstName() + "" + customer.getLastName()).show();
        }
    }));
    // end::item-click-action[]
    // tag::enter-press-action[]
    tableClick.setEnterPressAction(new BaseAction("enterPressAction").withHandler(actionPerformedEvent -> {
        Customer customer = tableClick.getSingleSelected();
        if (customer != null) {
            notifications.create().withCaption("Enter pressed for: " + customer.getFirstName() + "" + customer.getLastName()).show();
        }
    }));
    // end::enter-press-action[]
    // tag::programmatic-binding[]
    customersTable1.setItems(new ContainerTableItems<>(customersDc));
// end::programmatic-binding[]
// tag::onInit-end[]
}
Also used : ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) Customer(ui.ex1.entity.Customer) ThemeClassNames(io.jmix.ui.theme.ThemeClassNames) CollectionContainer(io.jmix.ui.model.CollectionContainer) Collection(java.util.Collection) Autowired(org.springframework.beans.factory.annotation.Autowired) ExcelExportAction(io.jmix.uiexport.action.ExcelExportAction) Notifications(io.jmix.ui.Notifications) JmixIcon(io.jmix.ui.icon.JmixIcon) List(java.util.List) UiComponents(io.jmix.ui.UiComponents) io.jmix.ui.screen(io.jmix.ui.screen) ScreenBuilders(io.jmix.ui.ScreenBuilders) SendByEmailAction(ui.ex1.screen.actions.SendByEmailAction) EmailAttachment(io.jmix.email.EmailAttachment) BudgetItem(ui.ex1.entity.BudgetItem) Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) Named(javax.inject.Named) ContainerTableItems(io.jmix.ui.component.data.table.ContainerTableItems) Collections(java.util.Collections) City(ui.ex1.entity.City) Nullable(javax.annotation.Nullable) io.jmix.ui.component(io.jmix.ui.component) Customer(ui.ex1.entity.Customer) ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) BaseAction(io.jmix.ui.action.BaseAction) Nullable(javax.annotation.Nullable)

Aggregations

ItemTrackingAction (io.jmix.ui.action.ItemTrackingAction)6 Action (io.jmix.ui.action.Action)4 BaseAction (io.jmix.ui.action.BaseAction)2 ListAction (io.jmix.ui.action.ListAction)2 EntityOp (io.jmix.core.security.EntityOp)1 EmailAttachment (io.jmix.email.EmailAttachment)1 JsonEmailTemplate (io.jmix.emailtemplates.entity.JsonEmailTemplate)1 ReportEmailTemplate (io.jmix.emailtemplates.entity.ReportEmailTemplate)1 Notifications (io.jmix.ui.Notifications)1 ScreenBuilders (io.jmix.ui.ScreenBuilders)1 UiComponents (io.jmix.ui.UiComponents)1 CreateAction (io.jmix.ui.action.list.CreateAction)1 io.jmix.ui.component (io.jmix.ui.component)1 ContainerTableItems (io.jmix.ui.component.data.table.ContainerTableItems)1 JmixIcon (io.jmix.ui.icon.JmixIcon)1 CollectionContainer (io.jmix.ui.model.CollectionContainer)1 io.jmix.ui.screen (io.jmix.ui.screen)1 ThemeClassNames (io.jmix.ui.theme.ThemeClassNames)1 ExcelExportAction (io.jmix.uiexport.action.ExcelExportAction)1 Collection (java.util.Collection)1