-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0StudentThread.java
More file actions
64 lines (58 loc) · 2.46 KB
/
Copy path0StudentThread.java
File metadata and controls
64 lines (58 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cdvirtualclient;
import java.io.*;
import java.util.Vector;
/**
*
* @author Chayan-Dhaddha
*/
public class StudentThread extends Thread{
Student student;
public StudentThread(Student student){
this.student=student;
try{
}catch(Exception ex){
System.out.println("Exception occured" + ex);
}
this.start();
}
public void run(){
try{
while(true){
ObjectInputStream in=new ObjectInputStream(CommResource.client.getInputStream());
Resource.ResponseCodes resp=(Resource.ResponseCodes)in.readObject();
if(resp==Resource.ResponseCodes.INIT_STUDENT_RESPONSE){
Vector<Vector>main=(Vector<Vector>)in.readObject();
//this.student.panel_upcoming_session.DATA.clear();
for(int i=0;i<main.size();i++){
this.student.panel_upcoming_session.DATA.add(main.elementAt(i));
}
this.student.panel_upcoming_session.table.repaint();
}
if(resp==Resource.ResponseCodes.NEW_SESSION){
Vector<Vector>main=(Vector<Vector>)in.readObject();
//this.mentor.panel_session_initiate.DATA.clear();
for(int i=0;i<main.size();i++){
this.student.panel_upcoming_session.DATA.add(main.elementAt(i));
}
this.student.panel_upcoming_session.table.repaint();
}
else if(resp==Resource.ResponseCodes.FILTER_SUCCESS){
Vector<Vector>main=(Vector<Vector>)in.readObject();
this.student.panel_past_session.DATA.clear();
for(int i=0;i<main.size();i++){
this.student.panel_past_session.DATA.add(main.elementAt(i));
}
this.student.panel_past_session.table.repaint();
System.out.println("filter success");
}
}
}catch(Exception ex){
System.out.println("Exception occured" + ex);
}
}
}