-
Notifications
You must be signed in to change notification settings - Fork 37
/
FormFieldAdapter.js
45 lines (39 loc) · 1.51 KB
/
FormFieldAdapter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
* Copyright (c) 2014-2017 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
scout.FormFieldAdapter = function() {
scout.FormFieldAdapter.parent.call(this);
/**
* Set this property to true when the form-field should stay enabled in offline case.
* By default the field will be disabled.
*/
this.enabledWhenOffline = false;
};
scout.inherits(scout.FormFieldAdapter, scout.ModelAdapter);
scout.FormFieldAdapter.prototype._goOffline = function() {
if (this.enabledWhenOffline) {
return;
}
this._enabledBeforeOffline = this.widget.enabled;
this.widget.setEnabled(false);
};
scout.FormFieldAdapter.prototype._goOnline = function() {
if (this.enabledWhenOffline) {
return;
}
this.widget.setEnabled(this._enabledBeforeOffline);
};
scout.FormFieldAdapter.prototype._onWidgetEvent = function(event) {
if (event.type === 'drop' && this.widget.dragAndDropHandler) {
this.widget.dragAndDropHandler.uploadFiles(event.files);
} else {
scout.FormFieldAdapter.parent.prototype._onWidgetEvent.call(this, event);
}
};