Search in sources :

Example 1 with ApplicationDashboardContentPanel

use of de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel in project bundle-app-ui by astrapi69.

the class OverviewResourceBundleAddEntryPanel method onDelete.

protected void onDelete(ActionEvent e) {
    int dialogResult = JOptionPane.showConfirmDialog(null, "This will delete this resource bundle and is not recoverable?(cannot be undone)", "Warning", JOptionPane.YES_NO_OPTION);
    if (dialogResult == JOptionPane.YES_OPTION) {
        SpringApplicationContext.getInstance().getResourcebundlesService().delete(getModelObject().getSelectedBundleName());
        final Model<ApplicationDashboardBean> baModel = MainFrame.getInstance().getSelectedBundleApplicationPropertyModel();
        final ApplicationDashboardContentPanel component = new ApplicationDashboardContentPanel(baModel);
        MainFrame.getInstance().replaceInternalFrame("Dashboard of " + baModel.getObject().getBundleApplication().getName() + " bundle app", component);
    }
}
Also used : ApplicationDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean) ApplicationDashboardContentPanel(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel)

Example 2 with ApplicationDashboardContentPanel

use of de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel in project bundle-app-ui by astrapi69.

the class OverviewOfAllBundleApplicationsPanel method onInitializeComponents.

@Override
protected void onInitializeComponents() {
    super.onInitializeComponents();
    lblHeaderOverview = new javax.swing.JLabel();
    lblBundleApp = new javax.swing.JLabel();
    srcBundleApps = new javax.swing.JScrollPane();
    tableModel = new StringBundleApplicationsBundleApplicationsTableModel();
    tableModel.addList(getTableModelList());
    tblBundleApps = new GenericJXTable<>(tableModel);
    final TableColumn chooseColumn = tblBundleApps.getColumn("Choose");
    chooseColumn.setCellRenderer(new TableCellButtonRenderer(null, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
            if (isSelected) {
                setForeground(newSelectionForeground(table));
                setBackground(newSelectionBackround(table));
            } else {
                setForeground(newForeground(table));
                setBackground(newBackround(table));
            }
            final String text = "Choose";
            setText(text);
            return this;
        }
    });
    chooseColumn.setCellEditor(new TableCellButtonEditor(new JCheckBox()) {

        private static final long serialVersionUID = 1L;

        @Override
        public Object getCellEditorValue() {
            final BundleApplications selectedBundleApplication = (BundleApplications) this.getValue();
            MainFrame.getInstance().setSelectedBundleApplication(selectedBundleApplication);
            final Model<ApplicationDashboardBean> baModel = MainFrame.getInstance().getSelectedBundleApplicationPropertyModel();
            final ApplicationDashboardContentPanel component = new ApplicationDashboardContentPanel(baModel);
            MainFrame.getInstance().replaceInternalFrame("Dashboard of " + selectedBundleApplication.getName() + " bundle app", component);
            final String text = "Select";
            return text;
        }

        @Override
        public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
            setRow(row);
            setColumn(column);
            setValue(value);
            if (isSelected) {
                getButton().setForeground(table.getSelectionForeground());
                getButton().setBackground(table.getSelectionBackground());
            } else {
                getButton().setForeground(table.getForeground());
                getButton().setBackground(table.getBackground());
            }
            final String text = "Choose";
            getButton().setText(text);
            setClicked(true);
            return getButton();
        }
    });
    final TableColumn deleteColumn = tblBundleApps.getColumn("Delete");
    deleteColumn.setCellRenderer(new TableCellButtonRenderer(null, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
            if (isSelected) {
                setForeground(newSelectionForeground(table));
                setBackground(newSelectionBackround(table));
            } else {
                setForeground(newForeground(table));
                setBackground(newBackround(table));
            }
            final String text = "Delete";
            setText(text);
            return this;
        }
    });
    deleteColumn.setCellEditor(new TableCellButtonEditor(new JCheckBox()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onClick() {
            try {
                super.onClick();
            } catch (IndexOutOfBoundsException e) {
                e.printStackTrace();
            }
        }

        @Override
        public Object getCellEditorValue() {
            final BundleApplications selectedBundleApplication = (BundleApplications) this.getValue();
            onDelete(selectedBundleApplication);
            final String text = "Delete";
            return text;
        }

        @Override
        public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
            setRow(row);
            setColumn(column);
            setValue(value);
            if (isSelected) {
                getButton().setForeground(table.getSelectionForeground());
                getButton().setBackground(table.getSelectionBackground());
            } else {
                getButton().setForeground(table.getForeground());
                getButton().setBackground(table.getBackground());
            }
            final String text = "Delete";
            getButton().setText(text);
            setClicked(true);
            return getButton();
        }
    });
    btnCreateBundleApp = new javax.swing.JButton();
    lblHeaderOverview.setText("Overview of all bundle applications");
    lblBundleApp.setText("Bundle application count");
    srcBundleApps.setViewportView(tblBundleApps);
    btnCreateBundleApp.setText("Create new bundle application");
    btnCreateBundleApp.addActionListener(e -> onCreateBundleApp(e));
}
Also used : BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) ApplicationDashboardContentPanel(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel) TableColumn(javax.swing.table.TableColumn) JCheckBox(javax.swing.JCheckBox) TableCellButtonEditor(de.alpharogroup.swing.table.editor.TableCellButtonEditor) TableCellButtonRenderer(de.alpharogroup.swing.renderer.TableCellButtonRenderer) JTable(javax.swing.JTable) BaseModel(de.alpharogroup.model.BaseModel) StringBundleApplicationsBundleApplicationsTableModel(de.alpharogroup.bundle.app.table.model.StringBundleApplicationsBundleApplicationsTableModel) PropertyModel(de.alpharogroup.model.PropertyModel) Model(de.alpharogroup.model.api.Model) StringBundleApplicationsBundleApplicationsTableModel(de.alpharogroup.bundle.app.table.model.StringBundleApplicationsBundleApplicationsTableModel) Component(java.awt.Component)

Example 3 with ApplicationDashboardContentPanel

use of de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel in project bundle-app-ui by astrapi69.

the class WizardPanel method onFinish.

@Override
protected void onFinish() {
    super.onFinish();
    // from here application specific behavior...
    MainFrame.getInstance().replaceInternalFrame("Dashboard bundle app", new ApplicationDashboardContentPanel());
}
Also used : ApplicationDashboardContentPanel(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel)

Example 4 with ApplicationDashboardContentPanel

use of de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel in project bundle-app-ui by astrapi69.

the class ReturnToDashboardAction method now.

public void now() {
    final Model<ApplicationDashboardBean> baModel = MainFrame.getInstance().getSelectedBundleApplicationPropertyModel();
    if (baModel.getObject().getBundleApplication() != null) {
        final ApplicationDashboardContentPanel component = new ApplicationDashboardContentPanel(baModel);
        MainFrame.getInstance().replaceInternalFrame("Dashboard of " + baModel.getObject().getBundleApplication().getName() + " bundle app", component);
    } else {
        final List<BundleApplications> bundleApplications = SpringApplicationContext.getInstance().getBundleApplicationsService().findAll();
        MainFrame.getInstance().getModelObject().setBundleApplications(bundleApplications);
        MainFrame.getInstance().replaceInternalFrame("Overview bundle apps", new MainDashboardPanel(PropertyModel.<MainDashboardBean>of(MainFrame.getInstance(), "model.object")));
    }
}
Also used : MainDashboardPanel(de.alpharogroup.bundle.app.panels.dashboard.mainapp.MainDashboardPanel) ApplicationDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) MainDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.mainapp.MainDashboardBean) ApplicationDashboardContentPanel(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel)

Aggregations

ApplicationDashboardContentPanel (de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel)4 ApplicationDashboardBean (de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean)2 BundleApplications (de.alpharogroup.db.resource.bundles.entities.BundleApplications)2 MainDashboardBean (de.alpharogroup.bundle.app.panels.dashboard.mainapp.MainDashboardBean)1 MainDashboardPanel (de.alpharogroup.bundle.app.panels.dashboard.mainapp.MainDashboardPanel)1 StringBundleApplicationsBundleApplicationsTableModel (de.alpharogroup.bundle.app.table.model.StringBundleApplicationsBundleApplicationsTableModel)1 BaseModel (de.alpharogroup.model.BaseModel)1 PropertyModel (de.alpharogroup.model.PropertyModel)1 Model (de.alpharogroup.model.api.Model)1 TableCellButtonRenderer (de.alpharogroup.swing.renderer.TableCellButtonRenderer)1 TableCellButtonEditor (de.alpharogroup.swing.table.editor.TableCellButtonEditor)1 Component (java.awt.Component)1 JCheckBox (javax.swing.JCheckBox)1 JTable (javax.swing.JTable)1 TableColumn (javax.swing.table.TableColumn)1