001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.internal.services;
014
015import org.apache.tapestry5.Field;
016import org.apache.tapestry5.corelib.data.InsertPosition;
017import org.apache.tapestry5.http.Link;
018import org.apache.tapestry5.services.ClientBehaviorSupport;
019
020public class ClientBehaviorSupportImpl implements ClientBehaviorSupport
021{
022    private void unsupported(String name, String message)
023    {
024        throw new UnsupportedOperationException(String.format("ClientBehaviorSupport.%s is not longer supported. %s",
025                name, message));
026    }
027
028    public void addZone(String clientId, String showFunctionName, String updateFunctionName)
029    {
030        unsupported("addZone", "Use the data-container-type attribute set to 'zone'.");
031    }
032
033    public void linkZone(String linkId, String elementId, Link eventLink)
034    {
035        unsupported("linkZone", "Use the data-update-zone attribute on the triggering element, instead.");
036    }
037
038    public void addFormFragment(String clientId, String showFunctionName, String hideFunctionName)
039    {
040        addFormFragment(clientId, false, showFunctionName, hideFunctionName, null);
041    }
042
043    public void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName, String hideFunctionName)
044    {
045        addFormFragment(clientId, false, showFunctionName, hideFunctionName, null);
046    }
047
048    public void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName, String hideFunctionName, String visibilityBoundFunctionName)
049    {
050        unsupported("addFormFragment", "Use the core/form-fragment module instead.");
051    }
052
053    public void addFormInjector(String clientId, Link link, InsertPosition insertPosition, String showFunctionName)
054    {
055        unsupported("addFormInjector", "FormInjector compnent was removed in 5.4.");
056    }
057
058    public void addValidation(Field field, String validationName, String message, Object constraint)
059    {
060        unsupported("addFormInjector", "Encode client field validation as attributes and document-level event handlers. See the core/validation module.");
061    }
062}