6 import java.io.IOException;
7 import java.net.InetAddress;
8 import java.net.UnknownHostException;
9 import java.text.DateFormat;
10 import java.text.SimpleDateFormat;
11 import java.util.ArrayList;
12 import java.util.Hashtable;
13 import javax.swing.JTable;
14 import javax.swing.table.DefaultTableModel;
15 import javax.swing.table.TableColumn;
29 static int id_user = -1;
30 public static boolean DBG =
true;
31 boolean serveron =
true;
32 boolean amalive =
true;
36 private static String
user =
" ";
37 private static String
pswd =
" ";
41 public static Hashtable
h =
new Hashtable();
49 @SuppressWarnings(
"static-access")
54 TableColumn col =
jTableShare1.getColumnModel().getColumn(5);
57 col.setPreferredWidth(0);
64 Thread tt =
new Thread(TRRF);
73 @SuppressWarnings(
"unchecked")
78 jLabel1 =
new javax.swing.JLabel();
79 jLabel2 =
new javax.swing.JLabel();
80 jButton2 =
new javax.swing.JButton();
81 jButton1 =
new javax.swing.JButton();
82 jButton3 =
new javax.swing.JButton();
83 jButton4 =
new javax.swing.JButton();
85 jButton5 =
new javax.swing.JButton();
87 jList1 =
new javax.swing.JList();
88 jLabel3 =
new javax.swing.JLabel();
89 jButton6 =
new javax.swing.JButton();
90 jButton7 =
new javax.swing.JButton();
91 jLabel4 =
new javax.swing.JLabel();
94 jLabel5 =
new javax.swing.JLabel();
98 jLabel7 =
new javax.swing.JLabel();
99 jLabel8 =
new javax.swing.JLabel();
100 jLabel9 =
new javax.swing.JLabel();
109 jButton8 =
new javax.swing.JButton();
110 jLabel6 =
new javax.swing.JLabel();
112 jMenu1 =
new javax.swing.JMenu();
114 jMenu2 =
new javax.swing.JMenu();
115 jMenu3 =
new javax.swing.JMenu();
124 jMenu4 =
new javax.swing.JMenu();
129 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
130 setTitle(
"P2PFileSystem - Client");
131 setName(
"ClientFrame");
133 addWindowListener(
new java.awt.event.WindowAdapter() {
134 public void windowClosing(java.awt.event.WindowEvent evt) {
139 jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
141 jLabel1.setFont(
new java.awt.Font(
"Tahoma", 1, 12));
142 jLabel1.setText(
"Distributed File System ");
144 jLabel2.setFont(
new java.awt.Font(
"Tahoma", 1, 12));
145 jLabel2.setText(
"Local File System");
147 jButton2.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Update_ico.png")));
148 jButton2.setText(
"Update file list");
149 jButton2.addActionListener(
new java.awt.event.ActionListener() {
150 public void actionPerformed(java.awt.event.ActionEvent evt) {
155 jButton1.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/OpenFile_ico.png")));
157 jButton1.addActionListener(
new java.awt.event.ActionListener() {
158 public void actionPerformed(java.awt.event.ActionEvent evt) {
163 jButton3.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Add_ico.png")));
166 jButton3.addActionListener(
new java.awt.event.ActionListener() {
167 public void actionPerformed(java.awt.event.ActionEvent evt) {
172 jButton4.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Remove_ico.png")));
174 jButton4.addActionListener(
new java.awt.event.ActionListener() {
175 public void actionPerformed(java.awt.event.ActionEvent evt) {
180 jButton5.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/LogOut_ico.png")));
182 jButton5.addActionListener(
new java.awt.event.ActionListener() {
183 public void actionPerformed(java.awt.event.ActionEvent evt) {
188 jList1.addMouseListener(
new java.awt.event.MouseAdapter() {
189 public void mouseClicked(java.awt.event.MouseEvent evt) {
195 jLabel3.setFont(
new java.awt.Font(
"Tahoma", 1, 12));
197 jLabel3.setText(
"Server attivi:");
199 jButton6.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Connect_ico.png")));
200 jButton6.setText(
"Connect to server");
201 jButton6.addActionListener(
new java.awt.event.ActionListener() {
202 public void actionPerformed(java.awt.event.ActionEvent evt) {
207 jButton7.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Refresh_ico.png")));
208 jButton7.setText(
"Update server list");
209 jButton7.addActionListener(
new java.awt.event.ActionListener() {
210 public void actionPerformed(java.awt.event.ActionEvent evt) {
215 jLabel4.setFont(
new java.awt.Font(
"Tahoma", 0, 12));
216 jLabel4.setForeground(
new java.awt.Color(0, 51, 204));
217 jLabel4.setText(
"No Connection");
223 jFileChooser1.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG);
225 jFileChooser1.setFileSelectionMode(javax.swing.JFileChooser.FILES_AND_DIRECTORIES);
227 jLabel5.setFont(
new java.awt.Font(
"Tahoma", 1, 12));
228 jLabel5.setText(
"Directories and files shared");
230 jTableShare.setModel(
new javax.swing.table.DefaultTableModel(
238 Class[] types =
new Class [] {
239 java.lang.String.class, java.lang.String.class
241 boolean[] canEdit =
new boolean [] {
245 public Class getColumnClass(
int columnIndex) {
246 return types [columnIndex];
249 public boolean isCellEditable(
int rowIndex,
int columnIndex) {
250 return canEdit [columnIndex];
253 jTableShare.setMinimumSize(
new java.awt.Dimension(5, 0));
255 jTableShare.getTableHeader().setReorderingAllowed(
false);
257 jTableShare.getColumnModel().getColumn(0).setPreferredWidth(30);
258 jTableShare.getColumnModel().getColumn(1).setPreferredWidth(50);
260 jButton10.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/add_server.png")));
262 jButton10.addActionListener(
new java.awt.event.ActionListener() {
263 public void actionPerformed(java.awt.event.ActionEvent evt) {
268 jLabel7.setFont(
new java.awt.Font(
"Tahoma", 1, 14));
271 jLabel8.setFont(
new java.awt.Font(
"Tahoma", 1, 14));
274 jLabel9.setFont(
new java.awt.Font(
"Tahoma", 1, 14));
277 jTableShare1.setModel(
new javax.swing.table.DefaultTableModel(
282 "Owner",
"Path",
"Name",
"Rights",
"Size",
"id" 285 Class[] types =
new Class [] {
286 java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
288 boolean[] canEdit =
new boolean [] {
289 false,
false,
false,
false,
false,
false 292 public Class getColumnClass(
int columnIndex) {
293 return types [columnIndex];
296 public boolean isCellEditable(
int rowIndex,
int columnIndex) {
297 return canEdit [columnIndex];
300 jTableShare1.setMinimumSize(
new java.awt.Dimension(5, 0));
302 jTableShare1.getTableHeader().setReorderingAllowed(
false);
305 jButton11.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Up_ico.png")));
306 jButton11.setText(
"Upload to client...");
307 jButton11.addActionListener(
new java.awt.event.ActionListener() {
308 public void actionPerformed(java.awt.event.ActionEvent evt) {
313 jButton12.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/delete_ico.png")));
315 jButton12.addActionListener(
new java.awt.event.ActionListener() {
316 public void actionPerformed(java.awt.event.ActionEvent evt) {
321 jButton8.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/disconnectIcon.png")));
322 jButton8.setText(
"Disconnect from server");
323 jButton8.addActionListener(
new java.awt.event.ActionListener() {
324 public void actionPerformed(java.awt.event.ActionEvent evt) {
329 jLabel6.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/no_connection_ico.png")));
333 jMenuItem1.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/LogOut_ico.png")));
335 jMenuItem1.addActionListener(
new java.awt.event.ActionListener() {
336 public void actionPerformed(java.awt.event.ActionEvent evt) {
346 jMenu3.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/folder_distributed_ico.png")));
347 jMenu3.setText(
"Distributed File System");
349 jMenuItem6.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Refresh_ico.png")));
351 jMenuItem6.addActionListener(
new java.awt.event.ActionListener() {
352 public void actionPerformed(java.awt.event.ActionEvent evt) {
358 jMenuItem8.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/add_server.png")));
360 jMenuItem8.addActionListener(
new java.awt.event.ActionListener() {
361 public void actionPerformed(java.awt.event.ActionEvent evt) {
367 jMenuItem7.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Connect_ico.png")));
369 jMenuItem7.addActionListener(
new java.awt.event.ActionListener() {
370 public void actionPerformed(java.awt.event.ActionEvent evt) {
376 jMenuItem11.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/disconnectIcon.png")));
378 jMenuItem11.addActionListener(
new java.awt.event.ActionListener() {
379 public void actionPerformed(java.awt.event.ActionEvent evt) {
386 jMenuItem2.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Update_ico.png")));
388 jMenuItem2.addActionListener(
new java.awt.event.ActionListener() {
389 public void actionPerformed(java.awt.event.ActionEvent evt) {
395 jMenuItem3.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/OpenFile_ico.png")));
397 jMenuItem3.addActionListener(
new java.awt.event.ActionListener() {
398 public void actionPerformed(java.awt.event.ActionEvent evt) {
404 jMenuItem9.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/delete_ico.png")));
406 jMenuItem9.addActionListener(
new java.awt.event.ActionListener() {
407 public void actionPerformed(java.awt.event.ActionEvent evt) {
415 jMenu4.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/folder_local_ico.png")));
416 jMenu4.setText(
"Local File System");
418 jMenuItem4.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Add_ico.png")));
420 jMenuItem4.addActionListener(
new java.awt.event.ActionListener() {
421 public void actionPerformed(java.awt.event.ActionEvent evt) {
427 jMenuItem10.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Up_ico.png")));
429 jMenuItem10.addActionListener(
new java.awt.event.ActionListener() {
430 public void actionPerformed(java.awt.event.ActionEvent evt) {
436 jMenuItem5.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/icons/Remove_ico.png")));
438 jMenuItem5.addActionListener(
new java.awt.event.ActionListener() {
439 public void actionPerformed(java.awt.event.ActionEvent evt) {
451 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
452 getContentPane().setLayout(layout);
453 layout.setHorizontalGroup(
454 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
455 .addGroup(layout.createSequentialGroup()
456 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
457 .addGroup(layout.createSequentialGroup()
459 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
460 .addGroup(layout.createSequentialGroup()
462 .addGap(285, 285, 285))
464 .addComponent(
jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE)
465 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
466 .addGroup(layout.createSequentialGroup()
472 .addComponent(
jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 503, javax.swing.GroupLayout.PREFERRED_SIZE))
473 .addGroup(layout.createSequentialGroup()
474 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
475 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
476 .addComponent(
jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
478 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
479 .addComponent(
jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 170, Short.MAX_VALUE)
480 .addComponent(
jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
481 .addGroup(layout.createSequentialGroup()
482 .addComponent(
jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
483 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
485 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
486 .addComponent(
jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
489 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
490 .addComponent(
jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
491 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
493 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
494 .addComponent(
jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
495 .addComponent(
jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
497 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
500 .addComponent(
jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 412, javax.swing.GroupLayout.PREFERRED_SIZE))
501 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)))
502 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
503 .addComponent(
jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
504 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
505 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
506 .addGroup(layout.createSequentialGroup()
507 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
508 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
509 .addComponent(
jFileChooser1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 464, javax.swing.GroupLayout.PREFERRED_SIZE)
510 .addComponent(
jLabel2, javax.swing.GroupLayout.Alignment.LEADING)))
511 .addGroup(layout.createSequentialGroup()
514 .addGroup(layout.createSequentialGroup()
515 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
516 .addComponent(
jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE))
517 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
518 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
520 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
522 .addGap(12, 12, 12)))
523 .addGroup(layout.createSequentialGroup()
524 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
526 .addComponent(
jButton5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
527 .addGroup(layout.createSequentialGroup()
529 .addComponent(
jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 1047, Short.MAX_VALUE)))
532 layout.setVerticalGroup(
533 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
534 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
536 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
537 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
539 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
540 .addComponent(
jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
542 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
545 .addComponent(
jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
547 .addComponent(
jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
548 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
550 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
551 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
552 .addGroup(layout.createSequentialGroup()
553 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
554 .addComponent(
jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
555 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
557 .addGroup(layout.createSequentialGroup()
558 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
559 .addComponent(
jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
560 .addComponent(
jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
562 .addGroup(layout.createSequentialGroup()
565 .addGroup(layout.createSequentialGroup()
569 .addComponent(
jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
570 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
571 .addGroup(layout.createSequentialGroup()
574 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
576 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
577 .addComponent(
jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE))
578 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
579 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
580 .addComponent(
jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
581 .addGap(22, 22, 22))))
582 .addComponent(
jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
585 .addComponent(
jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 598, javax.swing.GroupLayout.PREFERRED_SIZE)
586 .addGroup(layout.createSequentialGroup()
589 .addComponent(
jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
590 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
591 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
592 .addComponent(
jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
593 .addComponent(
jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
596 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
597 .addComponent(
jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
598 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
600 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
601 .addComponent(
jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
602 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
617 l.setLocationRelativeTo(null);
628 l.setLocationRelativeTo(null);
641 if((id_user!=-1) && (serveron) && (amalive))
642 if( (
user.compareTo(
" ")!=0) && (
pswd.compareTo(
" ")!=0) )
644 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: connection with server "+
ip_server+
" already active.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
647 if((!serveron) || (!amalive))
681 if((id_user!=-1) && (serveron) && (amalive))
682 if( (
user.compareTo(
" ")!=0) && (
pswd.compareTo(
" ")!=0) )
684 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: connection with server "+
ip_server+
" already active.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
687 if((!serveron) || (!amalive))
700 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
720 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
737 if (evt.getClickCount() != 2)
742 if((id_user!=-1) && (serveron) && (amalive))
743 if( (
user.compareTo(
" ")!=0) && (
pswd.compareTo(
" ")!=0) )
745 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: connection with server "+
ip_server+
" already active.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
748 if((!serveron) || (!amalive))
762 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
780 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
798 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
816 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
844 Frame[] f = Frame.getFrames();
846 for(
int i =0; i< f.length; i++){
847 if(((f[i].getName()).equals(
"MainFrame")&&(!f[i].isVisible()))&&(!
Config.
r_serverOpen()))
861 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
879 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
896 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
923 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
941 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
958 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
975 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
993 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no active connection.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
1069 javax.swing.JOptionPane.showMessageDialog(null,
"Ip address not valid. Text box empty.",
"Error", 0);
1073 int ip1, ip2, ip3, ip4;
1080 catch(Exception ex) {
1081 javax.swing.JOptionPane.showMessageDialog(null,
"Ip address not valid.",
"Error", 0);
1084 if((ip1<0)||(ip1>255)||(ip2<0)||(ip2>255)||(ip3<0)||(ip3>255)||(ip4<0)||(ip4>255)){
1085 javax.swing.JOptionPane.showMessageDialog(null,
"Ip address not valid.",
"Error", 0);
1089 String server_ip [] =
new String[1];
1090 server_ip[0] = ip1+
"."+ip2+
"."+ip3+
"."+ip4;
1091 jList1.setListData(server_ip);
1103 @SuppressWarnings(
"static-access")
1110 TRC.funct =
"getList";
1112 Thread t =
new Thread(TRC);
1117 }
catch (InterruptedException ex) {
1123 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no connection with server",
"Warning",javax.swing.JOptionPane.WARNING_MESSAGE );
1128 DefaultTableModel model = (DefaultTableModel)
jTableShare1.getModel();
1130 while(model.getRowCount()>0){
1135 model.fireTableRowsDeleted(0, num_row);
1143 String [] cols =
new String [6];
1144 for(
int i=0;i<l.size();i++)
1146 ArrayList ll = (ArrayList)l.get(i);
1147 cols[0] = ll.get(3).toString();
1148 cols[1] = ll.get(2).toString();
1149 cols[2] = ll.get(1).toString();
1150 cols[3] = ll.get(7).toString();
1151 cols[4] = ll.get(5).toString();
1152 cols[5] = ll.get(0).toString();
1155 model.fireTableRowsInserted(0, l.size()-1);
1169 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no server available",
"Warning",javax.swing.JOptionPane.WARNING_MESSAGE );
1172 String server[] =
new String[ip.size()];
1174 for(
int i=0; !ip.isEmpty(); i++){
1175 server[i]=ip.get(i).toString();
1180 jList1.setListData(server);
1182 catch (IOException ex){
1192 @SuppressWarnings(
"static-access")
1194 String server =
new String(
"");
1196 server = (
jList1.getSelectedValue().toString().replaceAll(
" ",
""));
1197 if(server.equals(
""))
1198 jLabel4.setText(
"No server selected");
1202 javax.swing.JLabel label1 =
new javax.swing.JLabel(
"Insert username:");
1203 javax.swing.JTextField juf =
new javax.swing.JTextField();
1204 javax.swing.JLabel label2 =
new javax.swing.JLabel(
"Insert password:");
1205 javax.swing.JPasswordField jpf =
new javax.swing.JPasswordField();
1206 javax.swing.JOptionPane.showConfirmDialog(null,
new Object[]{label1,juf , label2, jpf},
"Password:", javax.swing.JOptionPane.OK_CANCEL_OPTION,1);
1212 user = juf.getText();
1214 jpf.setText(
"*****");
1218 TRC.funct =
"registerToServer";
1219 Thread t =
new Thread(TRC);
1224 }
catch (InterruptedException ex) {
1230 javax.swing.JOptionPane.showMessageDialog(null,
"ID or PASSWORD not valid",
"Error", 0);
1253 @SuppressWarnings(
"static-access")
1257 DefaultTableModel model = (DefaultTableModel)
jTableShare1.getModel();
1260 String id_owner = model.getValueAt(indexToOpen, 0).toString();
1261 String id_file = model.getValueAt(indexToOpen, 5).toString();
1262 String path_file = model.getValueAt(indexToOpen, 1).toString();
1263 String name_file = model.getValueAt(indexToOpen, 2).toString();
1267 String accessString =
"-1";
1272 TRC.funct =
"getAccessStringRead";
1275 Thread t =
new Thread(TRC);
1282 }
catch (InterruptedException ex) {
1287 if( (accessString==null) || (!accessString.contains((CharSequence)
";")) ){
1288 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: generic error",
"Access deny",0 );
1293 if(accessString.equals(
"-2")){
1294 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: wrong id or password",
"Access deny",0 );
1299 if(accessString.equals(
"-4")){
1300 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: no rights to open the file",
"Access deny",0 );
1305 if(accessString.equals(
"-3")){
1306 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: impossible to open a file in writing",
"Access deny",0 );
1311 String k_to_connect =
user + id_file;
1312 String ip_to_connect = accessString.substring(0, accessString.indexOf(
';'));
1313 String v_to_connect = accessString.substring(accessString.indexOf(
';')+1, accessString.length());
1317 TRF.name = name_file;
1318 TRF.path = path_file.replace(
"//",
"////");
1319 TRF.user = k_to_connect;
1320 TRF.pswd = v_to_connect;
1321 TRF.function =
"getFile";
1322 Thread t2 =
new Thread (TRF);
1336 @SuppressWarnings(
"static-access")
1340 DefaultTableModel model = (DefaultTableModel)
jTableShare1.getModel();
1343 String rights = model.getValueAt(indexToDelete, 3).toString();
1344 if(!rights.equals(
"2")){
1345 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: impossible to delete the selected file",
"Access deny",0 );
1349 String id_owner = model.getValueAt(indexToDelete, 0).toString();
1350 String id_file = model.getValueAt(indexToDelete, 5).toString();
1351 String path_file = model.getValueAt(indexToDelete, 1).toString();
1352 String name_file = model.getValueAt(indexToDelete, 2).toString();
1353 String size = model.getValueAt(indexToDelete, 4).toString();
1356 String accessString =
"-1";
1362 TRC.funct =
"getAccessStringDelete";
1365 Thread t =
new Thread(TRC);
1370 }
catch (InterruptedException ex) {
1375 if( (accessString==null) || (!accessString.contains((CharSequence)
";")) ){
1376 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: generic error",
"Access deny",0 );
1381 if(accessString.equals(
"-2")){
1382 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: id or password aren't correct",
"Access deny",0 );
1386 if(accessString.equals(
"-4")){
1387 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: no rights to delete the file",
"Access deny",0 );
1391 if(accessString.equals(
"-3")){
1392 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: impossible to delete a file in writing",
"Access deny",0 );
1396 if(accessString.equals(
"-5")){
1397 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: impossible to delete a file in reading",
"Access deny",0 );
1401 String k_to_connect =
user + id_file;
1402 String ip_to_connect = accessString.substring(0, accessString.indexOf(
';'));
1403 String v_to_connect = accessString.substring(accessString.indexOf(
';')+1, accessString.length());
1407 TRF.name = name_file;
1408 TRF.path = path_file.replace(
"\\",
"\\\\");
1409 TRF.user = k_to_connect;
1410 TRF.pswd = v_to_connect;
1411 TRF.function =
"deleteFile";
1412 Thread t2 =
new Thread (TRF);
1418 }
catch (InterruptedException ex) {
1426 TRCC.funct =
"removeFile";
1429 Thread tt =
new Thread(TRCC);
1435 }
catch (InterruptedException ex) {
1439 model.removeRow(indexToDelete);
1441 model.fireTableRowsDeleted(indexToDelete, indexToDelete);
1445 DefaultTableModel model2 = (DefaultTableModel)
jTableShare.getModel();
1446 for(
int i=0; i< model2.getRowCount(); i++){
1449 if((model2.getValueAt(i, 0).toString().compareTo(name_file)==0 )&& (model2.getValueAt(i, 1).toString().compareTo(path_file)==0)){
1450 model2.removeRow(i);
1451 model2.fireTableRowsDeleted(i, i);
1467 @SuppressWarnings(
"static-access")
1472 if(f.isDirectory()){
1482 TRC.funct =
"getUserList";
1484 Thread t =
new Thread(TRC);
1489 }
catch (InterruptedException ex) {
1495 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: no client available.",
"Warning",javax.swing.JOptionPane.WARNING_MESSAGE );
1499 Object o [] =
new Object[l.size()];
1501 for(
int i=0; i<l.size(); i++)
1502 o[i] = ((ArrayList)l.get(i)).
get(2);
1504 javax.swing.JLabel label1 =
new javax.swing.JLabel(
"Select CLIENT:");
1505 javax.swing.JComboBox clist =
new javax.swing.JComboBox(o);
1506 int r = javax.swing.JOptionPane.showConfirmDialog(null,
new Object[]{label1,clist},
"Upload to client...", javax.swing.JOptionPane.OK_CANCEL_OPTION, 1);
1508 if(r != javax.swing.JOptionPane.OK_OPTION)
1510 int ind = clist.getSelectedIndex();
1511 String ip_client =((ArrayList)l.get(ind)).
get(1).toString();
1514 String accessString =
"-1";
1519 TRCC.funct =
"getAccessStringUpload";
1522 Thread tt =
new Thread(TRCC);
1529 }
catch (InterruptedException ex) {
1534 if( accessString==null ){
1535 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: generic error",
"Access deny",0 );
1540 if(accessString.equals(
"-2")){
1541 javax.swing.JOptionPane.showMessageDialog(null,
"Access deny: id or password aren't correct",
"Access deny",0 );
1548 TRF.name = f.getName();
1549 TRF.path = f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-f.getName().length());
1551 TRF.pswd = accessString;
1552 TRF.function =
"sendFile";
1553 Thread t2 =
new Thread (TRF);
1564 @SuppressWarnings(
"static-access")
1569 if(f.isDirectory()){
1575 r.setLocationRelativeTo(null);
1578 String path = f.getAbsolutePath();
1581 if(
h.containsKey(path)){
1582 javax.swing.JOptionPane.showMessageDialog(null,
"Warning: selected file already shared.",
"Warning", javax.swing.JOptionPane.WARNING_MESSAGE);
1588 path = path.substring(0, path.length()-f.getName().length());
1589 path = path.replace(
"\\",
"\\\\");
1592 long length = f.length();
1593 java.util.Date date =
new java.util.Date(f.lastModified());
1594 DateFormat df =
new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
1596 ArrayList l2 =
new ArrayList();
1598 l2.add(f.getName());
1601 l2.add(f.isDirectory());
1603 l2.add(df.format(date));
1606 ArrayList l1 =
new ArrayList();
1614 TRC.funct =
"sendList";
1615 Thread t =
new Thread(TRC);
1618 String [] cols =
new String [2];
1619 DefaultTableModel model = (DefaultTableModel)
jTableShare.getModel();
1620 cols[0] = f.getName();
1621 cols[1] = f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-cols[0].length());
1658 @SuppressWarnings(
"static-access")
1663 String name =
jTableShare.getModel().getValueAt(indexToRemove, 0).toString();
1664 String path =
jTableShare.getModel().getValueAt(indexToRemove, 1).toString();
1665 DefaultTableModel model = (DefaultTableModel)
jTableShare.getModel();
1666 model.removeRow(indexToRemove);
1667 model.fireTableRowsDeleted(indexToRemove, indexToRemove);
1669 h.remove(path+name);
1673 path = path.replace(
"\\",
"\\\\");
1678 TRC.funct =
"removeFile";
1679 Thread t =
new Thread(TRC);
1682 javax.swing.JOptionPane.showMessageDialog(null,
"The file "+name+
" has been unshared",
"File unshared",javax.swing.JOptionPane.INFORMATION_MESSAGE );
1697 String netmask =
"";
1698 String v = InetAddress.getLocalHost().getHostAddress();
1704 for(
int i=0; i< 3; i++){
1705 int y = v.indexOf(
".");
1706 iipp = v.substring(0,y);
1707 v = v.substring(y+1);
1710 int hi = n.indexOf(
".");
1711 netmask = n.substring(0,hi);
1712 n = n.substring(hi+1);
1715 short v_ip = Short.parseShort(iipp);
1716 short v_netmask = Short.parseShort(netmask);
1718 bcast += 256+(v_ip|(~v_netmask))+
".";
1722 short v_ip = Short.parseShort(v);
1723 short v_netmask = Short.parseShort(n);
1724 bcast += 256+(v_ip|(~v_netmask))+
"";
1742 catch(Exception e) {
return false;}
1757 catch(Exception e) {
return false;}
1766 @SuppressWarnings(
"static-access")
1768 if( (
user.compareTo(
" ")==0) && (
pswd.compareTo(
" ")==0) )
1776 TRC.funct =
"serverOn";
1777 Thread g =
new Thread(TRC);
1783 catch(Exception ex){
1790 if((!on) && (output))
1791 javax.swing.JOptionPane.showMessageDialog(null,
"Error: server "+
ip_server+
" is down.",
"Error", 0);
1802 @SuppressWarnings(
"static-access")
1804 if( (
user.compareTo(
" ")==0) && (
pswd.compareTo(
" ")==0) )
1807 boolean alive =
false;
1813 TRC.funct =
"clientAlive";
1814 Thread g =
new Thread(TRC);
1820 }
catch (InterruptedException ex) {
1826 if((!alive) && (output)){
1827 javax.swing.JOptionPane.showMessageDialog(null,
"Error: connection with server "+
ip_server+
" is not alive.",
"Error", 0);
1828 jLabel4.setText(
"No Connection");
1851 DefaultTableModel model = (DefaultTableModel)
jTableShare.getModel();
1853 while(model.getRowCount()>0){
1858 model.fireTableRowsDeleted(0, num_row);
1865 DefaultTableModel model1 = (DefaultTableModel)
jTableShare1.getModel();
1867 while(model1.getRowCount()>0){
1868 model1.removeRow(0);
1872 model1.fireTableRowsDeleted(0, num_row);
1878 Object o [] =
new Object[0];
1884 jLabel4.setText(
"No Connection");
1895 @SuppressWarnings(
"static-access")
1902 TRC.funct =
"disconnectClient";
1905 Thread t =
new Thread(TRC);
1911 }
catch (InterruptedException ex) {
javax.swing.JSeparator jSeparator3
static int booleanToRight(boolean read, boolean write)
Converte i diritti da due boolean a un intero.
Classe che permette la configurazione di tutto il programma in base alle specifiche esigenze dell'ute...
Classe che implementa il metodo run dell'interfaccia Runnable e crea un'istanza di C2C_client...
static javax.swing.JLabel jLabel4
Classe che implementa metodi vari di utilita' generale.
javax.swing.JLabel jLabel1
javax.swing.JTable jTableShare
javax.swing.JButton jButton7
static void disconnectClient()
Metodo che effettua la disconnessione del client dal ServerRMI chiamando la funzione "disconnectClien...
Classe che implementa il servizio Client.
javax.swing.JButton jButton3
javax.swing.JTextField jTextField2
javax.swing.JScrollPane jScrollPane2
static String user
User e password che il client usa per connettersi al server.
void uploadFile()
Metodo che dato un file selezionato dal jFileChooser e un client selezionato da una combo box in una ...
void jList1MouseClicked(java.awt.event.MouseEvent evt)
Evento doubleclick sulla lista, che richiama la funzione serverSelected()
javax.swing.JSeparator jSeparator2
void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu Remove.
void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone di share.
static boolean isMyPswd(String p)
Metodo che verifica se la stringa passata corrisponde alla password del client.
javax.swing.JButton jButton8
javax.swing.JMenuItem jMenuItem11
Classe che implementa il metodo run dell'interfaccia Runnable e crea un'istanza di clientRMI...
javax.swing.JTextField jTextField4
static boolean connection
void formWindowClosing(java.awt.event.WindowEvent evt)
Azione da effettuare alla chiusura della finestra: disconnessione del client.
void jButton7ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone di update dei server disponibili.
void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dael JMenu Upload file to client...
javax.swing.JMenuItem jMenuItem10
javax.swing.JLabel jLabel5
javax.swing.JSeparator jSeparator4
void jButton12ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Delete file.
void jButton6ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone di connessione al server. ...
javax.swing.JButton jButton12
void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Open.
static int r_threadtimeout()
Permette la lettura della varibile relativa in modo sicuro.
void initComponents()
Metodo chiamato dal costruttore per inizializzare la form WARNING: Do NOT modify this code...
void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone del JMenu di share.
void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu di connessione al server...
static Hashtable start(String bip, int port, int timeout, boolean dbg)
Funzione che invia un Datagram in broadcast e che fino allo scadere del timeout resta in attesa delle...
void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone di LogOut dal JMenu: creazione di un istanza ...
void deleteFile()
Metodo che dato un file selezionato dalla jTableShare1, richiede tramite la funzione RMI "getAccessSt...
javax.swing.JMenuItem jMenuItem1
javax.swing.JLabel jLabel2
javax.swing.JLabel jLabel9
static boolean dbg
Variabile boolean per attivare il degug.
void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu Delete file.
javax.swing.JFileChooser jFileChooser1
javax.swing.JMenuItem jMenuItem4
static int r_port()
Permette la lettura della varibile relativa in modo sicuro.
javax.swing.JLabel jLabel8
javax.swing.JButton jButton4
static void logGeneric(String data)
Scrive i dati in input sul file di log Generico (se questo esiste valido)
javax.swing.JLabel jLabel7
Classe che implementa il client RMI che si interfaccia a ServerRMI, richiamando le funzione dell'inte...
javax.swing.JMenuItem jMenuItem7
static String accessString
javax.swing.JMenuItem jMenuItem2
Classe che implementa il metodo run dell'interfaccia Runnable e crea un'istanza di C2C_server...
javax.swing.JScrollPane jScrollPane4
void removeAllFromTable()
Metodo che rimuove tutto il contenuto di tabelle e liste nella GUI dei client.
Classe che genera graficamente la finestra Rights che richiede di selezionare i permessi d'accesso al...
void jButton11ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Upload file to client.
void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal jMenu Open.
static String r_netmask()
Permette la lettura della varibile relativa in modo sicuro.
static boolean amAlive(boolean output)
Metodo che verifica se questo client e' ancora connesso al server.
javax.swing.JButton jButton5
javax.swing.JMenuItem jMenuItem6
javax.swing.JTable jTableShare1
void removeRowSelectedShared()
Metodo che dato il file selezionato dalla tabella jTableShare, lo rimuove e invia la richiesta di rim...
static boolean isMyUser(String u)
Metodo che verifica se la stringa passata corrisponde allo username del client.
javax.swing.JMenuItem jMenuItem5
void setServerInList()
Metodo che richiando p2pclient.ClientGetLocalServerList.start ottiene la lista dei server attivi e la...
javax.swing.JMenuItem jMenuItem3
void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Update file list.
void jButton5ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone di LogOut: creazione di un istanza di LogOutF...
static boolean r_serverOpen()
Permette la lettura della varibile relativa in modo sicuro.
Classe che genera graficamente la finestra di LogOut dal frame Client.
void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu Disconnect client.
javax.swing.JButton jButton11
javax.swing.JButton jButton2
void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu AddServer.
void updateFileList()
Chiamando la funzione "getList" nel ServerRMI, riceve la lista aggiornata dei file condivisi e la ins...
void jButton8ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Disconnect client.
javax.swing.JLabel jLabel6
javax.swing.JMenuItem jMenuItem9
javax.swing.JSeparator jSeparator1
static boolean isServerOn(boolean output)
Metodo che verifica se il server a cui sono connesso e' attivo.
void jButton4ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone Remove.
void jButton10ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone AddServer.
javax.swing.JTextField jTextField5
void setFileDirectoryListShared()
Metodo che dato il file selezionato dal jFileChooser, lo invia al ServerRmi tramite la funzione "send...
void fileOpenRead()
Metodo che dato un file selezionato dalla jTableShare1, richiede tramite la funzione RMI "getAccessSt...
void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu di update dei server disponibili...
String setBroadcastIp()
Metodo che genera l'indirizzo di broadcast di una sottorete.
void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt)
Azione effettuata in seguito alla pressione del bottone dal JMenu Update file list.
static String hash_sha(String text)
Converte una stringa nel corrispondente HASH SHA-1 in forma esadecimale.
javax.swing.JTextField jTextField1
javax.swing.JButton jButton1
static void w_clientOpen(boolean value)
Permette la scrittura della varibile relativa in modo sicuro.
void serverSelected()
Metodo che estrae l'ip del server selezionato dalla jList1, richiede username e password, stabilisce la connessione tramite la funzione RMI "registerToServer" su ServerRMI.
javax.swing.JButton jButton10
static String r_ico_server_enable()
Permette la lettura della varibile relativa in modo sicuro.
Classe che implementa un client mediante socket, che effettua in broadcast la richiesta dei server at...
javax.swing.JButton jButton6
void addServer()
Metodo che estrae dai quattro jTextField i valori numerici, controlla se la stringa ottenuta e' un in...
javax.swing.JMenuBar jMenuBar1
javax.swing.JMenuItem jMenuItem8
static String r_ico_server_disable()
Permette la lettura della varibile relativa in modo sicuro.
javax.swing.JLabel jLabel3
static void logClient(String data)
Scrive i dati in input sul file di log del Client (se questo esiste valido)
javax.swing.JScrollPane jScrollPane3