Skip to content
Snippets Groups Projects
Commit 3703f2ca authored by gpawel's avatar gpawel
Browse files

[LMS-2342] upload client: more and more intelligent triggering of Validation,...

[LMS-2342] upload client: more and more intelligent triggering of Validation, refresh -> validation button renamed

SVN: 22020
parent 5ba480e0
No related branches found
No related tags found
No related merge requests found
...@@ -114,7 +114,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer ...@@ -114,7 +114,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer
{ {
if (file != null) if (file != null)
{ {
if (file.getFile().exists() && file.validationRequired()) if (file.validationRequired())
{ {
file.markValidation(); file.markValidation();
return true; return true;
...@@ -162,7 +162,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer ...@@ -162,7 +162,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer
private final JButton dataSetFileButton; private final JButton dataSetFileButton;
private final JButton dataSetFileRefreshButton; private final JButton dataSetFileValidateButton;
private final JRadioButton experimentButton; private final JRadioButton experimentButton;
...@@ -211,7 +211,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer ...@@ -211,7 +211,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer
{ EMPTY_FILE_SELECTION }; { EMPTY_FILE_SELECTION };
dataSetFileComboBox = new JComboBox(initialOptions); dataSetFileComboBox = new JComboBox(initialOptions);
dataSetFileButton = new JButton("Browse..."); dataSetFileButton = new JButton("Browse...");
dataSetFileRefreshButton = new JButton("Refresh"); dataSetFileValidateButton = new JButton("Validate");
dataSetFileLabel = new JLabel("File:", JLabel.TRAILING); dataSetFileLabel = new JLabel("File:", JLabel.TRAILING);
validationErrors = new ErrorsPanel(mainWindow); validationErrors = new ErrorsPanel(mainWindow);
...@@ -362,9 +362,9 @@ public class DataSetMetadataPanel extends JPanel implements Observer ...@@ -362,9 +362,9 @@ public class DataSetMetadataPanel extends JPanel implements Observer
} }
} }
}); });
dataSetFileRefreshButton.setPreferredSize(new Dimension(90, BUTTON_HEIGHT)); dataSetFileValidateButton.setPreferredSize(new Dimension(90, BUTTON_HEIGHT));
dataSetFileRefreshButton.setToolTipText("File will be refreshed and revalidated"); dataSetFileValidateButton.setToolTipText("File will be refreshed and revalidated");
dataSetFileRefreshButton.addActionListener(new ActionListener() dataSetFileValidateButton.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
...@@ -377,7 +377,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer ...@@ -377,7 +377,7 @@ public class DataSetMetadataPanel extends JPanel implements Observer
} }
}); });
addRow(1, dataSetFileLabel, dataSetFileComboBox, dataSetFileButton, addRow(1, dataSetFileLabel, dataSetFileComboBox, dataSetFileButton,
dataSetFileRefreshButton); dataSetFileValidateButton);
// The owner row // The owner row
ownerIdLabel.setPreferredSize(new Dimension(LABEL_WIDTH, BUTTON_HEIGHT)); ownerIdLabel.setPreferredSize(new Dimension(LABEL_WIDTH, BUTTON_HEIGHT));
......
...@@ -37,7 +37,19 @@ public class ExperimentPickerPanel extends JPanel ...@@ -37,7 +37,19 @@ public class ExperimentPickerPanel extends JPanel
{ {
private static final long serialVersionUID = -8093481985680332715L; private static final long serialVersionUID = -8093481985680332715L;
private final JTextField textField = new JTextField(); private static class JTextFieldFireActionPerformedExposed extends JTextField
{
private static final long serialVersionUID = -7656053161479466883L;
@Override
public void fireActionPerformed()
{
super.fireActionPerformed();
}
}
private final JTextFieldFireActionPerformedExposed textField =
new JTextFieldFireActionPerformedExposed();
private final JButton button = new JButton("..."); private final JButton button = new JButton("...");
...@@ -59,6 +71,7 @@ public class ExperimentPickerPanel extends JPanel ...@@ -59,6 +71,7 @@ public class ExperimentPickerPanel extends JPanel
if (experimentId != null) if (experimentId != null)
{ {
textField.setText(experimentId); textField.setText(experimentId);
textField.fireActionPerformed();
} }
} }
}); });
...@@ -86,6 +99,7 @@ public class ExperimentPickerPanel extends JPanel ...@@ -86,6 +99,7 @@ public class ExperimentPickerPanel extends JPanel
public void addFocusListener(FocusListener focusListener) public void addFocusListener(FocusListener focusListener)
{ {
textField.addFocusListener(focusListener); textField.addFocusListener(focusListener);
button.addFocusListener(focusListener);
} }
@Override @Override
......
...@@ -27,6 +27,8 @@ public class ValidatedFile ...@@ -27,6 +27,8 @@ public class ValidatedFile
private long lastValidated; private long lastValidated;
private boolean fileExisted = true;
public ValidatedFile(File file) public ValidatedFile(File file)
{ {
this.file = file; this.file = file;
...@@ -45,11 +47,18 @@ public class ValidatedFile ...@@ -45,11 +47,18 @@ public class ValidatedFile
public boolean validationRequired() public boolean validationRequired()
{ {
return lastValidated < file.lastModified(); if (fileExisted)
{
return false == file.exists() || lastValidated < file.lastModified();
} else
{
return file.exists();
}
} }
public void markValidation() public void markValidation()
{ {
fileExisted = file.exists();
this.lastValidated = file.lastModified(); this.lastValidated = file.lastModified();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment