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.ui.dialogs.history.diff;
029
030import org.opencms.ui.CmsVaadinUtils;
031import org.opencms.ui.Messages;
032import org.opencms.ui.util.table.Column;
033import org.opencms.workplace.comparison.CmsAttributeComparison;
034
035/**
036 * Represents a row in an attribute comparison table.<p>
037 */
038public class CmsPropertyCompareBean {
039
040    /** The attribute comparison. */
041    private CmsAttributeComparison m_comp;
042
043    /**
044     * Creates a new instance.<p>
045     *
046     * @param comp an attribute comparison
047     */
048    public CmsPropertyCompareBean(CmsAttributeComparison comp) {
049        m_comp = comp;
050    }
051
052    /**
053     * Gets the attribute name.<p>
054     *
055     * @return the attribute name
056     */
057    @Column(header = Messages.GUI_HISTORY_DIALOG_COL_PROPERTY_0, order = 10)
058    public String getProperty() {
059
060        String result = m_comp.getName();
061        if (result.startsWith("GUI_")) {
062            result = CmsVaadinUtils.getMessageText(result);
063        }
064        return result;
065    }
066
067    /**
068     * Gets the value for the first version.<p>
069     *
070     * @return the first version's value
071     */
072    @Column(header = "V1 (%(v1))", order = 20)
073    public String getV1() {
074
075        return m_comp.getVersion1();
076    }
077
078    /**
079     * Gets the value for the second version.<p>
080     *
081     * @return the second version's value
082     */
083    @Column(header = "V2 (%(v2))", order = 30)
084    public String getV2() {
085
086        return m_comp.getVersion2();
087    }
088
089}