Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public Exam collectExamData(CreateExamPanel view,action accion,Exam examen){
String name= view.getNameBox();
String id;
String instructions= view.getInstructionsArea();
String level= view.getLevelBox();
String duration=String.valueOf(view.getDurationBox());
ArrayList<String> domains= new ArrayList<>();
ArrayList<String> questions = new ArrayList<>();
Expand All @@ -95,6 +96,6 @@ public Exam collectExamData(CreateExamPanel view,action accion,Exam examen){
break;
}

return new Exam(name,id,duration,instructions,domains);
return new Exam(name,id,duration,instructions,domains,level);
}
}
5 changes: 4 additions & 1 deletion src/main/java/cienciasucv/certicomp/Models/Exam.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Exam {
private String name;
private String duration;
private String instructions;
private String level;
private ArrayList<String> dominios;
private ArrayList<String> questions;
public static Map<String, Exam> exams;
Expand All @@ -48,12 +49,14 @@ public class Exam {
this.dominios= domains;
}

public Exam(String name,String id, String duration, String instructions,ArrayList<String> domains){
public Exam(String name,String id, String duration, String instructions,ArrayList<String> domains,String level){
this.name= name;
this.id = id;
this.duration= duration;
this.instructions=instructions;
this.dominios=domains;
this.level=level;

}

private static Map<String, Exam> loadExamsFromFile() {
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/cienciasucv/certicomp/Models/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class User {

private String name;
private String lastname;
private String nationalID;
private String email;
private String role;
class User {

protected String name;
protected String lastname;
protected String nationalID;
protected String email;
protected enum role{
STUDENT,
ADMIN;
}
protected role role;

public User(String name, String lastname, String nationalID, String email, String role) {
public User(String name, String lastname, String nationalID, String email) {

this.name = name;
this.lastname = lastname;
this.nationalID = nationalID;
this.email = email;
this.role = role;
}

public String getName() {
Expand All @@ -45,7 +48,7 @@ public String getEmail() {
return email;
}

public String getRole() {
public role getRole() {
return role;
}

Expand All @@ -65,8 +68,7 @@ public void setEmail(String email) {
this.email= email;
}


public void setRole(String role) {
public void setRole(role role) {
this.role = role;
}

Expand Down Expand Up @@ -104,6 +106,6 @@ public static Map<String, String> getUsersInfo() {
}
return usersInfo;
}


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cienciasucv.certicomp.Views.AdminViews;
import cienciasucv.certicomp.Controllers.CreateExamController;
import cienciasucv.certicomp.Models.Course;
import cienciasucv.certicomp.Models.Exam;
import cienciasucv.certicomp.Views.ButtonSize;
import cienciasucv.certicomp.Views.Buttons;
Expand All @@ -9,12 +10,15 @@
import javax.swing.event.DocumentListener;
import javax.swing.text.AbstractDocument;

import com.google.gson.Gson;

import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileReader;
import java.util.Map;

public class CreateExamPanel extends PanelContent{
Expand All @@ -29,7 +33,8 @@ public class CreateExamPanel extends PanelContent{
JButton botonCrear;
private JButton addEdit1;
private JButton addEdit2;

private java.lang.reflect.Type type;

public CreateExamPanel(){
for (Map.Entry<String, Exam> entry : Exam.exams.entrySet()) {
String key = entry.getKey();
Expand All @@ -47,8 +52,7 @@ public CreateExamPanel(){
addDurationBox(DurationBox);
String [] Prueba ={"Nivel 1", "Nivel 2", "Nivel 3"};
addLevelBox(Prueba);
String [] CursosP={"Java","CISCO","Front-End Web Developer"};
addCourseBox(CursosP);
addCourseBox();
DominiumArea =addTextArea(160, 265, 220,50);
DominiumArea.setEditable(false);
addDominumArea(DominiumArea);
Expand Down Expand Up @@ -164,9 +168,14 @@ private void addLevelBox(String[] prueba){
this.add(Levels);
}

private void addCourseBox(String[] lista){
private void addCourseBox(){
Map<String,String> coursesInfo= Course.getCoursesInfo();
DefaultComboBoxModel<String>comboBoxModel=new DefaultComboBoxModel<>();
for(String course:coursesInfo.values()){
comboBoxModel.addElement(course);
}
addSideText("Curso Asociado:", 54, 168, 120, 30);
AsociatedCourses=addComboBox(lista, 160,173 , 220, 22);
AsociatedCourses=addComboBox(comboBoxModel, 160,173 , 220, 22);
this.add(AsociatedCourses);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public static JComboBox addComboBox(Object contenido[],int x,int y, int w, int h
lista.setBounds(x, y, w, h);
return lista;
}

public static JComboBox addComboBox(DefaultComboBoxModel<String> Modelo ,int x,int y, int w, int h){
JComboBox lista = new JComboBox(Modelo);
lista.setBounds(x, y, w, h);
return lista;
}

public static JTextArea addTextArea(int x, int y, int w, int h){
JTextArea Area = new JTextArea();
Expand Down