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

com.anrisoftware.prefdialog.fields.textfield.TextFieldService Maven / Gradle / Ivy

/*
 * Copyright 2013-2015 Erwin Müller 
 *
 * This file is part of prefdialog-corefields.
 *
 * prefdialog-corefields is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * prefdialog-corefields is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with prefdialog-corefields. If not, see .
 */
package com.anrisoftware.prefdialog.fields.textfield;

import java.awt.Component;

import org.mangosdk.spi.ProviderFor;

import com.anrisoftware.prefdialog.annotations.TextField;
import com.anrisoftware.prefdialog.fields.FieldFactory;
import com.anrisoftware.prefdialog.fields.FieldInfo;
import com.anrisoftware.prefdialog.fields.FieldService;
import com.google.inject.Injector;

/**
 * Makes the text field available.
 * 
 * @author Erwin Mueller, [email protected]
 * @since 3.0
 */
@ProviderFor(FieldService.class)
public class TextFieldService implements FieldService {

	/**
	 * The field information.
	 */
	public static final FieldInfo INFO = new FieldInfo(TextField.class);

	@Override
	public FieldInfo getInfo() {
		return INFO;
	}

	@SuppressWarnings("unchecked")
	@Override
	public FieldFactory getFactory(Object... parent) {
		return createInjector((Injector) parent[0]).getInstance(
				FieldFactory.class);
	}

	private Injector createInjector(Injector parent) {
		return parent.createChildInjector(new TextFieldModule());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy