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 * dragos 016 * 017 * $Id$ 018 */ 019 020package org.nuxeo.ecm.platform.rendering.impl; 021 022import java.util.HashMap; 023 024import org.nuxeo.ecm.platform.rendering.RenderingContext; 025import org.nuxeo.ecm.platform.rendering.RenderingEngine; 026 027/** 028 * Abstract RenderingContext subclass that adds capabilities of storing a DocumentModel and retrieve RenderingConfig 029 * associated with the current set DocumentModel. 030 * 031 * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a> 032 */ 033public class DefaultRenderingContext extends HashMap<String, Object> implements RenderingContext { 034 035 private static final long serialVersionUID = -5442029141468819238L; 036 037 public <T> T getAdapter(Class<T> adapter) { 038 if (adapter.isAssignableFrom(getClass())) { 039 return adapter.cast(this); 040 } 041 return null; 042 } 043 044 public boolean accept(RenderingEngine engine) { 045 return true; 046 } 047 048}