/*
 * Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
 *
 * 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.
 *
 * 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 com.arsdigita.cms.ui.authoring;

import com.arsdigita.bebop.PageState;


import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Component;

import org.libreccm.l10n.LocalizedString;

// Renders strings as labels
public class TextAssetBodyLabelCellRenderer implements TableCellRenderer {

    @Override
    public Component getComponent(final Table table, 
                                  final PageState state, 
                                  final Object value,
                                  final boolean isSelected, 
                                  final Object key,
                                  final int row, 
                                  final int column) {
        
        throw new UnsupportedOperationException("ToDo");
        
//        final Label label;
//        if ("content".equals(key) && value instanceof LocalizedString) {
//            // We have different styles for different mime types
//            final LocalizedString asset = (LocalizedString )value;
//            label = new Label(asset.getText());
//            label.setIdAttr("webPage");
//            String type = asset.getMimeType().getMimeType()
//                .toLowerCase();
//            if (type.indexOf("text/xml") > -1 || 
//                type.indexOf("text/xsl") > -1 ||
//                type.indexOf("text/x-jsp") > -1) {
//                label.setClassAttr("preformatted");
//                label.setOutputEscaping(true);
//            } else {
//                label.setOutputEscaping(false);
//            }
//        } else if (MIME_TYPE_KEY.equals(key) && value instanceof TextAsset) {
//            label = new Label(((TextAsset)value).getMimeType().getLabel(),
//                              false);
//        } else {
//            label = new Label(value.toString());
//            label.setOutputEscaping(false);
//        }
//
//        return label;
    }
}
