/*
* Copyright 2004, 2005, 2006 Odysseus Software GmbH
*
* 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 de.odysseus.calyxo.forms.taglib.html;
import javax.servlet.http.HttpServletRequest;
import de.odysseus.calyxo.forms.view.FormContext;
import de.odysseus.calyxo.forms.view.FormComponentStyles;
/**
*
* @author Christoph Beck
*/
public class FormTag extends de.odysseus.calyxo.base.taglib.html.FormTag implements FormComponentStyles {
private String assertClass;
private String assertStyle;
private String errorClass;
private String errorStyle;
private boolean create;
/**
* Create and store form input context.
*/
public void init() throws Exception {
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
FormContext context = new FormContext(request, getAction(), this, create);
pageContext.getRequest().setAttribute(FormInputTag.FORM_CONTEXT_KEY, context);
}
/**
* Reset attributes and remove form input context
*/
protected void reset() {
super.reset();
assertClass = null;
assertStyle = null;
errorClass = null;
errorStyle = null;
create = false;
pageContext.getRequest().removeAttribute(FormInputTag.FORM_CONTEXT_KEY);
}
/**
* Get create property
*/
public final boolean isCreate() {
return create;
}
/**
* Set create property
*/
public final void setCreate(boolean value) {
create = value;
}
/**
* Get the assertClass attribute
*/
public final String getAssertClass() {
return assertClass;
}
/**
* Set the assertClass attribute
*/
public final void setAssertClass(String string) {
assertClass = string;
}
/**
* Get the assertStyle attribute
*/
public final String getAssertStyle() {
return assertStyle;
}
/**
* Set the assertStyle attribute
*/
public final void setAssertStyle(String string) {
assertStyle = string;
}
/**
* Get the errorClass attribute
*/
public final String getErrorClass() {
return errorClass;
}
/**
* Set the errorClass attribute
*/
public final void setErrorClass(String string) {
errorClass = string;
}
/**
* Get the errorStyle attribute
*/
public final String getErrorStyle() {
return errorStyle;
}
/**
* Set the errorStyle attribute
*/
public final void setErrorStyle(String string) {
errorStyle = string;
}
}