net.sf.jguiraffe.gui.builder.components.DefaultFieldHandlerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jguiraffe Show documentation
Show all versions of jguiraffe Show documentation
Java GUI Resource and Application Framework with Form Extensions
/*
* Copyright 2006-2010 The JGUIraffe Team.
*
* 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 net.sf.jguiraffe.gui.builder.components;
import net.sf.jguiraffe.gui.forms.ComponentHandler;
import net.sf.jguiraffe.gui.forms.DefaultFieldHandler;
import net.sf.jguiraffe.gui.forms.FieldHandler;
import net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag;
/**
*
* A default implementation of the FieldHandlerFactory
interface.
*
*
* This implementation creates objects of class
* {@link net.sf.jguiraffe.gui.forms.DefaultFieldHandler DefaultFieldHandler}
.
* All information needed to initialize such an object are obtained from the
* passed in input component tag.
*
*
* @author Oliver Heger
* @version $Id: DefaultFieldHandlerFactory.java 192 2010-08-22 16:15:22Z oheger $
*/
public class DefaultFieldHandlerFactory implements FieldHandlerFactory
{
/**
* Creates a new field handler object for the specified input component tag.
*
* @param tag the component tag
* @param componentHandler the component handler
* @return the new field handler object
* @throws FormBuilderException if an error occurs
*/
public FieldHandler createFieldHandler(InputComponentTag tag,
ComponentHandler> componentHandler) throws FormBuilderException
{
DefaultFieldHandler fh = new DefaultFieldHandler();
fh.setComponentHandler(componentHandler);
fh.setSyntaxValidator(tag.getFieldValidator());
fh.setLogicValidator(tag.getFormValidator());
fh.setPropertyName(tag.getPropertyName());
fh.setReadTransformer(tag.getReadTransformer());
fh.setWriteTransformer(tag.getWriteTransformer());
fh.setType(tag.getComponentType());
fh.setDisplayName(tag.getDisplayName());
return fh;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy