Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Add excel action to Entity inspector browser #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Desire456 committed Aug 11, 2021
1 parent 0d532b7 commit 3a0f71e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
import io.jmix.datatools.DatatoolsConfiguration;
import io.jmix.datatoolsui.DatatoolsUiConfiguration;
import io.jmix.ui.UiConfiguration;
import io.jmix.uiexport.UiExportConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import({CoreConfiguration.class, UiConfiguration.class, DatatoolsConfiguration.class, DatatoolsUiConfiguration.class})
@Import({CoreConfiguration.class, UiConfiguration.class, UiExportConfiguration.class, DatatoolsConfiguration.class,
DatatoolsUiConfiguration.class})
public class DatatoolsUiAutoConfiguration {
}
1 change: 1 addition & 0 deletions datatools-ui/datatools-ui.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {

api 'io.jmix.core:jmix-core'
api 'io.jmix.data:jmix-data'
api 'io.jmix.ui:jmix-ui-export'
api 'io.jmix.ui:jmix-ui'

api 'com.google.code.gson:gson'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import io.jmix.ui.model.DataComponents;
import io.jmix.ui.navigation.Route;
import io.jmix.ui.screen.*;
import io.jmix.uiexport.action.ExcelExportAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -337,12 +338,10 @@ protected void createButtonsPanel(Table table) {
removeButton.setIcon(icons.get(JmixIcon.REMOVE_ACTION));
removeButton.setFrame(getWindow().getFrame());

//TODO excel action
// excelButton = uiComponents.create(Button.class);
// excelButton.setCaption(messages.getMessage(com.haulmont.cuba.gui.app.core.entityinspector.EntityInspectorBrowse.class, "excel"));
// excelButton.setAction(new ExcelAction(entitiesTable));
// excelButton.setIcon(icons.get(CubaIcon.EXCEL_ACTION));
// excelButton.setFrame(frame);
Button excelButton = uiComponents.create(Button.class);
ExcelExportAction excelExportAction = createExcelExportAction(table);
excelButton.setAction(excelExportAction);
excelButton.setFrame(getWindow().getFrame());

Button refreshButton = uiComponents.create(Button.class);
RefreshAction refreshAction = createRefreshAction(table);
Expand Down Expand Up @@ -418,8 +417,8 @@ fileName, nullToEmpty(e.getMessage())))
buttonsPanel.add(createButton);
buttonsPanel.add(editButton);
buttonsPanel.add(removeButton);
// buttonsPanel.add(excelButton);
buttonsPanel.add(refreshButton);
buttonsPanel.add(excelButton);
buttonsPanel.add(exportPopupButton);
buttonsPanel.add(importUpload);
buttonsPanel.add(restoreButton);
Expand All @@ -428,6 +427,12 @@ fileName, nullToEmpty(e.getMessage())))
}
}

private ExcelExportAction createExcelExportAction(Table table) {
ExcelExportAction excelExportAction = actions.create(ExcelExportAction.class);
excelExportAction.setTarget(table);
return excelExportAction;
}

private ShowEntityInfoAction createShowEntityInfoAction(Table table) {
ShowEntityInfoAction showEntityInfoAction = actions.create(ShowEntityInfoAction.class);
showEntityInfoAction.setTarget(table);
Expand Down

0 comments on commit 3a0f71e

Please sign in to comment.