updated attribute in CheckPanel
This commit is contained in:
parent
d93cf69dab
commit
738c430720
@ -51,8 +51,8 @@ public class CheckPanel extends JPanel
|
|||||||
{
|
{
|
||||||
private static final 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 static final long serialVersionUID = -1580485684838045920L;
|
private static final long serialVersionUID = -1580485684838045920L;
|
||||||
static File choosenFile;
|
private JTextField fileToCheckField;
|
||||||
static JTextField textField;
|
private File choosenFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the constructor for this panel.
|
* This is the constructor for this panel.
|
||||||
@ -78,6 +78,7 @@ public class CheckPanel extends JPanel
|
|||||||
|
|
||||||
JButton btnNewButton = new JButton(BUNDLE.getString("CheckPanel.btnNewButton.text")); //$NON-NLS-1$
|
JButton btnNewButton = new JButton(BUNDLE.getString("CheckPanel.btnNewButton.text")); //$NON-NLS-1$
|
||||||
btnNewButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
btnNewButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
|
File choosenFile;
|
||||||
btnNewButton.addActionListener(new ActionListener()
|
btnNewButton.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -85,7 +86,7 @@ public class CheckPanel extends JPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CheckPanel.choosenFile = choosenDirectory();
|
CheckPanel.this.choosenFile = choosenDirectory();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e1)
|
catch (IOException e1)
|
||||||
@ -101,9 +102,9 @@ public class CheckPanel extends JPanel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CheckPanel.textField = new JTextField();
|
this.fileToCheckField = new JTextField();
|
||||||
add(CheckPanel.textField, "3, 2, fill, default");
|
add(this.fileToCheckField, "3, 2, fill, default");
|
||||||
CheckPanel.textField.setColumns(10);
|
this.fileToCheckField.setColumns(10);
|
||||||
add(btnNewButton, "4, 2, left, top");
|
add(btnNewButton, "4, 2, left, top");
|
||||||
|
|
||||||
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
||||||
@ -115,20 +116,21 @@ public class CheckPanel extends JPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ((CheckPanel.choosenFile != null) && CheckPanel.choosenFile.exists())
|
File choosenFile = CheckPanel.this.choosenFile;
|
||||||
|
if ((choosenFile != null) && choosenFile.exists())
|
||||||
{
|
{
|
||||||
boolean check = SibaManager.check(CheckPanel.choosenFile);
|
boolean check = SibaManager.check(choosenFile);
|
||||||
String titre = BUNDLE.getString("CheckPanel.confirmDialogTitle.text");
|
String titre = BUNDLE.getString("CheckPanel.confirmDialogTitle.text");
|
||||||
if (check)
|
if (check)
|
||||||
{
|
{
|
||||||
String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogGood.text"),
|
String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogGood.text"),
|
||||||
CheckPanel.choosenFile.getName());
|
choosenFile.getName());
|
||||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogBad.text"),
|
String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogBad.text"),
|
||||||
CheckPanel.choosenFile.getName());
|
choosenFile.getName());
|
||||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,11 +141,13 @@ public class CheckPanel extends JPanel
|
|||||||
JOptionPane.showMessageDialog(null, dataMissing, titleWarning, JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, dataMissing, titleWarning, JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (SibaException exception)
|
catch (SibaException exception)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(btnNewButton_1, "3, 4");
|
add(btnNewButton_1, "3, 4");
|
||||||
@ -153,11 +157,11 @@ public class CheckPanel extends JPanel
|
|||||||
{
|
{
|
||||||
File result;
|
File result;
|
||||||
|
|
||||||
CheckPanel.choosenFile = CheckDirectorySelector.showSelectorDialog(null, null);
|
File choosenFile = CheckDirectorySelector.showSelectorDialog(null, null);
|
||||||
if ((CheckPanel.choosenFile != null) && CheckPanel.choosenFile.exists())
|
if ((choosenFile != null) && choosenFile.exists())
|
||||||
{
|
{
|
||||||
CheckPanel.textField.setText(CheckPanel.choosenFile.getName());
|
this.fileToCheckField.setText(choosenFile.getName());
|
||||||
result = CheckPanel.choosenFile;
|
result = choosenFile;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -165,4 +169,9 @@ public class CheckPanel extends JPanel
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFileToCheck(final String sourceDirectory)
|
||||||
|
{
|
||||||
|
this.fileToCheckField.setText(sourceDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ public class SibaGUI
|
|||||||
|
|
||||||
JFrame frmSimpleBackup;
|
JFrame frmSimpleBackup;
|
||||||
private BackupPanel backupPanel;
|
private BackupPanel backupPanel;
|
||||||
|
private CheckPanel checkPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the constructor of this application.
|
* This is the constructor of this application.
|
||||||
@ -221,10 +222,10 @@ public class SibaGUI
|
|||||||
public void actionPerformed(final ActionEvent e)
|
public void actionPerformed(final ActionEvent e)
|
||||||
{
|
{
|
||||||
tabbedPane.setSelectedIndex(1);
|
tabbedPane.setSelectedIndex(1);
|
||||||
CheckPanel.choosenFile = CheckDirectorySelector.showSelectorDialog(null, null);
|
File choosenFile = CheckDirectorySelector.showSelectorDialog(null, null);
|
||||||
if ((CheckPanel.choosenFile != null) && CheckPanel.choosenFile.exists())
|
if ((choosenFile != null) && choosenFile.exists())
|
||||||
{
|
{
|
||||||
CheckPanel.textField.setText(CheckPanel.choosenFile.getName());
|
SibaGUI.this.checkPanel.setFileToCheck(choosenFile.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user