Changeset 2236
- Timestamp:
- 06/12/08 16:41:38
(4 months ago)
- Author:
- apatel
- Message:
cleaned up a bit, Used NLS messages in place of the string. Changed some of the listener methods as the argument list is gone and all the checking and error generation is done in the checkInput method.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2235 |
r2236 |
|
| 3 | 3 | |*| License: refer to COPYING file for license information. |
|---|
| 4 | 4 | |*| Author: Norman Patrick <npatrick@tresys.com> |
|---|
| | 5 | |*| Anand Patel <apatel@tresys.com> |
|---|
| 5 | 6 | |*| |
|---|
| 6 | 7 | |*| $Rev$ |
|---|
| … | … | |
| 228 | 229 | protected class VerifyTextValueListener extends ModifyValueListener implements ModifyListener |
|---|
| 229 | 230 | { |
|---|
| 230 | | private String errorMessage; |
|---|
| 231 | | |
|---|
| 232 | | public VerifyTextValueListener(NetworkResourceShapePropertyPage Page, String IPVar, String ErrorMessage) |
|---|
| | 231 | public VerifyTextValueListener(NetworkResourceShapePropertyPage Page, String IPVar) |
|---|
| 233 | 232 | { |
|---|
| 234 | 233 | super(Page, IPVar); |
|---|
| 235 | | this.errorMessage = ErrorMessage; |
|---|
| 236 | 234 | } |
|---|
| 237 | 235 | |
|---|
| … | … | |
| 247 | 245 | protected class VerifyIPAddressListener extends ModifyTextValueListener |
|---|
| 248 | 246 | { |
|---|
| 249 | | private String errorMessage; |
|---|
| 250 | | private boolean required; |
|---|
| 251 | | |
|---|
| 252 | | public VerifyIPAddressListener(NetworkResourceShapePropertyPage Page, String IPVar, boolean Required, String ErrorMessage) |
|---|
| | 247 | public VerifyIPAddressListener(NetworkResourceShapePropertyPage Page, String IPVar) |
|---|
| 253 | 248 | { |
|---|
| 254 | 249 | super(Page, IPVar); |
|---|
| 255 | | this.required = Required; |
|---|
| 256 | | this.errorMessage = ErrorMessage; |
|---|
| 257 | 250 | } |
|---|
| 258 | 251 | |
|---|
| … | … | |
| 268 | 261 | protected class VerifyIPPortsListener extends ModifyTextValueListener |
|---|
| 269 | 262 | { |
|---|
| 270 | | private String errorMessage; |
|---|
| 271 | | |
|---|
| 272 | | public VerifyIPPortsListener(NetworkResourceShapePropertyPage Page, String IPVar, String ErrorMessage) |
|---|
| | 263 | public VerifyIPPortsListener(NetworkResourceShapePropertyPage Page, String IPVar) |
|---|
| 273 | 264 | { |
|---|
| 274 | 265 | super(Page, IPVar); |
|---|
| 275 | | this.errorMessage = ErrorMessage; |
|---|
| 276 | 266 | } |
|---|
| 277 | 267 | |
|---|
| … | … | |
| 374 | 364 | |
|---|
| 375 | 365 | Text ip = new Text(localDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 376 | | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_IP_ADDRESS, true, Messages.NetworkResourcePropertyPage_bad_local_ip_address)); |
|---|
| | 366 | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_IP_ADDRESS)); |
|---|
| 377 | 367 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 378 | 368 | ip.setLayoutData(sysData); |
|---|
| … | … | |
| 386 | 376 | |
|---|
| 387 | 377 | Text ports = new Text(localDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 388 | | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_LOCAL_IP_PORTS, Messages.NetworkResourcePropertyPage_bad_local_ip_ports)); |
|---|
| | 378 | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_LOCAL_IP_PORTS)); |
|---|
| 389 | 379 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 390 | 380 | ports.setLayoutData(sysData); |
|---|
| … | … | |
| 422 | 412 | |
|---|
| 423 | 413 | Text ip = new Text(localDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 424 | | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_IP_ADDRESS, true, Messages.NetworkResourcePropertyPage_bad_local_ip_address)); |
|---|
| | 414 | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_IP_ADDRESS)); |
|---|
| 425 | 415 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 426 | 416 | ip.setLayoutData(sysData); |
|---|
| … | … | |
| 434 | 424 | |
|---|
| 435 | 425 | Text mask = new Text(localDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 436 | | mask.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_MASK, false, Messages.NetworkResourcePropertyPage_bad_local_ip_mask)); |
|---|
| | 426 | mask.addModifyListener (new VerifyIPAddressListener(this, FIELD_LOCAL_MASK)); |
|---|
| 437 | 427 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 438 | 428 | mask.setLayoutData(sysData); |
|---|
| … | … | |
| 446 | 436 | |
|---|
| 447 | 437 | Text ports = new Text(localDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 448 | | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_LOCAL_IP_PORTS, Messages.NetworkResourcePropertyPage_bad_local_ip_ports)); |
|---|
| | 438 | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_LOCAL_IP_PORTS)); |
|---|
| 449 | 439 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 450 | 440 | ports.setLayoutData(sysData); |
|---|
| … | … | |
| 480 | 470 | |
|---|
| 481 | 471 | Text ip = new Text(remoteDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 482 | | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_REMOTE_IP_ADDRESS, true, Messages.NetworkResourcePropertyPage_bad_remote_ip_address)); |
|---|
| | 472 | ip.addModifyListener (new VerifyIPAddressListener(this, FIELD_REMOTE_IP_ADDRESS)); |
|---|
| 483 | 473 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 484 | 474 | ip.setLayoutData(sysData); |
|---|
| … | … | |
| 492 | 482 | |
|---|
| 493 | 483 | Text mask = new Text(remoteDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 494 | | mask.addModifyListener (new VerifyIPAddressListener(this, FIELD_REMOTE_MASK, false, Messages.NetworkResourcePropertyPage_bad_remote_ip_mask)); |
|---|
| | 484 | mask.addModifyListener (new VerifyIPAddressListener(this, FIELD_REMOTE_MASK)); |
|---|
| 495 | 485 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 496 | 486 | mask.setLayoutData(sysData); |
|---|
| … | … | |
| 504 | 494 | |
|---|
| 505 | 495 | Text ports = new Text(remoteDetails, SWT.BORDER | SWT.SINGLE); |
|---|
| 506 | | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_REMOTE_IP_PORTS, Messages.NetworkResourcePropertyPage_bad_remote_ip_ports)); |
|---|
| | 496 | ports.addModifyListener (new VerifyIPPortsListener(this, FIELD_REMOTE_IP_PORTS)); |
|---|
| 507 | 497 | GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); |
|---|
| 508 | 498 | ports.setLayoutData(sysData); |
|---|
| … | … | |
| 555 | 545 | if ( localIPAddress.length () == 0 ) |
|---|
| 556 | 546 | { |
|---|
| 557 | | updateStatus ("Enter valid local IP address", false); |
|---|
| | 547 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); |
|---|
| 558 | 548 | return; |
|---|
| 559 | 549 | } |
|---|
| … | … | |
| 564 | 554 | ) |
|---|
| 565 | 555 | { |
|---|
| 566 | | updateStatus("Enter valid local port, multiple ports seperated by space", false); |
|---|
| | 556 | updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); |
|---|
| 567 | 557 | return; |
|---|
| 568 | 558 | } |
|---|
| … | … | |
| 577 | 567 | if( ! (ip4 || ip6 || match) ) |
|---|
| 578 | 568 | { |
|---|
| 579 | | updateStatus ("Enter valid local IP address", false); |
|---|
| | 569 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); |
|---|
| 580 | 570 | return; |
|---|
| 581 | 571 | } |
|---|
| … | … | |
| 588 | 578 | if( localDevice.trim ().length () == 0 ) |
|---|
| 589 | 579 | { |
|---|
| 590 | | updateStatus ("Enter valid local Device", false); |
|---|
| | 580 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_device, false); |
|---|
| 591 | 581 | return; |
|---|
| 592 | 582 | } |
|---|
| … | … | |
| 594 | 584 | if ( localIPAddress.trim ().length () == 0 ) |
|---|
| 595 | 585 | { |
|---|
| 596 | | updateStatus ("Enter valid local IP address", false); |
|---|
| | 586 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); |
|---|
| 597 | 587 | return; |
|---|
| 598 | 588 | } |
|---|
| … | … | |
| 602 | 592 | ) |
|---|
| 603 | 593 | { |
|---|
| 604 | | updateStatus ("Enter valid local Mask value", false); |
|---|
| | 594 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_mask, false); |
|---|
| 605 | 595 | return; |
|---|
| 606 | 596 | } |
|---|
| … | … | |
| 609 | 599 | ) |
|---|
| 610 | 600 | { |
|---|
| 611 | | updateStatus("Enter valid local ports, multiple ports seperated by space", false); |
|---|
| | 601 | updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); |
|---|
| 612 | 602 | return; |
|---|
| 613 | 603 | } |
|---|
| … | … | |
| 620 | 610 | if( ! (ip4 || ip6 || match) ) |
|---|
| 621 | 611 | { |
|---|
| 622 | | updateStatus ("Enter valid local IP address", false); |
|---|
| | 612 | updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); |
|---|
| 623 | 613 | return; |
|---|
| 624 | 614 | } |
|---|
| … | … | |
| 626 | 616 | |
|---|
| 627 | 617 | |
|---|
| 628 | | // remote infomration all of them are optional |
|---|
| | 618 | // remote information all of them are optional |
|---|
| 629 | 619 | if( remoteDevice.trim ().length () > 0 && remoteIPAddress.trim ().length () == 0) |
|---|
| 630 | 620 | { |
|---|
| 631 | | updateStatus ("Enter valid remote IP Address", false); |
|---|
| | 621 | updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_address, false); |
|---|
| 632 | 622 | return; |
|---|
| 633 | 623 | } |
|---|
| 634 | 624 | if ( remoteIPAddress.trim ().length () > 0 && remoteDevice.trim ().length () == 0 ) |
|---|
| 635 | 625 | { |
|---|
| 636 | | updateStatus ("Enter valid remote Device", false); |
|---|
| | 626 | updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_device, false); |
|---|
| 637 | 627 | return; |
|---|
| 638 | 628 | } |
|---|
| … | … | |
| 645 | 635 | if( ! (ip4 || ip6 || match) ) |
|---|
| 646 | 636 | { |
|---|
| 647 | | updateStatus ("Enter Valid remote IP address", false); |
|---|
| | 637 | updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_address, false); |
|---|
| 648 | 638 | return; |
|---|
| 649 | 639 | } |
|---|
| … | … | |
| 654 | 644 | ) |
|---|
| 655 | 645 | { |
|---|
| 656 | | updateStatus ("Enter valid remote Mask value", false); |
|---|
| | 646 | updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_mask, false); |
|---|
| 657 | 647 | return; |
|---|
| 658 | 648 | } |
|---|
| … | … | |
| 661 | 651 | ) |
|---|
| 662 | 652 | { |
|---|
| 663 | | updateStatus("Enter valid remote ports, multiple ports seperated by space", false); |
|---|
| | 653 | updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); |
|---|
| 664 | 654 | return; |
|---|
| 665 | 655 | } |
|---|
| r2153 |
r2236 |
|
| 44 | 44 | NetworkResourcePropertyPage_bad_local_ip_address=Please enter a valid local IP Address |
|---|
| 45 | 45 | NetworkResourcePropertyPage_bad_local_ip_mask=Please enter a valid local IP Mask |
|---|
| 46 | | NetworkResourcePropertyPage_bad_local_ip_ports=Please enter a valid list of local IP ports |
|---|
| | 46 | NetworkResourcePropertyPage_bad_local_ip_ports=Please enter a valid list of local IP ports separated by space |
|---|
| 47 | 47 | NetworkResourcePropertyPage_bad_remote_device=Please enter a remote device name |
|---|
| 48 | 48 | NetworkResourcePropertyPage_bad_remote_ip_address=Please enter a valid remote IP Address |
|---|
| 49 | 49 | NetworkResourcePropertyPage_bad_remote_ip_mask=Please enter a valid remote IP Mask |
|---|
| 50 | | NetworkResourcePropertyPage_bad_remote_ip_ports=Please enter a valid list of remote IP ports |
|---|
| | 50 | NetworkResourcePropertyPage_bad_remote_ip_ports=Please enter a valid list of remote IP ports separated by space |
|---|
| 51 | 51 | NetworkResourcePropertyPage_err_local_device_or_ip=Either a local device or local IP address must be specified |
|---|
| 52 | 52 | |
|---|
Download in other formats:
* Generating other formats may take time.