package com.floreantpos.ui.report.actions;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.JTabbedPane;
import com.floreantpos.bo.ui.BackOfficeWindow;
import com.floreantpos.main.Application;
import com.floreantpos.ui.report.SalesSummaryReportView;
public class SalesAnalysisReportAction extends AbstractAction {
public SalesAnalysisReportAction() {
super("Sales Analysis");
}
public SalesAnalysisReportAction(String name) {
super(name);
}
public SalesAnalysisReportAction(String name, Icon icon) {
super(name, icon);
}
public void actionPerformed(ActionEvent e) {
BackOfficeWindow window = Application.getInstance().getBackOfficeWindow();
JTabbedPane tabbedPane = window.getTabbedPane();
SalesSummaryReportView reportView = null;
int index = tabbedPane.indexOfTab("Sales Analysis");
if (index == -1) {
reportView = new SalesSummaryReportView();
reportView.setReportType(SalesSummaryReportView.REPORT_SALES_ANALYSIS);
tabbedPane.addTab("Sales Analysis", reportView);
}
else {
reportView = (SalesSummaryReportView) tabbedPane.getComponentAt(index);
}
tabbedPane.setSelectedComponent(reportView);
}
}