Projects >> zk >>146762acf635a7fa478f11abdacdd4cce83cf2c0

Chunk
Conflicting content
	public Integer getBegin(){
		return 0;
	}
<<<<<<< HEAD
	
	// default 1
	public Integer getStep() {
		return null;
	}
	// ZK-2552: for internal use only    
	// the old index is used to distinguish with other expression. 
	public int getCurrentIndex(Component comp, int oldIndex) {
		int result = -1;
		if (comp instanceof Listitem) {
			result = ((Listitem) comp).getIndex();
		} else if (comp instanceof Row) {
			result = ((Row) comp).getIndex();
		}  else if (comp instanceof Treeitem) {
			result = ((Treeitem) comp).getIndex();
		} else 
			result = comp.getParent().getChildren().indexOf(comp);
		return result;
	}
	public boolean isFirst() {
		return getCount() == 1;
	}
	public boolean isLast() {
		return (getIndex() + 1) == getEnd();
	}
	public Object getEach() {
		return getCurrent();
	}
	public int getCount() {
		return getIndex() + 1;
	}
=======
>>>>>>> 6fa166a579c3a0983097f8a795b253c47a99a417
}
Solution content
	public Integer getBegin(){
		return 0;
	}
	
	// default 1
	public Integer getStep() {
		return null;
	}
	// ZK-2552: for internal use only    
	// the old index is used to distinguish with other expression. 
	public int getCurrentIndex(Component comp, int oldIndex) {
		int result = -1;
		if (comp instanceof Listitem) {
			result = ((Listitem) comp).getIndex();
		} else if (comp instanceof Row) {
			result = ((Row) comp).getIndex();
		}  else if (comp instanceof Treeitem) {
			result = ((Treeitem) comp).getIndex();
		} else 
			result = comp.getParent().getChildren().indexOf(comp);
		return result;
	}
	public boolean isFirst() {
		return getCount() == 1;
	}
	public boolean isLast() {
		return (getIndex() + 1) == getEnd();
	}
	public Object getEach() {
		return getCurrent();
	}
	public int getCount() {
		return getIndex() + 1;
	}
}
File
AbstractForEachStatus.java
Developer's decision
Version 1
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
		} else {
			final Binder binder = BinderUtil.getBinder(comp, true);
			if (binder == null) return; //no binder
<<<<<<< HEAD
			// ZK-2552: use an expression instead of solid number to represent index
			final String expression;
			if (comp.getAttribute(IS_TEMPLATE_MODEL_ENABLED_ATTR) != null) {
				expression = BindELContext.getModelName(modelOwner) 
						+ "[self.getAttribute('" + CURRENT_INDEX_RESOLVER_ATTR + "').getCurrentIndex(self, "+ index+")]";
			} else {
				expression = BindELContext.getModelName(modelOwner)+"["+index+"]";
			}
=======
			final String expression = BindELContext.getModelName(modelOwner)+"["+index+"]";
>>>>>>> 6fa166a579c3a0983097f8a795b253c47a99a417
			//should not use binder.addReferenceBinding(comp, varnm, expression, null); here, it will mark comp bound.
			//it is safe that we set to comp attr here since the component is created by renderer/binder. 
			comp.setAttribute(varnm, new ReferenceBindingImpl(binder, comp, varnm, expression)); //reference
Solution content
		} else {
			final Binder binder = BinderUtil.getBinder(comp, true);
			if (binder == null) return; //no binder
			// ZK-2552: use an expression instead of solid number to represent index
			final String expression;
			if (comp.getAttribute(IS_TEMPLATE_MODEL_ENABLED_ATTR) != null) {
				expression = BindELContext.getModelName(modelOwner) 
						+ "[self.getAttribute('" + CURRENT_INDEX_RESOLVER_ATTR + "').getCurrentIndex(self, "+ index+")]";
			} else {
				expression = BindELContext.getModelName(modelOwner)+"["+index+"]";
			}
			//should not use binder.addReferenceBinding(comp, varnm, expression, null); here, it will mark comp bound.
			//it is safe that we set to comp attr here since the component is created by renderer/binder. 
			comp.setAttribute(varnm, new ReferenceBindingImpl(binder, comp, varnm, expression)); //reference
File
AbstractRenderer.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
		Object oldIter = owner.getAttribute(itervarnm);
		owner.setAttribute(varnm, data);
		owner.setAttribute(itervarnm, iterStatus);
<<<<<<< HEAD

		// For bug ZK-2552
		Component insertBefore = null;
		List cbrCompsList = (List) owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
		if (cbrCompsList != null) {
			int newIndex = 0;
			int steps = 0;
			for (Component[] cmps : cbrCompsList) {
				if (steps++ >= index)
					break;
				newIndex += cmps.length;
			}
			if (owner.getChildren().size() > newIndex) {
				insertBefore = owner.getChildren().get(newIndex);
			} 
		}
		final Component[] items = ShadowElementsCtrl.filterOutShadows(tm.create(owner, insertBefore, null, null));
		// ZK-2552: define own iterStatus since children inside template could be more than 1 for children binding
		final ForEachStatus bindChildIterStatus = new AbstractForEachStatus() { // provide iteration status in this context
			private static final long serialVersionUID = 1L;
			
			public int getIndex() {
				return index;
			}
			
			public Object getCurrent(){
				return data;
			}
			
			public Integer getEnd(){
				return size;
			}
			
			// the old index is used to distinguish with other expression. 
			public int getCurrentIndex(Component comp, int index) { 
				int result = -1;
				if (comp instanceof Listitem) {
					result = ((Listitem) comp).getIndex();
				} else if (comp instanceof Row) {
					result = ((Row) comp).getIndex();
				}  else if (comp instanceof Treeitem) {
					result = ((Treeitem) comp).getIndex();
				} else 
					result = comp.getParent().getChildren().indexOf(comp);
				
				result = result / items.length;
				return result;
			}
		};
=======
		
		final Component[] items = tm.create(owner, null, null, null);
>>>>>>> 6fa166a579c3a0983097f8a795b253c47a99a417
		
		owner.setAttribute(varnm, oldVar);
		owner.setAttribute(itervarnm, oldIter);
Solution content
		Object oldIter = owner.getAttribute(itervarnm);
		owner.setAttribute(varnm, data);
		owner.setAttribute(itervarnm, iterStatus);

		// For bug ZK-2552
		Component insertBefore = null;
		List cbrCompsList = (List) owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
		if (cbrCompsList != null) {
			int newIndex = 0;
			int steps = 0;
			for (Component[] cmps : cbrCompsList) {
				if (steps++ >= index)
					break;
				newIndex += cmps.length;
			}
			if (owner.getChildren().size() > newIndex) {
				insertBefore = owner.getChildren().get(newIndex);
			} 
		}
		final Component[] items = ShadowElementsCtrl.filterOutShadows(tm.create(owner, insertBefore, null, null));
		// ZK-2552: define own iterStatus since children inside template could be more than 1 for children binding
		final ForEachStatus bindChildIterStatus = new AbstractForEachStatus() { // provide iteration status in this context
			private static final long serialVersionUID = 1L;
			
			public int getIndex() {
				return index;
			}
			
			public Object getCurrent(){
				return data;
			}
			
			public Integer getEnd(){
				return size;
			}
			
			// the old index is used to distinguish with other expression. 
			public int getCurrentIndex(Component comp, int index) { 
				int result = -1;
				if (comp instanceof Listitem) {
					result = ((Listitem) comp).getIndex();
				} else if (comp instanceof Row) {
					result = ((Row) comp).getIndex();
				}  else if (comp instanceof Treeitem) {
					result = ((Treeitem) comp).getIndex();
				} else 
					result = comp.getParent().getChildren().indexOf(comp);
				
				result = result / items.length;
				return result;
			}
		};
		
		owner.setAttribute(varnm, oldVar);
		owner.setAttribute(itervarnm, oldIter);
File
BindChildRenderer.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Comment
If statement
Method invocation
Variable