001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ade.galleries.client.ui;
029
030import org.opencms.ade.galleries.client.Messages;
031import org.opencms.ade.galleries.shared.CmsResultItemBean;
032
033import com.google.gwt.core.client.GWT;
034import com.google.gwt.dom.client.SpanElement;
035import com.google.gwt.dom.client.TableCellElement;
036import com.google.gwt.uibinder.client.UiBinder;
037import com.google.gwt.uibinder.client.UiField;
038import com.google.gwt.user.client.ui.Composite;
039import com.google.gwt.user.client.ui.HTMLPanel;
040
041/**
042 * Image info element.<p>
043 */
044public class CmsImageInfo extends Composite {
045
046    /** The ui-binder interface. */
047    interface I_CmsImageInfoUiBinder extends UiBinder<HTMLPanel, CmsImageInfo> {
048        // nothing to do
049    }
050
051    /** The ui-binder instance. */
052    private static I_CmsImageInfoUiBinder uiBinder = GWT.create(I_CmsImageInfoUiBinder.class);
053
054    /** The description field. */
055    @UiField
056    protected TableCellElement m_description;
057
058    /** The dimension field. */
059    @UiField
060    protected TableCellElement m_dimension;
061
062    /** The description label. */
063    @UiField
064    protected TableCellElement m_labelDescription;
065
066    /** The dimension label. */
067    @UiField
068    protected TableCellElement m_labelDimension;
069
070    /** The last changed label. */
071    @UiField
072    protected TableCellElement m_labelLastChanged;
073
074    /** The user last modified label. */
075    @UiField
076    protected TableCellElement m_labelUserLastModified;
077
078    /** The last changed field. */
079    @UiField
080    protected TableCellElement m_lastChanged;
081
082    /** The title field. */
083    @UiField
084    protected SpanElement m_title;
085
086    /** The user last modified field. */
087    @UiField
088    protected TableCellElement m_userLastModified;
089
090    /**
091     * Constructor.<p>
092     *
093     * @param info the resource info bean
094     * @param dimensions the image dimensions
095     */
096    public CmsImageInfo(CmsResultItemBean info, String dimensions) {
097
098        initWidget(uiBinder.createAndBindUi(this));
099        m_labelDescription.setInnerText(Messages.get().key(Messages.GUI_IMAGE_INFO_DESCRIPTION_0));
100        m_labelDimension.setInnerText(Messages.get().key(Messages.GUI_IMAGE_INFO_DIMENSION_0));
101        m_labelLastChanged.setInnerText(Messages.get().key(Messages.GUI_IMAGE_INFO_DATE_LAST_CHANGED_0));
102        m_labelUserLastModified.setInnerText(Messages.get().key(Messages.GUI_IMAGE_INFO_LAST_CHANGED_BY_0));
103        m_description.setInnerText(info.getDescription());
104        m_description.setTitle(info.getDescription());
105        m_dimension.setInnerText(dimensions);
106        m_dimension.setTitle(dimensions);
107        m_userLastModified.setInnerText(info.getUserLastModified());
108        m_userLastModified.setTitle(info.getUserLastModified());
109        m_lastChanged.setInnerText(info.getDateLastModified());
110        m_lastChanged.setTitle(info.getDateLastModified());
111        m_title.setInnerText(info.getTitle());
112        m_title.setTitle(info.getTitle());
113    }
114}