added method setSourceDirectory in BackupPanel
This commit is contained in:
parent
dfa6b2dcf6
commit
6a37764ca1
@ -61,7 +61,7 @@ public class BackupPanel extends JPanel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||||
static JTextField textField;
|
public JTextField sourceDirectoryField;
|
||||||
private JTextField textField_1;
|
private JTextField textField_1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,6 +70,7 @@ public class BackupPanel extends JPanel
|
|||||||
|
|
||||||
public BackupPanel() throws SibaException
|
public BackupPanel() throws SibaException
|
||||||
{
|
{
|
||||||
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
setLayout(new BorderLayout(0, 0));
|
setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
@ -94,9 +95,9 @@ public class BackupPanel extends JPanel
|
|||||||
lblSourceDirectory.setHorizontalAlignment(SwingConstants.LEFT);
|
lblSourceDirectory.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
lblSourceDirectory.setVerticalAlignment(SwingConstants.TOP);
|
lblSourceDirectory.setVerticalAlignment(SwingConstants.TOP);
|
||||||
|
|
||||||
this.textField = new JTextField();
|
this.sourceDirectoryField = new JTextField();
|
||||||
panel.add(this.textField, "4, 2");
|
panel.add(this.sourceDirectoryField, "4, 2");
|
||||||
this.textField.setColumns(10);
|
this.sourceDirectoryField.setColumns(10);
|
||||||
|
|
||||||
JButton btnNewButton = new JButton(BUNDLE.getString("BackupPanel.btnNewButton.text")); //$NON-NLS-1$
|
JButton btnNewButton = new JButton(BUNDLE.getString("BackupPanel.btnNewButton.text")); //$NON-NLS-1$
|
||||||
btnNewButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
btnNewButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
@ -108,10 +109,11 @@ public class BackupPanel extends JPanel
|
|||||||
File file = SourceDirectorySelector.showSelectorDialog(null, null);
|
File file = SourceDirectorySelector.showSelectorDialog(null, null);
|
||||||
if (!(file == null))
|
if (!(file == null))
|
||||||
{
|
{
|
||||||
BackupPanel.this.textField.setText(file.getPath());
|
BackupPanel.this.sourceDirectoryField.setText(file.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
panel.add(btnNewButton, "6, 2");
|
panel.add(btnNewButton, "6, 2");
|
||||||
|
|
||||||
@ -175,7 +177,7 @@ public class BackupPanel extends JPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File directoryToSave1 = new File(BackupPanel.this.textField.getText());
|
File directoryToSave1 = new File(BackupPanel.this.sourceDirectoryField.getText());
|
||||||
File targetDirectory = new File(BackupPanel.this.textField_1.getText());
|
File targetDirectory = new File(BackupPanel.this.textField_1.getText());
|
||||||
if (directoryToSave1.exists() && targetDirectory.exists())
|
if (directoryToSave1.exists() && targetDirectory.exists())
|
||||||
{
|
{
|
||||||
@ -210,4 +212,9 @@ public class BackupPanel extends JPanel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSourceDirectory(final String sourceDirectory)
|
||||||
|
{
|
||||||
|
this.sourceDirectoryField.setText(sourceDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ public class SibaGUI
|
|||||||
Locale locale;
|
Locale locale;
|
||||||
|
|
||||||
private JFrame frmSimpleBackup;
|
private JFrame frmSimpleBackup;
|
||||||
|
private JPanel backupPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the constructor of this application.
|
* This is the constructor of this application.
|
||||||
@ -168,10 +169,10 @@ public class SibaGUI
|
|||||||
tabbedPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
tabbedPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
this.frmSimpleBackup.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
this.frmSimpleBackup.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
JPanel panel = new BackupPanel();
|
this.backupPanel = new BackupPanel();
|
||||||
panel.setBackground(new Color(0, 255, 0));
|
this.backupPanel.setBackground(new Color(0, 255, 0));
|
||||||
String backup = BackupPanel.BUNDLE.getString("BackupPanel.TitleBackupPanel.text");
|
String backup = BackupPanel.BUNDLE.getString("BackupPanel.TitleBackupPanel.text");
|
||||||
tabbedPane.addTab(backup, null, panel, null);
|
tabbedPane.addTab(backup, null, this.backupPanel, null);
|
||||||
|
|
||||||
JPanel panel_1 = new CheckPanel();
|
JPanel panel_1 = new CheckPanel();
|
||||||
panel_1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
panel_1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
@ -208,7 +209,7 @@ public class SibaGUI
|
|||||||
File file = SourceDirectorySelector.showSelectorDialog(null, null);
|
File file = SourceDirectorySelector.showSelectorDialog(null, null);
|
||||||
if (!(file == null))
|
if (!(file == null))
|
||||||
{
|
{
|
||||||
BackupPanel.textField.setText(file.getPath());
|
((BackupPanel) SibaGUI.this.backupPanel).setSourceDirectory(file.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// panel.setVisible(true);
|
// panel.setVisible(true);
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package org.dclermonte.siba.model;
|
package org.dclermonte.siba.model;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -109,7 +108,6 @@ public class SibaManager
|
|||||||
out.close();
|
out.close();
|
||||||
fileWithMD5(result, target + "/" + outputFileNameWithoutExtension + ".tgz.md5");
|
fileWithMD5(result, target + "/" + outputFileNameWithoutExtension + ".tgz.md5");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ioExceptionBackup)
|
catch (IOException ioExceptionBackup)
|
||||||
{
|
{
|
||||||
@ -122,7 +120,6 @@ public class SibaManager
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IOUtils.closeQuietly(out);
|
IOUtils.closeQuietly(out);
|
||||||
IOUtils.closeQuietly(gzipOutputStream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -167,7 +164,7 @@ public class SibaManager
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This method generate ArchiveEntry.
|
* This method generates ArchiveEntry.
|
||||||
*
|
*
|
||||||
* @param directory
|
* @param directory
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
@ -247,8 +244,8 @@ public class SibaManager
|
|||||||
if (choosenFile.exists() && (choosenFile.length() > 32))
|
if (choosenFile.exists() && (choosenFile.length() > 32))
|
||||||
{
|
{
|
||||||
FileReader fileReader = new FileReader(choosenFile);
|
FileReader fileReader = new FileReader(choosenFile);
|
||||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
// BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||||
String line = bufferedReader.readLine();
|
// String line = bufferedReader.readLine();
|
||||||
char[] fileToCheck = new char[(int) (choosenFile.length()) - 32];
|
char[] fileToCheck = new char[(int) (choosenFile.length()) - 32];
|
||||||
fileReader.read();
|
fileReader.read();
|
||||||
fileReader.skip(32);
|
fileReader.skip(32);
|
||||||
@ -271,6 +268,7 @@ public class SibaManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user