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.preview.ui;
029
030import org.opencms.ade.galleries.shared.CmsImageInfoBean;
031import org.opencms.gwt.client.ui.input.datebox.CmsDateConverter;
032import org.opencms.gwt.shared.property.CmsClientProperty;
033
034import com.google.gwt.core.client.GWT;
035import com.google.gwt.uibinder.client.UiBinder;
036import com.google.gwt.uibinder.client.UiField;
037import com.google.gwt.user.client.ui.Composite;
038import com.google.gwt.user.client.ui.Label;
039import com.google.gwt.user.client.ui.Widget;
040
041/**
042 * The widget to display the information of the selected image.<p>
043 *
044 * @since 8.0.
045 */
046public class CmsImageInfoDisplay extends Composite {
047
048    /**
049     * @see com.google.gwt.uibinder.client.UiBinder
050     */
051    protected interface I_CmsImageInfosTabUiBinder extends UiBinder<Widget, CmsImageInfoDisplay> {
052        // GWT interface, nothing to do here
053    }
054
055    /** The ui-binder instance for this class. */
056    private static I_CmsImageInfosTabUiBinder m_uiBinder = GWT.create(I_CmsImageInfosTabUiBinder.class);
057
058    /** The path label. */
059    @UiField
060    protected Label m_labelPath;
061
062    /** The name label. */
063    @UiField
064    protected Label m_labelName;
065
066    /** The title label. */
067    @UiField
068    protected Label m_labelTitle;
069
070    /** The format label. */
071    @UiField
072    protected Label m_labelFormat;
073
074    /** The type label. */
075    @UiField
076    protected Label m_labelType;
077
078    /** The size label. */
079    @UiField
080    protected Label m_labelSize;
081
082    /** The date last modified label. */
083    @UiField
084    protected Label m_labelModified;
085
086    /** The path label. */
087    @UiField
088    protected Label m_displayPath;
089
090    /** The name label. */
091    @UiField
092    protected Label m_displayName;
093
094    /** The title label. */
095    @UiField
096    protected Label m_displayTitle;
097
098    /** The format label. */
099    @UiField
100    protected Label m_displayFormat;
101
102    /** The type label. */
103    @UiField
104    protected Label m_displayType;
105
106    /** The size label. */
107    @UiField
108    protected Label m_displaySize;
109
110    /** The date last modified label. */
111    @UiField
112    protected Label m_displayModified;
113
114    /**
115     * The constructor.<p>
116    */
117    public CmsImageInfoDisplay() {
118
119        initWidget(m_uiBinder.createAndBindUi(this));
120
121        m_labelPath.setText("Path:");
122        m_labelName.setText("Name:");
123        m_labelTitle.setText("Title:");
124        m_labelFormat.setText("Format:");
125        m_labelType.setText("Type:");
126        m_labelSize.setText("Size:");
127        m_labelModified.setText("Last modified:");
128    }
129
130    /**
131     * Fills the contend data.<p>
132     *
133     * @param infoBean the image info bean
134     */
135    public void fillContent(CmsImageInfoBean infoBean) {
136
137        m_displayPath.setText(infoBean.getResourcePath());
138        m_displayName.setText(infoBean.getTitle());
139        m_displayFormat.setText(infoBean.getWidth() + "x" + infoBean.getHeight());
140        m_displayType.setText(infoBean.getResourceType());
141        m_displaySize.setText(infoBean.getSize());
142        m_displayTitle.setText(infoBean.getProperties().get(CmsClientProperty.PROPERTY_TITLE));
143        m_displayModified.setText(CmsDateConverter.toString(infoBean.getLastModified()));
144    }
145}