public void enregistrerRecherche(Application application) { Recherche maRecherche = new Recherche(); maRecherche.setNumRecherche(application.getMesRecherches().size() + 1); maRecherche.setDateRecherche(new Date()); maRecherche.setMotRecherche(textFieldRecherche.getText()); for (Entry<Integer, String> entry : Bddictionnairique.getInstance(application) .getVoletRechercheSimple() .getListeDicos() .entrySet()) { maRecherche.getListeDictionnaire().add(entry.getValue()); } HeadwordDAO headwords = new HeadwordDAO("local"); for (String dictionnaire : maRecherche.getListeDictionnaire()) { List<Headword> mots = headwords.findExactly(textFieldRecherche.getText(), dictionnaire); for (Headword headword : mots) { maRecherche.getListeResultat().put(headword.getIdHeadword(), headword); } } application.getMesRecherches().add(maRecherche); }
public void initComponents(final Application application) { // setBounds(100, 100, 800, 550); setPreferredSize(application.getSize()); setBackground(Color.PINK); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {20, 350, 20, 309, 20, 0}; gridBagLayout.rowHeights = new int[] {20, 350, 20, 0, 20, 0}; gridBagLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); tabbedPaneConfig = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPaneConfig = new GridBagConstraints(); gbc_tabbedPaneConfig.insets = new Insets(0, 0, 5, 5); gbc_tabbedPaneConfig.fill = GridBagConstraints.BOTH; gbc_tabbedPaneConfig.gridx = 1; gbc_tabbedPaneConfig.gridy = 1; tabbedPaneConfig.addTab("Local", configParamSqlLocal); tabbedPaneConfig.addTab("Master", configParamSqlMaster); add(tabbedPaneConfig, gbc_tabbedPaneConfig); tabbedPaneRequetes = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPaneRequetes = new GridBagConstraints(); gbc_tabbedPaneRequetes.gridheight = 3; gbc_tabbedPaneRequetes.insets = new Insets(0, 0, 5, 5); gbc_tabbedPaneRequetes.fill = GridBagConstraints.BOTH; gbc_tabbedPaneRequetes.gridx = 3; gbc_tabbedPaneRequetes.gridy = 1; add(tabbedPaneRequetes, gbc_tabbedPaneRequetes); tabbedPaneRequetes.addTab("Local", configSqlEditorLocal); tabbedPaneRequetes.addTab("Master", configSqlEditorMaster); add(tabbedPaneRequetes, gbc_tabbedPaneRequetes); }
public void afficherRecherche(Application application, int numRecherche) { resultat.removeAll(); ArrayList<String> dico = application.getMesRecherches().get(numRecherche).getListeDictionnaire(); expandingPanels = new ExpandingPanels(dico.size()); expandingPanels.clear(); for (String dictionnaire : dico) { Vector<MotsCell> listeMots = new Vector<MotsCell>(); MotsCell motsCell; for (Object hw : application.getMesRecherches().get(numRecherche).getListeResultat().values()) { if (dictionnaire.equalsIgnoreCase( ((Headword) hw).getDictionnaires().getNomDictionnaire())) { motsCell = new MotsCell(application); motsCell.setHeadword(((Headword) hw)); listeMots.addElement(motsCell); } } this.expandingPanels.addVolet( dictionnaire.toUpperCase(), listeMots.size(), new MotsRenderer(application, listeMots)); /*// DETAIL 1 if (Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getValue() == Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getMinimum()) { Vector<RSDetail_1> listeMots = new Vector<RSDetail_1>(); RSDetail_1 rsdetail_1; for(Object hw : application.getMesRecherches().get(numRecherche).getListeResultat().values()) { if(dictionnaire.equalsIgnoreCase(((Headword) hw).getDictionnaires().getNomDictionnaire())) { rsdetail_1 = new RSDetail_1(application); rsdetail_1.setHeadword(((Headword) hw)); listeMots.addElement(rsdetail_1); } } this.expandingPanels.addVolet(dictionnaire.toUpperCase(), listeMots.size(), new MotsRenderer_1(application, listeMots)); } // DETAIL 2 else if (Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getValue() == (Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getMaximum())/2) { Vector<RSDetail_2> listeMots = new Vector<RSDetail_2>(); RSDetail_2 rsdetail_2; for(Object hw : application.getMesRecherches().get(numRecherche).getListeResultat().values()) { if(dictionnaire.equalsIgnoreCase(((Headword) hw).getDictionnaires().getNomDictionnaire())) { rsdetail_2 = new RSDetail_2(application); rsdetail_2.setHeadword(((Headword) hw)); rsdetail_2.getLblMots().setText(((Headword) hw).getMot()); rsdetail_2.getLblCategories().setText(((Headword) hw).getMot()); String cat = "Catégorie(s) : "; Set<?> test = ((Headword) hw).getAvoirPourCategorieHeadwords(); Set<ListeCategories> test1 = new HashSet<ListeCategories>(0); for(Object object : test) { test1.add(((AvoirPourCategorieHeadword) object).getListeCategories()); } for(Object object1 : test1) { cat += ((ListeCategories) object1).getNom(); cat += " "; } rsdetail_2.getLblCategories().setText(cat); for(Object object : ((Headword) hw).getSyllabeses()) { rsdetail_2.getLblRegion().setText("Région : " + ((Syllabes) object).getRegion()); rsdetail_2.getLblSchema().setText("Schéma : " + ((Syllabes) object).getSchema()); rsdetail_2.getLblType().setText("Type : " + ((Syllabes) object).getTypePrononciation()); rsdetail_2.getLblSyllabes().setText("Syllabes : " + ((Syllabes) object).getSyllabe1() + " " + ((Syllabes) object).getSyllabe2() + " " + ((Syllabes) object).getSyllabe3() + " " + ((Syllabes) object).getSyllabe4() + " " + ((Syllabes) object).getSyllabe5() + " " + ((Syllabes) object).getSyllabe6() + " " + ((Syllabes) object).getSyllabe7() + "\t" + ((Syllabes) object).getSyllabe8() + " " + ((Syllabes) object).getSyllabe9() + " " + ((Syllabes) object).getSyllabe10()); } listeMots.addElement(rsdetail_2); } } this.expandingPanels.addVolet(dictionnaire.toUpperCase(), listeMots.size(), new MotsRenderer_2(application, listeMots)); } // DETAIL 3 else if (Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getValue() == Bddictionnairique.getInstance(application).getVoletRechercheSimple().getSliderDetails().getMaximum()) { Vector<RSDetail_3> listeMots = new Vector<RSDetail_3>(); RSDetail_3 rsdetail_3; for(Object hw : application.getMesRecherches().get(numRecherche).getListeResultat().values()) { if(dictionnaire.equalsIgnoreCase(((Headword) hw).getDictionnaires().getNomDictionnaire())) { rsdetail_3 = new RSDetail_3(application); rsdetail_3.setIdHeadword(((Headword) hw).getIdHeadword()); rsdetail_3.getLblMots().setText(((Headword) hw).getMot()); listeMots.addElement(rsdetail_3); } } this.expandingPanels.addVolet(dictionnaire.toUpperCase(), listeMots.size(), new MotsRenderer_3(application, listeMots)); }*/ } resultat.add(new JScrollPane(expandingPanels.getComponent()), gbc_result); this.revalidate(); }