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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
| package présentation;
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.util.Observable;
import java.util.Observer;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
import application.ModeleTaitement;
import application.Modeletait1;
public class Vuetait1 extends JPanel implements Observer
{
/**
* numéro de sérialisation
*/
private static final long serialVersionUID = -5410904049757311328L;
Modeletait1 mdl = new Modeletait1();
ControleurTait1 ctrl = new ControleurTait1(mdl);
JLabel fichBlast;
JLabel fichSortie;
JProgressBar barre;
public void paintComponent (Graphics image)
{
Image fond = getToolkit().getImage("images/fond.jpg");;
image.drawImage(fond,0,0,this);
}
/** Le constructeur de la vue
*
*/
public Vuetait1()
{
setBorder(BorderFactory.createTitledBorder("Blast : Traitement des données"));
setLayout(new BorderLayout());
add(nouveauTitre(),BorderLayout.NORTH);
JPanel panCentre = new JPanel();
panCentre.setLayout(new GridLayout(3,1));
panCentre.setOpaque(false);
panCentre.add(nouveauLigne("Fichier blast à traiter","Parcourir",ctrl, "parcourir1"));
panCentre.add(nouveauLigne("Nom du fichier résultats","Parcourir",ctrl,"parcourir2"));
panCentre.add(progression());
add(panCentre,BorderLayout.CENTER);
add(panOption(), BorderLayout.SOUTH);
mdl.addObserver(this);
}
private Component panOption()
{
JPanel pan = new JPanel();
pan.setOpaque(false);
pan.setBorder(BorderFactory.createTitledBorder("Les options du traitement"));
pan.setLayout(new GridLayout(6,1));
pan.add(new PanCheckTrait("Nhits", false, "Visualiser les N 1st Hits", "", ctrl));
pan.add(new PanCheckTrait("minScore", false, "Valeur minimum du score", "", ctrl));
pan.add(new PanCheckTrait("eValMax", false, "Valeur maximum de la e-Value", "", ctrl));
pan.add(new PanCheckTrait("pourAlign", false, "% minimum de recouvrement du HSP", "", ctrl));
pan.add(new PanCheckTrait("pourIdent", false, "% minimum d'identité du HSP", "", ctrl));
pan.add(new PanCheckTrait("pourPositif", false, "% minimum de positif du HSP", "", ctrl));
return pan;
}
/** Cette méthode permet de montrer la progression de l'analyse
*
* @return
*/
private JPanel progression()
{
JPanel pan = new JPanel();
pan.setOpaque(false);
pan.setLayout(new GridLayout(1,2));
JButton bout = new JButton("Lancer Analyse");
JButton fermer = new JButton("Fermer");
bout.setForeground(Color.RED);
fermer.setForeground(Color.blue);
barre = new JProgressBar();
barre.setValue(0);
bout.setName("lancer");
fermer.setName("fermer");
JPanel panBou = new JPanel();
panBou.setLayout(new GridLayout(2,1));
panBou.add(bout);
panBou.add(fermer);
panBou.setOpaque(false);
bout.addActionListener(ctrl);
fermer.addActionListener(ctrl);
JPanel panbarre = new JPanel();
panbarre.add(barre);
panbarre.setOpaque(false);
pan.add(panbarre);
pan.add(panBou);
return pan;
}
/** Cette méthode permet de créer un panneau contenant 2 lignes
* un titre, et un ligne avec une zone de texte et un bouton
* @param libelle le titre
* @param lobBou le libel du bouton
* @param ctrl le controleur
* @return
*/
private JPanel nouveauLigne(String libelle, String lobBou, ControleurTait1 ctrl, String nom)
{
JPanel pan = new JPanel();
pan.setBorder(BorderFactory.createTitledBorder(libelle));
pan.setOpaque(false);
pan.setLayout(new GridLayout(2,1));
JLabel titre = new JLabel(libelle);
titre.setFont(getFont().deriveFont(Font.ITALIC, 17));
titre.setHorizontalAlignment(SwingConstants.CENTER);
titre.setForeground(Color.ORANGE);
JPanel panLigne = new JPanel();
panLigne.setOpaque(false);
panLigne.setLayout(new GridLayout(1,2));
if(nom=="parcourir1")
{
fichBlast = new JLabel("Aucun Fichier sélectionné");
fichBlast.setFont(getFont().deriveFont(Font.ITALIC, 15));
fichBlast.setHorizontalAlignment(SwingConstants.RIGHT);
fichBlast.setForeground(Color.ORANGE);
panLigne.add(fichBlast);
}
else if(nom=="parcourir2")
{
fichSortie = new JLabel("Aucun Fichier sélectionné");
fichSortie.setFont(getFont().deriveFont(Font.ITALIC, 15));
fichSortie.setHorizontalAlignment(SwingConstants.RIGHT);
fichSortie.setForeground(Color.ORANGE);
panLigne.add(fichSortie);
}
JButton bout = new JButton(lobBou);
bout.setName(nom);
bout.addActionListener(ctrl);
JPanel panBou = new JPanel();
panBou.setOpaque(false);
panBou.add(bout);
panLigne.add(panBou);
pan.add(titre);
pan.add(panLigne);
return pan;
}
/** Cette méthode permet de créer un titre
*
* @return Un Jlabel contenant le titre de l'aplication
*/
private JLabel nouveauTitre()
{
JLabel titre = new JLabel("Traitement des résultats blast");
titre.setFont(getFont().deriveFont(Font.ITALIC, 20));
titre.setHorizontalAlignment(SwingConstants.CENTER);
titre.setForeground(Color.RED);
return titre;
}
/** Permet la mise à jour de la vue
*
*/
public void update(Observable arg0, Object arg1)
{
if (arg0 instanceof Modeletait1 && arg1!=null)
{
mdl = (Modeletait1) arg0 ;
String nomType = arg1.toString() ;
if (nomType.equals("blast")) fichBlast.setText(mdl.getFichier());
else if (nomType.equals("save")) fichSortie.setText(mdl.getSortie());
else if (nomType.equals("fin")) {
barre.setValue(100);
fichBlast.setText("Aucun Fichier sélectionné");
fichSortie.setText("Aucun Fichier sélectionné");
}
if (nomType.equals("NHits"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedHit(), 0);
}
if (nomType.equals("score"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedScore(), 1);
}
if (nomType.equals("evalue"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedEvalue(), 2);
}
if (nomType.equals("align"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedAlign(), 3);
}
if (nomType.equals("ident"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedIdent(), 4);
}
if (nomType.equals("positif"))
{
System.out.println("Activation champ");
PanCheckTrait.actifChamp(mdl.getSelectedPositif(), 5);
}
if (nomType.equals("fin"))
{
PanCheckTrait.actifCheck(false, 0);
PanCheckTrait.actifCheck(false, 1);
PanCheckTrait.actifCheck(false, 2);
PanCheckTrait.actifCheck(false, 3);
PanCheckTrait.actifCheck(false, 4);
PanCheckTrait.actifCheck(false, 5);
PanCheckTrait.actifChamp(true, 0);
PanCheckTrait.actifChamp(true, 1);
PanCheckTrait.actifChamp(true, 2);
PanCheckTrait.actifChamp(true, 3);
PanCheckTrait.actifChamp(true, 4);
PanCheckTrait.actifChamp(true, 5);
PanCheckTrait.setText("", 0);
PanCheckTrait.setText("", 1);
PanCheckTrait.setText("", 2);
PanCheckTrait.setText("", 3);
PanCheckTrait.setText("", 4);
PanCheckTrait.setText("", 5);
}
}
}
} |
Partager