Revision 91736608
Added by Andreas Kohlbecker almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java | ||
---|---|---|
150 | 150 |
// private final int MIN_WIDTH = 530; |
151 | 151 |
// private final int MIN_HEIGHT = 220; |
152 | 152 |
// private final int MIN_EXP_HEIGHT = 380; |
153 |
|
|
153 | 154 |
private final int MESSAGE_HEIGHT = 50; |
154 | 155 |
private Label lblEditorVersion; |
155 | 156 |
private Text txtEditorVersion; |
... | ... | |
203 | 204 |
|
204 | 205 |
setEditorInfo(); |
205 | 206 |
populateCdmServerCombo(); |
207 |
shlConnect.pack(true); |
|
206 | 208 |
shlConnect.open(); |
207 |
shlConnect.layout(); |
|
208 |
Point newSize = shlConnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
|
209 |
shlConnect.setSize(newSize); |
|
210 | 209 |
|
211 | 210 |
xpndblcmpstAdvanced.setExpanded(false); |
212 | 211 |
|
... | ... | |
228 | 227 |
*/ |
229 | 228 |
private void createContents() { |
230 | 229 |
shlConnect = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE); |
231 |
//shlConnect.setMinimumSize(new Point(MIN_WIDTH, MIN_HEIGHT)); |
|
232 |
// shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT); |
|
233 | 230 |
shlConnect.setText(Messages.RemotingLoginDialog_LABEL_CONNECT); |
234 | 231 |
shlConnect.setLayout(new FillLayout(SWT.HORIZONTAL)); |
235 | 232 |
|
... | ... | |
238 | 235 |
|
239 | 236 |
Composite cdmServerComposite = new Composite(remotingComposite, SWT.NONE); |
240 | 237 |
GridData gd_cdmServerComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
241 |
// gd_cdmServerComposite.heightHint = 68; |
|
242 | 238 |
cdmServerComposite.setLayoutData(gd_cdmServerComposite); |
243 | 239 |
cdmServerComposite.setLayout(new GridLayout(4, false)); |
244 | 240 |
|
... | ... | |
247 | 243 |
lblCdmServer.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL)); |
248 | 244 |
lblCdmServer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
249 | 245 |
|
250 |
comboCdmServer = new Combo(cdmServerComposite, SWT.READ_ONLY); |
|
246 |
comboCdmServer = new Combo(cdmServerComposite, SWT.READ_ONLY) { |
|
247 |
@Override |
|
248 |
public Point computeSize(final int wHint, final int hHint, final boolean changed) { |
|
249 |
final Point preferredSize = super.computeSize(wHint, hHint, changed); |
|
250 |
return new Point(Math.min(maxSize.x, preferredSize.x), Math.min(maxSize.y, preferredSize.y)); |
|
251 |
} |
|
252 |
}; |
|
251 | 253 |
comboCdmServer.addSelectionListener(new SelectionAdapter() { |
252 | 254 |
@Override |
253 | 255 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
256 | 258 |
} |
257 | 259 |
}); |
258 | 260 |
GridData gd_comboCdmServer = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
259 |
//gd_comboCdmServer.widthHint = 150; |
|
260 | 261 |
comboCdmServer.setLayoutData(gd_comboCdmServer); |
261 | 262 |
comboCdmServer.select(0); |
262 | 263 |
|
... | ... | |
264 | 265 |
txtCdmServerStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND)); |
265 | 266 |
txtCdmServerStatus.setEditable(false); |
266 | 267 |
GridData gd_txtCdmServerStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); |
267 |
//gd_txtCdmServerStatus.widthHint = 100; |
|
268 | 268 |
|
269 | 269 |
txtCdmServerStatus.setLayoutData(gd_txtCdmServerStatus); |
270 | 270 |
|
... | ... | |
293 | 293 |
} |
294 | 294 |
}); |
295 | 295 |
GridData gd_comboCdmInstance = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
296 |
//gd_comboCdmInstance.widthHint = 150; |
|
297 | 296 |
comboCdmInstance.setLayoutData(gd_comboCdmInstance); |
298 | 297 |
comboCdmInstance.select(0); |
299 | 298 |
|
... | ... | |
301 | 300 |
txtCdmInstanceStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND)); |
302 | 301 |
txtCdmInstanceStatus.setEditable(false); |
303 | 302 |
GridData gd_txtCdmInstanceStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); |
304 |
//gd_txtCdmInstanceStatus.widthHint = 100; |
|
305 | 303 |
txtCdmInstanceStatus.setLayoutData(gd_txtCdmInstanceStatus); |
306 | 304 |
|
307 | 305 |
btnCdmInstanceRefresh = new Button(cdmServerComposite, SWT.FLAT); |
... | ... | |
312 | 310 |
} |
313 | 311 |
}); |
314 | 312 |
GridData gd_btnCdmInstanceRefresh = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); |
315 |
// gd_btnCdmInstanceRefresh.widthHint = 110; |
|
316 |
// gd_btnCdmInstanceRefresh.heightHint = 30; |
|
317 | 313 |
btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh); |
318 | 314 |
btnCdmInstanceRefresh.setText(Messages.RemotingLoginDialog_LABEL_REFRESH); |
319 | 315 |
|
320 | 316 |
loginComposite = new Composite(remotingComposite, SWT.NONE); |
321 | 317 |
GridData gd_loginComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
322 |
// gd_loginComposite.widthHint = 487; |
|
323 |
// gd_loginComposite.heightHint = 70; |
|
324 | 318 |
loginComposite.setLayoutData(gd_loginComposite); |
325 | 319 |
GridLayout gl_loginComposite = new GridLayout(6, false); |
326 | 320 |
gl_loginComposite.marginTop = 5; |
... | ... | |
328 | 322 |
|
329 | 323 |
lblLogin = new Label(loginComposite, SWT.CENTER); |
330 | 324 |
GridData gd_lblLogin = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); |
331 |
// gd_lblLogin.widthHint = 50; |
|
332 | 325 |
lblLogin.setLayoutData(gd_lblLogin); |
333 | 326 |
lblLogin.setText(Messages.RemotingLoginDialog_LABEL_LOGIN_COLON); |
334 | 327 |
lblLogin.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL)); |
... | ... | |
336 | 329 |
txtLogin = new Text(loginComposite, SWT.BORDER); |
337 | 330 |
GridData gd_txtLogin = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
338 | 331 |
gd_txtLogin.minimumWidth = 80; |
339 |
// gd_txtLogin.widthHint = 80; |
|
340 |
// gd_txtLogin.heightHint = 15; |
|
341 | 332 |
txtLogin.setLayoutData(gd_txtLogin); |
342 | 333 |
|
343 | 334 |
lblPassword = new Label(loginComposite, SWT.CENTER); |
... | ... | |
348 | 339 |
txtPassword = new Text(loginComposite, SWT.BORDER | SWT.PASSWORD); |
349 | 340 |
GridData gd_txtPassword = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
350 | 341 |
gd_txtPassword.minimumWidth = 80; |
351 |
// gd_txtPassword.widthHint = 80; |
|
352 |
// gd_txtPassword.heightHint = 15; |
|
353 | 342 |
txtPassword.setLayoutData(gd_txtPassword); |
354 | 343 |
new Label(loginComposite, SWT.NONE); |
355 | 344 |
txtPassword.addKeyListener(new KeyAdapter() { |
... | ... | |
394 | 383 |
GridData gd_styledTxtMessage = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
395 | 384 |
gd_styledTxtMessage.exclude = true; |
396 | 385 |
gd_styledTxtMessage.minimumHeight = MESSAGE_HEIGHT; |
397 |
// gd_styledTxtMessage.heightHint = MESSAGE_HEIGHT; |
|
398 |
//gd_styledTxtMessage.widthHint = MIN_WIDTH - 5; |
|
399 | 386 |
|
400 | 387 |
styledTxtMessage.setLayoutData(gd_styledTxtMessage); |
401 | 388 |
|
402 | 389 |
xpndblcmpstAdvanced = new ExpandableComposite(remotingComposite, SWT.NONE, ExpandableComposite.TWISTIE); |
403 | 390 |
GridData gd_xpndblcmpstAdvanced = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1); |
404 |
// gd_xpndblcmpstAdvanced.heightHint = 19; |
|
405 |
// gd_xpndblcmpstAdvanced.widthHint = MIN_WIDTH - 10; |
|
406 | 391 |
xpndblcmpstAdvanced.setLayoutData(gd_xpndblcmpstAdvanced); |
407 | 392 |
xpndblcmpstAdvanced.addExpansionListener(new IExpansionListener() { |
408 | 393 |
@Override |
409 | 394 |
public void expansionStateChanged(ExpansionEvent e) { |
410 |
if(e.getState()) { |
|
411 |
Point newSize = shlConnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
|
412 |
shlConnect.setSize(newSize); |
|
413 |
} else { |
|
414 |
Point newSize = shlConnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
|
415 |
shlConnect.setSize(newSize); |
|
416 |
} |
|
417 |
|
|
395 |
shlConnect.pack(true); |
|
418 | 396 |
} |
419 | 397 |
@Override |
420 | 398 |
public void expansionStateChanging(ExpansionEvent e) { |
... | ... | |
429 | 407 |
|
430 | 408 |
lblPort = new Label(compAdvanced, SWT.CENTER); |
431 | 409 |
lblPort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
432 |
//lblPort.setSize(0, 0); |
|
433 | 410 |
lblPort.setText(Messages.RemotingLoginDialog_LABEL_PORT); |
434 | 411 |
lblPort.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL)); |
435 | 412 |
|
436 | 413 |
txtPort = new Text(compAdvanced, SWT.BORDER); |
437 | 414 |
GridData gd_txtPort = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); |
438 | 415 |
gd_txtPort.minimumWidth = 50; |
439 |
// gd_txtPort.widthHint = 50; |
|
440 | 416 |
txtPort.setLayoutData(gd_txtPort); |
441 | 417 |
|
442 | 418 |
lblServerVersion = new Label(compAdvanced, SWT.CENTER); |
... | ... | |
465 | 441 |
txtEditorVersion = new Text(compAdvanced, SWT.BORDER); |
466 | 442 |
txtEditorVersion.setEditable(false); |
467 | 443 |
txtEditorVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
468 |
new Label(compAdvanced, SWT.NONE); |
|
469 |
new Label(compAdvanced, SWT.NONE); |
|
444 |
// new Label(compAdvanced, SWT.NONE);
|
|
445 |
// new Label(compAdvanced, SWT.NONE);
|
|
470 | 446 |
|
471 | 447 |
lblServerCDMVersion = new Label(compAdvanced, SWT.CENTER); |
472 | 448 |
lblServerCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
476 | 452 |
txtServerCDMVersion = new Text(compAdvanced, SWT.BORDER); |
477 | 453 |
txtServerCDMVersion.setEditable(false); |
478 | 454 |
txtServerCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
479 |
new Label(compAdvanced, SWT.NONE); |
|
480 |
new Label(compAdvanced, SWT.NONE); |
|
455 |
// new Label(compAdvanced, SWT.NONE);
|
|
456 |
// new Label(compAdvanced, SWT.NONE);
|
|
481 | 457 |
|
482 | 458 |
lblEditorCDMVersion = new Label(compAdvanced, SWT.CENTER); |
483 | 459 |
lblEditorCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
863 | 839 |
btnConnect.setEnabled(true); |
864 | 840 |
btnConnect.setText("Create Schema"); |
865 | 841 |
btnConnect.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); |
842 |
btnConnect.requestLayout(); |
|
866 | 843 |
} |
867 | 844 |
}); |
868 | 845 |
} else { |
... | ... | |
1104 | 1081 |
styledTxtMessage.setVisible(true); |
1105 | 1082 |
((GridData)styledTxtMessage.getLayoutData()).exclude = false; |
1106 | 1083 |
// shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT); |
1107 |
Point newSize = shlConnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
|
1108 |
shlConnect.setSize(newSize); |
|
1084 |
shlConnect.pack(true); |
|
1109 | 1085 |
} else { |
1110 | 1086 |
if (!styledTxtMessage.isDisposed()){ |
1111 | 1087 |
styledTxtMessage.setText(""); //$NON-NLS-1$ |
... | ... | |
1113 | 1089 |
((GridData)styledTxtMessage.getLayoutData()).exclude = true; |
1114 | 1090 |
} |
1115 | 1091 |
if(!shlConnect.isDisposed()){ |
1116 |
// shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage()); |
|
1117 |
Point newSize = shlConnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
|
1118 |
shlConnect.setSize(newSize); |
|
1092 |
shlConnect.pack(true); |
|
1119 | 1093 |
} |
1120 | 1094 |
} |
1121 | 1095 |
if (!remotingComposite.isDisposed()){ |
Also available in: Unified diff
ref #7189 improving & cleaning up size calculation of login dialog