Changeset 2234
- Timestamp:
- 06/12/08 14:59:12 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/NetworkResourceShape.java
r2215 r2234 97 97 public static final String NetworkResource_ipv4_address_pattern = "^(((25[0-5])|(2[0-4][0-9])|([01]?[0-9][0-9]?))\\.){3}((25[0-5])|(2[0-4][0-9])|([01]?[0-9][0-9]?))$"; 98 98 public static final String NetworkResource_ipv6_address_pattern = "^(^(([0-9a-fA-F]{1,4}(((:[0-9a-fA-F]{1,4}){5}::[0-9a-fA-F]{1,4})|((:[0-9a-fA-F]{1,4}){4}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,1})|((:[0-9a-fA-F]{1,4}){3}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,2})|((:[0-9a-fA-F]{1,4}){2}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,3})|(:[0-9a-fA-F]{1,4}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,4})|(::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,5})|(:[0-9a-fA-F]{1,4}){7}))$|^(::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,6})$)|^::$)|^((([0-9a-fA-F]{1,4}(((:[0-9a-fA-F]{1,4}){3}::([0-9a-fA-F]{1,4}){1})|((:[0-9a-fA-F]{1,4}){2}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,1})|((:[0-9a-fA-F]{1,4}){1}::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,2})|(::[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,3})|((:[0-9a-fA-F]{1,4}){0,5})))|([:]{2}[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){0,4})):|::)((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{0,2})\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{0,2})$$"; 99 public static final String NetworkResource_ip_address_pattern = "\\w+.\\w+((.\\w+)+)"; 100 99 101 public static final String NetworkResource_ip_ports_pattern = "([0-9]+( [0-9]+)*)?"; 100 102 trunk/framework-plugin/src/com/tresys/framework/plugin/wizards/shape/NetworkResourceShapePropertyPage.java
r2233 r2234 168 168 public ModifyValueListener(NetworkResourceShapePropertyPage Page, String IPVar) 169 169 { 170 super();171 170 this.page = Page; 172 171 this.ipVar = IPVar; … … 223 222 modifyValue (s); 224 223 updateStatus (); 225 }224 } 226 225 227 226 } … … 269 268 modifyValue (s); 270 269 271 if (!this.required && s. length () == 0)270 if (!this.required && s.trim().length () == 0) 272 271 { 273 272 updateStatus(); 274 273 } 275 276 274 else 277 275 { 278 if (!Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, s) && 279 !Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, s)) 276 boolean match = Pattern.matches(NetworkResourceShape.NetworkResource_ip_address_pattern, s); 277 boolean ip4 = Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, s); 278 boolean ip6 = Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, s); 279 280 if( ip4 || ip6 || match ) 281 updateStatus (); 282 else 280 283 { 281 284 String msg = getErrorMessage (); 282 283 285 if (msg == null || !msg.equals (this.errorMessage)) 284 286 updateStatus (this.errorMessage, false); 285 287 } 286 else287 updateStatus();288 288 } 289 289 } … … 306 306 modifyValue (s); 307 307 308 if (s.length () == 0) 309 { 310 updateStatus(); 311 } 312 308 if (s.trim ().length () > 0 && !Pattern.matches (NetworkResourceShape.NetworkResource_ip_ports_pattern, s)) 309 updateStatus(this.errorMessage, false); 313 310 else 314 { 315 if (!Pattern.matches (NetworkResourceShape.NetworkResource_ip_ports_pattern, s)) 316 updateStatus(this.errorMessage, false); 317 318 else 319 updateStatus(); 320 } 311 updateStatus(); 321 312 } 322 313 } … … 594 585 if ((getNetworkType().GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Yes || getNetworkType().GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Optional)) 595 586 { 596 if (localIPAddress. length () == 0)587 if (localIPAddress.trim ().length () == 0) 597 588 super.updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); 598 589 } … … 600 591 else if ((getNetworkType().GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Yes || getNetworkType().GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Optional)) 601 592 { 602 if (localDevice. length () == 0 && localIPAddress.length () == 0)593 if (localDevice.trim ().length () == 0 && localIPAddress.trim ().length () == 0) 603 594 super.updateStatus (Messages.NetworkResourcePropertyPage_err_local_device_or_ip, false); 604 595 } … … 607 598 608 599 public Rdef getNetworkType() 609 { 600 { 610 601 return (Rdef)((StructuredSelection) this.m_combo.getSelection ()).getFirstElement (); 611 602 }
