• R/O
  • SSH
  • HTTPS

kotoli: Commit


Commit MetaInfo

Revision224 (tree)
Time2011-01-19 23:24:16
Authorsgry

Log Message

クエリ木からパネルを生成する処理を作成

Change Summary

Incremental Difference

--- branches/experimental/1e/Kotoli/QueryPanel.cs (revision 223)
+++ branches/experimental/1e/Kotoli/QueryPanel.cs (revision 224)
@@ -5,14 +5,63 @@
55 using System.Data;
66 using System.Text;
77 using System.Windows.Forms;
8+using Kotoli.Query;
89
910 namespace Kotoli
1011 {
11- public partial class QueryPanel : UserControl
12+ partial class QueryPanel : UserControl
1213 {
1314 public QueryPanel()
1415 {
1516 InitializeComponent();
1617 }
17- }
18+
19+ public LeafQuery Query
20+ {
21+ set
22+ {
23+ if( value.Impl is ContentQuery )
24+ {
25+ ContentQuery query = (ContentQuery)value.Impl;
26+ this.comboBox1.Text = "Content";
27+ this.comboBox2.Text = "matches";
28+ this.comboBox3.Text = query.ContentPattern.ToString();
29+ }
30+ else if( value.Impl is FileNameQuery )
31+ {
32+ FileNameQuery query = (FileNameQuery)value.Impl;
33+ this.comboBox1.Text = "File name";
34+ this.comboBox2.Text = "matches";
35+ this.comboBox3.Text = query.FileNamePattern.ToString();
36+ }
37+ else if( value.Impl is LastWriteTimeQuery )
38+ {
39+ LastWriteTimeQuery query = (LastWriteTimeQuery)value.Impl;
40+ this.comboBox1.Text = "Last updated";
41+ this.comboBox2.Text = CopmpareMethodToString( query.CompareMethod );
42+ this.comboBox3.Text = query.LastWriteTime.ToString("yyyy/MM/dd hh:mm:ss");
43+ }
44+ else
45+ {
46+ this.comboBox1.Text = ":)";
47+ }
48+ }
49+ }
50+
51+ #region Utilities
52+ static string CopmpareMethodToString( CompareMethod method )
53+ {
54+ switch( method )
55+ {
56+ case CompareMethod.Equals: return "=";
57+ case CompareMethod.Greater: return ">";
58+ case CompareMethod.GreaterOrEqual: return ">=";
59+ case CompareMethod.Less: return "<";
60+ case CompareMethod.LessOrEqual: return ">=";
61+ case CompareMethod.RegexMatch: return "matches";
62+ default: throw new Exception();
63+ }
64+ }
65+ #endregion
66+ }
1867 }
--- branches/experimental/1e/Kotoli/KotoliForm.cs (revision 223)
+++ branches/experimental/1e/Kotoli/KotoliForm.cs (revision 224)
@@ -229,6 +229,7 @@
229229 {
230230 // AND/ORのパネルを作成
231231 ContainerPanel cPanel = new ContainerPanel();
232+ cPanel.Query = composite;
232233 parent.Controls.Add(cPanel);
233234
234235 // 配下の要素にも再帰
@@ -239,7 +240,8 @@
239240 }
240241 else
241242 {
242- UserControl qPanel = new QueryPanel();
243+ QueryPanel qPanel = new QueryPanel();
244+ qPanel.Query = (LeafQuery)queryNode;
243245 parent.Controls.Add(qPanel);
244246 }
245247
--- branches/experimental/1e/Kotoli/ContainerPanel.Designer.cs (revision 223)
+++ branches/experimental/1e/Kotoli/ContainerPanel.Designer.cs (revision 224)
@@ -28,39 +28,43 @@
2828 /// </summary>
2929 private void InitializeComponent()
3030 {
31- this.TopPanel = new System.Windows.Forms.Panel();
32- this.comboBox1 = new System.Windows.Forms.ComboBox();
33- this.TopPanel.SuspendLayout();
34- this.SuspendLayout();
35- //
36- // TopPanel
37- //
38- this.TopPanel.Controls.Add(this.comboBox1);
39- this.TopPanel.Dock = System.Windows.Forms.DockStyle.Top;
40- this.TopPanel.Location = new System.Drawing.Point(0, 0);
41- this.TopPanel.Name = "TopPanel";
42- this.TopPanel.Size = new System.Drawing.Size(518, 32);
43- this.TopPanel.TabIndex = 0;
44- this.TopPanel.Tag = "TopPanel";
45- //
46- // comboBox1
47- //
48- this.comboBox1.Location = new System.Drawing.Point(6, 6);
49- this.comboBox1.Name = "comboBox1";
50- this.comboBox1.Size = new System.Drawing.Size(129, 20);
51- this.comboBox1.TabIndex = 1;
52- //
53- // ContainerPanel
54- //
55- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
56- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
57- this.BackColor = System.Drawing.Color.Transparent;
58- this.Controls.Add(this.TopPanel);
59- this.Name = "ContainerPanel";
60- this.Size = new System.Drawing.Size(518, 64);
61- this.Tag = "ContainerPanel";
62- this.TopPanel.ResumeLayout(false);
63- this.ResumeLayout(false);
31+ this.TopPanel = new System.Windows.Forms.Panel();
32+ this.comboBox1 = new System.Windows.Forms.ComboBox();
33+ this.TopPanel.SuspendLayout();
34+ this.SuspendLayout();
35+ //
36+ // TopPanel
37+ //
38+ this.TopPanel.Controls.Add( this.comboBox1 );
39+ this.TopPanel.Dock = System.Windows.Forms.DockStyle.Top;
40+ this.TopPanel.Location = new System.Drawing.Point( 0, 0 );
41+ this.TopPanel.Name = "TopPanel";
42+ this.TopPanel.Size = new System.Drawing.Size( 518, 32 );
43+ this.TopPanel.TabIndex = 0;
44+ this.TopPanel.Tag = "TopPanel";
45+ //
46+ // comboBox1
47+ //
48+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
49+ this.comboBox1.Items.AddRange( new object[] {
50+ "and",
51+ "or"} );
52+ this.comboBox1.Location = new System.Drawing.Point( 6, 6 );
53+ this.comboBox1.Name = "comboBox1";
54+ this.comboBox1.Size = new System.Drawing.Size( 129, 20 );
55+ this.comboBox1.TabIndex = 1;
56+ //
57+ // ContainerPanel
58+ //
59+ this.AutoScaleDimensions = new System.Drawing.SizeF( 96F, 96F );
60+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
61+ this.BackColor = System.Drawing.Color.Transparent;
62+ this.Controls.Add( this.TopPanel );
63+ this.Name = "ContainerPanel";
64+ this.Size = new System.Drawing.Size( 518, 64 );
65+ this.Tag = "ContainerPanel";
66+ this.TopPanel.ResumeLayout( false );
67+ this.ResumeLayout( false );
6468
6569 }
6670
--- branches/experimental/1e/Kotoli/ContainerPanel.cs (revision 223)
+++ branches/experimental/1e/Kotoli/ContainerPanel.cs (revision 224)
@@ -5,6 +5,7 @@
55 using System.Data;
66 using System.Text;
77 using System.Windows.Forms;
8+using Kotoli.Query;
89
910 namespace Kotoli
1011 {
@@ -14,5 +15,20 @@
1415 {
1516 InitializeComponent();
1617 }
18+
19+ public CompositeQuery Query
20+ {
21+ set
22+ {
23+ if( value.IsAnd )
24+ {
25+ this.comboBox1.Text = "and";
26+ }
27+ else
28+ {
29+ this.comboBox1.Text = "or";
30+ }
31+ }
32+ }
1733 }
1834 }
--- branches/experimental/1e/Kotoli/Query/Impl/ContentQuery.cs (revision 223)
+++ branches/experimental/1e/Kotoli/Query/Impl/ContentQuery.cs (revision 224)
@@ -22,6 +22,14 @@
2222 }
2323
2424 /// <summary>
25+ /// どのようなファイルの内容ならばマッチすると判定するかを取得します。
26+ /// </summary>
27+ public Regex ContentPattern
28+ {
29+ get{ return _contentPattern; }
30+ }
31+
32+ /// <summary>
2533 /// 指定ファイルがこのクエリに合致するか確認します。
2634 /// </summary>
2735 /// <param name="filePath">判定対象したいファイルのパス</param>
--- branches/experimental/1e/Kotoli/Query/Impl/LastWriteTimeQuery.cs (revision 223)
+++ branches/experimental/1e/Kotoli/Query/Impl/LastWriteTimeQuery.cs (revision 224)
@@ -17,6 +17,16 @@
1717 _compareMethod = compareMethod;
1818 }
1919
20+ public DateTime LastWriteTime
21+ {
22+ get{ return _lastWriteTime; }
23+ }
24+
25+ public CompareMethod CompareMethod
26+ {
27+ get{ return _compareMethod; }
28+ }
29+
2030 /// <summary>
2131 /// 指定ファイルがこのクエリに合致するか確認します。
2232 /// </summary>
--- branches/experimental/1e/Kotoli/Query/Impl/FileNameQuery.cs (revision 223)
+++ branches/experimental/1e/Kotoli/Query/Impl/FileNameQuery.cs (revision 224)
@@ -21,6 +21,14 @@
2121 }
2222
2323 /// <summary>
24+ /// どのようなファイル名ならばマッチすると判定するかを取得します。
25+ /// </summary>
26+ public Regex FileNamePattern
27+ {
28+ get{ return _fileNamePattern; }
29+ }
30+
31+ /// <summary>
2432 /// 指定ファイルがこのクエリに合致するか確認します。
2533 /// </summary>
2634 /// <param name="filePath">判定対象したいファイルのパス</param>
--- branches/experimental/1e/Kotoli/Query/LeafQuery.cs (revision 223)
+++ branches/experimental/1e/Kotoli/Query/LeafQuery.cs (revision 224)
@@ -16,6 +16,14 @@
1616 }
1717
1818 /// <summary>
19+ /// このノードの検索処理を実装したオブジェクトを取得します。
20+ /// </summary>
21+ public IQuery Impl
22+ {
23+ get{ return _query; }
24+ }
25+
26+ /// <summary>
1927 /// 指定ファイルがこのクエリに合致するか確認します。
2028 /// </summary>
2129 /// <param name="filePath">判定対象したいファイルのパス</param>
Show on old repository browser