1 // ========================================================================== 2 // Papercube.PaperTreeController 3 // 4 // License: PaperCube is open source software released under 5 // the MIT License (see license.js) 6 // ========================================================================== 7 8 require('core'); 9 10 /** @class 11 12 This controller is used to control the paper tree view. 13 14 @extends SC.Object 15 @author Peter Bergstrom 16 @version 1.0 17 @copyright 2008-2009 Peter Bergström. 18 @static 19 */ 20 Papercube.paperTreeController = SC.Object.create( 21 /** @scope Papercube.paperTreeController.prototype */ { 22 23 /** 24 The increment value for the depth slider. 25 26 @property {Integer} 27 @default 1 28 */ 29 depthStep: 1, 30 31 /** 32 The max value for the depth slider. 33 34 @property {Integer} 35 @default 15 36 */ 37 depthValueMax: 15, 38 39 /** 40 The min value for the depth slider. 41 42 @property {Integer} 43 @default 1 44 */ 45 depthValueMin: 1, 46 47 /** 48 The value for the depth slider. 49 50 @property {Integer} 51 @default 8 52 */ 53 depth: 8, 54 55 /** 56 The default depth value. 57 58 @property {Integer} 59 @default 8 60 */ 61 defaultDepth: 8, 62 63 /** 64 The increment value for the refThreshold slider. 65 66 @property {Integer} 67 @default 1 68 */ 69 refThresholdStep: 1, 70 71 /** 72 The max value for the refThreshold slider.Default 15. 73 74 @property {Integer} 75 */ 76 refThresholdValueMax: 15, 77 78 /** 79 The min value for the refThreshold slider. 80 81 @property {Integer} 82 @default 0 83 */ 84 refThresholdValueMin: 0, 85 86 /** 87 The value for the refThreshold slider. 88 89 @property {Integer} 90 @default 0 91 */ 92 refThreshold: 0, 93 94 /** 95 The default refThreshold value. 96 97 @property {Integer} 98 @default 15 99 */ 100 defaultRefThreshold: 0, 101 102 /** 103 The increment value for the citeThreshold slider. 104 105 @property {Integer} 106 @default 1 107 */ 108 citeThresholdStep: 1, 109 110 /** 111 The max value for the citeThreshold slider. 112 113 @property {Integer} 114 @default 0 115 */ 116 citeThresholdValueMax: 15, 117 118 /** 119 The min value for the citeThreshold slider. 120 121 @property {Integer} 122 @default 0 123 */ 124 citeThresholdValueMin: 0, 125 126 /** 127 The value for the citeThreshold slider. 128 129 @property {Integer} 130 @default 0 131 */ 132 citeThreshold: 0, 133 134 /** 135 The default citeThreshold value. 136 137 @property {Integer} 138 @default 0 139 */ 140 defaultCiteThreshold: 0, 141 142 /** 143 Route to the appropriate max strength action. 144 145 @param opt {boolean} If YES, ref, if NO, cite. 146 */ 147 maxStrength: function(opt) 148 { 149 if(opt) 150 { 151 this.maxRefStrength(); 152 } 153 else 154 { 155 this.maxCiteStrength(); 156 } 157 }, 158 159 /** 160 Route to the appropriate min strength action. 161 162 @param opt {boolean} If YES, ref, if NO, cite. 163 */ 164 minStrength: function(opt) 165 { 166 if(opt) 167 { 168 this.minRefStrength(); 169 } 170 else 171 { 172 this.minCiteStrength(); 173 } 174 }, 175 176 /** 177 Increment the ref strength towards the maximum. 178 */ 179 maxRefStrength: function() 180 { 181 if(this.get('refThreshold') < this.get('refThresholdValueMax')) 182 this.set('refThreshold', this.get('refThreshold')+1); 183 }, 184 185 /** 186 Increment the ref strength towards the minimum. 187 */ 188 minRefStrength: function() 189 { 190 if(this.get('refThreshold') > this.get('refThresholdValueMin')) 191 this.set('refThreshold', this.get('refThreshold')-1); 192 }, 193 194 /** 195 Increment cite ref strength towards the maximum. 196 */ 197 maxCiteStrength: function() 198 { 199 if(this.get('citeThreshold') < this.get('citeThresholdValueMax')) 200 this.set('citeThreshold', this.get('citeThreshold')+1); 201 }, 202 203 /** 204 Increment cite ref strength towards the miniumum. 205 */ 206 minCiteStrength: function() 207 { 208 if(this.get('citeThreshold') > this.get('citeThresholdValueMin')) 209 this.set('citeThreshold', this.get('citeThreshold')-1); 210 }, 211 212 /** 213 Increment the depth towards the maximum. 214 Take her down! 215 */ 216 maxDepth: function() 217 { 218 if(this.get('depth') < this.get('depthValueMax')) 219 this.set('depth',this.get('depth')+1); 220 }, 221 222 /** 223 Increment the depth towards the maximum. 224 225 Rig for surface! 226 */ 227 minDepth: function() 228 { 229 if(this.get('depth') > this.get('depthValueMin')) 230 this.set('depth',this.get('depth')-1); 231 }, 232 233 /** 234 Set the default values for the controller. 235 */ 236 setDefaults: function() 237 { 238 this.set('refThreshold', this.get('defaultRefThreshold')); 239 this.set('citeThreshold', this.get('defaultCiteThreshold')); 240 this.set('depth', this.get('defaultDepth')); 241 } 242 }) ; 243