Subversion Repository Public Repository

Nextrek

1
{"uid":"9D54BA537A327347E78B16B10A68DF90B6D1","isLoaded":true,"lastModificationTime":0,"items":{"name":"EXSliderItemView","type":"objj_script","parentId":"84C8F4136E0EB146F3983E3707A0FBE49FBF","order":0,"content":"e3ZhciB0aGVfY2xhc3MgPSBvYmpqX2FsbG9jYXRlQ2xhc3NQYWlyKEdTT0l0ZW1WaWV3LCAiRVhTbGlkZXJJdGVtVmlldyIpLAptZXRhX2NsYXNzID0gdGhlX2NsYXNzLmlzYTtjbGFzc19hZGRJdmFycyh0aGVfY2xhc3MsIFtuZXcgb2Jqal9pdmFyKCJfc2xpZGVyIiksIG5ldyBvYmpqX2l2YXIoIl9vcmllbnRhdGlvbiIpXSk7b2Jqal9yZWdpc3RlckNsYXNzUGFpcih0aGVfY2xhc3MpOwpjbGFzc19hZGRNZXRob2RzKHRoZV9jbGFzcywgW25ldyBvYmpqX21ldGhvZChzZWxfZ2V0VWlkKCJpbml0V2l0aEZyYW1lOml0ZW1EZXNjcmlwdG9yOiIpLCBmdW5jdGlvbihzZWxmLCBfY21kLCBhRnJhbWUsIGFuSXRlbURlc2NyaXB0b3IpCnsKICAgIHNlbGYgPSBvYmpqX21zZ1NlbmRTdXBlcjIoeyByZWNlaXZlcjpzZWxmLCBzdXBlcl9jbGFzczpvYmpqX2dldENsYXNzKCJFWFNsaWRlckl0ZW1WaWV3Iikuc3VwZXJfY2xhc3MgfSwgImluaXRXaXRoRnJhbWU6aXRlbURlc2NyaXB0b3I6IiwgYUZyYW1lLCBhbkl0ZW1EZXNjcmlwdG9yKTsKICAgIGlmIChzZWxmKQogICAgewogICAgICAgIHNlbGYuX3NsaWRlciA9ICgoX19fcjEgPSBDUFNsaWRlci5pc2Eub2Jqal9tc2dTZW5kMChDUFNsaWRlciwgImFsbG9jIikpLCBfX19yMSA9PSBudWxsID8gbnVsbCA6IF9fX3IxLmlzYS5vYmpqX21zZ1NlbmQxKF9fX3IxLCAiaW5pdFdpdGhGcmFtZ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JpZW50YXRpb24gPT0gR1NPcmllbnRhdGlvbkhvcml6b250YWwpCiAgICB7CiAgICAgICAgKChfX19yMSA9IHNlbGYuX3NsaWRlciksIF9fX3IxID09IG51bGwgPyBudWxsIDogX19fcjEuaXNhLm9iampfbXNnU2VuZDEoX19fcjEsICJzZXRGcmFtZToiLCBDR1JlY3RNYWtlKDAsIDAsIHNpemUud2lkdGgsIDI1KSkpOwogICAgfQogICAgZWxzZQogICAgewogICAgICAgICgoX19fcjEgPSBzZWxmLl9zbGlkZXIpLCBfX19yMSA9PSBudWxsID8gbnVsbCA6IF9fX3IxLmlzYS5vYmpqX21zZ1NlbmQxKF9fX3IxLCAic2V0RnJhbWU6IiwgQ0dSZWN0TWFrZSgwLCAwLCAyNSwgc2l6ZS5oZWlnaHQpKSk7CiAgICB9CiAgICB2YXIgX19fcjE7Cn0KKV0pOwp9R1NPSXRlbVZpZXdGYWN0b3J5LmlzYS5vYmpqX21zZ1NlbmQyKEdTT0l0ZW1WaWV3RmFjdG9yeSwgInJlZ2lzdGVySXRlbVZpZXc6Zm9yVHlwZU5hbWU6IiwgRVhTbGlkZXJJdGVtVmlldywgIkVYU2xpZGVyIik7Cg==","rawContent":"/*\n*\tEXSliderItemView\n*\n*\tHINT: This custom control is just an example to show how a custom control can be implemented. It is \n*   not used by any of the default UI views. To use sliders, GSSlider type is already available. You can delete this file anytime.\n*/\n\n@implementation EXSliderItemView : GSOItemView\n{\n\tCPSlider _slider;\n\tint _orientation;\n}\n\n/**\n* Initializes the slider from the specified slider item descriptor.\n*\n* @param aFrame - Not used. Always CGRectMakeZero().\n* @param anItemDescriptor - The item descriptor.\n* @return self.\n*/\n- (id)initWithFrame:(CGRect)aFrame itemDescriptor:(id)anItemDescriptor\n{\n    // Call the super constructor to initialize the base\n\tself = [super initWithFrame:aFrame itemDescriptor:anItemDescriptor];\n\n\tif(self)\n\t{\n\t    // Create a new CPSlider control which is part of the Cappuccino-Framework.\n\t\t_slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()];\n\t\t// Set the minimum and maximum value of the slider.\n\t\t[_slider setMinValue:_itemDescriptor.minimum || 0];\n\t\t[_slider setMaxValue:_itemDescriptor.maximum || 100];\n\t\t// Set a default value. If not provided, use the minimum value. If that is not provided too, put 0.\n\t\t[_slider setIntValue:!(GSIsNull(_itemDescriptor.defaultValue) ? _itemDescriptor.defaultValue : (_itemDescriptor.minimum || 0))];\n\t\t// Set outselve as target for the valueDidChange action triggered whenever the value of the slider has changed.\n\t\t[_slider setTarget:self];\n\t\t[_slider setAction:@selector(valueDidChange:)];\n\n        // Store the orientation of the slider to access it later in layout calculations\n\t\t_orientation = _itemDescriptor.orientation || \"horizontal\";\n\n        // Add the slider control to our item-view.\n\t\t[self addSubview:_slider];\n\t}\n\n\treturn self;\n}\n\n/**\n* Binding receiver. This method is called if there is a binding between or slider and\n* another UI controls via \"bindings\"-property. If our slider supports the target-field of the binding, we set it\n* to the sent value.\n*\n* @param aSender - Not used. Always CGRectMakeZero().\n* @param anAttribute - The item descriptor.\n* @param aBinding - The item descriptor.\n* @return self.\n*/\n- (void)attributeDidChange:(id)aSender attribute:(id)anAttribute binding:(id)aBinding\n{\n    // We only support \"value\" as target\n\tif(aBinding.target == \"value\")\n\t{\n\t    // Set the slider's value to the sent value.\n\t\t[_slider setIntValue:anAttribute.value || 0];\n\t}\n}\n\n/**\n* Called whenever the value of the CPSlider control has changed. Here we\n* write the slider's number value into the backend-field and also notify\n* possible delegates and bindings.\n*\n* @param aSender - The sender of this action which is the CPSlider control.\n*/\n- (void)valueDidChange:(id)aSender\n{\n    // Notify all bindings that our value has changed\n\t[self attributeChange:{ name: \"value\", value: [_slider intValue]}];\n\t// Notify all delegates that our value has changed\n\t[self notifyDelegates:[_slider intValue]];\n\t// Write the slider's value into the backend field.\n\t[self write];\n}\n\n/**\n* We have to implement this method to control how the slider's value is written\n* into the backend field. If the JSON item descriptor has no \"attribute\" property specified,\n* this method is not called.\n*\n* @param anObject - The backend object\n*/\n- (void)writeToObject:(id)anObject\n{\n    // Get the attribute/field name\n\tvar attribute = _itemDescriptor.attribute;\n\n    // Set the attribute/field of the backend object to the slider's current value\n\t[self setAttribute:attribute ofObject:anObject toValue:[_slider intValue]];\n}\n\n/**\n* We have to implement this method to control how the slider's value is read\n* from the backend field and passed to the CPSlider ui control. If the JSON item descriptor has \n* no \"attribute\" property specified, this method is not called.\n*\n* @param anObject - The backend object\n*/\n- (void)readFromObject:(id)anObject\n{\n    // Get the attribute/field name\n\tvar attribute = _itemDescriptor.attribute;\n\t// Variable to store backend value\n\tvar value = nil;\n    // Read the value of the attribute/field from the backend object\n\tvalue = [self attribute:attribute ofObject:anObject];\n\n    // Set the value of the CPSlider ui control to the read value from the backend object. If that value\n    // is nil/null, we use the default value instead. If that value is not present, we use the slider's default minimum value.\n\t[_slider setIntValue:value != nil ? value : (!GSIsNull(_itemDescriptor.defaultValue) ? _itemDescriptor.defaultValue : [_slider minValue])];\n\n}\n\n/**\n* We have to implement this method to size our item-view so that it fits it's content.\n*/\n- (void)sizeToFit\n{\n    // Get the slider UI control frame-size\n\tvar size = [_slider frameSize];\n\n    // Check if we have a horizontal or vertical slider\n\tif(_orientation == GSOrientationHorizontal)\n\t{\n\t    // Resize the item-view's frame so that the slider fits in.\n\t\t[self setFrameSize:CGSizeMake(size.width, 25)];\n\t}\n\telse\n\t{\n\t    // Resize the item-view's frame so that the slider fits in.\n\t\t[self setFrameSize:CGSizeMake(25, size.height)];\n\t}\n}\n\n/**\n* We have to implement this method to layout/position the content of our item-view\n* correctly. In this example, the \"content\" is just the CPSlider ui control.\n*/\n- (void)layoutSubviews\n{\n    // Get the frame-size of our item-view\n\tvar size = [self frameSize];\n\n    // Check the orientation\n\tif(_orientation == GSOrientationHorizontal)\n\t{\n\t    // Resize the slider so that it matches our item-view's size.\n\t\t[_slider setFrame:CGRectMake(0, 0, size.width, 25)];\n\t}\n\telse\n\t{\n\t    // Resize the slider so that it matches our item-view's size.\n\t\t[_slider setFrame:CGRectMake(0, 0, 25, size.height)];\n\t}\n}\n@end\n\n// Registers the custom control. This is necessary to make our custom control accessible\n// in JSON.\n[GSOItemViewFactory registerItemView:EXSliderItemView forTypeName:@\"EXSlider\"];\n"},"summary":["name","type"]}

Commits for Nextrek/s2s/data/9D54BA537A327347E78B16B10A68DF90B6D1.json

Diff revisions: vs.
Revision Author Commited Message
1084 MOliva picture MOliva Fri 11 May, 2018 12:41:55 +0000