Moved aboutdialog to GUIToolBox + some minors others
This commit is contained in:
parent
6932f3f54e
commit
5d83fc61c9
@ -30,8 +30,8 @@ public class SibaException extends Exception
|
|||||||
private static final long serialVersionUID = 2909630770291570845L;
|
private static final long serialVersionUID = 2909630770291570845L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public SibaException()
|
public SibaException()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
@ -39,6 +39,7 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
|
|
||||||
|
import org.dclermonte.siba.gui.utils.GUIToolBox;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ public class AboutDialog extends JDialog
|
|||||||
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.setContentType("text/html");
|
txtpnSimpleBackupDveloppeur.setContentType("text/html");
|
||||||
txtpnSimpleBackupDveloppeur.setText(AboutDialogUtils.aboutDialog());
|
txtpnSimpleBackupDveloppeur.setText(GUIToolBox.aboutDialog());
|
||||||
panel.add(txtpnSimpleBackupDveloppeur);
|
panel.add(txtpnSimpleBackupDveloppeur);
|
||||||
{
|
{
|
||||||
JLabel lblNewLabel = new JLabel("");
|
JLabel lblNewLabel = new JLabel("");
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Didier Clermonté <dclermonte@april.org>
|
|
||||||
* Copyright (C) 2016 Christian Pierre Momon <christian.momon@devinsy.fr>
|
|
||||||
*
|
|
||||||
* This file is part of Siba.
|
|
||||||
*
|
|
||||||
* Siba is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.dclermonte.siba.gui;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Didier Clermonté (dclermonte@april.org)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class AboutDialogUtils
|
|
||||||
{
|
|
||||||
private static ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public static String aboutDialog() throws IOException
|
|
||||||
{
|
|
||||||
String result = null;
|
|
||||||
|
|
||||||
String about = BUNDLE.getString("AboutDialog");
|
|
||||||
File aboutFile = new File(AboutDialog.class.getResource("/org/dclermonte/siba/gui/" + about).getFile());
|
|
||||||
result = FileUtils.readFileToString(aboutFile, (Charset) null);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
@ -54,7 +54,7 @@ import com.jgoodies.forms.layout.RowSpec;
|
|||||||
public class BackupPanel extends JPanel
|
public class BackupPanel extends JPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 4714383090458639282L;
|
private static final long serialVersionUID = 4714383090458639282L;
|
||||||
private static ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||||
private JTextField sourceDirectoryField;
|
private JTextField sourceDirectoryField;
|
||||||
private JTextField targetDirectoryField;
|
private JTextField targetDirectoryField;
|
||||||
|
|
||||||
|
@ -114,9 +114,9 @@ public class CheckPanel extends JPanel
|
|||||||
|
|
||||||
Component horizontalGlue = Box.createHorizontalGlue();
|
Component horizontalGlue = Box.createHorizontalGlue();
|
||||||
panel.add(horizontalGlue);
|
panel.add(horizontalGlue);
|
||||||
JButton ButtonCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
JButton btnCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
||||||
panel.add(ButtonCheck);
|
panel.add(btnCheck);
|
||||||
ButtonCheck.addActionListener(new ActionListener()
|
btnCheck.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e)
|
public void actionPerformed(final ActionEvent e)
|
||||||
@ -157,7 +157,7 @@ public class CheckPanel extends JPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonCheck.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
btnCheck.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
|
|
||||||
Component horizontalGlue1 = Box.createHorizontalGlue();
|
Component horizontalGlue1 = Box.createHorizontalGlue();
|
||||||
panel.add(horizontalGlue1);
|
panel.add(horizontalGlue1);
|
||||||
|
@ -143,7 +143,6 @@ public class SibaGUI
|
|||||||
logger.debug("Failed to set the system LookAndFeel.");
|
logger.debug("Failed to set the system LookAndFeel.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); */
|
|
||||||
logger.debug("Activated lookAndFeel: {} ", UIManager.getLookAndFeel().getName());
|
logger.debug("Activated lookAndFeel: {} ", UIManager.getLookAndFeel().getName());
|
||||||
|
|
||||||
// Set default locale.
|
// Set default locale.
|
||||||
|
@ -19,11 +19,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.dclermonte.siba.gui.utils;
|
package org.dclermonte.siba.gui.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.dclermonte.siba.gui.AboutDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some utility
|
* Some utility
|
||||||
*
|
*
|
||||||
@ -32,6 +39,24 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public class GUIToolBox
|
public class GUIToolBox
|
||||||
{
|
{
|
||||||
|
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static String aboutDialog() throws IOException
|
||||||
|
{
|
||||||
|
String result = null;
|
||||||
|
|
||||||
|
String about = BUNDLE.getString("AboutDialog");
|
||||||
|
File aboutFile = new File(AboutDialog.class.getResource("/org/dclermonte/siba/gui/" + about).getFile());
|
||||||
|
result = FileUtils.readFileToString(aboutFile, (Charset) null);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<String> availableLookAndFeels()
|
public static List<String> availableLookAndFeels()
|
||||||
{
|
{
|
||||||
List<String> result;
|
List<String> result;
|
||||||
|
@ -63,7 +63,7 @@ public class SibaUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param md5
|
* @param md5
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param target
|
* @param target
|
||||||
@ -196,7 +196,7 @@ public class SibaUtils
|
|||||||
in = new FileReader(choosenFile);
|
in = new FileReader(choosenFile);
|
||||||
BufferedReader bufferedReader = new BufferedReader(in);
|
BufferedReader bufferedReader = new BufferedReader(in);
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
String fileNameToString = new String();
|
String fileNameToString;
|
||||||
fileNameToString = line.substring(33);
|
fileNameToString = line.substring(33);
|
||||||
in.close();
|
in.close();
|
||||||
if (choosenFile.isAbsolute())
|
if (choosenFile.isAbsolute())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user