From e365737a0fa26f0aaaf088aabb4cca0b7f61ece9 Mon Sep 17 00:00:00 2001 From: esoe Date: Fri, 13 May 2022 17:10:00 +0300 Subject: [PATCH] ce --- src/main/java/ru/egspt/AccessPane.java | 4 +- src/main/java/ru/egspt/App.java | 10 ++- src/main/java/ru/egspt/BaseControls.java | 7 ++- src/main/java/ru/egspt/ReportPane.java | 34 ++++++++++ src/main/java/ru/egspt/ReportTableModel.java | 58 ++++++++++++++++++ src/main/java/ru/egspt/UserListModel.java | 9 ++- target/classes/ru/egspt/AccessPane.class | Bin 3897 -> 3797 bytes target/classes/ru/egspt/App.class | Bin 1558 -> 1822 bytes target/classes/ru/egspt/BaseControls.class | Bin 1585 -> 1839 bytes target/classes/ru/egspt/ReportPane.class | Bin 0 -> 1779 bytes .../classes/ru/egspt/ReportTableModel.class | Bin 0 -> 1778 bytes target/classes/ru/egspt/UserListModel.class | Bin 2935 -> 3373 bytes 12 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 src/main/java/ru/egspt/ReportPane.java create mode 100644 src/main/java/ru/egspt/ReportTableModel.java create mode 100644 target/classes/ru/egspt/ReportPane.class create mode 100644 target/classes/ru/egspt/ReportTableModel.class diff --git a/src/main/java/ru/egspt/AccessPane.java b/src/main/java/ru/egspt/AccessPane.java index 2970f7c..4f7d437 100644 --- a/src/main/java/ru/egspt/AccessPane.java +++ b/src/main/java/ru/egspt/AccessPane.java @@ -23,7 +23,7 @@ public class AccessPane extends JPanel { private JButton connButton = new JButton("Подключиться"); private JButton DisconnButton = new JButton("Отключиться"); - public AccessPane(Base base){ + public AccessPane(Base base, Data data, ReportPane reportPane){ loginField.setText("esoe");//значения по умолчанию linkField.setText("www.egspt.ru");//значения по умолчанию this.add(loginLabel); @@ -34,7 +34,7 @@ public class AccessPane extends JPanel { this.add(linkField); //настройка кнопки connButton this.add(connButton); - connButton.addActionListener(e -> BaseControls.ConnectToServer(base, this)); + connButton.addActionListener(e -> BaseControls.ConnectToServer(base, data, this, reportPane)); //настройка кнопки отключения от базы this.add(DisconnButton); DisconnButton.addActionListener(e -> BaseControls.DisconnectFromServer(base)); diff --git a/src/main/java/ru/egspt/App.java b/src/main/java/ru/egspt/App.java index ebc0731..8ce63a9 100644 --- a/src/main/java/ru/egspt/App.java +++ b/src/main/java/ru/egspt/App.java @@ -10,10 +10,14 @@ import javax.swing.WindowConstants; public class App extends JPanel{ public Base base = new Base(); public Data data = new Data(); - + public ReportPane rp = new ReportPane(); + public AccessPane ap = new AccessPane(base, data, rp); + public TagPane tp = new TagPane(base, new TagModel()); + public void init(){ - this.add(new AccessPane(base)); - this.add(new TagPane(base, new TagModel())); + this.add(ap); + this.add(tp); + this.add(rp); this.setVisible(true); } public void initFrame(){ diff --git a/src/main/java/ru/egspt/BaseControls.java b/src/main/java/ru/egspt/BaseControls.java index f72f40f..6ae4066 100644 --- a/src/main/java/ru/egspt/BaseControls.java +++ b/src/main/java/ru/egspt/BaseControls.java @@ -2,7 +2,7 @@ package ru.egspt; public class BaseControls { // - public static void ConnectToServer(Base base, AccessPane accessPane){ + public static void ConnectToServer(Base base, Data data, AccessPane accessPane, ReportPane reportPane){ System.out.println("Инициировано событие ConnectToServer ..."); String link = accessPane.getLinkField().getText(); base.getAccess().setLink(link); @@ -11,6 +11,11 @@ public class BaseControls { String password = String.valueOf(accessPane.getPassField().getPassword()); base.getAccess().setPassword(password); base.connect();//подключиться к базе + data.setUsersFromBase(base); + //данные в консоль + //data.getUsersToConsole(data.getUsers()); + //данные в панель отчетов + reportPane.setData(data); } public static void DisconnectFromServer(Base base){ System.out.println("Инициировано событие DisconnectFromServer ..."); diff --git a/src/main/java/ru/egspt/ReportPane.java b/src/main/java/ru/egspt/ReportPane.java new file mode 100644 index 0000000..7d15aa1 --- /dev/null +++ b/src/main/java/ru/egspt/ReportPane.java @@ -0,0 +1,34 @@ +package ru.egspt; + +import java.awt.Dimension; +import java.awt.Color; + +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.LineBorder; +import javax.swing.border.TitledBorder; + +public class ReportPane extends JPanel{ + JPanel controlPane = new JPanel();//панель кнопок - пока не надо + JButton generateXLSXButton = new JButton("create xlsx"); + JButton generateTXTButton = new JButton("create txt"); + JPanel tabPane = new JPanel();//панель таблицы + public ReportPane(){ + controlPane.add(generateXLSXButton); + controlPane.add(generateTXTButton); + this.add(controlPane); + this.add(tabPane); + TitledBorder border = new TitledBorder(new LineBorder(Color.black), "report", TitledBorder.CENTER, TitledBorder.CENTER); + this.setBorder(border); + this.setVisible(true); + } + public void setData(Data data){ + JTable table = new JTable(new ReportTableModel(data)); + table.setPreferredScrollableViewportSize(new Dimension(500, 70)); + table.setFillsViewportHeight(true); + JScrollPane scrollPane = new JScrollPane(table); + tabPane.add(scrollPane); + } +} diff --git a/src/main/java/ru/egspt/ReportTableModel.java b/src/main/java/ru/egspt/ReportTableModel.java new file mode 100644 index 0000000..a2a6ce1 --- /dev/null +++ b/src/main/java/ru/egspt/ReportTableModel.java @@ -0,0 +1,58 @@ +package ru.egspt; + +import javax.swing.table.AbstractTableModel; + +public class ReportTableModel extends AbstractTableModel{ + private String[] header = {"id", "login", "mail"}; + private Object[][] data; + public ReportTableModel(Data data){ + //заполняем модель данными + int i = 0; + while (i < data.getUsers().size()){ + this.data[0][i] = data.getUsers().get(i).getId(); + this.data[1][i] = data.getUsers().get(i).getLogin(); + this.data[2][i] = data.getUsers().get(i).getMail(); + i++; + } + } + + @Override + public int getRowCount() { + return getData().length; + } + + @Override + public int getColumnCount() { + return getHeader().length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + return getData()[rowIndex][columnIndex]; + } + /** + * @return the data + */ + public Object[][] getData() { + return data; + } + /** + * @param data the data to set + */ + public void setData(Object[][] data) { + this.data = data; + } + /** + * @return the header + */ + public String[] getHeader() { + return header; + } + /** + * @param header the header to set + */ + public void setHeader(String[] header) { + this.header = header; + } + +} diff --git a/src/main/java/ru/egspt/UserListModel.java b/src/main/java/ru/egspt/UserListModel.java index b87b7f5..58dee03 100644 --- a/src/main/java/ru/egspt/UserListModel.java +++ b/src/main/java/ru/egspt/UserListModel.java @@ -6,7 +6,6 @@ import java.util.ArrayList; public class UserListModel { private ArrayList users; public UserListModel(){ - users = new ArrayList(); } /** * @return the users @@ -41,6 +40,14 @@ public class UserListModel { } setUsers(us); } + //вывод пользователей в консоль + public void getUsersToConsole(ArrayList ul){ + int i = 0; + while (i < ul.size()){ + System.out.println(ul.get(i).id + " " + ul.get(i).login + " " + ul.get(i).mail ); + i++; + } + } /** * Возвращает список пользователей, отфильтрованный по заданному тегу * @return diff --git a/target/classes/ru/egspt/AccessPane.class b/target/classes/ru/egspt/AccessPane.class index 9ad1a97496682420b91f39c439fdf5e98b977887..ba8412a1b6df69fb032f705758ca5f2670e3ae1a 100644 GIT binary patch delta 878 zcmZ`%OHUI~6#i}>bUGB;KtM}?bOE6hup}Uh){UYjMiL1kiJF)U?FFmtOf%C~@r8;H ze52PFzCe876GT){qby8Zn7Gt6#*M$h1$w3dNlZv4bI!Tn`M&erGxN6mTbcZ2?%hWK zjhLR0U5qt}A*p2fS|z1~Tl930cN@u6u#G1*J=LnHla;K=Vu|_1xKt#DCGXOWz1D;! zWQ&pxgL_daE6gD43yPefXc7K5Nc^&Y=siW$T}nm?#uc?YxK7tKUBVfL)-9^e4K1GG zQC~z$Bx7+U71LB-Qr9};JQ4EA&i0+0Ak|3e=}1b`eXAo8ZWwd}?q8!AyxJEtd}%ex zyJ9Mj$};*<${@v+L}yf~sAp*Nx9DO-T2`{uCU{uvkjo_*1GwbCMUkMb30x+}&6=w6 zNUB}i%=HY{88(_LwV6UJCxl zY|Ocfdk&0B>PCmnbre#m{!&&YutU>=dk{bZ@F6ZNhJd&m~> z+C-NtzWpnz@Ev~qL^XaRz<^pNqmH?;0-5aplqF*i_EJSM=)pd6V`lqt0G4ca5QktT zeldD+7&gL>;HdECg{*xzCORk{r&{EN+D_mkp@k$BAO`6`evkgG1*fNQc7`eo()7;B zBI~mbXoAOLu4A6JiuB17q?+15-83$U!Ti!1X~7^QT)|b?JhHj1c}kEX$-o|%#-NzZ rFAtkNj11h)j=X~*ipA9Pkj@_ADV}As=Xik$yd=#00F!u)DR}<^#kS)F delta 1115 zcmZuvTWl0%6#o95GCMO&VY_uvs+2WtX)Q~)3B;H-7@-#|w4kX8X?Pmep{(qsnVD@t ztJ@0-$ekYn1u1u}B6M5WUKUyqm7C&_=(G6fn{T`j511u@j%Wv5Ud;f!3)7BU-FI*t*TM^r(v6*ux;i6BdK7Ihzj0gYOvOnAK_-x)!aK zu#chH9(dSePuj!wRk9QIke|$uow6q%_R-gCPdR6j5Gnh*<5GCcPr!^lM3-J7tO$kT ziJ0ZDs;W|O0EgT-$WZv4iYho3Ft|IMCL%F6zF_b=xUE66D@?7gZZx#0F5xJH5{k!S zTF45=V+sx@@rnY5uT&JkOLv@5@ij^rUNUv7Uf-l8B34}_ZtCkgbVHjap~*oybQlbI zn$d1jUmJ3}$gRqvPTFf3DMyF0?%PX3n`EUGPX&&#Es$W$wh+!2Y@KVY8u<6W8 z%tj*~&2f35yi6R!gd5|$MJ^XIxW>EWN3%v57FO^nsd%{ulg?IdsLZV$Dl{~UabPZ)_X%H7z zj^W#<#YM^kWm)ZcgdxPtddRzk%W!!V`a!-Kp&$_)*eudX@$NarwGN2h9IjB*g{w%D eb)>FSYzjZ(R@VCow{Zt|Dd#+dd-xR(F#ms{;w_K> diff --git a/target/classes/ru/egspt/App.class b/target/classes/ru/egspt/App.class index da2ad6ddc4209c1349ab60763160c6a040f291cb..d00d41527a6307786dc66aca491b597c19880bd8 100644 GIT binary patch literal 1822 zcmZ`(TUQ%Z6#h;K3{0mjBoMjul9Zw$sfkvtTCmEcC^c;n5Tsc300W(x+nNm4`c&(K zOP6c;)c5`bizKOy;=50if8Z~1`JI`R0T-^U%-Lt}@9b~i&iU(~XL|r%M?phKz_7Qo z=2oTbWGBjH4Pk-EUHO&#I$ODC6}Ph2=48>#3xwBX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)*9*`$E9x_+3{1*ynlVJb= diff --git a/target/classes/ru/egspt/BaseControls.class b/target/classes/ru/egspt/BaseControls.class index 22129a4bd1e61b13efe26c5f524ba0a5568eb772..ac62d0735a43df0873e5eee5e0a64eec7a7804e5 100644 GIT binary patch delta 615 zcmZ9I%}x_x6o#MaOj{VIwHAuVf|%%nU+Y4WLPLl~&`=_XP!;?eWcX8PnJH^_?#*0) zS3pQvd@(M(09Gtr8Mp*)fNdEYZl=P+v@U;Ow9JYe^$eQ>+dH{nP(x*3xmuRAzE=*q-u~0yvAbS z`N5Q5+m6Tv`TxE8t2VD#O7q&F;|kL9m~(eLhh^Rvqy-g`{~?SPb-sSFvQ{+ydK^<< zB7;@E_17TU2~W(vUfb7~L@ow}c(Y|5o|_f3jZfi%^~BnC*a^Q`U-o~KAT7Uc?ucBz zOVK@~=vCYuvj!9cw=BhdQAQ#qsgTBwhz_1Tu-R=m3I&b`Fn5Q)e| zT=)Tgh5m<#C)ott%*>fNXU@#C6WP}1@B0UUC3GIFr}1fj`{u3`T&e5ZQmw6matf>6 zZlF~3^JRDfvcsXkP&$s;;iL4!Z@Er_`+w0)GmF#EH#g$AmdW`2aR*1_Ql{ajx%D6WwHMUsPBW^KZF-~ECu^(AvkZ1IW z3!L~E_bqvhyygavVaL3vg#w(!4WITg~w=-m7$_S mj$qEkFP!iNUUQaS<4}m?j$wMcu`6>TK*LE~1uoe%(EbCVWJ+rQ diff --git a/target/classes/ru/egspt/ReportPane.class b/target/classes/ru/egspt/ReportPane.class new file mode 100644 index 0000000000000000000000000000000000000000..8c3f8f46c62d2a215ad808e2a7ae85fbc6d2e679 GIT binary patch literal 1779 zcmaJ?|56)O6#g!RY}l?OgkKGo0@cDt9;L4QD8iOUMEMEb?HjqQgSa} z*jqkQ%5w!K`gOx&QXV~3F76dibv0#G!U)m3wri_<0)y#HNg%S~)ufI=#0^}4F$}Ud zFodXvF{09kCUh3V1f%vP!I?X88YeoEm}2XTgee_>G98O37L-p+bD0u*oi?B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