001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: DirectoryEntryOutputTag.java 26053 2007-10-16 01:45:43Z atchertchian $
020 */
021
022package org.nuxeo.ecm.platform.ui.web.directory;
023
024import javax.faces.application.Application;
025import javax.faces.component.UIComponent;
026import javax.faces.context.FacesContext;
027import javax.faces.el.ValueBinding;
028import javax.faces.webapp.UIComponentTag;
029
030/**
031 * Tag for directory entry component.
032 *
033 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
034 * @deprecated facelets do not use the tag class
035 */
036@Deprecated
037public class DirectoryEntryOutputTag extends UIComponentTag {
038
039    /**
040     * @deprecated standard value attribute should be used instead
041     */
042    @Deprecated
043    protected String entryId;
044
045    protected String directoryName;
046
047    protected Boolean displayIdAndLabel;
048
049    protected Boolean translate;
050
051    /**
052     * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
053     */
054    @Override
055    protected void setProperties(UIComponent component) {
056        super.setProperties(component);
057        component.getAttributes().put("displayIdAndLabel", displayIdAndLabel);
058        component.getAttributes().put("translate", translate);
059        FacesContext context = FacesContext.getCurrentInstance();
060        Application application = context.getApplication();
061        ValueBinding binding = application.createValueBinding(entryId);
062        component.setValueBinding("entryId", binding);
063        binding = application.createValueBinding(directoryName);
064        component.setValueBinding("directoryName", binding);
065    }
066
067    /**
068     * @see javax.faces.webapp.UIComponentTag#getComponentType()
069     */
070    @Override
071    public String getComponentType() {
072        return "nxdirectory.DirectoryEntryOutput";
073    }
074
075    /**
076     * @see javax.faces.webapp.UIComponentTag#getRendererType()
077     */
078    @Override
079    public String getRendererType() {
080        return null;
081    }
082
083    public String getDirectoryName() {
084        return directoryName;
085    }
086
087    public void setDirectoryName(String directoryName) {
088        this.directoryName = directoryName;
089    }
090
091    public Boolean getDisplayIdAndLabel() {
092        return displayIdAndLabel;
093    }
094
095    public void setDisplayIdAndLabel(Boolean displayIdAndLabel) {
096        this.displayIdAndLabel = displayIdAndLabel;
097    }
098
099    public Boolean getTranslate() {
100        return translate;
101    }
102
103    public void setTranslate(Boolean translate) {
104        this.translate = translate;
105    }
106
107}