/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library 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 2.1 of the License, or (at your option) * any later version. * * This library 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 Lesser General Public License for more * details. */ package com.liferay.taglib.aui; import com.liferay.portal.kernel.servlet.taglib.aui.ValidatorTag; import com.liferay.taglib.aui.base.BaseFormTag; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.portlet.PortletURL; import javax.servlet.http.HttpServletRequest; /** * @author Julio Camarero * @author Jorge Ferrer * @author Brian Wing Shun Chan */ public class FormTag extends BaseFormTag { @Override public String getAction() { return super.getAction(); } public void setAction(PortletURL portletURL) { if (portletURL != null) { setAction(portletURL.toString()); } } @Override protected void cleanUp() { super.cleanUp(); _checkboxNames.clear(); if (_validatorTagsMap != null) { for (List<ValidatorTag> validatorTags : _validatorTagsMap.values()) { for (ValidatorTag validatorTag : validatorTags) { validatorTag.cleanUp(); } } _validatorTagsMap.clear(); } } @Override protected boolean isCleanUpSetAttributes() { return _CLEAN_UP_SET_ATTRIBUTES; } @Override protected void setAttributes(HttpServletRequest request) { super.setAttributes(request); request.setAttribute("aui:form:validatorTagsMap", _validatorTagsMap); request.setAttribute( "LIFERAY_SHARED_aui:form:checkboxNames", _checkboxNames); } private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true; private final List<String> _checkboxNames = new ArrayList<>(); private final Map<String, List<ValidatorTag>> _validatorTagsMap = new HashMap<>(); }