mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-25 06:58:39 +00:00
Added JavaDoc, used CodeFormater on all changes in this branch, some refactoring
This commit is contained in:
@@ -93,4 +93,6 @@ public interface StringMessages extends Messages {
|
||||
String explainReplicationServletPort();
|
||||
|
||||
String ok();
|
||||
|
||||
String setUpStorageService();
|
||||
}
|
||||
|
||||
+18
-3
@@ -46,8 +46,11 @@ public class URLFieldWithFileUpload extends Composite implements HasValue<String
|
||||
private final Button removeButton;
|
||||
|
||||
private boolean valueChangeHandlerInitialized = false;
|
||||
|
||||
private final SubmitButton submitButton;
|
||||
|
||||
private boolean uploadEnabled;
|
||||
|
||||
public URLFieldWithFileUpload(final StringMessages stringMessages) {
|
||||
final VerticalPanel mainPanel = new VerticalPanel();
|
||||
final HorizontalPanel imageUrlPanel = new HorizontalPanel();
|
||||
@@ -104,8 +107,13 @@ public class URLFieldWithFileUpload extends Composite implements HasValue<String
|
||||
fileUploadField.addChangeHandler(new ChangeHandler() {
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
if(fileUploadField.getFilename() != null && !fileUploadField.getFilename().isEmpty()) {
|
||||
submitButton.setEnabled(true);
|
||||
if(fileUploadFieldSet()) {
|
||||
if (uploadEnabled) {
|
||||
submitButton.setEnabled(true);
|
||||
} else {
|
||||
submitButton.setEnabled(false);
|
||||
Notification.notify(stringMessages.setUpStorageService(), NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -201,6 +209,13 @@ public class URLFieldWithFileUpload extends Composite implements HasValue<String
|
||||
}
|
||||
|
||||
public void setUploadEnabled(boolean value) {
|
||||
submitButton.setEnabled(value);
|
||||
uploadEnabled = value;
|
||||
if (fileUploadFieldSet()) {
|
||||
submitButton.setEnabled(value);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fileUploadFieldSet() {
|
||||
return fileUploadField.getFilename() != null && !fileUploadField.getFilename().isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user