001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 016 * 017 * $Id: LayoutTagLibrary.java 28493 2008-01-04 19:51:30Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.forms.layout.facelets.library; 021 022import java.util.List; 023 024import org.apache.commons.logging.Log; 025import org.apache.commons.logging.LogFactory; 026import org.nuxeo.ecm.platform.forms.layout.api.FieldDefinition; 027import org.nuxeo.ecm.platform.forms.layout.api.Layout; 028import org.nuxeo.ecm.platform.forms.layout.api.LayoutRow; 029import org.nuxeo.ecm.platform.forms.layout.api.WidgetTypeDefinition; 030import org.nuxeo.ecm.platform.forms.layout.functions.LayoutFunctions; 031import org.nuxeo.ecm.platform.forms.layout.service.WebLayoutManager; 032import org.nuxeo.ecm.platform.ui.web.tag.fn.Functions; 033import org.nuxeo.runtime.api.Framework; 034 035/** 036 * Layout tag library. 037 * <p> 038 * Since 7.4, only holds JSF functions for the nxl tag library. 039 * 040 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 041 */ 042public class LayoutTagLibrary { 043 044 private static final Log log = LogFactory.getLog(LayoutTagLibrary.class); 045 046 // JSF functions 047 048 public static WidgetTypeDefinition getWidgetTypeDefinition(String typeName) { 049 WebLayoutManager layoutService = Framework.getService(WebLayoutManager.class); 050 return layoutService.getWidgetTypeDefinition(typeName); 051 } 052 053 /** 054 * Returns a String representing each of the field definitions property name, separated by a space. 055 */ 056 public static String getFieldDefinitionsAsString(FieldDefinition[] defs) { 057 return LayoutFunctions.getFieldDefinitionsAsString(defs); 058 } 059 060 public static List<LayoutRow> getSelectedRows(Layout layout, List<String> selectedRowNames, 061 boolean showAlwaysSelected) { 062 return LayoutFunctions.getSelectedRows(layout, selectedRowNames, showAlwaysSelected); 063 } 064 065 public static List<LayoutRow> getNotSelectedRows(Layout layout, List<String> selectedRowNames) { 066 return LayoutFunctions.getNotSelectedRows(layout, selectedRowNames); 067 } 068 069 public static List<String> getDefaultSelectedRowNames(Layout layout, boolean showAlwaysSelected) { 070 return LayoutFunctions.getDefaultSelectedRowNames(layout, showAlwaysSelected); 071 } 072 073 /** 074 * Joins two strings to get a valid reRender attribute for ajax components. 075 * 076 * @since 5.7 077 * @deprecated since 6.0: use {@link #joinRender(String, String)} instead. 078 */ 079 @Deprecated 080 public static String joinReRender(String render1, String render2) { 081 log.warn("Method nxl:joinReRender is deprecated, use nxu:joinRender instead"); 082 return Functions.joinRender(render1, render2); 083 } 084 085}