本文整理匯總了Java中org.appcelerator.kroll.KrollDict.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java KrollDict.keySet方法的具體用法?Java KrollDict.keySet怎麽用?Java KrollDict.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.appcelerator.kroll.KrollDict
的用法示例。
在下文中一共展示了KrollDict.keySet方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateOrMergeWithDefaultProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public void updateOrMergeWithDefaultProperties(KrollDict data, boolean update) {
for (String binding: data.keySet()) {
DataItem dataItem = dataItems.get(binding);
if (dataItem == null) continue;
KrollDict defaultProps = dataItem.getDefaultProperties();
KrollDict props = new KrollDict((HashMap)data.get(binding));
if (defaultProps != null) {
if (update) {
//update default properties
Set<String> existingKeys = defaultProps.keySet();
for (String key: props.keySet()) {
if (!existingKeys.contains(key)) {
defaultProps.put(key, null);
}
}
} else {
//merge default properties with new properties and update data
HashMap<String, Object> newData = ((HashMap<String, Object>)defaultProps.clone());
newData.putAll(props);
data.put(binding, newData);
}
}
}
}
示例2: generateDiffProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
* This method compares applied properties of a view and our data model to
* generate a new set of properties we need to set. It is crucial for scrolling performance.
* @param properties The properties from our data model
* @return The difference set of properties to set
*/
public KrollDict generateDiffProperties(KrollDict properties) {
diffProperties.clear();
for (String appliedProp : this.properties.keySet()) {
if (!properties.containsKey(appliedProp)) {
applyProperty(appliedProp, null);
}
}
for (String property : properties.keySet()) {
Object value = properties.get(property);
if (CollectionView.MUST_SET_PROPERTIES.contains(property)) {
applyProperty(property, value);
continue;
}
Object existingVal = this.properties.get(property);
if (existingVal == null || value == null || !existingVal.equals(value)) {
applyProperty(property, value);
}
}
return diffProperties;
}
示例3: processTemplates
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
protected void processTemplates(KrollDict templates) {
for (String key : templates.keySet()) {
//Here we bind each template with a key so we can use it to look up later
KrollDict properties = new KrollDict((HashMap)templates.get(key));
CollectionViewTemplate template = new CollectionViewTemplate(key, properties);
//Set type to template, for recycling purposes.
template.setType(getItemType());
templatesByBinding.put(key, template);
//set parent of root item
template.setRootParent(proxy);
}
}