Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 45 | Rev 47 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45 Rev 46
Line 16... Line 16...
16
 
16
 
17
	private ImageMediateur iMediateur = null ;
17
	private ImageMediateur iMediateur = null ;
18
	private int noteEnCours = 0 ;
18
	private int noteEnCours = 0 ;
19
	private int noteMax = 0 ;
19
	private int noteMax = 0 ;
-
 
20
	private int noteCurseur = 0 ;
20
	private int noteCurseur = 0 ;
21
	private boolean estNote = false ;
Line 21... Line 22...
21
	private Image[] etoiles = null ;
22
	private Image[] etoiles = null ;
22
	
23
	
23
	private BarreNotationVue()
24
	private BarreNotationVue()
24
	{
25
	{
Line 25... Line 26...
25
		super() ;
26
		super() ;
26
	}
27
	}
27
	
-
 
28
	public BarreNotationVue(ImageMediateur im, int noteMax)
28
	
29
	{
29
	public BarreNotationVue(ImageMediateur im, int noteMax)
30
		super("Notation") ;
30
	{
-
 
31
		iMediateur = im ;
-
 
32
		setNoteMax(noteMax) ;
Line 31... Line 33...
31
		iMediateur = im ;
33
		this.setSize(200, 100) ;
Line 32... Line 34...
32
		setNoteMax(noteMax) ;
34
		this.setBodyBorder(false) ;
Line 59... Line 61...
59
					
61
					
Line 60... Line 62...
60
				}
62
				}
Line 61... Line 63...
61
 
63
 
62
				public void onMouseLeave(Widget sender) {
64
				public void onMouseLeave(Widget sender) {
Line 63... Line 65...
63
				
65
				
Line 76... Line 78...
76
					while(etoiles[i] != (Image)sender)
78
					while(etoiles[i] != (Image)sender)
77
					{
79
					{
78
						i++ ;
80
						i++ ;
79
					}			
81
					}			
Line 80... Line -...
80
					
-
 
81
					noteEnCours = i ;
82
					
82
					noter() ;
83
					noter(i) ;
Line 83... Line 84...
83
					System.out.println("Nouvelle note : "+noteEnCours);
84
					System.out.println("Nouvelle note : "+noteEnCours);
Line 91... Line 92...
91
	}
92
	}
Line 92... Line 93...
92
	
93
	
93
	
94
	
94
	public void rafraichir(Object nouvelleDonnees,
-
 
Line -... Line 95...
-
 
95
	public void rafraichir(Object nouvelleDonnees,
-
 
96
			boolean repandreRaffraichissement) {
-
 
97
		
-
 
98
		if(nouvelleDonnees instanceof String[])
-
 
99
		{
-
 
100
			estNote = false ;
-
 
101
			
-
 
102
			String[] note = (String[])nouvelleDonnees ;
-
 
103
			int noteInt = Integer.parseInt(note[0]) ;
-
 
104
			
-
 
105
			System.out.println("Note reçue : "+noteInt);
-
 
106
			if(noteInt != -1)
-
 
107
			{
-
 
108
				noter(noteInt) ;
-
 
109
			}
-
 
110
			else
-
 
111
			{
-
 
112
				noteEnCours = 0 ;
-
 
113
				afficherNote() ;
-
 
114
			}
-
 
115
			
-
 
116
		}
-
 
117
		
-
 
118
	}
-
 
119
	
-
 
120
	public void noter(int note)
-
 
121
	{
95
			boolean repandreRaffraichissement) {
122
		noteEnCours = note ;
Line 96... Line 123...
96
		// TODO Auto-generated method stub
123
		estNote = true ;
97
		
124
		afficherNote() ;
98
	}
125
	}
Line 107... Line 134...
107
			etoiles[i] = new Image("etoile_vide.jpg") ;
134
			etoiles[i] = new Image("etoile_vide.jpg") ;
108
			this.add(etoiles[i]) ;
135
			this.add(etoiles[i]) ;
109
		}
136
		}
110
	}
137
	}
Line 111... Line 138...
111
	
138
	
112
	public void noter()
139
	public void afficherNote()
113
	{
140
	{
114
		for(int j = 0 ; j <= noteEnCours ; j++)
141
		if(estNote)
-
 
142
		{
-
 
143
			for(int i = 0 ; i <= noteEnCours ; i++)
115
		{
144
			{
-
 
145
				etoiles[i].setUrl("etoile_notee.jpg") ;
-
 
146
			}
-
 
147
			
-
 
148
			for (int j = noteEnCours + 1 ; j < noteMax ; j++) 
-
 
149
			{						
-
 
150
				etoiles[j].setUrl("etoile_vide.jpg") ;						
116
			etoiles[j].setUrl("etoile_notee.jpg") ;
151
			}
-
 
152
		}
117
		}
153
		else
118
		
154
		{
-
 
155
			for(int i = 0 ; i < noteMax ; i++)
119
		for (int j = noteEnCours + 1 ; j <= noteMax ; j++) {						
156
			{
-
 
157
				etoiles[i].setUrl("etoile_vide.jpg") ;
120
			etoiles[j].setUrl("etoile_vide.jpg") ;						
158
			}
-
 
159
		}
-
 
160
		
-
 
161
		
-
 
162
	}
-
 
163
	
-
 
164
	public String getNote()
-
 
165
	{
121
		}
166
		return ""+noteEnCours ;
122
	}
-
 
Line 123... Line 167...
123
 
167
	}