protected override void CreateChildControls() { Controls.Clear(); if (currentDef != null) { // Buttons WAFPanel pnlButtons = new WAFPanel(); pnlButtons.Height = Unit.Pixel(25); pnlButtons.Border = false; if (writeAccess || currentDef.IsChangeDef) { MainButton btnSave = new MainButton(); btnSave.Text = "Save"; btnSave.Click += new EventHandler(btnSave_Click); pnlButtons.Controls.Add(btnSave); MainButton btnEditAsTextFile = new MainButton(); btnEditAsTextFile.Text = "Edit values as text table..."; btnEditAsTextFile.Click += new EventHandler(btnEditAsTextFile_Click); pnlButtons.Controls.Add(btnEditAsTextFile); if (DefinitionType == DefinitionType.Local) { MainButton btnDelete = new MainButton(); btnDelete.Confirm = true; if (currentDef.IsChangeDef) { btnDelete.Text = "Delete enumeration changes..."; btnDelete.ConfirmQuestion = "Delete changes to native enumeration \"" + bestDef.CodeName + "\"?"; } else { btnDelete.ConfirmQuestion = "Delete enumeration \"" + currentDef.CodeName + "\"?"; btnDelete.Text = "Delete enumeration..."; } btnDelete.Click += new EventHandler(btnDelete_Click); pnlButtons.Controls.Add(btnDelete); } } if (DefinitionType == DefinitionType.Native) { //MainButton btnNewChangeEnumeration = new MainButton(); //btnNewChangeEnumeration.Text = "Change"; //btnNewChangeEnumeration.Click += new EventHandler(btnNewChangeEnumeration_Click); //pnlButtons.Controls.Add(btnNewChangeEnumeration); } Controls.Add(pnlButtons); // Code name txtCodeName = new TextBox(); txtCodeName.Width = Unit.Percentage(100); txtCodeName.Font.Size = new FontUnit(14, UnitType.Pixel); txtCodeName.Text = bestDef.CodeName; txtCodeName.Enabled = !currentDef.IsChangeDef && writeAccess; StringBuilder htmlIcon = new StringBuilder(); htmlIcon.Append("<img style=\"float:left; margin:5px 2px; 0px 0px;\" src=\""); htmlIcon.Append(IconUrl); htmlIcon.Append("\" height=\"16\" width=\"16\" />"); PropertyPanel ppCodeName = new PropertyPanel(txtCodeName, PropertyLayout.TwoColumns, htmlIcon.ToString(), null); ppCodeName.TitleWidth = Unit.Pixel(50); ppCodeName.Height = Unit.Pixel(45); ppCodeName.ShowAdvancedFunctions = false; Controls.Add(ppCodeName); ppCodeName.Border = true; ppCodeName.MarginTop = true; TabbedView tab = new TabbedView(); this.Controls.Add(tab); tab.PostOnViewChange = false; tab.MarginTop = true; tab.Height = Unit.Percentage(100); tab.Width = Unit.Percentage(100); TabView general = tab.CreateAndAddView("General", "General"); // Namespace txtNameSpace = new TextBox(); txtNameSpace.Width = Unit.Percentage(100); txtNameSpace.Enabled = !currentDef.IsChangeDef && writeAccess; txtNameSpace.Text = bestDef.Namespace; PropertyPanel ppNameSpace = new PropertyPanel(txtNameSpace, PropertyLayout.TwoColumns, "Namespace", null); ppNameSpace.ShowAdvancedFunctions = false; general.Controls.Add(ppNameSpace); TabView tNames = tab.CreateAndAddView("Names", "Names"); // Language versions langVersions = new LanguageVersions(); langVersions.SetData(currentDef.NameByLCID, currentDef.DescriptionByLCID); PropertyPanel ppLangVersion = new PropertyPanel(langVersions, PropertyLayout.NoTitle, "Friendly names and descriptions:", null); langVersions.Enabled = writeAccess; ppLangVersion.Layout = PropertyLayout.NoTitle; tNames.Controls.Add(ppLangVersion); TabView tValues = tab.CreateAndAddView("Values", "Values"); WAFPanel p = new WAFPanel(); p.Width = Unit.Percentage(100); p.Height = Unit.Percentage(100); p.Border = false; p.ScrollBars = ScrollBars.Auto; enumControls = new List<EnumerationValueControl>(); foreach (var v in bestDef.Values.Values) { var c = new EnumerationValueControl(); c.SetData(v.Value, v.CodeName, v.NameByLCID, v.DescriptionByLCID, writeAccess); enumControls.Add(c); p.Controls.Add(c); } tValues.Controls.Add(p); _btnAddValue = new LightButton(); _btnAddValue.Text = "Add enumeration value"; _btnAddValue.Enabled = writeAccess; if (writeAccess) _btnAddValue.Click += new EventHandler(btnAddValue_Click); p.Controls.Add(_btnAddValue); base.CreateChildControls(); } }
protected override void CreateChildControls() { PropertyPanel pp; _codeNameControl = new TextBox(); _codeNameControl.Text = _codename; _codeNameControl.Enabled = _writeAccess; pp = new PropertyPanel(_codeNameControl, PropertyLayout.TwoColumns, "Codename", null); pp.Width = Unit.Percentage(95); pp.ShowAdvancedFunctions = false; this.Controls.Add(pp); _valueControl = new TextBox(); _valueControl.Text = _value.ToString(); _valueControl.Enabled = _writeAccess; pp = new PropertyPanel(_valueControl, PropertyLayout.TwoColumns, "Value", null); pp.Width = Unit.Percentage(95); pp.ShowAdvancedFunctions = false; this.Controls.Add(pp); _lcidControl = new LanguageVersions(); _lcidControl.SetData(_names, _descriptions); _lcidControl.Enabled = _writeAccess; pp = new PropertyPanel(_lcidControl, PropertyLayout.NoTitle, "Language texts:", null); pp.Width = Unit.Percentage(95); pp.ShowAdvancedFunctions = false; this.Controls.Add(pp); Literal l = new Literal(); l.EnableViewState = false; l.Text = "<div style=\"float:left; width:99%; border-top:solid 1px #BBBBBB; height:7px;\"></div><div style=\"clear:both;\"></div>"; this.Controls.Add(l); base.CreateChildControls(); }
protected override void CreateChildControls() { Controls.Clear(); PropertyPanel pp; if (currentDef != null) { // Buttons WAFPanel pnlButtons = new WAFPanel(); pnlButtons.Height = Unit.Pixel(25); pnlButtons.Border = false; if (writeAccess) { MainButton btnSave = new MainButton(); btnSave.Text = "Save"; btnSave.Click += new EventHandler(btnSave_Click); pnlButtons.Controls.Add(btnSave); if (DefinitionType == DefinitionType.Local) { MainButton btnDelete = new MainButton(); btnDelete.Confirm = true; btnDelete.ConfirmQuestion = "Delete property group \"" + currentDef.Name + "\"?"; btnDelete.Text = "Delete property group..."; btnDelete.Click += new EventHandler(btnDelete_Click); pnlButtons.Controls.Add(btnDelete); } } if (DefinitionType == DefinitionType.Native) { //MainButton btnNewChangePropertyGroup = new MainButton(); //btnNewChangePropertyGroup.Text = "Change"; //btnNewChangePropertyGroup.Click += new EventHandler(btnNewChangePropertyGroup_Click); //pnlButtons.Controls.Add(btnNewChangePropertyGroup); } Controls.Add(pnlButtons); // Code name txtName = new TextBox(); txtName.Width = Unit.Percentage(100); txtName.Font.Size = new FontUnit(14, UnitType.Pixel); txtName.Text = currentDef.Name; txtName.Enabled = writeAccess; StringBuilder htmlIcon = new StringBuilder(); htmlIcon.Append("<img style=\"float:left; margin:5px 2px; 0px 0px;\" src=\""); htmlIcon.Append(IconUrl + currentDef.GroupType.ToString() + ".png"); htmlIcon.Append("\" height=\"16\" width=\"16\" />"); PropertyPanel ppCodeName = new PropertyPanel(txtName, PropertyLayout.TwoColumns, htmlIcon.ToString(), null); ppCodeName.TitleWidth = Unit.Pixel(50); ppCodeName.Height = Unit.Pixel(45); ppCodeName.ShowAdvancedFunctions = false; Controls.Add(ppCodeName); ppCodeName.Border = true; ppCodeName.MarginTop = true; TabbedView tab = new TabbedView(); this.Controls.Add(tab); tab.PostOnViewChange = false; tab.MarginTop = true; tab.Height = Unit.Percentage(100); tab.Width = Unit.Percentage(100); TabView general = tab.CreateAndAddView("General", "General"); general.Height = Unit.Percentage(100); general.Width = Unit.Percentage(100); // Group type lstType = new RadioButtonList(); lstType.Items.Add(new ListItem("Panel", PropertyGroupType.Panel.ToString())); lstType.Items.Add(new ListItem("Tab panel", PropertyGroupType.TabPanel.ToString())); lstType.Items.Add(new ListItem("Tab container", PropertyGroupType.TabStrip.ToString())); lstType.Width = Unit.Percentage(100); lstType.SelectedValue = currentDef.GroupType.ToString(); pp = new PropertyPanel(lstType, PropertyLayout.TwoColumns, "Type", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(lstType); general.Controls.Add(pp); // Height txtHeight = new TextBox(); txtHeight.Text = currentDef.Height.IsEmpty ? "" : currentDef.Height.ToString(); pp = new PropertyPanel(txtHeight, PropertyLayout.TwoColumns, "Height", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(txtHeight); general.Controls.Add(pp); // Width txtWidth = new TextBox(); txtWidth.Text = currentDef.Width.IsEmpty ? "" : currentDef.Width.ToString(); pp = new PropertyPanel(txtWidth, PropertyLayout.TwoColumns, "Width", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(txtWidth); general.Controls.Add(pp); // Border chkBorder = new CheckBox(); chkBorder.Checked = currentDef.Settings.Border; pp = new PropertyPanel(chkBorder, PropertyLayout.TwoColumns, "Border", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(chkBorder); general.Controls.Add(pp); // Show title chkShowTitle = new CheckBox(); chkShowTitle.Checked = currentDef.Settings.ShowTitle; pp = new PropertyPanel(chkShowTitle, PropertyLayout.TwoColumns, "Show title", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(chkShowTitle); general.Controls.Add(pp); // Inline chkInline = new CheckBox(); chkInline.Checked = currentDef.Settings.Inline; pp = new PropertyPanel(chkInline, PropertyLayout.TwoColumns, "Inline", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(chkInline); general.Controls.Add(pp); // Access group ID chkAccessGroupId = new TextBox(); chkAccessGroupId.Text = currentDef.Settings.AccessGroupId.ToString(); pp = new PropertyPanel(chkAccessGroupId, PropertyLayout.TwoColumns, "Access group id", null); pp.ShowAdvancedFunctions = false; pp.Controls.Add(chkAccessGroupId); general.Controls.Add(pp); TabView tNames = tab.CreateAndAddView("Names", "Names"); // Language versions langVersions = new LanguageVersions(); langVersions.SetData(currentDef.NameByLCID, currentDef.DescriptionByLCID); PropertyPanel ppLangVersion = new PropertyPanel(langVersions, PropertyLayout.NoTitle, "Friendly names and descriptions:", null); langVersions.Enabled = writeAccess; ppLangVersion.Layout = PropertyLayout.NoTitle; tNames.Controls.Add(ppLangVersion); base.CreateChildControls(); } }