All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dragome.forms.bindings.builders.helpers.RepeaterBuilderHelper Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2011-2014 Fernando Petrola
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dragome.forms.bindings.builders.helpers;

import com.dragome.forms.bindings.builders.ComponentBuilder;
import com.dragome.forms.bindings.builders.Getter;
import com.dragome.forms.bindings.builders.ItemRepeater;
import com.dragome.forms.bindings.builders.Order;
import com.dragome.forms.bindings.builders.RepeaterBuilder;
import com.dragome.forms.bindings.builders.Supplier;
import com.dragome.forms.bindings.builders.Tester;

public class RepeaterBuilderHelper
{
	private RepeaterBuilder repeaterBuilder;

	public RepeaterBuilderHelper(RepeaterBuilder repeaterBuilder)
	{
		this.repeaterBuilder= repeaterBuilder;
	}

	public RepeaterBuilderHelper repeat(final ItemRepeaterHelper itemRepeater)
	{
		repeaterBuilder.repeat(new ItemRepeater()
		{
			public void process(T item, ComponentBuilder componentBuilder)
			{
				ComponentBuilder lastComponentBuilder= BinderHelper.componentBuilder;
				BinderHelper.componentBuilder= componentBuilder;
				itemRepeater.process(item);
				BinderHelper.componentBuilder= lastComponentBuilder;
			}
		});
		return this;
	}

	public RepeaterBuilderHelper filter(Supplier> aFilter)
	{
		repeaterBuilder.filter(aFilter);
		return this;
	}

	public RepeaterBuilderHelper orderBy(Getter> getter, Supplier order)
	{
		repeaterBuilder.orderBy(getter, order);
		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy