001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Jean-Marc Orliaguet, Chalmers 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.theme.jsf.component; 016 017import java.io.IOException; 018import java.util.HashMap; 019import java.util.Map; 020 021import javax.faces.component.UIOutput; 022import javax.faces.context.FacesContext; 023import javax.faces.context.ResponseWriter; 024 025import org.nuxeo.theme.html.ui.Panel; 026 027public class UIPanel extends UIOutput { 028 029 private String identifier; 030 031 private String url; 032 033 private String loading; 034 035 private String stylesheet; 036 037 private String javascript; 038 039 private String subviews; 040 041 private String visibleInPerspectives; 042 043 private String controlledBy; 044 045 private String filter; 046 047 @Override 048 public void encodeAll(final FacesContext context) throws IOException { 049 final ResponseWriter writer = context.getResponseWriter(); 050 Map<String, String> params = new HashMap<String, String>(); 051 String applicationPath = context.getExternalContext().getRequestParameterMap().get( 052 "org.nuxeo.theme.application.path"); 053 if (applicationPath == null) { 054 applicationPath = context.getExternalContext().getRequestContextPath(); 055 } 056 params.put("org.nuxeo.theme.application.path", applicationPath); 057 params.put("org.nuxeo.theme.application.name", ""); 058 Map<String, Object> attributes = getAttributes(); 059 params.put("identifier", (String) attributes.get("identifier")); 060 params.put("url", (String) attributes.get("url")); 061 params.put("loading", (String) attributes.get("loading")); 062 params.put("stylesheet", (String) attributes.get("stylesheet")); 063 params.put("javascript", (String) attributes.get("javascript")); 064 params.put("subviews", (String) attributes.get("subviews")); 065 params.put("visibleInPerspectives", (String) attributes.get("visibleInPerspectives")); 066 params.put("controlledBy", (String) attributes.get("controlledBy")); 067 params.put("filter", (String) attributes.get("filter")); 068 writer.write(Panel.render(params)); 069 } 070 071 public String getControlledBy() { 072 return controlledBy; 073 } 074 075 public void setControlledBy(final String controlledBy) { 076 this.controlledBy = controlledBy; 077 } 078 079 public String getIdentifier() { 080 return identifier; 081 } 082 083 public void setIdentifier(final String identifier) { 084 this.identifier = identifier; 085 } 086 087 public String getJavascript() { 088 return javascript; 089 } 090 091 public void setJavascript(final String javascript) { 092 this.javascript = javascript; 093 } 094 095 public String getStylesheet() { 096 return stylesheet; 097 } 098 099 public void setStylesheet(final String stylesheet) { 100 this.stylesheet = stylesheet; 101 } 102 103 public String getSubviews() { 104 return subviews; 105 } 106 107 public void setSubviews(final String subviews) { 108 this.subviews = subviews; 109 } 110 111 public String getUrl() { 112 return url; 113 } 114 115 public void setUrl(final String url) { 116 this.url = url; 117 } 118 119 public String getVisibleInPerspectives() { 120 return visibleInPerspectives; 121 } 122 123 public void setVisibleInPerspectives(final String visibleInPerspectives) { 124 this.visibleInPerspectives = visibleInPerspectives; 125 } 126 127 public String getLoading() { 128 return loading; 129 } 130 131 public void setLoading(String loading) { 132 this.loading = loading; 133 } 134 135 public String getFilter() { 136 return filter; 137 } 138 139 public void setFilter(String filter) { 140 this.filter = filter; 141 } 142 143}