Project

General

Profile

« Previous | Next » 

Revision a41953a2

Added by Cherian Mathew about 9 years ago

ApplicationUtil : Added 'Remoting' to title
CdmTransientEntityCacher : corrected recursive call for delete functionality
RemotingLoginDialog : Added refresh functionality
PolytomousKeyTest : updated test data and added tests for delete functionality

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java
66 66
    private final String STATUS_CHECKING_AVAILABILITY = "Checking ...";
67 67
    private final String STATUS_NO_INSTANCES = "No Instances Found";
68 68
    private final String STATUS_ERROR = "Error";
69
    private final String STATUS_REMOTING_NOT_ACTIVATED = "Remoting not activated";
69 70

  
70 71
    private CdmServerInfo selectedCsii;
71 72
    private CdmInstanceInfo selectedCdmInstance;
73
    private Button btnCdmServerRefresh;
72 74

  
73 75

  
74 76
    /**
......
122 124
        remotingComposite.setLayout(fl_remotingComposite);
123 125

  
124 126
        Composite cdmServerComposite = new Composite(remotingComposite, SWT.NONE);
125
        cdmServerComposite.setLayout(new GridLayout(5, false));
127
        cdmServerComposite.setLayout(new GridLayout(6, false));
126 128

  
127 129
        Label lblCdmServer = new Label(cdmServerComposite, SWT.NONE);
128 130
        lblCdmServer.setText("CDM Server : ");
......
133 135
        comboCdmServer.addSelectionListener(new SelectionAdapter() {
134 136
            @Override
135 137
            public void widgetSelected(SelectionEvent e) {
136
                updateSelectedCdmServer();
137
                updatePort();
138
                populateCdmInstanceCombo(false);
138
                refreshCdmServer();
139 139
            }
140 140
        });
141 141
        GridData gd_comboCdmServer = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
......
158 158
        gd_txtCdmServerStatus.widthHint = 100;
159 159
        txtCdmServerStatus.setLayoutData(gd_txtCdmServerStatus);
160 160

  
161
        btnCdmServerRefresh = new Button(cdmServerComposite, SWT.NONE);
162
        btnCdmServerRefresh.addSelectionListener(new SelectionAdapter() {
163
            @Override
164
            public void widgetSelected(SelectionEvent e) {
165
                refreshCdmServer();
166
            }
167
        });
168
        btnCdmServerRefresh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
169
        btnCdmServerRefresh.setText("Refresh");
170

  
161 171
        Label lblCdmInstance = new Label(cdmServerComposite, SWT.NONE);
162 172
        GridData gd_lblCdmInstance = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
163 173
        gd_lblCdmInstance.heightHint = 30;
......
178 188
        comboCdmInstance.setLayoutData(gd_comboCdmInstance);
179 189
        comboCdmInstance.select(0);
180 190

  
181
        Button btnRefresh = new Button(cdmServerComposite, SWT.FLAT);
182
        GridData gd_btnRefresh = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
183
        gd_btnRefresh.widthHint = 110;
184
        gd_btnRefresh.heightHint = 30;
185
        btnRefresh.setLayoutData(gd_btnRefresh);
186
        btnRefresh.setText("Refresh");
187

  
188 191
        txtCdmInstanceStatus = new Text(cdmServerComposite, SWT.BORDER);
189 192
        txtCdmInstanceStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
190 193
        txtCdmInstanceStatus.setEditable(false);
191
        GridData gd_txtCdmInstanceStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
194
        GridData gd_txtCdmInstanceStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
192 195
        gd_txtCdmInstanceStatus.widthHint = 100;
193 196
        txtCdmInstanceStatus.setLayoutData(gd_txtCdmInstanceStatus);
197

  
198
        Button btnCdmInstanceRefresh = new Button(cdmServerComposite, SWT.FLAT);
199
        btnCdmInstanceRefresh.addSelectionListener(new SelectionAdapter() {
200
            @Override
201
            public void widgetSelected(SelectionEvent e) {
202
                refreshCdmInstance();
203
            }
204
        });
205
        GridData gd_btnCdmInstanceRefresh = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
206
        gd_btnCdmInstanceRefresh.widthHint = 110;
207
        gd_btnCdmInstanceRefresh.heightHint = 30;
208
        btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh);
209
        btnCdmInstanceRefresh.setText("Refresh");
194 210
        new Label(cdmServerComposite, SWT.NONE);
195 211

  
196 212
        btnConnect = new Button(cdmServerComposite, SWT.FLAT);
......
207 223
        new Label(cdmServerComposite, SWT.NONE);
208 224
        new Label(cdmServerComposite, SWT.NONE);
209 225
        new Label(cdmServerComposite, SWT.NONE);
226
        new Label(cdmServerComposite, SWT.NONE);
210 227

  
211 228
    }
212 229

  
......
222 239
                            comboCdmServer.add(csii.getName());
223 240
                        }
224 241
                        comboCdmServer.select(0);
225
                        updateSelectedCdmServer();
226
                        updatePort();
227
                        checkSelectedCdmServer();
242
                        refreshCdmServer();
228 243
                    }
229 244
                });
230 245
                return Status.OK_STATUS;
......
234 249
    }
235 250

  
236 251

  
252
    private void refreshCdmServer() {
253
        txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
254
        updateSelectedCdmServer();
255
        updatePort();
256
        checkSelectedCdmServer();
257
    }
258

  
237 259
    private void updateSelectedCdmServer() {
238 260
        int selIndex = comboCdmServer.getSelectionIndex();
239 261
        if(selIndex != -1) {
......
248 270
        }
249 271
    }
250 272

  
251

  
252 273
    private void checkSelectedCdmServer() {
253 274
        int selIndex = comboCdmServer.getSelectionIndex();
275
        txtCdmInstanceStatus.setText("");
254 276
        if(selectedCsii != null) {
255 277
            if(selectedCsii.pingServer()) {
256 278
                txtCdmServerStatus.setText(STATUS_AVAILABLE);
257 279
                populateCdmInstanceCombo(true);
258 280
            } else {
259 281
                txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
282
                comboCdmInstance.removeAll();
260 283
            }
261 284
        }
262 285
    }
263 286

  
264
    private void updateSelectedCdmInstance() {
265
        int selIndex = comboCdmInstance.getSelectionIndex();
266
        if(selIndex != -1) {
267
            selectedCdmInstance = selectedCsii.getInstanceFromName(comboCdmInstance.getItem(selIndex));
268
        }
269
    }
270 287

  
271 288
    private void populateCdmInstanceCombo(final boolean forceRefresh) {
272 289
        comboCdmInstance.removeAll();
......
305 322
                    Display.getDefault().asyncExec(new Runnable() {
306 323
                        @Override
307 324
                        public void run() {
308
                            txtCdmInstanceStatus.setText(STATUS_ERROR);
325
                            txtCdmInstanceStatus.setText(STATUS_REMOTING_NOT_ACTIVATED);
309 326
                            comboCdmInstance.setEnabled(false);
310 327
                            btnConnect.setEnabled(false);
311 328
                        }
312 329
                    });
313

  
314

  
315 330
                }
316 331
                return Status.OK_STATUS;
317 332
            }
318 333
        };
319 334

  
320
        // Start the Job
321
        job.schedule();
335
        if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) {
336
            // Start the Job
337
            job.schedule();
338
        }
322 339

  
340
    }
341

  
342
    private void refreshCdmInstance() {
343
        txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY);
344
        updateSelectedCdmInstance();
345
        checkSelectedCdmServerInstance();
346
    }
323 347

  
348
    private void updateSelectedCdmInstance() {
349
        int selIndex = comboCdmInstance.getSelectionIndex();
350
        if(selIndex != -1) {
351
            selectedCdmInstance = selectedCsii.getInstanceFromName(comboCdmInstance.getItem(selIndex));
352
        }
324 353
    }
325 354

  
326 355
    private void checkSelectedCdmServerInstance() {

Also available in: Unified diff