@Override
    public void showDialog(DialogAction dialogAction, int row, String code) {
        if (DialogAction.UPDATE.equals(dialogAction) && (row == BAD_ROW || code == null)) {
            throw new UnsupportedOperationException("You can not perform this action");
        }

        JDialogStudent dialogStudent = new JDialogStudent(getParentForDialog());
        dialogStudent.setAction(dialogAction);
        dialogStudent.installEscapeCloseOperation();

        Student student;

        if (DialogAction.UPDATE.equals(dialogAction)) {
            student = studentController.getByCode(code);

            dialogStudent.setEntity(student);
        }

        dialogStudent.setVisible(true);

        student = dialogStudent.getEntity();
        if (student == null) {
            return;
        }

        switch (dialogAction) {
            case INSERT:
                addRow(student);
                break;

            case UPDATE:
                setRowValues(row, student);
                break;
        }
    }