| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Model\AttributeModel\XPercent.cs | - | 0,0 % | 0,0 % | 0,0 % |
|
1 | #region Copyright | |
2 | /* | |
3 | ShowX. Maps business objects into presentation layer. | |
4 | Copyright (C) 2005 Jesus Diaz. | |
5 | ||
6 | This library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | This library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with this library; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
19 | ||
20 | For project details see: http://showx.sourceforge.net | |
21 | */ | |
22 | #endregion | |
23 | ||
24 | using System; | |
25 | using ShowX.Model; | |
26 | ||
27 | namespace ShowX.Model.AttributeModel | |
28 | { | |
29 | /// <summary> | |
30 | /// Attributes marked with the percent attribute are likely to be show as | |
31 | /// progress bars. | |
32 | /// </summary> | |
33 | [AttributeUsage(AttributeTargets.Property)] | |
34 | public class XPercent : Attribute, IXPercentMap | |
35 | { | |
36 | /// <summary> | |
37 | /// Represent the name of the property who hold the 100% of this quantity. | |
38 | /// </summary> | |
39 | protected string maxProp = string.Empty; | |
40 | ||
41 | /// <summary> | |
42 | /// Keep track whether we want to display attribute as a percent. | |
43 | /// </summary> | |
44 | protected bool showLikePercent = true; | |
45 | ||
46 | /// <summary> | |
47 | /// Name of the attribute. Default value is "". | |
48 | /// </summary> | |
49 | protected string name =""; | |
50 | ||
51 | /// <summary> | |
52 | /// Heading to show over this property. | |
53 | /// </summary> | |
54 | protected string heading = ""; | |
55 | ||
56 | /// <summary> | |
57 | /// Is this attribute show? If false, the attribute won't be show neither on | |
58 | /// editing or viewing. Default value is true. | |
59 | /// </summary> | |
60 | protected bool show = true; | |
61 | ||
62 | /// <summary> | |
63 | /// Style of this item. | |
64 | /// </summary> | |
65 | protected ItemStyle itemStyle; | |
66 | ||
67 | #region IXPercentMap Members | |
68 | ||
69 | /// <summary> | |
70 | /// Reflex the property who store the maximum value. | |
71 | /// </summary> | |
72 | 0 | public string MaxPoperty |
73 | { | |
74 | get { return this.maxProp; } | |
75 | set { maxProp = value; } | |
76 | } | |
77 | ||
78 | /// <summary> | |
79 | /// Expose the showLikePercent attribute. | |
80 | /// </summary> | |
81 | 0 | public bool ShowLikePercent |
82 | { | |
83 | get { return this.showLikePercent; } | |
84 | set { showLikePercent = value; } | |
85 | } | |
86 | ||
87 | #endregion | |
88 | ||
89 | #region IPropertyMap Members | |
90 | ||
91 | /// <summary> | |
92 | /// Reflex the <see cref="name"/> field. | |
93 | /// </summary> | |
94 | 0 | public string Name |
95 | { | |
96 | get { return this.name; } | |
97 | set { this.name = value; } | |
98 | } | |
99 | ||
100 | /// <summary> | |
101 | /// Reflex readonly-ness of the property. | |
102 | /// </summary> | |
103 | 0 | public bool ReadOnly |
104 | { | |
105 | get { return true; } | |
106 | set {} | |
107 | } | |
108 | ||
109 | /// <summary> | |
110 | /// Reflex whether the property should be edited on insertion. | |
111 | /// </summary> | |
112 | 0 | public bool EditOnInsert |
113 | { | |
114 | get { return false; } | |
115 | set {} | |
116 | } | |
117 | ||
118 | /// <summary> | |
119 | /// Reflex whether the property value should be treated as a password. | |
120 | /// </summary> | |
121 | 0 | public bool IsPassword |
122 | { | |
123 | get { return false; } | |
124 | set {} | |
125 | } | |
126 | ||
127 | /// <summary> | |
128 | /// Reflex whether the value of the property should be show or not. | |
129 | /// </summary> | |
130 | 0 | public bool Show |
131 | { | |
132 | get {return this.show; } | |
133 | set { this.show = value; } | |
134 | } | |
135 | ||
136 | /// <summary> | |
137 | /// See the <see cref="itemStyle"/> field. | |
138 | /// </summary> | |
139 | 0 | public ItemStyle ItemStyle |
140 | { | |
141 | get { return this.itemStyle; } | |
142 | set { this.itemStyle = value; } | |
143 | } | |
144 | ||
145 | /// <summary> | |
146 | /// Not used. | |
147 | /// </summary> | |
148 | 0 | public ITranslator Translator |
149 | { | |
150 | get { return null; } | |
151 | set {} | |
152 | } | |
153 | ||
154 | /// <summary> | |
155 | /// See the <see cref="heading"/> field. | |
156 | /// </summary> | |
157 | 0 | public string Heading |
158 | { | |
159 | get { return this.heading; } | |
160 | set { this.heading = value; } | |
161 | } | |
162 | ||
163 | #endregion | |
164 | } | |
165 | } |
|