Changeset 2117

Show
Ignore:
Timestamp:
05/13/08 15:58:20 (6 months ago)
Author:
npatrick
Message:

Fixed a problem with the NetworkResource? property sheet.
Properties in comboboxes were not being displayed properly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/networking/src/com/tresys/framework/plugin/editor/policy/graphic/model/NetworkResourceShape.java

    r2116 r2117  
    1010package com.tresys.framework.plugin.editor.policy.graphic.model; 
    1111 
     12import java.util.ArrayList; 
    1213import java.util.HashSet; 
    1314import java.util.Iterator; 
     
    7374 
    7475        public static final String NETWORK_LOCAL_ENCRYPTION_TYPE = "NetworkResource.LocalEncryptionType"; 
     76        public static final String NETWORK_LOCAL_ENCRYPTION_TYPE_INDEX = "NetworkResource.LocalEncryptionTypeIndex"; 
    7577        public static final String DISPLAY_NAME_NETWORK_LOCAL_ENCRYPTION_TYPE = Messages.network_local_encryption_type; 
    7678 
     
    8890 
    8991        public static final String NETWORK_PROTOCOL = "NetworkResource.Protocol"; 
     92        public static final String NETWORK_PROTOCOL_INDEX = "NetworkResource.ProtocolIndex"; 
    9093        public static final String DISPLAY_NAME_NETWORK_PROTOCOL = Messages.network_protocol; 
    9194 
     
    263266                                myDescriptors[5].setCategory (PROP_NETWORK_RESOURCE); 
    264267                                 
    265                                 myDescriptors[6] = new ComboBoxPropertyDescriptor(NETWORK_LOCAL_ENCRYPTION_TYPE, DISPLAY_NAME_NETWORK_LOCAL_ENCRYPTION_TYPE, (String[])GetNetworkEncryptionTypes ().toArray (new String[2])); 
     268                                myDescriptors[6] = new ComboBoxPropertyDescriptor(NETWORK_LOCAL_ENCRYPTION_TYPE_INDEX, DISPLAY_NAME_NETWORK_LOCAL_ENCRYPTION_TYPE, (String[])GetNetworkEncryptionTypes ().toArray (new String[2])); 
    266269                                myDescriptors[6].setCategory (PROP_NETWORK_RESOURCE); 
    267270                        } 
     
    293296                                myDescriptors[10].setCategory (PROP_NETWORK_RESOURCE); 
    294297 
    295                                 myDescriptors[11] = new ComboBoxPropertyDescriptor(NETWORK_PROTOCOL, DISPLAY_NAME_NETWORK_PROTOCOL, (String[])GetNetworkProtcols ().toArray (new String[2])); 
     298                                myDescriptors[11] = new ComboBoxPropertyDescriptor(NETWORK_PROTOCOL_INDEX, DISPLAY_NAME_NETWORK_PROTOCOL, (String[])GetNetworkProtcols ().toArray (new String[3])); 
    296299                                myDescriptors[11].setCategory (PROP_NETWORK_RESOURCE); 
    297300                        } 
     
    387390                        return this.local_encryption_type; 
    388391                 
     392                if (NETWORK_LOCAL_ENCRYPTION_TYPE_INDEX.equals(propertyId)) 
     393                        return this.GetNetworkEncryptionIndex (); 
     394                 
    389395                if (NETWORK_REMOTE_DEVICE.equals (propertyId)) 
    390396                        return this.remote_device; 
     
    401407                if (NETWORK_PROTOCOL.equals (propertyId)) 
    402408                        return this.protocol; 
     409                 
     410                if (NETWORK_PROTOCOL_INDEX.equals(propertyId)) 
     411                        return this.GetNetworkProtocolIndex (); 
    403412                 
    404413                return super.getPropertyValue (propertyId); 
     
    439448                else if (NETWORK_LOCAL_ENCRYPTION_TYPE.equals (propertyId)) 
    440449                        this.local_encryption_type = (String)value; 
     450                else if (NETWORK_LOCAL_ENCRYPTION_TYPE_INDEX.equals (propertyId)) 
     451                        this.SetNetworkEncryptionIndex (value); 
    441452                else if (NETWORK_REMOTE_DEVICE.equals (propertyId)) 
    442453                        this.remote_device = (String)value; 
     
    449460                else if (NETWORK_PROTOCOL.equals (propertyId)) 
    450461                        this.protocol = (String)value; 
     462                else if (NETWORK_PROTOCOL_INDEX.equals (propertyId)) 
     463                        this.SetNetworkProtocolIndex (value); 
    451464                else 
    452465                        super.setPropertyValue (propertyId, value); 
    453466        } 
    454467 
     468        public Integer GetNetworkEncryptionIndex() 
     469        { 
     470                ArrayList list = new ArrayList(GetNetworkEncryptionTypes ()); 
     471                return new Integer(list.indexOf (this.local_encryption_type));   
     472        } 
     473         
     474        public void SetNetworkEncryptionIndex(Object index) 
     475        { 
     476                ArrayList list = new ArrayList(GetNetworkEncryptionTypes ()); 
     477                this.local_encryption_type = (String) list.get ((Integer)index); 
     478        } 
     479         
     480        public Integer GetNetworkProtocolIndex() 
     481        { 
     482                ArrayList list = new ArrayList(GetNetworkProtcols()); 
     483                return new Integer(list.indexOf (this.protocol)); 
     484        } 
     485         
     486        public void SetNetworkProtocolIndex(Object index) 
     487        { 
     488                ArrayList list = new ArrayList(GetNetworkProtcols()); 
     489                this.protocol = (String) list.get ((Integer)index); 
     490        } 
     491         
    455492        public static Set GetNetworkEncryptionTypes () 
    456493        { 
     
    465502        { 
    466503                HashSet protocols = new HashSet (); 
     504                protocols.add ("All"); 
    467505                protocols.add ("tcp"); 
    468506                protocols.add ("udp"); 
  • branches/networking/src/com/tresys/framework/plugin/wizards/shape/NetworkResourceShapePropertyWizard.java

    r2116 r2117  
    6262                this.m_shape.setPropertyValue (NetworkResourceShape.NETWORK_REMOTE_IP_ADDRESS, m_page1.remoteIPAddress); 
    6363                this.m_shape.setPropertyValue (NetworkResourceShape.NETWORK_REMOTE_MASK, m_page1.remoteMask); 
     64                this.m_shape.setPropertyValue (NetworkResourceShape.NETWORK_REMOTE_IP_PORTS, m_page1.remoteIPPorts); 
    6465                this.m_shape.setPropertyValue (NetworkResourceShape.NETWORK_PROTOCOL, m_page1.protocol); 
    6566