// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the address. PlAddress address = obj as PlAddress; // Change the display information for the new address. if (null == address) { this.ObjectTitle = "Address unknown"; this.Message = "The address information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = string.Format("Address {0}", address.AddressId); this.Message = string.Empty; this.Icon = Resources.GlobeEnvelope_32; this.textBoxAddress.Text = "{0}{1}{2}{3}{4}".FormatWith(address.Line1, Environment.NewLine, address.Line2, Environment.NewLine, address.Line3); this.textBoxPostalCode.Text = address.PostalCode; this.textBoxCity.Text = address.City; this.textBoxState.Text = address.State; this.textBoxCountry.Text = address.Country; // Identifiers. this.textBoxAddressId.Text = address.AddressId.HasValue ? address.AddressId.Value.ToString() : ControlObjectProperties.notAvailable; // Types. this.listViewTypes.Items.Clear(); for (int index = 0; (index < address.AddressTypeIds.Length) && (index < address.AddressTypes.Length); index++) { ListViewItem item = new ListViewItem(new string[] { address.AddressTypeIds[index].ToString(), address.AddressTypes[index] }, 0); item.Tag = address.AddressTypeIds[index]; this.listViewTypes.Items.Add(item); } // Disable the buttons. this.buttonType.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxAddress.Select(); this.textBoxAddress.SelectionStart = 0; this.textBoxAddress.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">Tha PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // The PlanetLab object. PlSliceTag tag = obj as PlSliceTag; // Change the display information for the new tag. if (null == tag) { this.ObjectTitle = "Slice tag unknown"; this.Message = "The slice tag information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = tag.TagName; this.Message = string.Empty; this.Icon = Resources.GlobeTag_32; this.textBoxTagName.Text = tag.TagName; this.textBoxDescription.Text = tag.Description; this.textBoxCategory.Text = tag.Category; this.textBoxValue.Text = tag.Value; this.textBoxSliceName.Text = tag.Name; // Identifiers. this.textBoxTagId.Text = tag.SliceTagId.HasValue ? tag.SliceTagId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxSliceId.Text = tag.NodeId.HasValue ? tag.NodeId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxTypeId.Text = tag.TagTypeId.HasValue ? tag.TagTypeId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxNodeId.Text = tag.NodeId.HasValue ? tag.NodeId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxNodeGroupId.Text = tag.NodeGroupId.HasValue ? tag.NodeGroupId.Value.ToString() : ControlObjectProperties.notAvailable; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxTagName.Select(); this.textBoxTagName.SelectionStart = 0; this.textBoxTagName.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the site. PlKey key = obj as PlKey; // Change the display information for the new site. if (null == key) { this.ObjectTitle = "Key unknown"; this.Message = "The key information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = "Key {0}".FormatWith(key.Id); this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxKey.Text = key.Key; this.textBoxKeyType.Text = key.KeyType; // Identifiers. this.textBoxKeyId.Text = key.KeyId.HasValue ? key.KeyId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerId.Text = key.PeerId.HasValue ? key.PeerId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPersonId.Text = key.PersonId.HasValue ? key.PersonId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerKeyId.Text = key.PeerKeyId.HasValue ? key.PeerKeyId.Value.ToString() : ControlObjectProperties.notAvailable; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxKey.Select(); this.textBoxKey.SelectionStart = 0; this.textBoxKey.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the address type. PlAddressType type = obj as PlAddressType; // Change the display information for the new address type. if (null == type) { this.ObjectTitle = "Address type unknown"; this.Message = "The address type information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = type.Name; this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxName.Text = type.Name; this.textBoxDescription.Text = type.Description; // Identifiers. this.textBoxAddressTypeId.Text = type.AddressTypeId.HasValue ? type.AddressTypeId.Value.ToString() : ControlObjectProperties.notAvailable; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxName.Select(); this.textBoxName.SelectionStart = 0; this.textBoxName.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the slice. PlSlice slice = obj as PlSlice; // Change the display information for the new slice. if (null == slice) { this.ObjectTitle = "Slice unknown"; this.Message = "The slice information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = slice.Name; this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxName.Text = slice.Name; this.textBoxDescription.Text = slice.Description; this.textBoxInstantiation.Text = slice.Instantiation; this.textBoxUrl.Text = slice.Url; this.textBoxCreated.Text = slice.Created.HasValue ? slice.Created.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxExpires.Text = slice.Expires.HasValue ? slice.Expires.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxMaxNodes.Text = slice.MaxNodes.HasValue ? slice.MaxNodes.Value.ToString() : ControlObjectProperties.notAvailable; // Identifiers. this.textBoxSliceId.Text = slice.SliceId.HasValue ? slice.SliceId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxSiteId.Text = slice.SiteId.HasValue ? slice.SiteId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerId.Text = slice.PeerId.HasValue ? slice.PeerId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerSliceId.Text = slice.PeerSliceId.HasValue ? slice.PeerSliceId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxCreatorPersonId.Text = slice.CreatorPersonId.HasValue ? slice.CreatorPersonId.Value.ToString() : ControlObjectProperties.notAvailable; // Nodes. this.listViewNodes.Items.Clear(); foreach (int id in slice.NodeIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodes.Items.Add(item); } // Persons. this.listViewPersons.Items.Clear(); foreach (int id in slice.PersonIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewPersons.Items.Add(item); } // Disable the buttons. this.buttonNode.Enabled = false; this.buttonPerson.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxName.Select(); this.textBoxName.SelectionStart = 0; this.textBoxName.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the node. PlConfigurationFile file = obj as PlConfigurationFile; // Change the display information for the new node. if (null == file) { this.ObjectTitle = "Configuration file unknown"; this.Message = "The configuration file information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = "Configuration file {0}".FormatWith(file.Id); this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxSource.Text = file.Source; this.textBoxDestination.Text = file.Destination; this.textBoxPermissions.Text = file.FilePermissions; this.textBoxGroup.Text = file.FileGroup; this.textBoxOwner.Text = file.FileOwner; this.checkBoxEnabled.CheckState = file.Enabled.HasValue ? file.Enabled.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; this.checkBoxAlwaysUpdate.CheckState = file.AlwaysUpdate.HasValue ? file.AlwaysUpdate.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; this.checkBoxIgnoreCommandErrors.CheckState = file.IgnoreCommandErrors.HasValue ? file.IgnoreCommandErrors.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; // Identifiers. this.textBoxConfigurationFileId.Text = file.ConfigurationFileId.HasValue ? file.ConfigurationFileId.Value.ToString() : ControlObjectProperties.notAvailable; // Commands. this.textBoxPreinstall.Text = file.PreinstallCommand; this.textBoxPostinstall.Text = file.PostinstallCommand; this.textBoxError.Text = file.ErrorCommand; // Nodes. this.listViewNodes.Items.Clear(); foreach (int id in file.NodeIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodes.Items.Add(item); } // Node groups. this.listViewNodeGroups.Items.Clear(); foreach (int id in file.NodeGroupIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodeGroups.Items.Add(item); } // Disable the buttons. this.buttonNode.Enabled = false; this.buttonNodeGroup.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxSource.Select(); this.textBoxSource.SelectionStart = 0; this.textBoxSource.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the interface. PlInterface iface = obj as PlInterface; // Change the display information for the new node. if (null == iface) { this.ObjectTitle = "Interface unknown"; this.Message = "The interface information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General and additional. this.ObjectTitle = iface.Ip; this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxLastUpdated.Text = iface.LastUpdated.HasValue ? iface.LastUpdated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxType.Text = iface.Type; this.textBoxHostname.Text = iface.Hostname; this.textBoxMac.Text = iface.Mac; this.textBoxIp.Text = iface.Ip; this.textBoxNetmask.Text = iface.Netmask; this.textBoxBroadcast.Text = iface.Broadcast; this.textBoxGateway.Text = iface.Gateway; this.textBoxBandwidthLimit.Text = iface.BandwidthLimit.HasValue ? iface.BandwidthLimit.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxDns1.Text = iface.Dns1; this.textBoxDns2.Text = iface.Dns2; this.textBoxMethod.Text = iface.Method; this.checkBoxIsPrimary.CheckState = iface.IsPrimary.HasValue ? iface.IsPrimary.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; // Identifiers. this.textBoxInterfaceId.Text = iface.InterfaceId.HasValue ? iface.InterfaceId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxNodeId.Text = iface.NodeId.HasValue ? iface.NodeId.Value.ToString() : ControlObjectProperties.notAvailable; // Interface tags. this.listViewInterfaceTags.Items.Clear(); foreach (int id in iface.InterfaceTagIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewInterfaceTags.Items.Add(item); } // Disable the buttons. this.buttonInterfaceTag.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxHostname.Select(); this.textBoxHostname.SelectionStart = 0; this.textBoxHostname.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the node. PlNode node = obj as PlNode; // Change the display information for the new node. if (null == node) { this.ObjectTitle = "Node unknown"; this.Message = "The node information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = node.Hostname; this.Message = string.Empty; this.Icon = Resources.GlobeNode_32; this.textBoxHostname.Text = node.Hostname; this.textBoxVersion.Text = node.Version; this.textBoxModel.Text = node.Model; this.textBoxDateCreated.Text = node.DateCreated.HasValue ? node.DateCreated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastUpdated.Text = node.LastUpdated.HasValue ? node.LastUpdated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxBootState.Text = node.BootState; this.textBoxNodeType.Text = node.NodeType; this.textBoxRunLevel.Text = node.RunLevel; this.textBoxSshKey.Text = node.SshRsaKey; this.checkBoxVerified.CheckState = node.Verified.HasValue ? node.Verified.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; // Identifiers. this.textBoxNodeId.Text = node.NodeId.HasValue ? node.NodeId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxSiteId.Text = node.SiteId.HasValue ? node.SiteId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerId.Text = node.PeerId.HasValue ? node.PeerId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerNodeId.Text = node.PeerNodeId.HasValue ? node.PeerNodeId.Value.ToString() : ControlObjectProperties.notAvailable; // Status. this.textBoxLastBoot.Text = node.LastBoot.HasValue ? node.LastBoot.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastPcuReboot.Text = node.LastPcuReboot.HasValue ? node.LastPcuReboot.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastContact.Text = node.LastContact.HasValue ? node.LastContact.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastPcuConfirmation.Text = node.LastPcuConfirmation.HasValue ? node.LastPcuConfirmation.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastDownload.Text = node.LastDownload.HasValue ? node.LastDownload.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastTimeSpentOnline.Text = node.LastTimeSpentOnline.HasValue ? node.LastTimeSpentOnline.Value.ToString("d' day(s) 'hh' hour(s) 'mm' minute(s)'") : ControlObjectProperties.notAvailable; this.textBoxLastTimeSpentOffline.Text = node.LastTimeSpentOffline.HasValue ? node.LastTimeSpentOffline.Value.ToString("d' day(s) 'hh' hour(s) 'mm' minute(s)'") : ControlObjectProperties.notAvailable; // Ports. this.listBoxPorts.Items.Clear(); foreach (int id in node.Ports) { this.listBoxPorts.Items.Add(id); } // PCUs. this.listViewPcus.Items.Clear(); foreach (int id in node.PcuIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewPcus.Items.Add(item); } // Interfaces. this.listViewInterfaces.Items.Clear(); foreach (int id in node.InterfaceIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewInterfaces.Items.Add(item); } // Slices. this.listViewSlices.Items.Clear(); foreach (int id in node.SliceIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewSlices.Items.Add(item); } // Node tags. this.listViewNodeTags.Items.Clear(); foreach (int id in node.NodeTagIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodeTags.Items.Add(item); } // Node groups. this.listViewNodeGroups.Items.Clear(); foreach (int id in node.NodeGroupIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodeGroups.Items.Add(item); } // Slice whitelist. this.listViewSliceWhitelist.Items.Clear(); foreach (int id in node.SliceIdsWhitelist) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewSliceWhitelist.Items.Add(item); } // Configuration files. this.listViewConfigurationFiles.Items.Clear(); foreach (int id in node.ConfigurationFileIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewConfigurationFiles.Items.Add(item); } // Disable the buttons. this.buttonInterface.Enabled = false; this.buttonPcu.Enabled = false; this.buttonNodeTag.Enabled = false; this.buttonSlice.Enabled = false; this.buttonNodeGroup.Enabled = false; this.buttonSliceWhitelist.Enabled = false; this.buttonConfigurationFile.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxHostname.Select(); this.textBoxHostname.SelectionStart = 0; this.textBoxHostname.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the PCU. PlPcu pcu = obj as PlPcu; // Change the display information for the new PCU. if (null == pcu) { this.ObjectTitle = "PCU unknown"; this.Message = "The PCU information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = pcu.Hostname; this.Message = string.Empty; this.Icon = Resources.GlobePower_32; this.textBoxHostname.Text = pcu.Hostname; this.textBoxModel.Text = pcu.Model; this.textBoxUsername.Text = pcu.Username; this.textBoxPassword.Text = pcu.Password; this.textBoxLastUpdated.Text = pcu.LastUpdated.HasValue ? pcu.LastUpdated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxProtocol.Text = pcu.Protocol; this.textBoxIp.Text = pcu.Ip; this.textBoxNotes.Text = pcu.Notes; // Identifiers. this.textBoxPcuId.Text = pcu.PcuId.HasValue ? pcu.PcuId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxSiteId.Text = pcu.SiteId.HasValue ? pcu.SiteId.Value.ToString() : ControlObjectProperties.notAvailable; // Ports. this.listBoxPorts.Items.Clear(); foreach (int id in pcu.Ports) { this.listBoxPorts.Items.Add(id); } // Nodes. this.listViewNodes.Items.Clear(); foreach (int id in pcu.NodeIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodes.Items.Add(item); } // Disable the buttons. this.buttonNode.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxHostname.Select(); this.textBoxHostname.SelectionStart = 0; this.textBoxHostname.SelectionLength = 0; } }
/// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected virtual void OnObjectSet(PlObject obj) { }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the node. PlNodeGroup nodeGroup = obj as PlNodeGroup; // Change the display information for the new node group. if (null == nodeGroup) { this.ObjectTitle = "Node group unknown"; this.Message = "The node group information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = nodeGroup.GroupName; this.Message = string.Empty; this.Icon = Resources.GlobeObject_32; this.textBoxGroupName.Text = nodeGroup.GroupName; this.textBoxValue.Text = nodeGroup.Value; this.textBoxTagName.Text = nodeGroup.TagName; // Identifiers. this.textBoxNodeGroupId.Text = nodeGroup.NodeGroupId.HasValue ? nodeGroup.NodeGroupId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxTagTypeId.Text = nodeGroup.TagTypeId.HasValue ? nodeGroup.TagTypeId.Value.ToString() : ControlObjectProperties.notAvailable; // Nodes. this.listViewNodes.Items.Clear(); foreach (int id in nodeGroup.NodeIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewNodes.Items.Add(item); } // Configuration files. this.listViewConfigurationFiles.Items.Clear(); foreach (int id in nodeGroup.ConfigurationFileIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewConfigurationFiles.Items.Add(item); } // Disable the buttons. this.buttonNode.Enabled = false; this.buttonConfigurationFile.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxGroupName.Select(); this.textBoxGroupName.SelectionStart = 0; this.textBoxGroupName.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the site. PlSite site = obj as PlSite; // Change the display information for the new site. if (null == site) { this.ObjectTitle = "Address unknown"; this.Message = "The address information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = site.Name; this.Message = string.Empty; this.Icon = Resources.GlobeSchema_32; this.textBoxName.Text = site.Name; this.textBoxAbbreviatedName.Text = site.AbbreviatedName; this.textBoxUrl.Text = site.Url; this.textBoxLoginBase.Text = site.LoginBase; this.textBoxDateCreated.Text = site.DateCreated.HasValue ? site.DateCreated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxLastUpdated.Text = site.LastUpdated.HasValue ? site.LastUpdated.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxMaxSlices.Text = site.MaxSlices.HasValue ? site.MaxSlices.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxMaxSlivers.Text = site.MaxSlivers.HasValue ? site.MaxSlivers.Value.ToString() : ControlObjectProperties.notAvailable; this.checkBoxIsEnabled.CheckState = site.IsEnabled.HasValue ? site.IsEnabled.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; this.checkBoxIsPublic.CheckState = site.IsPublic.HasValue ? site.IsPublic.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; // Identifiers. this.textBoxSiteId.Text = site.SiteId.HasValue ? site.SiteId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerId.Text = site.PeerId.HasValue ? site.PeerId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxExtConsortiumId.Text = site.ExtConsortiumId.HasValue ? site.ExtConsortiumId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerSiteId.Text = site.PeerSiteId.HasValue ? site.PeerSiteId.Value.ToString() : ControlObjectProperties.notAvailable; // Location. this.textBoxLatitude.Text = site.Latitude.HasValue ? site.Latitude.Value.LatitudeToString() : ControlObjectProperties.notAvailable; this.textBoxLongitude.Text = site.Longitude.HasValue ? site.Longitude.Value.LongitudeToString() : ControlObjectProperties.notAvailable; if (site.Latitude.HasValue && site.Longitude.HasValue) { this.marker.Location = new MapPoint((float)site.Longitude.Value, (float)site.Latitude.Value); this.marker.Name = site.Name; this.marker.Emphasized = true; this.mapControl.ShowMarkers = true; } else this.mapControl.ShowMarkers = false; // Nodes. this.listViewNodes.Items.Clear(); foreach (int node in site.NodeIds) { ListViewItem item = new ListViewItem(node.ToString(), 0); item.Tag = node; this.listViewNodes.Items.Add(item); } // PCUs. this.listViewPcus.Items.Clear(); foreach (int pcu in site.PcuIds) { ListViewItem item = new ListViewItem(pcu.ToString(), 0); item.Tag = pcu; this.listViewPcus.Items.Add(item); } // Persons. this.listViewPersons.Items.Clear(); foreach (int person in site.PersonIds) { ListViewItem item = new ListViewItem(person.ToString(), 0); item.Tag = person; this.listViewPersons.Items.Add(item); } // Slices. this.listViewSlices.Items.Clear(); foreach (int slice in site.SliceIds) { ListViewItem item = new ListViewItem(slice.ToString(), 0); item.Tag = slice; this.listViewSlices.Items.Add(item); } // Addresses. this.listViewAddresses.Items.Clear(); foreach (int address in site.AddressIds) { ListViewItem item = new ListViewItem(address.ToString(), 0); item.Tag = address; this.listViewAddresses.Items.Add(item); } // Tags. this.listViewTags.Items.Clear(); foreach (int tag in site.SiteTagIds) { ListViewItem item = new ListViewItem(tag.ToString(), 0); item.Tag = tag; this.listViewTags.Items.Add(item); } // Disable the buttons. this.buttonNode.Enabled = false; this.buttonPcu.Enabled = false; this.buttonPerson.Enabled = false; this.buttonSlice.Enabled = false; this.buttonAddress.Enabled = false; this.buttonTag.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxName.Select(); this.textBoxName.SelectionStart = 0; this.textBoxName.SelectionLength = 0; } }
// Protected methods. /// <summary> /// An event handler called when a new PlanetLab object is set. /// </summary> /// <param name="obj">The PlanetLab object.</param> protected override void OnObjectSet(PlObject obj) { // Get the person. PlPerson person = obj as PlPerson; // Change the display information for the new person. if (null == person) { this.ObjectTitle = "Person unknown"; this.Message = "The person information is not available."; this.Icon = Resources.GlobeWarning_32; this.tabControl.Visible = false; } else { // General. this.ObjectTitle = "{0} {1}".FormatWith(person.FirstName, person.LastName); this.Message = string.Empty; this.Icon = Resources.GlobeUser_32; this.textBoxFirstName.Text = person.FirstName; this.textBoxLastName.Text = person.LastName; this.textBoxTitle.Text = person.Title; this.textBoxPhone.Text = person.Phone; this.textBoxEmail.Text = person.Email; this.textBoxUrl.Text = person.Url; this.textBoxBio.Text = person.Bio; this.checkBoxEnabled.CheckState = person.IsEnabled.HasValue ? person.IsEnabled.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; // Identifiers. this.textBoxPersonId.Text = person.PersonId.HasValue ? person.PersonId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerId.Text = person.PeerId.HasValue ? person.PeerId.Value.ToString() : ControlObjectProperties.notAvailable; this.textBoxPeerPersonId.Text = person.PeerPersonId.HasValue ? person.PeerPersonId.Value.ToString() : ControlObjectProperties.notAvailable; // Roles. this.listViewRoles.Items.Clear(); for (int index = 0; (index < person.RoleIds.Length) && (index < person.Roles.Length); index++) { ListViewItem item = new ListViewItem(new string[] { person.RoleIds[index].ToString(), person.Roles[index] }, 0); item.Tag = person.RoleIds[index]; this.listViewRoles.Items.Add(item); } // Keys. this.listViewKeys.Items.Clear(); foreach (int id in person.KeyIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewKeys.Items.Add(item); } // Slices. this.listViewSlices.Items.Clear(); foreach (int id in person.SliceIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewSlices.Items.Add(item); } // Sites. this.listViewSites.Items.Clear(); foreach (int id in person.SiteIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewSites.Items.Add(item); } // Tags. this.listViewTags.Items.Clear(); foreach (int id in person.PersonTagIds) { ListViewItem item = new ListViewItem(id.ToString(), 0); item.Tag = id; this.listViewTags.Items.Add(item); } // Disable the buttons. this.buttonKey.Enabled = false; this.buttonSite.Enabled = false; this.buttonTag.Enabled = false; this.tabControl.Visible = true; } this.tabControl.SelectedTab = this.tabPageGeneral; if (this.Focused) { this.textBoxFirstName.Select(); this.textBoxFirstName.SelectionStart = 0; this.textBoxFirstName.SelectionLength = 0; } }