Changeset 2236

Show
Ignore:
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
  • trunk/framework-plugin/src/com/tresys/framework/plugin/wizards/shape/NetworkResourceShapePropertyPage.java

    r2235 r2236  
    33|*| License: refer to COPYING file for license information. 
    44|*| Author:     Norman Patrick <npatrick@tresys.com> 
     5|*|                     Anand Patel <apatel@tresys.com> 
    56|*|   
    67|*| $Rev$ 
     
    228229        protected class VerifyTextValueListener extends ModifyValueListener implements ModifyListener 
    229230        { 
    230                 private String errorMessage; 
    231                  
    232                 public VerifyTextValueListener(NetworkResourceShapePropertyPage Page, String IPVar, String ErrorMessage) 
     231                public VerifyTextValueListener(NetworkResourceShapePropertyPage Page, String IPVar) 
    233232                { 
    234233                        super(Page, IPVar); 
    235                         this.errorMessage = ErrorMessage; 
    236234                } 
    237235                 
     
    247245        protected class VerifyIPAddressListener extends ModifyTextValueListener 
    248246        { 
    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) 
    253248                { 
    254249                        super(Page, IPVar); 
    255                         this.required = Required; 
    256                         this.errorMessage = ErrorMessage; 
    257250                } 
    258251                 
     
    268261        protected class VerifyIPPortsListener extends ModifyTextValueListener 
    269262        { 
    270                 private String errorMessage; 
    271  
    272                 public VerifyIPPortsListener(NetworkResourceShapePropertyPage Page, String IPVar, String ErrorMessage) 
     263                public VerifyIPPortsListener(NetworkResourceShapePropertyPage Page, String IPVar) 
    273264                { 
    274265                        super(Page, IPVar); 
    275                         this.errorMessage = ErrorMessage; 
    276266                } 
    277267                 
     
    374364 
    375365                                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));                              
    377367                                GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    378368                                ip.setLayoutData(sysData); 
     
    386376 
    387377                                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)); 
    389379                                GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    390380                                ports.setLayoutData(sysData); 
     
    422412 
    423413                                        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));                              
    425415                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    426416                                        ip.setLayoutData(sysData); 
     
    434424 
    435425                                        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)); 
    437427                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    438428                                        mask.setLayoutData(sysData); 
     
    446436 
    447437                                        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)); 
    449439                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    450440                                        ports.setLayoutData(sysData); 
     
    480470 
    481471                                        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));                             
    483473                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    484474                                        ip.setLayoutData(sysData); 
     
    492482 
    493483                                        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)); 
    495485                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    496486                                        mask.setLayoutData(sysData); 
     
    504494 
    505495                                        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)); 
    507497                                        GridData sysData = new GridData(GridData.FILL_HORIZONTAL| GridData.GRAB_HORIZONTAL); 
    508498                                        ports.setLayoutData(sysData); 
     
    555545                        if ( localIPAddress.length () == 0 ) 
    556546                        { 
    557                                 updateStatus ("Enter valid local IP address", false); 
     547                                updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); 
    558548                                return; 
    559549                        } 
     
    564554                                ) 
    565555                        { 
    566                                 updateStatus("Enter valid local port, multiple ports seperated by space", false); 
     556                                updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); 
    567557                                return; 
    568558                        } 
     
    577567                                if( ! (ip4 || ip6 || match) ) 
    578568                                { 
    579                                         updateStatus ("Enter valid local IP address", false); 
     569                                        updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); 
    580570                                        return; 
    581571                                } 
     
    588578                        if( localDevice.trim ().length () == 0 ) 
    589579                        { 
    590                                 updateStatus ("Enter valid local Device", false); 
     580                                updateStatus (Messages.NetworkResourcePropertyPage_bad_local_device, false); 
    591581                                return; 
    592582                        } 
     
    594584                        if ( localIPAddress.trim ().length () == 0 ) 
    595585                        { 
    596                                 updateStatus ("Enter valid local IP address", false); 
     586                                updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); 
    597587                                return; 
    598588                        } 
     
    602592                                                ) 
    603593                        { 
    604                                 updateStatus ("Enter valid local Mask value", false); 
     594                                updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_mask, false); 
    605595                                return; 
    606596                        } 
     
    609599                                ) 
    610600                        { 
    611                                 updateStatus("Enter valid local ports, multiple ports seperated by space", false); 
     601                                updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); 
    612602                                return; 
    613603                        } 
     
    620610                                if( ! (ip4 || ip6 || match) ) 
    621611                                { 
    622                                         updateStatus ("Enter valid local IP address", false); 
     612                                        updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); 
    623613                                        return; 
    624614                                } 
     
    626616                         
    627617                         
    628                         // remote infomration all of them are optional 
     618                        // remote information all of them are optional 
    629619                        if( remoteDevice.trim ().length () > 0  && remoteIPAddress.trim ().length () == 0) 
    630620                        { 
    631                                 updateStatus ("Enter valid remote IP Address", false); 
     621                                updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_address, false); 
    632622                                return; 
    633623                        } 
    634624                        if ( remoteIPAddress.trim ().length () > 0  && remoteDevice.trim ().length () == 0 ) 
    635625                        { 
    636                                 updateStatus ("Enter valid remote Device", false); 
     626                                updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_device, false); 
    637627                                return; 
    638628                        } 
     
    645635                                if( ! (ip4 || ip6 || match) ) 
    646636                                { 
    647                                         updateStatus ("Enter Valid remote IP address", false); 
     637                                        updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_address, false); 
    648638                                        return; 
    649639                                } 
     
    654644                                                ) 
    655645                        { 
    656                                 updateStatus ("Enter valid remote Mask value", false); 
     646                                updateStatus (Messages.NetworkResourcePropertyPage_bad_remote_ip_mask, false); 
    657647                                return; 
    658648                        } 
     
    661651                                ) 
    662652                        { 
    663                                 updateStatus("Enter valid remote ports, multiple ports seperated by space", false); 
     653                                updateStatus(Messages.NetworkResourcePropertyPage_bad_local_ip_ports, false); 
    664654                                return; 
    665655                        } 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/wizards/shape/messages.properties

    r2153 r2236  
    4444NetworkResourcePropertyPage_bad_local_ip_address=Please enter a valid local IP Address 
    4545NetworkResourcePropertyPage_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 
     46NetworkResourcePropertyPage_bad_local_ip_ports=Please enter a valid list of local IP ports separated by space 
    4747NetworkResourcePropertyPage_bad_remote_device=Please enter a remote device name 
    4848NetworkResourcePropertyPage_bad_remote_ip_address=Please enter a valid remote IP Address 
    4949NetworkResourcePropertyPage_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 
     50NetworkResourcePropertyPage_bad_remote_ip_ports=Please enter a valid list of remote IP ports separated by space 
    5151NetworkResourcePropertyPage_err_local_device_or_ip=Either a local device or local IP address must be specified 
    5252