view flys-client/src/main/java/de/intevation/flys/client/client/ui/RecommendationPairRecord.java @ 1304:18b0414bde44

Allow reparameterization of W-Diffs. flys-client/trunk@2938 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 11 Oct 2011 11:59:57 +0000
parents f4f30d758550
children 1627a28c4504
line wrap: on
line source
package de.intevation.flys.client.client.ui;

import com.smartgwt.client.widgets.grid.ListGridRecord;
import de.intevation.flys.client.shared.model.Recommendation;


/**
 * Two strings to be displayed in a GridList, derived from two
 * Recommendations.
 */
public class RecommendationPairRecord extends ListGridRecord {

    /** First attribute-name for StringPairRecord. */
    protected static final String ATTRIBUTE_FIRST  = "first";
    
    /** Second attribute-name for StringPairRecord. */
    protected static final String ATTRIBUTE_SECOND = "second";

    /** The "first" recommendation (typically the minuend). */
    Recommendation first;

    /** The "second" recommendation (typically the subtrahend). */
    Recommendation second;

    /** Human-readable short information about the "first" recommendation. */
    String firstName;

    /** Human-readable short information about the "second" recommendation. */
    String secondName;

    /**
     * Whether the RecommendationPairRecord was restored from data and thus
     * already loaded (usually cloned) in an ArtifactCollection or not.
     */
    boolean alreadyLoaded;


    public RecommendationPairRecord() {
    }


    /**
     * Create a new RecommendationPairRecord.
     *
     * @param firstName Name for the first recommendation (typical minuend).
     * @param first     The first recommendation (typically the minuend).
     * @param secondName Name for the second recommendation (subtrahend).
     * @param first     The second recommendation (typically the subtrahend).
     */
    public RecommendationPairRecord(
        String firstName,
        Recommendation first,
        String secondName,
        Recommendation second)
    {
        setFirst(first, firstName);
        setSecond(second, secondName);
        alreadyLoaded = false;
    }


    /**
     * Sets the first recommendation with info (minuend).
     */
    public void setFirst(Recommendation first, String name) {
        this.first = first;
        this.firstName = name;
        setAttribute(ATTRIBUTE_FIRST, name);
    }


    /**
     * Sets the second recommendation with info (subtrahend).
     */
    public void setSecond(Recommendation second, String name) {
        this.second = second;
        this.secondName = name;
        setAttribute(ATTRIBUTE_SECOND, name);
    }


    /**
     * Get first recommendation (typically the minuend).
     * @return first recommendation (typically the minuend).
     */
    public Recommendation getFirst() {
        return first;
    }


    /**
     * Get second recommendation (typically the subtrahend).
     * @return second recommendation (typically the subtrahend).
     */
    public Recommendation getSecond() {
        return second;
    }


    /**
     * Get name of first recommendation (typically the minuend).
     * @return name of first recommendation (typically the minuend).
     */
    public String getFirstName() {
        return firstName;
    }


    /**
     * Get name of second recommendation (typically the subtrahend).
     * @return name of second recommendation (typically the subtrahend).
     */
    public String getSecondName() {
        return secondName;
    }


    /**
     * Sets whether or not the Recommendation is already loaded (in contrast
     * to not yet loaded).
     * @param isAlreadyLoaded new value.
     */
    public void setIsAlreadyLoaded(boolean isAlreadyLoaded) {
        this.alreadyLoaded = isAlreadyLoaded;
    }


    /**
     * Whether or not this pair of recommendations is already laoded (usually
     * cloned) in an ArtifactCollection.
     * @return whether pair of recommendations is already loaded.
     */
    public boolean isAlreadyLoaded() {
        return this.alreadyLoaded;
    }
}

http://dive4elements.wald.intevation.org