com.alkacon.acacia.client.I_WidgetService Maven / Gradle / Ivy
Show all versions of acacia-editor-client Show documentation
/*
* This library is part of the Acacia Editor -
* an open source inline and form based content editor for GWT.
*
* Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)
*
* 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.
*
* For further information about Alkacon Software, please see the
* company website: http://www.alkacon.com
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.alkacon.acacia.client;
import com.alkacon.acacia.client.widgets.I_EditWidget;
import com.alkacon.acacia.client.widgets.I_FormEditWidget;
import com.alkacon.acacia.shared.AttributeConfiguration;
import com.alkacon.vie.shared.I_Type;
import java.util.Map;
import com.google.gwt.user.client.Element;
/**
* Provides widget renderer for entity attributes.
*/
public interface I_WidgetService {
/**
* Adds a renderer.
*
* @param renderer the renderer to add
*/
public void addRenderer(I_EntityRenderer renderer);
/**
* Adds all configurations.
*
* @param configurations the configurations to add
*/
void addConfigurations(Map configurations);
/**
* Registers the given widget factory with the service.
*
* @param widgetName the widget name
* @param widgetFactory the widget factory
*/
void addWidgetFactory(String widgetName, I_WidgetFactory widgetFactory);
/**
* Returns the attribute form editing widget.
*
* @param attributeName the attribute name
*
* @return the attribute widget
*/
I_FormEditWidget getAttributeFormWidget(String attributeName);
/**
* Returns the attribute help information.
*
* @param attributeName the attribute name
*
* @return the attribute help information
*/
String getAttributeHelp(String attributeName);
/**
* Returns the attribute inline editing widget wrapping the given DOM element.
*
* @param attributeName the attribute name
* @param element the DOM element to wrap
*
* @return the attribute widget
*/
I_EditWidget getAttributeInlineWidget(String attributeName, Element element);
/**
* Returns the label for the given attribute.
*
* @param attributeName the attribute name
*
* @return the attribute label
*/
String getAttributeLabel(String attributeName);
/**
* Returns the default attribute value.
*
* @param attributeName the attribute name
*
* @return the default value
*/
String getDefaultAttributeValue(String attributeName);
/**
* Returns the renderer for the given attribute.
*
* @param attributeName the name of the attribute
* @param attributeType the type of the attribute
*
* @return the renderer
*/
I_EntityRenderer getRendererForAttribute(String attributeName, I_Type attributeType);
/**
* Returns the renderer for the given entity type.
*
* @param entityType the type
*
* @return the renderer
*/
I_EntityRenderer getRendererForType(I_Type entityType);
/**
* Returns the if the attribute widget should be displayed in compact view.
*
* @param attributeName the attribute name
*
* @return true
if the attribute widget should be displayed in compact view
*/
boolean isDisplayCompact(String attributeName);
/**
* Returns if the attribute widget should be displayed in single line view.
*
* @param attributeName the attribute name
*
* @return true
if the attribute widget should be displayed in single line view
*/
boolean isDisplaySingleLine(String attributeName);
/**
* Registers a complex widget attribute which should be handled by a special renderer.
*
* @param attrName the attribute name
* @param renderer the renderer to register for the attribute
* @param configuration the renderer configuration
*/
void registerComplexWidgetAttribute(String attrName, String renderer, String configuration);
/**
* Sets the default renderer
*
* @param renderer the default renderer
*/
void setDefaultRenderer(I_EntityRenderer renderer);
/**
* Sets the widget factories.
*
* @param widgetFactories the widget factories
*/
void setWidgetFactories(Map widgetFactories);
/**
* Returns true if the value which this widget is being used for should be disabled if it is unfocused and the last remaining attribute value for a given attribute.
*
* The main use case is disabling empty text input fields.
*
* @param widget the widget to check
*
* @return true if the value should be disabled
*/
boolean shouldRemoveLastValueAfterUnfocus(I_EditWidget widget);
}