| Revision 359,
1.1 KB
checked in by jdalbey, 7 years ago
(diff) |
|
Add EINotebook source
|
-
Property svn:executable set to
*
|
| Rev | Line | |
|---|
| 1 | /** |
|---|
| 2 | * Represents a property of an event. Does not represent an evaluation. |
|---|
| 3 | * @param type {String} Ex: "CHP Radio" |
|---|
| 4 | * @param data Array(text) OR Array(label1, text1, label2, text2, ...) |
|---|
| 5 | */ |
|---|
| 6 | function Property(type, data) |
|---|
| 7 | { |
|---|
| 8 | //========== public read-only members ==========// |
|---|
| 9 | this.type = type; |
|---|
| 10 | this.data = data; |
|---|
| 11 | |
|---|
| 12 | //========== public methods ==========// |
|---|
| 13 | this.html = html; |
|---|
| 14 | |
|---|
| 15 | //========== method definitions ==========// |
|---|
| 16 | /** |
|---|
| 17 | * @return The html representation of this property. |
|---|
| 18 | */ |
|---|
| 19 | function html() |
|---|
| 20 | { |
|---|
| 21 | var text = "<table class='property'>" + |
|---|
| 22 | "<tr>" + |
|---|
| 23 | "<th class='propertyType' colspace='" + |
|---|
| 24 | (this.data.length == 1 ? 1 : 2) + "'>" + type + "</th>" + |
|---|
| 25 | "</tr>"; |
|---|
| 26 | |
|---|
| 27 | if (this.data.length == 1) |
|---|
| 28 | { |
|---|
| 29 | text += "<tr>" + |
|---|
| 30 | "<td class='propertyContent'>" + this.data[0] + "</td>" + |
|---|
| 31 | "</tr>"; |
|---|
| 32 | } |
|---|
| 33 | else |
|---|
| 34 | { |
|---|
| 35 | for (i=0;i<this.data.length;i+=2) |
|---|
| 36 | { |
|---|
| 37 | text += "<tr>" + |
|---|
| 38 | "<td class='propertyLabel'>" + this.data[i] + "</td>" + |
|---|
| 39 | "<td class='propertyValue'>" + this.data[i+1] + "</td>" + |
|---|
| 40 | "</tr>"; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | text += "</table>"; |
|---|
| 45 | |
|---|
| 46 | return text; |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.