modified File Selector

This commit is contained in:
Didier Clermonté 2016-04-23 17:50:13 +02:00
parent 5a4d6fbd7a
commit 79d73a96e8
7 changed files with 70 additions and 78 deletions

View File

@ -2,29 +2,29 @@ cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_methods=true
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=false
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=false
cleanup.format_source_code=false
cleanup.correct_indentation=true
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.make_variable_declarations_final=true
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.organize_imports=false
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
@ -32,7 +32,7 @@ cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=false
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
@ -43,19 +43,19 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=false
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_type_arguments=false
cleanup_profile=org.eclipse.jdt.ui.default.eclipse_clean_up_profile
cleanup_profile=_Siba
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true

View File

@ -33,6 +33,10 @@ import javax.swing.border.EmptyBorder;
public class CheckDialog extends JDialog
{
/**
*
*/
private static final long serialVersionUID = 5266741894791360568L;
public static Object lblNewLabel;
public static String message;

View File

@ -40,6 +40,7 @@ import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.FormSpecs;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.layout.Sizes;
import java.util.ResourceBundle;
/**
*
@ -47,6 +48,7 @@ import com.jgoodies.forms.layout.Sizes;
*/
public class CheckPanel extends JPanel
{
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
private static final long serialVersionUID = -1580485684838045920L;
private JTextField textField;
private File choosenFile;
@ -70,10 +72,10 @@ public class CheckPanel extends JPanel
new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, }));
JLabel lblNewLabel = new JLabel("Sauvegarde à vérifier");
JLabel lblNewLabel = new JLabel(BUNDLE.getString("CheckPanel.lblNewLabel.text")); //$NON-NLS-1$
add(lblNewLabel, "2, 2, left, center");
JButton btnNewButton = new JButton("...");
JButton btnNewButton = new JButton(BUNDLE.getString("CheckPanel.btnNewButton.text")); //$NON-NLS-1$
btnNewButton.addActionListener(new ActionListener()
{
@Override
@ -101,7 +103,7 @@ public class CheckPanel extends JPanel
this.textField.setColumns(10);
add(btnNewButton, "4, 2, left, top");
JButton btnNewButton_1 = new JButton("Check");
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
btnNewButton_1.addActionListener(new ActionListener()
{
@Override

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Didier Clermonté <dclermonte@april.org>
* Copyright (C) 2016 Christian Pierre Momon <christian.momon@devinsy.fr>
* Didier Clermonté <dclermonte@april.org>
*
* This file is part of Siba.
*
@ -27,8 +27,6 @@ import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
@ -42,56 +40,11 @@ import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import org.apache.commons.lang3.StringUtils;
import org.dclermonte.siba.gui.utils.GUIToolBox;
public class SibaGUI
{
public static class GUIToolBox
{
/**
*
* @return
*/
public static List<String> availableLookAndFeels()
{
List<String> result;
//
result = new ArrayList<String>();
//
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
//
result.add(info.getName());
}
//
return result;
}
}
public static void main(final String[] args)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
try
{
SibaGUI window = new SibaGUI();
window.frmSimpleBackup.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Launch the application.
*/
@ -104,6 +57,7 @@ public class SibaGUI
*/
public SibaGUI()
{
// Set default GUI catch.
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
{
/**
@ -115,9 +69,9 @@ public class SibaGUI
String message;
if (exception instanceof OutOfMemoryError)
{
message = "Java ran out of memory!\n\nTo fix this problem, run GeneaQuilts from the command "
message = "Java ran out of memory!\n\n To fix this problem, run GeneaQuilts from the command "
+ "line:\njava -jar -Xms256m geneaquilt-x.x.x.jar\n\nIf you still "
+ "get the same error, increase thevalue 256 above.";
+ "get the same error, increase the value 256 above.";
}
else
{
@ -128,6 +82,7 @@ public class SibaGUI
exception.printStackTrace();
}
});
// Remove BOLD on default font.
UIManager.put("swing.boldMetal", Boolean.FALSE);
@ -161,8 +116,9 @@ public class SibaGUI
System.out.println("Failed to set the system LookAndFeel.");
}
}
System.out.println("Activated lookAndFeel: " + UIManager.getLookAndFeel().getName());
// Set default locale.
this.locale = Locale.getDefault();
updateLanguage(this.locale);
System.out.println(this.locale.getDisplayLanguage());
@ -245,4 +201,24 @@ public class SibaGUI
ResourceBundle.clearCache();
}
public static void main(final String[] args)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
try
{
SibaGUI window = new SibaGUI();
window.frmSimpleBackup.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
}

View File

@ -1,15 +1,17 @@
#Field ResourceBundle: BUNDLE
#Tue Apr 19 12:21:42 CEST 2016
#Thu Apr 21 22:53:27 CEST 2016
BackupPanel.btnNewButton.text=\u2026
BackupPanel.btnNewButton_1.text=\u2026
BackupPanel.btnNewButton_2.text=Backup
BackupPanel.lblLeRepertoire.text=- le repertoire \u00E0 compresser
BackupPanel.lblSourceDirectory.text=Source Directory\:
BackupPanel.lblNewLabel_1.text=Date Format
BackupPanel.lblNewLabel_2.text=<html><p style="margin-bottom: 0cm; line-height: 100%">Choisissez&nbsp;:</p><p style="margin-bottom: 0cm; line-height: 100%">- 1&nbsp;: le répertoire que vous souhaitez sauvegarder</p><p style="margin-bottom: 0cm; line-height: 100%">- 2&nbsp;: le répertoire dans lequel vous souhaitez placer la sauvegarde</p><p style="margin-bottom: 0cm; line-height: 100%">- 3&nbsp;: Cliquez sur Backup</p></html>
BackupPanel.lblNewLabel_2.text=<html><p style\="margin-bottom\: 0cm; line-height\: 100%">Choisissez&nbsp;\:</p><p style\="margin-bottom\: 0cm; line-height\: 100%">- 1&nbsp;\: le r\u00E9pertoire que vous souhaitez sauvegarder</p><p style\="margin-bottom\: 0cm; line-height\: 100%">- 2&nbsp;\: le r\u00E9pertoire dans lequel vous souhaitez placer la sauvegarde</p><p style\="margin-bottom\: 0cm; line-height\: 100%">- 3&nbsp;\: Cliquez sur Backup</p></html>
BackupPanel.lblSourceDirectory.text=Source Directory
BackupPanel.lblTargetDirectory.text=Target Directory
BackupPanel.rdbtnNewRadioButton.text=(iso8601) YYYY-MM-dd
BackupPanel.rdbtnNewRadioButton_1.text=Human
BackupPanel.sourceFileChooserButton.text=Source Directory
BackupPanel.targetFileChooserButton.text=Target Directory
CheckPanel.btnNewButton.text=...
CheckPanel.btnNewButton_1.text=Check
CheckPanel.lblNewLabel.text=Sauvegarde \u00E0 v\u00E9rifier

View File

@ -11,5 +11,8 @@ BackupPanel.lblSourceDirectory.text=R
BackupPanel.lblTargetDirectory.text=Répertoire de destination
BackupPanel.rdbtnNewRadioButton.text=(iso8601) YYYY-MM-dd
BackupPanel.rdbtnNewRadioButton_1.text=Human
BackupPanel.sourceFileChooserButton.text=Répertoire origine
BackupPanel.targetFileChooserButton.text=Répertoire destination
BackupPanel.sourceFileChooserButton.text=Source Directory
BackupPanel.targetFileChooserButton.text=Target Directory
CheckPanel.btnNewButton.text=...
CheckPanel.btnNewButton_1.text=Vérifier
CheckPanel.lblNewLabel.text=Sauvegarde \u00E0 v\u00E9rifier

View File

@ -49,6 +49,7 @@ public class SibaManager
public static File backup(final File toto, final String target) throws ArchiveException, IOException
{
File result;
pathLength = toto.getParentFile().getAbsolutePath().length();
/* String outputFileNameWithoutExtension = toto.getName()+"-"+ LocalDateTime.now(); */
@ -73,6 +74,8 @@ public class SibaManager
gzCompress.close();
output.delete();
md5(result, target + "/" + outputFileNameWithoutExtension + ".tgz.md5");
//
return result;
}
@ -103,10 +106,10 @@ public class SibaManager
{
File file = destination;
final List<File> untaredFiles = new LinkedList<File>();
InputStream inputStream;
try
{
final List<File> untaredFiles = new LinkedList<File>();
InputStream inputStream;
inputStream = new FileInputStream(directoryToUntar);
final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory()
@ -146,7 +149,9 @@ public class SibaManager
public static File md5(final File directoryToSave, final String destination) throws IOException
{
File result = new File(destination);
File result;
result = new File(destination);
try
{
byte[] bytedirectoryToSave = new byte[(int) directoryToSave.length()];