org.opencms.acacia.client.I_CmsWidgetService Maven / Gradle / Ivy
Show all versions of opencms-gwt Show documentation
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (C) Alkacon Software (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
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* 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 org.opencms.acacia.client;
import org.opencms.acacia.client.widgets.I_CmsEditWidget;
import org.opencms.acacia.client.widgets.I_CmsFormEditWidget;
import org.opencms.acacia.shared.CmsAttributeConfiguration;
import org.opencms.acacia.shared.CmsType;
import java.util.Map;
import com.google.gwt.dom.client.Element;
/**
* Provides widget renderer for entity attributes.
*/
public interface I_CmsWidgetService {
/**
* Adds the given path to the list of paths where child attributes have change their order.
*
* @param attributePath the attribute path
*/
void addChangedOrderPath(String attributePath);
/**
* Adds all configurations.
*
* @param configurations the configurations to add
*/
void addConfigurations(Map configurations);
/**
* Adds a renderer.
*
* @param renderer the renderer to add
*/
void addRenderer(I_CmsEntityRenderer renderer);
/**
* Registers the given widget factory with the service.
*
* @param widgetName the widget name
* @param widgetFactory the widget factory
*/
void addWidgetFactory(String widgetName, I_CmsWidgetFactory widgetFactory);
/**
* Returns the attribute form editing widget.
*
* @param attributeName the attribute name
*
* @return the attribute widget
*/
I_CmsFormEditWidget 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_CmsEditWidget 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
* @param simpleValuePath the value path
*
* @return the default value
*/
String getDefaultAttributeValue(String attributeName, String simpleValuePath);
/**
* 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_CmsEntityRenderer getRendererForAttribute(String attributeName, CmsType attributeType);
/**
* Returns the renderer for the given entity type.
*
* @param entityType the type
*
* @return the renderer
*/
I_CmsEntityRenderer getRendererForType(CmsType 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);
/**
* Returns if the given attribute should be visible in the editor.
*
* @param attributeName the attribute name
*
* @return true
if the given attribute should be visible in the editor
*/
boolean isVisible(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_CmsEntityRenderer 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_CmsEditWidget widget);
}