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

com.datastax.data.dataset.event.RowChangeEvent Maven / Gradle / Ivy

The newest version!

package com.datastax.data.dataset.event;

import com.datastax.data.dataset.DataColumn;
import com.datastax.data.dataset.DataRow;

import java.util.EventObject;


public class RowChangeEvent extends EventObject {
    public enum EventType {
        ROW_STATUS_CHANGED,
        CELL_CHANGED
    };
    
    private EventType eventType;
    private DataColumn columnAffected;
    private Object priorColumnValue;
    private DataRow.DataRowStatus priorRowStatus;
    
    private RowChangeEvent(DataRow source) {
        super(source);
    }

    
    public static RowChangeEvent newRowStatusChangeEvent(DataRow source, DataRow.DataRowStatus priorStatus) {
        RowChangeEvent rce = new RowChangeEvent(source);
        rce.eventType = EventType.ROW_STATUS_CHANGED;
        rce.priorRowStatus = priorStatus;
        return rce;
    }

    public static RowChangeEvent newCellChangedEvent(
          DataRow source, 
          DataColumn col, 
          Object priorValue,
          DataRow.DataRowStatus priorStatus
          ) {
        RowChangeEvent rce = new RowChangeEvent(source);
        rce.eventType = EventType.CELL_CHANGED;
        rce.columnAffected = col;
        rce.priorColumnValue = priorValue;
        rce.priorRowStatus = priorStatus;
        return rce;
    }
    
    
    public EventType getEventType() {
        return eventType;
    }
    
    
    public DataColumn getColumnAffected() {
        return columnAffected;
    }
    
    
    public Object getPriorColumnValue() {
        return priorColumnValue;
    }
    
    
    public DataRow.DataRowStatus getPriorRowStatus() {
        return priorRowStatus;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy