1 | private boolean isBackupInputOK() {↵ | | 1 | private boolean isRestoreInputOK() {↵
|
2 | StringBuffer bufError = new StringBuffer();↵ | | 2 | StringBuffer bufError = new StringBuffer();↵
|
3 | boolean focusSet = false;↵ | | 3 | boolean focusSet = false;↵
|
|
4 | if (jtextfieldUsername.getText().trim().length() == 0) {↵ | | 4 | if (jtextfieldUsername.getText().trim().length() == 0) {↵
|
5 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR);↵ | | 5 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR);↵
|
6 | jtextfieldUsername.requestFocusInWindow();↵ | | 6 | jtextfieldUsername.requestFocusInWindow();↵
|
7 | focusSet = true;↵ | | 7 | focusSet = true;↵
|
8 | }↵ | | 8 | }↵
|
9 | if (jtextfieldBckDBHost.getText().trim().length() == 0) {↵ | | 9 | if (jtextfieldResDBHost.getText().trim().length() == 0) {↵
|
10 | bufError.append(i18n.ERROR_SERVER_MISSING + CR);↵ | | 10 | bufError.append(i18n.ERROR_SERVER_MISSING + CR);↵
|
11 | if (!focusSet) {↵ | | 11 | if (!focusSet) {↵
|
12 | jtextfieldBckDBHost.requestFocusInWindow();↵ | | 12 | jtextfieldResDBHost.requestFocusInWindow();↵
|
13 | focusSet = true;↵ | | 13 | focusSet = true;↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
16 | if (jtextfieldBckPort.getText().trim().length() == 0) {↵ | | 16 | if (jtextfieldResPort.getText().trim().length() == 0) {↵
|
17 | bufError.append(i18n.ERROR_PORT_MISSING + CR);↵ | | 17 | bufError.append(i18n.ERROR_PORT_MISSING + CR);↵
|
18 | if (!focusSet) {↵ | | 18 | if (!focusSet) {↵
|
19 | jtextfieldBckPort.requestFocusInWindow();↵ | | 19 | jtextfieldResPort.requestFocusInWindow();↵
|
20 | focusSet = true;↵ | | 20 | focusSet = true;↵
|
21 | }↵ | | 21 | }↵
|
22 | } else {↵ | | 22 | } else {↵
|
23 | try {↵ | | 23 | try {↵
|
24 | Integer.parseInt(jtextfieldBckPort.getText());↵ | | 24 | Integer.parseInt(jtextfieldResPort.getText());↵
|
25 | } catch (NumberFormatException e) {↵ | | 25 | } catch (NumberFormatException e) {↵
|
26 | bufError.append(i18n.ERROR_PORT_NO_INTEGER + CR);↵ | | 26 | bufError.append(i18n.ERROR_PORT_NO_INTEGER + CR);↵
|
27 | if (!focusSet) {↵ | | 27 | if (!focusSet) {↵
|
28 | jtextfieldBckPort.requestFocusInWindow();↵ | | 28 | jtextfieldResPort.requestFocusInWindow();↵
|
29 | focusSet = true;↵ | | 29 | focusSet = true;↵
|
30 | }↵ | | 30 | }↵
|
31 | }↵ | | 31 | }↵
|
32 | }↵ | | 32 | }↵
|
33 | if (jtextfieldBckDBFile.getText().trim().length() == 0) {↵ | | 33 | if (jtextfieldResBackupFile.getText().trim().length() == 0) {↵
|
34 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR);↵ | | 34 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR);↵
|
35 | if (!focusSet) {↵ | | 35 | if (!focusSet) {↵
|
36 | jtextfieldBckDBFile.requestFocusInWindow();↵ | | 36 | jtextfieldResBackupFile.requestFocusInWindow();↵
|
37 | focusSet = true;↵ | | 37 | focusSet = true;↵
|
38 | }↵ | | 38 | }↵
|
39 | } else if (jtextfieldBckDBHost.getText().trim().equalsIgnoreCase("localhost")) {↵ | | 39 | } else if (jtextfieldResDBHost.getText().trim().equalsIgnoreCase("localhost")) {↵
|
40 | if (!FirebirdManagerHelper.fileExists(jtextfieldBckDBFile.getText())) {↵ | | 40 | if (!FirebirdManagerHelper.fileExists(jtextfieldResBackupFile.getText())) {↵
|
41 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " ↵ | | 41 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " ↵
|
42 | + jtextfieldBckDBFile.getText() + " " + CR);↵ | | 42 | + jtextfieldResBackupFile.getText() + " " + CR);↵
|
43 | if (!focusSet) {↵ | | 43 | if (!focusSet) {↵
|
44 | jtextfieldBckDBFile.requestFocusInWindow();↵ | | 44 | jtextfieldResBackupFile.requestFocusInWindow();↵
|
45 | focusSet = true;↵ | | 45 | focusSet = true;↵
|
46 | }↵ | | 46 | }↵
|
47 | }↵ | | 47 | }↵
|
48 | }↵ | | 48 | }↵
|
49 | if (jtextfieldBckBackupFile.getText().trim().length() == 0) {↵ | | 49 | if (jtextfieldResDBFile.getText().trim().length() == 0) {↵
|
50 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR);↵ | | 50 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR);↵
|
51 | if (!focusSet) {↵ | | 51 | if (!focusSet) {↵
|
52 | jtextfieldBckBackupFile.requestFocusInWindow();↵ | | 52 | jtextfieldResDBFile.requestFocusInWindow();↵
|
53 | focusSet = true;↵ | | 53 | focusSet = true;↵
|
54 | }↵ | | 54 | }↵
|
55 | }↵ | | 55 | } ↵
|
|
56 | ↵ | | |
|
57 | if (bufError.length() != 0) {↵ | | 56 | if (bufError.length() != 0) {↵
|
58 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString());↵ | | 57 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString());↵
|
59 | }↵ | | 58 | }↵
|
|
60 | return bufError.length() == 0;↵ | | 59 | return bufError.length() == 0;↵
|
61 | | | 60 |
|