當前位置: 首頁>>代碼示例>>Java>>正文


Java KrollDict.keySet方法代碼示例

本文整理匯總了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);
			}
		}
	}

}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:27,代碼來源:CollectionViewTemplate.java

示例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;
	
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:31,代碼來源:ViewItem.java

示例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);
	}
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:13,代碼來源:CollectionView.java


注:本文中的org.appcelerator.kroll.KrollDict.keySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。