Initial commit from SVN.
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 node of data which is associated with an object in the table.
|
||||
*/
|
||||
public class TreeNodeData implements java.io.Externalizable {
|
||||
/** The object identifier for the row being added. */
|
||||
private int objectId;
|
||||
/** The data for the node. */
|
||||
private Object data;
|
||||
/** Whether the node could possibly have children. */
|
||||
private boolean canHaveChildren = false;
|
||||
|
||||
/**
|
||||
* TreeNodeData constructor.
|
||||
*/
|
||||
public TreeNodeData() {
|
||||
}//TreeNodeData()//
|
||||
/**
|
||||
* TreeNodeData constructor.
|
||||
* @param objectId The object identifier for the row being added.
|
||||
* @param data The data for the node.
|
||||
* @param canHaveChildren Whether the node could possibly have children.
|
||||
*/
|
||||
public TreeNodeData(int objectId, Object data, boolean canHaveChildren) {
|
||||
this.objectId = objectId;
|
||||
this.data = data;
|
||||
this.canHaveChildren = canHaveChildren;
|
||||
}//TreeNodeData()//
|
||||
/**
|
||||
* Gets the object identifier for the row.
|
||||
* @return The object identifier which identifies the object that is associated with the row of data. Note that there can be more than one row per object id.
|
||||
*/
|
||||
public int getObjectId() {
|
||||
return objectId;
|
||||
}//getObjectId()//
|
||||
/**
|
||||
* Determines whether the node could possibly have children.
|
||||
* @return Whether the node might have children.
|
||||
*/
|
||||
public boolean canHaveChildren() {
|
||||
return canHaveChildren;
|
||||
}//canHaveChildren()//
|
||||
/**
|
||||
* Gets the data used to display the node.
|
||||
* @return The data for the node.
|
||||
*/
|
||||
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();
|
||||
data = in.readObject();
|
||||
canHaveChildren = in.readBoolean();
|
||||
}//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.writeObject(data);
|
||||
out.writeBoolean(canHaveChildren);
|
||||
}//writeExternal()//
|
||||
}//TreeNodeData//
|
||||
Reference in New Issue
Block a user