package com.acme.util.ui.bean;

import com.acme.structure.exception.main.FeatureNotSupportedException;

import com.acme.util.ui.UIHelper;
import com.acme.util.ui.WindowManager;
import com.acme.util.utilities.JSFUtils;

import javax.faces.event.ActionEvent;

public abstract class ToolbarMBean implements ToolbarTemplate
{
    public void loadButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void searchButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void clearButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void addButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void removeButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void saveButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void previousButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void nextButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void copyButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void pasteButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void rollbackButtonPressed(ActionEvent actionEvent)
    {
        UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
    }

    public void refreshButtonPressed(ActionEvent actionEvent)
    {
        JSFUtils.refresh();
    }

    public void recordHistoryPressed(ActionEvent actionEvent)
    {
        //        try
        //        {
        //            RecordHistoryWrapper rhw = RecordHistoryWrapper.getInstance((BaseEntity)getRecordHistoryEntity());
        //            WRecordHistory recordHistory = (WRecordHistory)WindowManager.getInstance().openWindowByKey("com.celebi.ikarus.main.component.window.WRecordHistory");
        //            recordHistory.initializeWithObject(rhw);
        //        }
        //        catch (Exception exc)
        //        {
        //         UIHelper.showInformationMessages(WindowManager.getInstance().getHandler().handleException(new FeatureNotSupportedException()));
        //        }
    }

    public Object getRecordHistoryEntity(ActionEvent actionEvent)
    {
        return null; //activeGrid.getSelectedRowObject();
    }
}
