チェンジセット 1651 (default)
- 日時:
- 2024/06/21 20:12:30 (4ヵ月前)
- 場所:
- framework/trunk
- ファイル:
-
- 3個の追加
- 4個の更新
- 2個のコピー
凡例:
- 未変更
- 追加
- 削除
-
framework/trunk/WebApplication/App_Data/SqlTemplates/UI/WebControls/SelectFieldTemplatePage.st
r1650 r1651 1 # SelectField Page.st1 # SelectFieldTemplatePage.st 2 2 @include resource:FCSoft.SilverFrost.Framework.Web/FCSoft.SilverFrost.Framework.Web.Resources.Data.CommonDbDataSource.st 3 3 … … 10 10 t.collation_name, 11 11 CASE 12 WHEN t. collation_name IS NOT NULLTHEN12 WHEN t.max_length <= 4 THEN 13 13 CAST(1 AS BIT) 14 14 ELSE 15 15 CAST(0 AS BIT) 16 END [check 1],16 END [check], 17 17 CASE 18 WHEN t.max_length >=8 THEN18 WHEN t.max_length BETWEEN 2 AND 8 THEN 19 19 CAST(1 AS BIT) 20 20 ELSE 21 21 CAST(0 AS BIT) 22 END [check2], 23 CASE 24 WHEN t.max_length <= 8 THEN 25 CAST(1 AS BIT) 26 ELSE 27 CAST(0 AS BIT) 28 END [check3] 22 END [is_small] 29 23 FROM 30 24 sys.types t -
framework/trunk/WebApplication/UI/WebControls/SelectFieldTemplatePage.aspx
r1650 r1651 1 1 <%@ Page 2 2 Language="C#" 3 CodeBehind="SelectField Page.aspx.cs"4 Inherits="FCSoft.SilverFrost.Framework.Web.UI.WebControls.SelectField Page"3 CodeBehind="SelectFieldTemplatePage.aspx.cs" 4 Inherits="FCSoft.SilverFrost.Framework.Web.UI.WebControls.SelectFieldTemplatePage" 5 5 %> 6 6 … … 16 16 <div class="test test-webcontrols"> 17 17 18 <h1>UnitTestWeb/UI/WebControls/SelectField Page.aspx</h1>19 18 <h1>UnitTestWeb/UI/WebControls/SelectFieldTemplatePage.aspx</h1> 19 20 20 <asp:Button ID="PostBackButton" runat="server" 21 21 Text="PostBack" … … 42 42 DataKeyNames="name"> 43 43 <Columns> 44 <sff:SelectField />45 44 <sff:SelectField 46 MultiSelect="false" /> 47 <sff:SelectField 48 DataField="check1" 49 HeaderText="check1 header" 50 FooterText="check1 footer" /> 51 <sff:SelectField 52 DataField="check2" 53 HeaderText="check2 header" 54 HeaderSelect="false" /> 55 <sff:SelectField 56 DataField="check3" 57 FooterSelect="false" /> 45 DataField="check" 46 FooterSelect="false"> 47 <ItemTemplate> 48 <asp:PlaceHolder runat="server" 49 Visible='<%# Eval("is_small") %>'> 50 [ <asp:CheckBox runat="server"/> ] 51 </asp:PlaceHolder> 52 </ItemTemplate> 53 </sff:SelectField> 58 54 <sff:BoundField 59 55 HeaderText="name" -
framework/trunk/WebApplication/WebApplication.csproj
r1642 r1651 79 79 <Content Include="UI\WebControls\RadioButtonFieldPage.aspx" /> 80 80 <Content Include="UI\WebControls\RangeValidatorPage.aspx" /> 81 <Content Include="UI\WebControls\SelectFieldTemplatePage.aspx" /> 81 82 <Content Include="UI\WebControls\TemplateFieldPage.aspx" /> 82 83 <Content Include="UI\WebControls\ObjectDataSourceGridViewPage.aspx" /> … … 396 397 <Compile Include="UI\WebControls\RangeValidatorPage.aspx.designer.cs"> 397 398 <DependentUpon>RangeValidatorPage.aspx</DependentUpon> 399 </Compile> 400 <Compile Include="UI\WebControls\SelectFieldTemplatePage.aspx.cs"> 401 <DependentUpon>SelectFieldTemplatePage.aspx</DependentUpon> 402 <SubType>ASPXCodeBehind</SubType> 403 </Compile> 404 <Compile Include="UI\WebControls\SelectFieldTemplatePage.aspx.designer.cs"> 405 <DependentUpon>SelectFieldTemplatePage.aspx</DependentUpon> 398 406 </Compile> 399 407 <Compile Include="UI\WebControls\TemplateFieldPage.aspx.cs"> … … 662 670 <None Include="App_Data\SqlTemplates\UI\WebControls\RowStyleFieldPage.st" /> 663 671 <Content Include="App_Data\SqlTemplates\UI\WebControls\SelectFieldBoundInnerGridViewPage.st" /> 672 <Content Include="App_Data\SqlTemplates\UI\WebControls\SelectFieldTemplatePage.st" /> 664 673 <None Include="App_Data\SqlTemplates\UI\WebControls\SelectFieldPage.st" /> 665 674 <Content Include="Hosting\ContextDumpHandler.ashx" /> -
framework/trunk/WebLibrary/Sources/UI/StyleUtility.cs
r1642 r1651 395 395 396 396 /// <summary> 397 /// CSS の <c>class</c> の値をマージして返します。 398 /// </summary> 399 /// <param name="cssClass1">CSS クラス1。</param> 400 /// <param name="cssClass2">CSS クラス2。</param> 401 /// <returns> 402 /// マージした値。 403 /// <paramref name="cssClass1"/> と <paramref name="cssClass2"/> 404 /// に指定が無い場合は空文字列。 405 /// </returns> 406 public static string MergeCssClass(string cssClass1, string cssClass2) 407 { 408 if (string.IsNullOrWhiteSpace(cssClass1)) 409 { 410 return !string.IsNullOrWhiteSpace(cssClass2) 411 ? cssClass2.Trim() 412 : string.Empty; 413 } 414 415 if (string.IsNullOrWhiteSpace(cssClass2)) 416 { 417 return cssClass1.Trim(); 418 } 419 420 return cssClass1.Trim() + ' ' + cssClass2.Trim(); 421 } 422 423 /// <summary> 397 424 /// 指定されたスタイルをリンクするように登録します。 398 425 /// </summary> -
framework/trunk/WebLibrary/Sources/UI/WebControls/SelectField.cs
r1341 r1651 25 25 using System; 26 26 using System.ComponentModel; 27 using System.Diagnostics; 27 28 using System.Reflection; 28 29 using System.Text.RegularExpressions; … … 91 92 = InitializeRadioButtonUniqueGroupNamePropertyAccessor(); 92 93 94 95 /// <summary> 96 /// <see cref="ItemTemplate"/> の値。 97 /// </summary> 98 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 99 private ITemplate itemTemplate; 93 100 94 101 /// <summary> … … 245 252 } 246 253 254 /// <summary> 255 /// データ バインド コントロールの項目を表示するときに使用するテンプレートを取得または設定します。 256 /// </summary> 257 /// <value> 258 /// <see cref="SelectField"/> の項目を表示するときに使用するテンプレートを格納している 259 /// <see cref="ITemplate"/> 実装オブジェクト。 260 /// 既定値は <see langword="null"/> です。 261 /// このプロパティが設定されていないことを示します。 262 /// </value> 263 /// <remarks> 264 /// このテンプレート内にある、一番先頭のチェックボックスに対して選択が動作します。 265 /// </remarks> 266 [Browsable(false)] 267 [DefaultValue(null)] 268 [WebDescription("Description_ItemTemplate")] 269 [PersistenceMode(PersistenceMode.InnerProperty)] 270 [TemplateContainer(typeof(IDataItemContainer), BindingDirection.TwoWay)] 271 public virtual ITemplate ItemTemplate 272 { 273 get 274 { 275 return itemTemplate; 276 } 277 278 set 279 { 280 itemTemplate = value; 281 OnFieldChanged(); 282 } 283 } 284 247 285 248 286 /// <summary> … … 297 335 internal static ICheckBoxControl GetCheckBoxControl(DataControlFieldCell cell) 298 336 { 299 if (cell.Controls.Count == 0) 300 { 301 return null; 302 } 303 304 return cell.Controls[0] as ICheckBoxControl; 337 return FindCheckBoxControl(cell.Controls, true); 305 338 } 306 339 … … 382 415 Control boundControl; 383 416 384 if (MultiSelect) 385 { 386 boundControl = new CheckBox 417 ITemplate template = itemTemplate; 418 if (template != null) 419 { 420 // テンプレートを使用 421 cell.Text = string.Empty; 422 template.InstantiateIn(cell); 423 424 // テンプレート内の最初のチェックボックスを取得 425 boundControl = FindCheckBoxControl(cell.Controls, false) as Control; 426 if (boundControl == null) 387 427 { 388 Text = Text, 389 }; 390 boundControl.PreRender += DataRowCheckBoxOnPreRender; 428 return; 429 } 430 431 // CheckBox の場合に、全てを選択するためのチェックボックスに連動するようにする 432 if (MultiSelect) 433 { 434 System.Web.UI.WebControls.CheckBox checkBox = boundControl as System.Web.UI.WebControls.CheckBox; 435 if (checkBox != null) 436 { 437 checkBox.PreRender += DataRowCheckBoxOnPreRender; 438 } 439 } 391 440 } 392 441 else 393 442 { 394 RadioButton radioButton = new RadioButton443 if (MultiSelect) 395 444 { 396 Text = Text,397 };398 boundControl = radioButton;399 400 if (RadioButtonIdSeparatorAccessor != null401 && RadioButtonUniqueGroupNameFieldAccessor != null402 && RadioButtonUniqueGroupNamePropertyAccessor != null)445 boundControl = new CheckBox 446 { 447 Text = Text, 448 }; 449 boundControl.PreRender += DataRowCheckBoxOnPreRender; 450 } 451 else 403 452 { 404 radioButton.Init += RadioButtonOnInit; 453 RadioButton radioButton = new RadioButton 454 { 455 Text = Text, 456 }; 457 boundControl = radioButton; 458 459 if (RadioButtonIdSeparatorAccessor != null 460 && RadioButtonUniqueGroupNameFieldAccessor != null 461 && RadioButtonUniqueGroupNamePropertyAccessor != null) 462 { 463 radioButton.Init += RadioButtonOnInit; 464 } 405 465 } 406 } 407 408 cell.Controls.Add(boundControl); 466 467 // ReSharper disable once ExceptionNotDocumented 468 cell.Controls.Add(boundControl); 469 } 409 470 410 471 boundControl.DataBinding += OnDataBindField; … … 436 497 Control controlContainer = boundControl.NamingContainer; 437 498 499 // ReSharper disable once ExceptionNotDocumented 438 500 object value = GetValue(controlContainer); 439 501 if (value == null || value == DBNull.Value) … … 600 662 601 663 /// <summary> 664 /// コントロールコレクションから最初に見付かった <see cref="ICheckBoxControl"/> を返します。 665 /// </summary> 666 /// <param name="controls">コントロールコレクション。</param> 667 /// <param name="visibleOnly"> 668 /// 表示中のコントロールのみを対象にする場合は <see langword="true"/>。 669 /// それ以外の場合は <see langword="false"/>。 670 /// </param> 671 /// <returns> 672 /// コントロールコレクションから最初に見付かった <see cref="ICheckBoxControl"/>。 673 /// 存在しない場合は <see langword="null"/>。 674 /// </returns> 675 private static ICheckBoxControl FindCheckBoxControl(ControlCollection controls, bool visibleOnly) 676 { 677 if (controls == null || controls.Count == 0) 678 { 679 return null; 680 } 681 682 foreach (Control control in controls) 683 { 684 // 非表示の場合は無視 685 if (visibleOnly && !control.Visible) 686 { 687 continue; 688 } 689 690 ICheckBoxControl checkBoxControl 691 = control as ICheckBoxControl 692 ?? FindCheckBoxControl(control.Controls, visibleOnly); 693 if (checkBoxControl != null) 694 { 695 return checkBoxControl; 696 } 697 } 698 699 return null; 700 } 701 702 /// <summary> 602 703 /// ヘッダーまたはフッターのセルを初期化します。 603 704 /// </summary> … … 645 746 private void DataRowCheckBoxOnPreRender(object sender, EventArgs e) 646 747 { 647 CheckBox checkBox = (CheckBox)sender; 648 checkBox.InputAttributes["class"] = GetTargetCheckBoxStyleName(); 748 System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)sender; 749 checkBox.InputAttributes["class"] 750 = StyleUtility.MergeCssClass( 751 checkBox.InputAttributes["class"], 752 GetTargetCheckBoxStyleName()); 649 753 } 650 754 -
framework/trunk/WebTest/WebTest.csproj
r1620 r1651 63 63 <Compile Include="Sources\ReflectionsTest.cs" /> 64 64 <Compile Include="Sources\Security\WebSecurityUtilityTest.cs" /> 65 <Compile Include="Sources\UI\StyleUtilityTest.cs" /> 65 66 <Compile Include="Sources\UI\WebControls\ConfirmTest.cs" /> 66 67 <Compile Include="Sources\UI\WebControls\TextBoxTest.cs" />
※ 詳しい使い方は
TracChangeset を参照してください。