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

org.eclipse.jface.widgets.AbstractCompositeFactory Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2019 Marcus Hoepfner and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Marcus Hoepfner - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.widgets;

import org.eclipse.pde.api.tools.annotations.NoExtend;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Layout;

/**
 * Abstract factory for composites. Factories for widgets that inherit from
 * Composite should extend this factory to handle the properties of Composite
 * itself, like layout.
 *
 * @param  factory
 * @param  control
 *
 * @since 3.18
 */
@NoExtend
public abstract class AbstractCompositeFactory, C extends Composite>
		extends AbstractControlFactory {

	protected AbstractCompositeFactory(Class factoryClass, WidgetSupplier controlCreator) {
		super(factoryClass, controlCreator);
	}

	/**
	 * Sets the layout which is associated with the receiver to be the argument
	 * which may be null.
	 *
	 * @param layout the receiver's layout or null
	 * @return this
	 *
	 * @see Composite#setLayout(Layout)
	 */
	public F layout(Layout layout) {
		addProperty(control -> control.setLayout(layout));
		return cast(this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy