PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/AppKit/rhino.platform/CPTableColumn.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 219 lines | 219 code | 0 blank | 0 comment | 0 complexity | 85db6268df44b3e02dc8edc8ccb2eeab MD5 | raw file
  1I;23;Foundation/Foundation.jc;7157;
  2CPTableColumnNoResizing=0;
  3CPTableColumnAutoresizingMask=1;
  4CPTableColumnUserResizingMask=2;
  5var _1=objj_allocateClassPair(CPObject,"CPTableColumn"),_2=_1.isa;
  6class_addIvars(_1,[new objj_ivar("_identifier"),new objj_ivar("_headerView"),new objj_ivar("_tableView"),new objj_ivar("_width"),new objj_ivar("_minWidth"),new objj_ivar("_maxWidth"),new objj_ivar("_resizingMask"),new objj_ivar("_dataView"),new objj_ivar("_dataViewData"),new objj_ivar("_dataViewForView"),new objj_ivar("_purgableInfosForDataView")]);
  7objj_registerClassPair(_1);
  8objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  9class_addMethods(_1,[new objj_method(sel_getUid("initWithIdentifier:"),function(_3,_4,_5){
 10with(_3){
 11_3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPObject")},"init");
 12if(_3){
 13objj_msgSend(_3,"_init");
 14_identifier=_5;
 15_width=40;
 16_minWidth=8;
 17_maxWidth=1000;
 18var _6=objj_msgSend(objj_msgSend(CPTextField,"alloc"),"initWithFrame:",CPRectMakeZero());
 19objj_msgSend(_6,"setValue:forThemeAttribute:inState:",objj_msgSend(CPColor,"whiteColor"),"text-color",CPThemeStateHighlighted);
 20objj_msgSend(_3,"setDataView:",_6);
 21_headerView=objj_msgSend(objj_msgSend(CPTextField,"alloc"),"initWithFrame:",CPRectMakeZero());
 22objj_msgSend(_headerView,"setBackgroundColor:",objj_msgSend(CPColor,"greenColor"));
 23}
 24return _3;
 25}
 26}),new objj_method(sel_getUid("_init"),function(_7,_8){
 27with(_7){
 28_dataViewData={};
 29_dataViewForView={};
 30_purgableInfosForDataView={};
 31}
 32}),new objj_method(sel_getUid("setIdentifier:"),function(_9,_a,_b){
 33with(_9){
 34_identifier=_b;
 35}
 36}),new objj_method(sel_getUid("identifier"),function(_c,_d){
 37with(_c){
 38return _identifier;
 39}
 40}),new objj_method(sel_getUid("setTableView:"),function(_e,_f,_10){
 41with(_e){
 42_tableView=_10;
 43}
 44}),new objj_method(sel_getUid("tableView"),function(_11,_12){
 45with(_11){
 46return _tableView;
 47}
 48}),new objj_method(sel_getUid("setWidth:"),function(_13,_14,_15){
 49with(_13){
 50_width=_15;
 51}
 52}),new objj_method(sel_getUid("width"),function(_16,_17){
 53with(_16){
 54return _width;
 55}
 56}),new objj_method(sel_getUid("setMinWidth:"),function(_18,_19,_1a){
 57with(_18){
 58if(_width<(_minWidth=_1a)){
 59objj_msgSend(_18,"setWidth:",_minWidth);
 60}
 61}
 62}),new objj_method(sel_getUid("minWidth"),function(_1b,_1c){
 63with(_1b){
 64return _minWidth;
 65}
 66}),new objj_method(sel_getUid("setMaxWidth:"),function(_1d,_1e,_1f){
 67with(_1d){
 68if(_width>(_maxmimumWidth=_1f)){
 69objj_msgSend(_1d,"setWidth:",_maxWidth);
 70}
 71}
 72}),new objj_method(sel_getUid("setResizingMask:"),function(_20,_21,_22){
 73with(_20){
 74_resizingMask=_22;
 75}
 76}),new objj_method(sel_getUid("resizingMask"),function(_23,_24){
 77with(_23){
 78return _resizingMask;
 79}
 80}),new objj_method(sel_getUid("sizeToFit"),function(_25,_26){
 81with(_25){
 82var _27=CPRectGetWidth(objj_msgSend(_headerView,"frame"));
 83if(_27<_minWidth){
 84objj_msgSend(_25,"setMinWidth:",_27);
 85}else{
 86if(_27>_maxWidth){
 87objj_msgSend(_25,"setMaxWidth:",_27);
 88}
 89}
 90if(_width!=_27){
 91objj_msgSend(_25,"setWidth:",_27);
 92}
 93}
 94}),new objj_method(sel_getUid("setEditable:"),function(_28,_29,_2a){
 95with(_28){
 96_isEditable=_2a;
 97}
 98}),new objj_method(sel_getUid("isEditable"),function(_2b,_2c){
 99with(_2b){
100return _isEditable;
101}
102}),new objj_method(sel_getUid("setHeaderView:"),function(_2d,_2e,_2f){
103with(_2d){
104_headerView=_2f;
105}
106}),new objj_method(sel_getUid("headerView"),function(_30,_31){
107with(_30){
108return _headerView;
109}
110}),new objj_method(sel_getUid("setDataCell:"),function(_32,_33,_34){
111with(_32){
112objj_msgSend(_32,"setDataView:",_34);
113}
114}),new objj_method(sel_getUid("setDataView:"),function(_35,_36,_37){
115with(_35){
116if(_dataView){
117_dataViewData[objj_msgSend(_dataView,"hash")]=nil;
118}
119_dataView=_37;
120_dataViewData[objj_msgSend(_37,"hash")]=objj_msgSend(CPKeyedArchiver,"archivedDataWithRootObject:",_37);
121}
122}),new objj_method(sel_getUid("dataCell"),function(_38,_39){
123with(_38){
124return _dataView;
125}
126}),new objj_method(sel_getUid("dataView"),function(_3a,_3b){
127with(_3a){
128return objj_msgSend(_3a,"dataCell");
129}
130}),new objj_method(sel_getUid("dataCellForRow:"),function(_3c,_3d,_3e){
131with(_3c){
132return objj_msgSend(_3c,"dataView");
133}
134}),new objj_method(sel_getUid("dataViewForRow:"),function(_3f,_40,_41){
135with(_3f){
136return objj_msgSend(_3f,"dataCellForRow:",_41);
137}
138}),new objj_method(sel_getUid("_markView:inRow:asPurgable:"),function(_42,_43,_44,_45,_46){
139with(_42){
140var _47=objj_msgSend(_44,"hash"),_48=objj_msgSend(_dataViewForView[_47],"hash");
141if(!_purgableInfosForDataView[_48]){
142if(!_46){
143return;
144}
145_purgableInfosForDataView[_48]={};
146}
147if(!_46){
148if(_purgableInfosForDataView[_48][_47]){
149CPLog.warn("removing unpurgable "+_purgableInfosForDataView[_48][_47]);
150}
151delete _purgableInfosForDataView[_48][_47];
152}else{
153_purgableInfosForDataView[_48][_47]={view:(_44),row:(_45)};
154}
155}
156}),new objj_method(sel_getUid("_newDataViewForRow:avoidingRows:"),function(_49,_4a,_4b,_4c){
157with(_49){
158var _4d=objj_msgSend(_49,"dataViewForRow:",_4b),_4e=objj_msgSend(_4d,"hash"),_4f=_purgableInfosForDataView[_4e];
159if(_4f){
160for(var key in _4f){
161var _51=_4f[key];
162delete _4f[key];
163return ((_51).view);
164}
165}
166if(!_dataViewData[_4e]){
167_dataViewData[_4e]=objj_msgSend(CPKeyedArchiver,"archivedDataWithRootObject:",_4d);
168}
169var _52=objj_msgSend(CPKeyedUnarchiver,"unarchiveObjectWithData:",_dataViewData[_4e]);
170_dataViewForView[objj_msgSend(_52,"hash")]=_4d;
171CPLog.warn("creating cell: %s",_52);
172return _52;
173}
174}),new objj_method(sel_getUid("_purge"),function(_53,_54){
175with(_53){
176for(var _55 in _purgableInfosForDataView){
177var _56=_purgableInfosForDataView[_55];
178for(var key in _56){
179var _58=((_56[key]).view);
180if(!_58){
181CPLog.info("key="+key+" view="+_58+" purgableInfos[key]="+_56[key]);
182}else{
183if(_58._superview){
184objj_msgSend(_58,"setHidden:",YES);
185}
186}
187}
188}
189}
190})]);
191var _59="CPTableColumnIdentifierKey",_5a="CPTableColumnHeaderViewKey",_5b="CPTableColumnDataViewKey",_5c="CPTableColumnWidthKey",_5d="CPTableColumnMinWidthKey",_5e="CPTableColumnMaxWidthKey",_5f="CPTableColumnResizingMaskKey";
192var _1=objj_getClass("CPTableColumn");
193if(!_1){
194objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPTableColumn\""));
195}
196var _2=_1.isa;
197class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_60,_61,_62){
198with(_60){
199objj_msgSend(_60,"_init");
200_identifier=objj_msgSend(_62,"decodeObjectForKey:",_59);
201objj_msgSend(_60,"setHeaderView:",objj_msgSend(_62,"decodeObjectForKey:",_5a));
202objj_msgSend(_60,"setDataView:",objj_msgSend(_62,"decodeObjectForKey:",_5b));
203_width=objj_msgSend(_62,"decodeFloatForKey:",_5c);
204_minWidth=objj_msgSend(_62,"decodeFloatForKey:",_5d);
205_maxWidth=objj_msgSend(_62,"decodeFloatForKey:",_5e);
206_resizingMask=objj_msgSend(_62,"decodeBoolForKey:",_5f);
207return _60;
208}
209}),new objj_method(sel_getUid("encodeWithCoder:"),function(_63,_64,_65){
210with(_63){
211objj_msgSend(_65,"encodeObject:forKey:",_identifier,_59);
212objj_msgSend(_65,"encodeObject:forKey:",_headerView,_5a);
213objj_msgSend(_65,"encodeObject:forKey:",_dataView,_5b);
214objj_msgSend(_65,"encodeObject:forKey:",_width,_5c);
215objj_msgSend(_65,"encodeObject:forKey:",_minWidth,_5d);
216objj_msgSend(_65,"encodeObject:forKey:",_maxWidth,_5e);
217objj_msgSend(_65,"encodeObject:forKey:",_resizingMask,_5f);
218}
219})]);