All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.cuf.model.RowColumnChangeEvent Maven / Gradle / Ivy

The newest version!
package net.sf.cuf.model;

import javax.swing.event.ChangeEvent;

/**
 * Change event to better describe a change with additional row and/or column info
 * from the model that changed.
 */
public class RowColumnChangeEvent extends ChangeEvent
{
    /** marker for a unknown row or column */
    public static int UNKNOWN_ROW_OR_COLUMN= -1;

    /** -1 or the row the change happended for */
    private final int mRow;
    /** -1 or the column the change happended for */
    private final int mColumn;

    /**
     * Create a new event without row/column info.
     * @param pSource the source triggering the change
     */
    public RowColumnChangeEvent(Object pSource)
    {
        this(pSource, UNKNOWN_ROW_OR_COLUMN, UNKNOWN_ROW_OR_COLUMN);
    }

    /**
     * Create a new event with row/column info.
     * @param pSource the source triggering the change
     * @param pRow -1 or the row triggering the change
     * @param pColumn -1 or the columne triggering the change
     */
    public RowColumnChangeEvent(Object pSource, int pRow, int pColumn)
    {
        super(pSource);
        mRow= pRow;
        mColumn= pColumn;
    }

    /**
     * @return -1 or the row fo the model involved in the change
     */
    public int getRow()
    {
        return mRow;
    }

    /**
     * @return -1 or the column of the model involved in the change
     */
    public int getColumn()
    {
        return mColumn;
    }

    /**
     * @return true if we have row change information
     */
    public boolean hasRowInfo()
    {
        return mRow!=UNKNOWN_ROW_OR_COLUMN;
    }

    /**
     * @return true if we have column change information
     */
    public boolean hasColumnInfo()
    {
        return mColumn!=UNKNOWN_ROW_OR_COLUMN;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy