package ggh.dialog;

import com.nexes.wizard.WizardPanelDescriptor;
import ggh.GGHData;

/**
 *
 * @author Admin
 */
public class Dialog4_Summary_Descriptor extends WizardPanelDescriptor {
    public static final String IDENTIFIER = "DIALOG4_SUMMARY";

    public Dialog4_Summary_Descriptor() {
        super(IDENTIFIER, new Dialog4_Summary());

    }

    @Override
    public Object getNextPanelDescriptor() {
        return FINISH;
    }

     @Override
    public void aboutToDisplayPanel() { //nacteni dat z dialogu pred prepnutim dalsiho
        Dialog4_Summary dialog = (Dialog4_Summary) this.getPanelComponent();
        GGHData data = GGHData.getInstance();
        int dimension = data.getDimension();

        for (int i = 0; i < GGHData.MAX_DIMENSION; i++) {
            for (int j = 0; j < GGHData.MAX_DIMENSION; j++) {
                if (i < dimension && j < dimension) {
                     dialog.getW_data()[i][j].setText(Double.toString(data.getW_vector().getElement(i, j)));
                     dialog.getV_data()[i][j].setText(Double.toString(data.getV_vector().getElement(i, j)));
                }
                else {
                     dialog.getW_data()[i][j].setText("");
                     dialog.getV_data()[i][j].setText("");
                     
               }
            }
            
            
            if (i < dimension) {
                     dialog.getM_data()[i].setText(Double.toString(data.getM_vector().getElement(0, i)));
                     dialog.getR_data()[i].setText(Double.toString(data.getR_vector().getElement(0, i)));
                     dialog.getE_data()[i].setText(Double.toString(data.getE_vector().getElement(0, i)));

                     dialog.getM_decrypted_data()[i].setText(Double.toString(data.getM_decrypted().getElement(0, i)));
                     dialog.getV_grid_data()[i].setText(Double.toString(data.getV_grid().getElement(0, i)));
                     dialog.getT_data()[i].setText(Double.toString(data.getT_vector().getElement(0, i)));
             }
             else {
                     dialog.getM_data()[i].setText("");
                     dialog.getR_data()[i].setText("");
                     dialog.getE_data()[i].setText("");

                     dialog.getM_decrypted_data()[i].setText("");
                     dialog.getV_grid_data()[i].setText("");
                     dialog.getT_data()[i].setText("");
             }





        }
    }

    @Override
    public Object getBackPanelDescriptor() {
        return Dialog3_Decrypt_Descriptor.IDENTIFIER;
    }

}
