81 lines
2.5 KiB
Java
81 lines
2.5 KiB
Java
/*
|
|
* Copyright (c) 2005,2009 Declarative Engineering LLC.
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the Declarative Engineering LLC
|
|
* verson 1 which accompanies this distribution, and is available at
|
|
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
|
*/
|
|
package com.foundation.tcv.swt;
|
|
|
|
import java.io.IOException;
|
|
import java.io.ObjectInput;
|
|
import java.io.ObjectOutput;
|
|
|
|
/*
|
|
* Encapsulates one cell of data for the purpose of updating selected cells.
|
|
* <p>This can be used to transmit header cell data as well by passing an objectId of -1.</p>
|
|
*/
|
|
public class TreeCellData implements java.io.Externalizable {
|
|
/** The identifier that will determine which row(s) are affected. */
|
|
private int objectId;
|
|
/** The zero based index of the column whose data is being modified. */
|
|
private int columnIndex;
|
|
/** The new cell data. */
|
|
private Object data;
|
|
|
|
/**
|
|
* TreeCellData constructor.
|
|
*/
|
|
public TreeCellData() {
|
|
}//TreeCellData()//
|
|
/**
|
|
* TreeCellData constructor.
|
|
* @param objectId The identifier that will determine which row(s) are affected.
|
|
* @param columnIndex The zero based index of the column whose data is being modified.
|
|
* @param data The new cell data.
|
|
*/
|
|
public TreeCellData(int objectId, int columnIndex, Object data) {
|
|
this.objectId = objectId;
|
|
this.columnIndex = columnIndex;
|
|
this.data = data;
|
|
}//TreeCellData()//
|
|
/**
|
|
* Gets the object identifier which is tied to one or more rows in the table.
|
|
* @return The identifier of the object whose rows need updating.
|
|
*/
|
|
public int getObjectId() {
|
|
return objectId;
|
|
}//getObjectId()//
|
|
/**
|
|
* Gets the index of the column whose data is being updated.
|
|
* @return The zero based column index.
|
|
*/
|
|
public int getColumnIndex() {
|
|
return columnIndex;
|
|
}//getColumnIndex()//
|
|
/**
|
|
* Gets the data for the cell.
|
|
* @return The new cell data.
|
|
*/
|
|
public Object getData() {
|
|
return data;
|
|
}//getData()//
|
|
/* (non-Javadoc)
|
|
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
|
|
*/
|
|
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
|
/*byte version = */in.readByte();
|
|
objectId = in.readInt();
|
|
columnIndex = in.readInt();
|
|
data = in.readObject();
|
|
}//readExternal()//
|
|
/* (non-Javadoc)
|
|
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
|
|
*/
|
|
public void writeExternal(ObjectOutput out) throws IOException {
|
|
out.writeByte(0);
|
|
out.writeInt(objectId);
|
|
out.writeInt(columnIndex);
|
|
out.writeObject(data);
|
|
}//writeExternal()//
|
|
}//TreeCellData// |