Search in sources :

Example 71 with Student

use of com.remswork.project.alice.model.Student in project classify-system by anverliedoit.

the class GradeViewActivity method initRView.

public void initRView(final long classId) {
    final Handler handler = new Handler(getMainLooper());
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                final ClassServiceImpl classService = new ClassServiceImpl();
                final List<Student> studenList = new ArrayList<>();
                final Set<Student> studentSet = classService.getStudentList(classId);
                for (Student student : studentSet) studenList.add(student);
                final StudentAdapter studentAdapter = new StudentAdapter(GradeViewActivity.this, studenList);
                final LinearLayoutManager layoutManager = new LinearLayoutManager(GradeViewActivity.this);
                layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        recyclerView.setAdapter(studentAdapter);
                        recyclerView.setLayoutManager(layoutManager);
                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                        if (studenList.size() < 1)
                            txtMsgContent.setVisibility(View.VISIBLE);
                    }
                });
            } catch (ClassException e) {
                e.printStackTrace();
            }
        }
    }).start();
}
Also used : ArrayList(java.util.ArrayList) StudentAdapter(com.lieverandiver.thesisproject.adapter.StudentAdapter) Handler(android.os.Handler) ClassException(com.remswork.project.alice.exception.ClassException) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl)

Example 72 with Student

use of com.remswork.project.alice.model.Student in project classify-system by anverliedoit.

the class QuizInputActivity method init.

public void init() {
    try {
        editTextName = (EditText) findViewById(R.id.input_name6);
        editTextTotal = (EditText) findViewById(R.id.input_total6);
        textViewDate = (TextView) findViewById(R.id.input_date6);
        buttonSubmit = (ToggleButton) findViewById(R.id.input_submit6);
        btnBack = (Button) findViewById(input_back6);
        dialogFailed = (CardView) findViewById(R.id.input_failed6);
        dialogSucces = (CardView) findViewById(R.id.input_succes6);
        btnOk = (Button) findViewById(R.id.input_ok6);
        btnTryAgain = (Button) findViewById(input_tryagain6);
        getDialogEmptyTotal = (CardView) findViewById(R.id.input_failedemp6);
        getBtnTryAgainEmptyTotal = (Button) findViewById(input_tryagainemp6);
        toggleButtonhideandshow = (ToggleButton) findViewById(R.id.input_hideandshow6);
        frameLayouthideandshow = (FrameLayout) findViewById(R.id.input_detailts6);
        toggleButtonhideandshow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    frameLayouthideandshow.setVisibility(View.GONE);
                } else {
                    frameLayouthideandshow.setVisibility(View.VISIBLE);
                }
            }
        });
        getDialogEmptyTotal.setVisibility(View.GONE);
        dialogSucces.setVisibility(View.GONE);
        dialogFailed.setVisibility(View.GONE);
        btnOk.setOnClickListener(this);
        btnBack.setOnClickListener(this);
        buttonSubmit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    buttonSubmit.setVisibility(View.GONE);
                }
            }
        });
        getBtnTryAgainEmptyTotal.setOnClickListener(this);
        btnTryAgain.setOnClickListener(this);
        recyclerViewStudentInput = (RecyclerView) findViewById(R.id.input_recyclerview6);
        recyclerViewStudentInput.setVisibility(View.VISIBLE);
        for (Student s : classService.getStudentList(getIntent().getExtras().getLong("classId"))) studentList.add(s);
        studentAdapter = new QuizInputAdapter(this, studentList);
        recyclerViewStudentInput.setAdapter(studentAdapter);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerViewStudentInput.setLayoutManager(layoutManager);
        recyclerViewStudentInput.setItemAnimator(new DefaultItemAnimator());
        String date = String.format(Locale.ENGLISH, "%02d/%02d/%d", Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + 1, Calendar.getInstance().get(Calendar.YEAR));
        textViewDate.setText(date);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : QuizInputAdapter(com.lieverandiver.thesisproject.adapter.QuizInputAdapter) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CompoundButton(android.widget.CompoundButton) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException)

Example 73 with Student

use of com.remswork.project.alice.model.Student in project classify-system by anverliedoit.

the class QuizInputActivityF method init.

public void init() {
    try {
        editTextName = (EditText) findViewById(R.id.input_name6);
        editTextTotal = (EditText) findViewById(R.id.input_total6);
        textViewDate = (TextView) findViewById(R.id.input_date6);
        buttonSubmit = (ToggleButton) findViewById(R.id.input_submit6);
        btnBack = (Button) findViewById(input_back6);
        dialogFailed = (CardView) findViewById(R.id.input_failed6);
        dialogSucces = (CardView) findViewById(R.id.input_succes6);
        btnOk = (Button) findViewById(R.id.input_ok6);
        btnTryAgain = (Button) findViewById(input_tryagain6);
        getDialogEmptyTotal = (CardView) findViewById(R.id.input_failedemp6);
        getBtnTryAgainEmptyTotal = (Button) findViewById(input_tryagainemp6);
        toggleButtonhideandshow = (ToggleButton) findViewById(R.id.input_hideandshow6);
        frameLayouthideandshow = (FrameLayout) findViewById(R.id.input_detailts6);
        toggleButtonhideandshow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    frameLayouthideandshow.setVisibility(View.GONE);
                } else {
                    frameLayouthideandshow.setVisibility(View.VISIBLE);
                }
            }
        });
        getDialogEmptyTotal.setVisibility(View.GONE);
        dialogSucces.setVisibility(View.GONE);
        dialogFailed.setVisibility(View.GONE);
        btnOk.setOnClickListener(this);
        btnBack.setOnClickListener(this);
        buttonSubmit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    buttonSubmit.setVisibility(View.GONE);
                }
            }
        });
        getBtnTryAgainEmptyTotal.setOnClickListener(this);
        btnTryAgain.setOnClickListener(this);
        recyclerViewStudentInput = (RecyclerView) findViewById(R.id.input_recyclerview6);
        recyclerViewStudentInput.setVisibility(View.VISIBLE);
        for (Student s : classService.getStudentList(getIntent().getExtras().getLong("classId"))) studentList.add(s);
        studentAdapter = new QuizInputAdapterF(this, studentList);
        recyclerViewStudentInput.setAdapter(studentAdapter);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerViewStudentInput.setLayoutManager(layoutManager);
        recyclerViewStudentInput.setItemAnimator(new DefaultItemAnimator());
        String date = String.format(Locale.ENGLISH, "%02d/%02d/%d", Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + 1, Calendar.getInstance().get(Calendar.YEAR));
        textViewDate.setText(date);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : QuizInputAdapterF(com.lieverandiver.thesisproject.adapter.QuizInputAdapterF) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CompoundButton(android.widget.CompoundButton) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException)

Example 74 with Student

use of com.remswork.project.alice.model.Student in project classify-system by anverliedoit.

the class StudentViewActivity method initRView.

public void initRView(final long classId) {
    final Handler handler = new Handler(getMainLooper());
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                final ClassServiceImpl classService = new ClassServiceImpl();
                final List<Student> studenList = new ArrayList<>();
                final Set<Student> studentSet = classService.getStudentList(classId);
                for (Student student : studentSet) studenList.add(student);
                Collections.sort(studenList, new Comparator<Student>() {

                    @Override
                    public int compare(final Student object1, final Student object2) {
                        return object1.getLastName().compareTo(object2.getLastName());
                    }
                });
                final StudentAdapter studentAdapter = new StudentAdapter(StudentViewActivity.this, studenList);
                final LinearLayoutManager layoutManager = new LinearLayoutManager(StudentViewActivity.this);
                layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        recyclerView.setAdapter(studentAdapter);
                        recyclerView.setLayoutManager(layoutManager);
                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                        if (studenList.size() < 1)
                            txtMsgContent.setVisibility(View.VISIBLE);
                    }
                });
            } catch (ClassException e) {
                e.printStackTrace();
            }
        }
    }).start();
}
Also used : ArrayList(java.util.ArrayList) StudentAdapter(com.lieverandiver.thesisproject.adapter.StudentAdapter) Handler(android.os.Handler) ClassException(com.remswork.project.alice.exception.ClassException) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl)

Example 75 with Student

use of com.remswork.project.alice.model.Student in project classify-system by anverliedoit.

the class GradeDaoImpl method updateGrade.

@Override
public Grade updateGrade(long id, Grade newGrade, long classId, long studentId) throws GradingFactorException {
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    try {
        Grade grade = session.get(Grade.class, id);
        Class _class = session.get(Class.class, classId);
        Student student = session.get(Student.class, studentId);
        if (newGrade == null)
            newGrade = new Grade();
        if (grade == null)
            throw new GradingFactorDaoException("Grade with id : " + id + " doesn't exist.");
        if (_class == null && classId != 0)
            throw new GradingFactorDaoException("Class with id : " + classId + " doesn't exist.");
        if (student == null && studentId != 0)
            throw new GradingFactorDaoException("Student with id : " + studentId + " doesn't exist.");
        if (classId < 0)
            throw new GradingFactorDaoException("The class id is invalid");
        if (studentId < 0)
            throw new GradingFactorDaoException("The student id is invalid");
        if (newGrade.getTotalScore() >= 0 && grade.getTotalScore() > 0)
            grade.setTotalScore(newGrade.getTotalScore());
        if (newGrade.getActivityScore() > 0 && grade.getActivityScore() > 0)
            grade.setActivityScore(newGrade.getActivityScore());
        if (newGrade.getAssignmentScore() > 0 && grade.getAssignmentScore() > 0)
            grade.setAssignmentScore(newGrade.getAssignmentScore());
        if (newGrade.getAttendanceScore() > 0 && grade.getAttendanceScore() > 0)
            grade.setAttendanceScore(newGrade.getAttendanceScore());
        if (newGrade.getExamScore() > 0 && grade.getExamScore() > 0)
            grade.setExamScore(newGrade.getExamScore());
        if (newGrade.getProjectScore() > 0 && grade.getProjectScore() > 0)
            grade.setProjectScore(newGrade.getProjectScore());
        if (newGrade.getQuizScore() > 0 && grade.getQuizScore() > 0)
            grade.setQuizScore(newGrade.getQuizScore());
        if (classId > 0) {
            if ((grade.get_class() != null ? grade.get_class().getId() : 0) == classId)
                throw new GradingFactorDaoException("The class id is already exist");
            grade.set_class(_class);
        }
        if (studentId > 0) {
            if ((grade.getStudent() != null ? grade.getStudent().getId() : 0) == studentId)
                throw new GradingFactorDaoException("The student id is already exist");
            grade.setStudent(student);
        }
        grade.set_class(_class);
        grade.setStudent(student);
        session.getTransaction().commit();
        session.close();
        return grade;
    } catch (GradingFactorDaoException e) {
        session.close();
        throw new GradingFactorException(e.getMessage());
    }
}
Also used : GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) Grade(com.remswork.project.alice.model.Grade) Class(com.remswork.project.alice.model.Class) Student(com.remswork.project.alice.model.Student) GradingFactorDaoException(com.remswork.project.alice.dao.exception.GradingFactorDaoException) Session(org.hibernate.Session)

Aggregations

Student (com.remswork.project.alice.model.Student)82 GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)29 CompoundButton (android.widget.CompoundButton)22 Message (com.remswork.project.alice.model.support.Message)21 Grade (com.remswork.project.alice.model.Grade)20 ArrayList (java.util.ArrayList)19 StudentException (com.remswork.project.alice.exception.StudentException)17 CardView (android.support.v7.widget.CardView)15 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)15 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)15 RecyclerView (android.support.v7.widget.RecyclerView)15 View (android.view.View)15 TextView (android.widget.TextView)15 ClassException (com.remswork.project.alice.exception.ClassException)14 Button (android.widget.Button)13 List (java.util.List)13 ToggleButton (android.widget.ToggleButton)11 Client (javax.ws.rs.client.Client)10 WebTarget (javax.ws.rs.client.WebTarget)10 Response (javax.ws.rs.core.Response)10