-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIMOB-8838: <BlackBerry: Implement UI.TableView> #62
Changes from 2 commits
523d6f4
d54376e
241a2f2
3eebc12
3f09e1e
3ad9d52
604748e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ methods: | |
summary: Animation properties, only used on iOS. | ||
type: TableViewAnimationProperties | ||
optional: true | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: deleteRow | ||
summary: Deletes an existing row. | ||
|
@@ -53,6 +54,7 @@ methods: | |
summary: Animation properties. Only used on iOS. | ||
type: TableViewAnimationProperties | ||
optional: true | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: deselectRow | ||
summary: Programmatically deselects a row. | ||
|
@@ -82,6 +84,7 @@ methods: | |
summary: Animation properties. Only used on iOS. | ||
type: TableViewAnimationProperties | ||
optional: true | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: insertRowBefore | ||
summary: Inserts a row before another row. | ||
|
@@ -103,6 +106,7 @@ methods: | |
summary: Animation properties. Only used on iOS. | ||
type: TableViewAnimationProperties | ||
optional: true | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: scrollToIndex | ||
summary: Scrolls the table view to ensure that the specified row is on screen. | ||
|
@@ -150,6 +154,7 @@ methods: | |
summary: Animation properties. Only used on iOS. | ||
type: TableViewAnimationProperties | ||
optional: true | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: selectRow | ||
summary: Programmatically selects a row. | ||
|
@@ -187,10 +192,12 @@ methods: | |
- name: properties | ||
summary: Animation properties. Only used on iOS. | ||
type: TableViewAnimationProperties | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
events: | ||
- name: click | ||
summary: Fired when a table row is clicked by the user. | ||
platforms: [android, iphone, ipad, mobileweb] | ||
platforms: [android, iphone, ipad, mobileweb, blackberry] | ||
properties: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be blackberry, instead of 'backberry'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
- name: index | ||
summary: Row index. | ||
|
@@ -645,6 +652,7 @@ properties: | |
- name: footerTitle | ||
summary: Table view footer title. | ||
type: String | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: hideSearchOnSelection | ||
summary: Boolean to indicate whether or not the search field should hide on completion. | ||
|
@@ -663,14 +671,17 @@ properties: | |
- name: footerView | ||
summary: Table view footer as a view that will be rendered instead of a label. | ||
type: Titanium.UI.View | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: headerTitle | ||
summary: Table view header title. | ||
type: String | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: headerView | ||
summary: Table view header as a view that will be rendered instead of a label. | ||
type: Titanium.UI.View | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: index | ||
summary: Array of objects (with `title` and `index` properties) to control the table view index. | ||
|
@@ -684,10 +695,12 @@ properties: | |
- name: maxRowHeight | ||
summary: Maximum row height for table view rows. | ||
type: Number | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: minRowHeight | ||
summary: Minimum row height for table view rows. | ||
type: Number | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: moving | ||
summary: Boolean to control the moveable state of the table view. | ||
|
@@ -697,6 +710,7 @@ properties: | |
- name: rowHeight | ||
summary: Default row height for table view rows. | ||
type: Number | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: scrollable | ||
summary: If `true`, the tableview can be scrolled. | ||
|
@@ -719,6 +733,7 @@ properties: | |
summary: Separator color between rows, specified as a hex or named value. | ||
type: String | ||
default: platform-specific default color | ||
platforms: [android, iphone, ipad, mobileweb] | ||
|
||
- name: separatorStyle | ||
summary: Separator style constant. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,12 +121,36 @@ int NativeControlObject::setTop(TiObject* obj) | |
return NATIVE_ERROR_OK; | ||
} | ||
|
||
PROP_SETTER(setLeft) | ||
int NativeControlObject::setLeft(TiObject* obj) | ||
{ | ||
return NATIVE_ERROR_NOTSUPPORTED; | ||
} | ||
|
||
PROP_SETTER(setValue) | ||
int NativeControlObject::setValue(TiObject* obj) | ||
{ | ||
return NATIVE_ERROR_NOTSUPPORTED; | ||
} | ||
|
||
PROP_SETTER(setWidth) | ||
int NativeControlObject::setWidth(TiObject* obj) | ||
{ | ||
return NATIVE_ERROR_NOTSUPPORTED; | ||
} | ||
|
||
PROP_SETTER(setHeight) | ||
int NativeControlObject::setHeight(TiObject* obj) | ||
{ | ||
return NATIVE_ERROR_NOTSUPPORTED; | ||
} | ||
|
||
PROP_SETTER(setData) | ||
int NativeControlObject::setData(TiObject* obj) | ||
{ | ||
return NATIVE_ERROR_NOTSUPPORTED; | ||
} | ||
|
||
PROP_SETTER(setVisible) | ||
int NativeControlObject::setVisible(TiObject* obj) | ||
{ | ||
|
@@ -196,15 +220,15 @@ static vector<NATIVE_PROPSET_CALLBACK> initFunctionMap() | |
vect[N_PROP_ELLIPSIZE] = NULL; | ||
vect[N_PROP_FOCUSABLE] = NULL; | ||
vect[N_PROP_FONT] = NULL; | ||
vect[N_PROP_HEIGHT] = NULL; | ||
vect[N_PROP_HEIGHT] = PROP_SETTING_FUNCTION(setHeight); | ||
vect[N_PROP_HIGHLIGHTED_COLOR] = NULL; | ||
vect[N_PROP_HINT_TEXT] = NULL; | ||
vect[N_PROP_HTML] = NULL; | ||
vect[N_PROP_IMAGE] = PROP_SETTING_FUNCTION(setImage); | ||
vect[N_PROP_KEEP_SCREEN_ON] = NULL; | ||
vect[N_PROP_LABEL] = PROP_SETTING_FUNCTION(setLabel); | ||
vect[N_PROP_LAYOUT] = NULL; | ||
vect[N_PROP_LEFT] = NULL; | ||
vect[N_PROP_LEFT] = PROP_SETTING_FUNCTION(setLeft); | ||
vect[N_PROP_MAX] = PROP_SETTING_FUNCTION(setMax); | ||
vect[N_PROP_MIN] = PROP_SETTING_FUNCTION(setMin); | ||
vect[N_PROP_MINIMUM_FONT_SIZE] = NULL; | ||
|
@@ -225,9 +249,10 @@ static vector<NATIVE_PROPSET_CALLBACK> initFunctionMap() | |
vect[N_PROP_TRANSFORM] = NULL; | ||
vect[N_PROP_VALUE] = PROP_SETTING_FUNCTION(setValue); | ||
vect[N_PROP_VISIBLE] = PROP_SETTING_FUNCTION(setVisible); | ||
vect[N_PROP_WIDTH] = NULL; | ||
vect[N_PROP_WIDTH] = PROP_SETTING_FUNCTION(setWidth); | ||
vect[N_PROP_WORD_WRAP] = NULL; | ||
vect[N_PROP_ZINDEX] = NULL; | ||
vect[N_PROP_DATA] = PROP_SETTING_FUNCTION(setData); | ||
return vect; | ||
} | ||
|
||
|
@@ -337,3 +362,42 @@ int NativeControlObject::getStringArray(TiObject* obj, QVector<QString>& value) | |
} | ||
return NATIVE_ERROR_OK; | ||
} | ||
|
||
int NativeControlObject::getDictionaryData(TiObject* obj, multimap<QString, QString>& dictionary) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use a QMultiMap? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to QVector, because it needs to keep the order of elements |
||
{ | ||
Handle<Value> value = obj->getValue(); | ||
if (value.IsEmpty() || (!value->IsArray())) | ||
{ | ||
return NATIVE_ERROR_INVALID_ARG; | ||
} | ||
|
||
Handle<Array> array = Handle<Array>::Cast(value); | ||
uint32_t length = array->Length(); | ||
//traverse through the dictionary elements | ||
for (uint32_t i = 0; i < length; ++i) | ||
{ | ||
Local<Value> el = array->Get(i); | ||
if (el->IsObject()) | ||
{ | ||
Local<Array> propAr = el->ToObject()->GetPropertyNames(); | ||
uint32_t arLenght = propAr->Length(); | ||
for (uint32_t j = 0; j < arLenght; ++j) | ||
{ | ||
Handle<String> propString = Handle < String > ::Cast(propAr->Get(j)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove spaces in |
||
String::Utf8Value propNameUTF(propString); | ||
QString key = *propNameUTF; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the explicit fromUtf8 function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
Local<Value> propValue = el->ToObject()->Get(propString); | ||
Local<String> valueStr = propValue->ToString(); | ||
String::Utf8Value valueUTF(valueStr); | ||
QString val = *valueUTF; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
dictionary.insert(std::make_pair(key, val)); | ||
} | ||
} | ||
else | ||
{ | ||
//if the element of the dictionary is not object, it means dictionary contains invalid data | ||
return NATIVE_ERROR_INVALID_ARG; | ||
} | ||
} | ||
return NATIVE_ERROR_OK; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all the click event properties currently supported? If not the yml needs updating