From a8ed938b51e075758cb48057814430d4680d06e8 Mon Sep 17 00:00:00 2001 From: esoe Date: Fri, 22 Apr 2022 16:58:48 +0300 Subject: [PATCH] qq --- src/main/java/ru/egspt/moodle/Base.java | 36 ++++++++++++++++++ .../moodle/events/TagButtonListener.java | 8 ++-- .../java/ru/egspt/moodle/panel/TagPane.java | 13 ++----- .../java/ru/egspt/moodle/panel/UserByTag.java | 5 --- .../ru/egspt/moodle/panel/UserByTagPane.java | 7 ++++ target/classes/ru/egspt/moodle/Base.class | Bin 14495 -> 15118 bytes .../moodle/events/TagButtonListener.class | Bin 1071 -> 1179 bytes .../ru/egspt/moodle/panel/TagPane.class | Bin 1656 -> 1540 bytes .../ru/egspt/moodle/panel/UserByTag.class | Bin 296 -> 0 bytes .../ru/egspt/moodle/panel/UserByTagPane.class | Bin 0 -> 310 bytes 10 files changed, 51 insertions(+), 18 deletions(-) delete mode 100644 src/main/java/ru/egspt/moodle/panel/UserByTag.java create mode 100644 src/main/java/ru/egspt/moodle/panel/UserByTagPane.java delete mode 100644 target/classes/ru/egspt/moodle/panel/UserByTag.class create mode 100644 target/classes/ru/egspt/moodle/panel/UserByTagPane.class diff --git a/src/main/java/ru/egspt/moodle/Base.java b/src/main/java/ru/egspt/moodle/Base.java index 103bca5..1b7b70e 100644 --- a/src/main/java/ru/egspt/moodle/Base.java +++ b/src/main/java/ru/egspt/moodle/Base.java @@ -348,6 +348,42 @@ public class Base { this.users = uList; } + public void setUsersByTeg(Connection conn, String tag){ + ArrayList uList = new ArrayList(); + String teg = ""; + int b = 0; + while (b != 2){ + try{ + //teg = JOptionPane.showInputDialog("Укажите тег для поиска пользователей:"); + Statement stmt = conn.createStatement(); + //берем данные о базах данных на сервере + ResultSet rs = stmt.executeQuery("SELECT id, username, email FROM mdl_user"); + while(rs.next()){ + //фильтруем выборку user + int id = rs.getInt("id"); + String username = rs.getString("username"); + String email = rs.getString("email"); + //проверяем соответствие тега и записи в таблице + if (username.contains(teg)){ + User u = new User(); + u.setId(id); + u.setMail(email); + u.setName(username); + uList.add(u); + } + } + } + catch (Exception ex){ + System.err.println ("Подключение к серверу баз данных не установлено ... "); + ex.printStackTrace(); + System.out.println (ex); + } + b = JOptionPane.showConfirmDialog(null, "Добавить еще тег?", "try", JOptionPane.OK_CANCEL_OPTION); + System.out.println("Сделан выбор: " + b); + } + this.users = uList; + } + /** * Фильтруем пользователей, находим дубли почтовых ящиков * когда ящик совпал, перебираем результаты и заменяем ID пользователя в результате diff --git a/src/main/java/ru/egspt/moodle/events/TagButtonListener.java b/src/main/java/ru/egspt/moodle/events/TagButtonListener.java index f859c0d..c1d5d58 100644 --- a/src/main/java/ru/egspt/moodle/events/TagButtonListener.java +++ b/src/main/java/ru/egspt/moodle/events/TagButtonListener.java @@ -7,15 +7,17 @@ import ru.egspt.moodle.Base; import ru.egspt.moodle.BaseControls; public class TagButtonListener implements ActionListener{ - Base baseTagged; - public TagButtonListener(Base base){ + private Base baseTagged; + private String s; + public TagButtonListener(Base base, String tag){ baseTagged = base; + s = tag; } public void actionPerformed(ActionEvent e) { System.out.println("Нажата кнопка TagButton"); //Добавляем выбранный тег в список, для возможности удаления //фильтруем выборку пользователей и выводим в текстовую область - baseTagged.setUsersByTeg(BaseControls.getConnaction()); + baseTagged.setUsersByTeg(BaseControls.getConnaction(), s); System.out.println("Выборка пользователей изменена ... "); } diff --git a/src/main/java/ru/egspt/moodle/panel/TagPane.java b/src/main/java/ru/egspt/moodle/panel/TagPane.java index 851740c..f9a5e3d 100644 --- a/src/main/java/ru/egspt/moodle/panel/TagPane.java +++ b/src/main/java/ru/egspt/moodle/panel/TagPane.java @@ -3,10 +3,8 @@ package ru.egspt.moodle.panel; import java.awt.Color; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; -import javax.swing.WindowConstants; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; @@ -14,10 +12,10 @@ import ru.egspt.moodle.Base; import ru.egspt.moodle.events.TagButtonListener; public class TagPane extends JPanel{ - private JFrame mainframe = new JFrame("Настройка выборки"); private JTextField tagField = new JTextField(20); private JButton TagAddButton = new JButton("+"); //private JButton TagDelButton = new JButton("-"); + private UserByTagPane usersPane = new UserByTagPane(); public TagPane(Base base){ @@ -25,14 +23,9 @@ public class TagPane extends JPanel{ this.setBorder(border); tagField.setText("");//значения по умолчанию this.add(tagField); - TagAddButton.addActionListener(new TagButtonListener(base)); + TagAddButton.addActionListener(new TagButtonListener(base, tagField.getText())); this.add(TagAddButton); //this.add(TagDelButton); - } - public void init(){ - mainframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - mainframe.add(this); - mainframe.setSize(320, 240); - mainframe.setVisible(true); + this.add(usersPane); } } diff --git a/src/main/java/ru/egspt/moodle/panel/UserByTag.java b/src/main/java/ru/egspt/moodle/panel/UserByTag.java deleted file mode 100644 index 01da2df..0000000 --- a/src/main/java/ru/egspt/moodle/panel/UserByTag.java +++ /dev/null @@ -1,5 +0,0 @@ -package ru.egspt.moodle.panel; - -public class UserByTag { - -} diff --git a/src/main/java/ru/egspt/moodle/panel/UserByTagPane.java b/src/main/java/ru/egspt/moodle/panel/UserByTagPane.java new file mode 100644 index 0000000..54c7433 --- /dev/null +++ b/src/main/java/ru/egspt/moodle/panel/UserByTagPane.java @@ -0,0 +1,7 @@ +package ru.egspt.moodle.panel; + +import javax.swing.JPanel; + +public class UserByTagPane extends JPanel{ + +} diff --git a/target/classes/ru/egspt/moodle/Base.class b/target/classes/ru/egspt/moodle/Base.class index fb71e3f9893101c355db233290e4b6b37603eed6..eacd176b4fac10c73bc1fe480438df8e0a52f7d4 100644 GIT binary patch delta 1851 zcmaJ>X>gQ95Pfg5yWd_A*d>@RyBh)m1w;}eA(dJLBcPNRf+&Fk3ot-90wm-p5K)wWq0Mb>XDrY#pahq1z1$pE1QcH`+q;@STEX*HTHmayl=f!*Nt@{!&WqBj?miUjk zOXr)-E#DKJ^*+89M|1k%=hj5Q@i~W9XH$@#KCsn(sTV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a/target/classes/ru/egspt/moodle/panel/TagPane.class b/target/classes/ru/egspt/moodle/panel/TagPane.class index 59a5e3eebf0f651097cbdece3bd4ab25c2067f77..1e5c5fd44904b8ee310dea324a6339776a21c643 100644 GIT binary patch delta 659 zcmZXR%T7~K6o$WjS~%snxwJsJw@?c90#*@FKt#EyXe%f;4>~!6+DHf_P`pfJ;tMp# zi9;VjL)*kACQh9?ao`K+6F4%i10&;PueJX5uYX89c4wc$^-YE@4NfMKYJ{hXy^PE~12)d<=xZB<&!geB;-L)}$+%S0s@u&WG~iPspmYb5NCNXf;}<+{2m z6S>q#g{!F(!l7#wuBSY&!p$wQ(Hcv3`V6>T<@jEO`(8eJninVTIUi&OgNO2t$!yS$ zpJusP3lTyj2{T6ri?U9RE;i|AmmZGjq@w?957ya`NH!AImTWmEM}LGZ>WXbd H*5L79^k#sP delta 924 zcmZXSOHWfl6vzM52QAkTX(^>V3+2_`0`&nZRs;l!AXv0eC_XQ6Ay-R_Z4u(8F5I~= zBdHOXI?nmHGi(nz(djJVS}ZxS5&r`p@s2nb-Ummp=X8KLpT?nZQsoo=kC^#{~xSLR?vV#!z0w{TmKSka0;sbkl_=&74MkQ7bOf5ZbI>ToqZp z`ddS9Ns!|@`t;9+fTy1UqLD$4n_?iAw3-neN`yJgF@lipHukVv`i!yDK8kT6!bKw! z9Fw@C|1f^dnzV#Q1vbPu=EXEzBr>cnE9>#hP&}Dd!)t0v$!N)hNE#N)LykvyT)Zx# zy`;xAd&g*mBBpRGV39#0m8h217UC2(dFOpm@|je8i<$3 zXgy1x=LmJ$;;Ef$Xj_sf$ zkBjymvpJ6|lX6E6*W_Ke?Kg55ki{v7p;_9gU^M2>V=RZ;a#lD*V4H3=AWUl)@c>mY zQA;-1(SQp0;ld!Q5u%BQQHwd$VFmSAgBw$n-B_f?UECv!_z}T0^)yJoU diff --git a/target/classes/ru/egspt/moodle/panel/UserByTag.class b/target/classes/ru/egspt/moodle/panel/UserByTag.class deleted file mode 100644 index b5ead9c1163bb14a966d14e19458b26954dd43bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmaivF;2rk5Jmqub_^zvhzp=}K*2WY5>bGZ$|6NV`n5AM8*RMN+D777R7eyYfI~&h zMu?W?&-@w9*PHLd=NEtpMkyk~mG2Z+&AwGT=QftrUe|2ZbHo1OZKbOeF=4dTuUc7M zS87pgxoipjnW;^CPv~9WtO@a>+i->+P6tTPCk%5_^HaAg*spY9nQ)oAQrormCivfB z+`gEGFwXzMm=dz3>wL*`6T&Y30Pg}D#t;&D3sNZ%h^FGy(F4it2TtB)5Frx{YskTw Q=-}8VQqRRnv}lCk4+$GV3IG5A diff --git a/target/classes/ru/egspt/moodle/panel/UserByTagPane.class b/target/classes/ru/egspt/moodle/panel/UserByTagPane.class new file mode 100644 index 0000000000000000000000000000000000000000..6b129817696ac8538d8360cffca84df8c4b1bf4b GIT binary patch literal 310 zcma)%%}T>S6ot=C)5gYVrEefoP#4a|o#MiRixQ+@?S9%`;>a{pCW$|f)m6cT58y*d z@04!bxjA#cbK&yM&+peafNPv2hzMuCQCw83S}mPhSXL`tvQ^I&`}@y{F2;fhVnY8_ zzv&NEy_>R7qflEy=hl>_z9Y2GFQ$Ze=oXx!g>Hs6I)q+sN`7pXGxifbvn*$FH`jKm zy$QT8 USWAgR$!tGoI1(ZpOGfBz0peyxhX4Qo literal 0 HcmV?d00001