Issue#36 Improved AboutDialog

This commit is contained in:
Didier Clermonté 2016-07-04 16:02:01 +02:00
parent efc45c07ea
commit f4aedd64cc
9 changed files with 97 additions and 9 deletions

View File

@ -29,6 +29,9 @@ public class SibaException extends Exception
{ {
private static final long serialVersionUID = 2909630770291570845L; private static final long serialVersionUID = 2909630770291570845L;
/**
*
*/
public SibaException() public SibaException()
{ {
super(); super();

View File

@ -22,11 +22,17 @@ package org.dclermonte.siba.gui;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ResourceBundle;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
@ -46,13 +52,18 @@ import org.slf4j.LoggerFactory;
public class AboutDialog extends JDialog public class AboutDialog extends JDialog
{ {
private static final long serialVersionUID = 8868109575782482455L; private static final long serialVersionUID = 8868109575782482455L;
private static ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
public static final Logger logger = LoggerFactory.getLogger(AboutDialog.class); public static final Logger logger = LoggerFactory.getLogger(AboutDialog.class);
/** /**
* This is the constructor for the dialog. * This is the constructor for the dialog.
*
* @throws IOException
*/ */
public AboutDialog() public AboutDialog() throws IOException
{ {
setMinimumSize(new Dimension(600, 350));
setMaximumSize(new Dimension(600, 500));
setIconImage(Toolkit.getDefaultToolkit() setIconImage(Toolkit.getDefaultToolkit()
.getImage(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png"))); .getImage(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png")));
setBackground(Color.GREEN); setBackground(Color.GREEN);
@ -84,18 +95,36 @@ public class AboutDialog extends JDialog
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setBackground(Color.GREEN); panel.setBackground(Color.GREEN);
getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.CENTER);
{ panel.setLayout(new BorderLayout(0, 0));
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png")));
panel.add(lblNewLabel);
}
JTextPane txtpnSimpleBackupDveloppeur = new JTextPane(); JTextPane txtpnSimpleBackupDveloppeur = new JTextPane();
txtpnSimpleBackupDveloppeur.setBackground(Color.GREEN); txtpnSimpleBackupDveloppeur.setBackground(Color.GREEN);
txtpnSimpleBackupDveloppeur.setFont(new Font("Dialog", Font.BOLD, 14)); txtpnSimpleBackupDveloppeur.setFont(new Font("Dialog", Font.BOLD, 14));
txtpnSimpleBackupDveloppeur.setText( txtpnSimpleBackupDveloppeur.setContentType("text/html");
"Simple Backup\n\nDéveloppeur Christian Pierre Momon et Didier Clermonté\n\nLicence GNU Affero General Public License 2016"); String path = System.getProperty("user.dir");
String about = BUNDLE.getString("AboutDialog");
File aboutFile = new File(path + "/src/org/dclermonte/siba/gui/" + about);
FileReader in = new FileReader(aboutFile);
BufferedReader bufferedReader = new BufferedReader(in);
StringBuilder stringBuilder = new StringBuilder();
String lines;
String line;
while ((line = bufferedReader.readLine()) != null)
{
stringBuilder.append(line);
}
lines = stringBuilder.toString();
txtpnSimpleBackupDveloppeur.setText(lines);
System.out.println("texte = " + lines);
// "Simple Backup\n\nDéveloppeur Christian Pierre Momon et Didier
// Clermonté\n\nLicence GNU Affero General Public License 2016");
panel.add(txtpnSimpleBackupDveloppeur); panel.add(txtpnSimpleBackupDveloppeur);
{
JLabel lblNewLabel = new JLabel("");
lblNewLabel
.setIcon(new ImageIcon(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo_256.png")));
panel.add(lblNewLabel, BorderLayout.WEST);
}
} }
/** /**

View File

@ -60,6 +60,9 @@ public class CheckPanel extends JPanel
public static final Logger logger = LoggerFactory.getLogger(CheckPanel.class); public static final Logger logger = LoggerFactory.getLogger(CheckPanel.class);
private JTextField fileToCheckField; private JTextField fileToCheckField;
/**
*
*/
public CheckPanel() public CheckPanel()
{ {
setLayout(new BorderLayout(0, 0)); setLayout(new BorderLayout(0, 0));

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,21 @@
<html>
<body lang="fr-FR" dir="ltr">
<p style="margin-bottom: 0cm; font-weight: normal; line-height: 100%">
<font color="#000000"><font face="Monospace" size="5" style="font-size: 16pt"><span ><b><u>SimpleBackup</u></b></span></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b>Create Archive tar of a directory and calculate the MD5 hash</b></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b><u>Developpers&nbsp;:</u><br />
Christian Pierre Momon et Didier Clermonté</b></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b>Licence
GNU Affero General Public License 2016</b></font></p>
<p><br/>
<br/>
</p>
</body>
</html>

View File

@ -0,0 +1,22 @@
<html>
<body lang="fr-FR" dir="ltr">
<p style="margin-bottom: 0cm; font-weight: normal; line-height: 100%">
<font color="#000000"><font face="Monospace" size="5" style="font-size: 16pt"><span ><b><u>SimpleBackup</u></b></span></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b>Crée une archive .tar d'un répertoire
et calcule son hash MD5</b></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b><u>Développeurs&nbsp;:</u><br />
Christian Pierre Momon et Didier Clermonté</b></font></p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><font color="#000000" face="Monospace" size="3" style="font-size: 12pt"><b>Licence
GNU Affero General Public License 2016</b></font></p>
<p><br/>
<br/>
</p>
</body>
</html>

View File

@ -32,3 +32,4 @@ SibaGUI.mntmNewMenuItem_2.text=About
SibaGUI.mntmQuit.text=Quit SibaGUI.mntmQuit.text=Quit
SourceDirectorySelector.this.dialogTitle=Directory to backup SourceDirectorySelector.this.dialogTitle=Directory to backup
TargetDirectorySelector.this.dialogTitle=Directory for the backup TargetDirectorySelector.this.dialogTitle=Directory for the backup
AboutDialog = about_en.html

View File

@ -29,4 +29,5 @@ BackupPanel.TitleWarning.text = Attention
SibaGUI.mnFile.text=Fichier SibaGUI.mnFile.text=Fichier
SibaGUI.mntmBackup.text=Sauvegarder\u2026 SibaGUI.mntmBackup.text=Sauvegarder\u2026
SibaGUI.mntmQuit.text=Quitter SibaGUI.mntmQuit.text=Quitter
SibaGUI.mntmCheck.text=Vérifier\u2026 SibaGUI.mntmCheck.text=Vérifier\u2026
AboutDialog= about_fr.html

View File

@ -62,6 +62,14 @@ public class SibaUtils
return result; return result;
} }
/**
*
* @param md5
* @param fileName
* @param target
* @return
* @throws IOException
*/
public static File createMD5File(final String md5, final String fileName, final String target) throws IOException public static File createMD5File(final String md5, final String fileName, final String target) throws IOException
{ {
File result; File result;