Walk Rustin

+ Follow
since Aug 05, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Walk Rustin

anyone. just reactivation the thread. One more thing:

- there is only one EventRespone OrderEventResponse.java.

Why use one special pattern for retrieving order info and another for getting the list of pets.

- Roger
I don't understand why any certification is pre requisite for any exam. I passed SCBCD two months back withtout any prior certification. Now I'm going for SCEA next month. All these condition based certification is nothing else but means to mint money for Sun Inc - an otherwise financially troubled company.
- Walker
Jboss documentation is so poor that it's hard to find instructions on getting anything done. Same is the case with 'enity commands'. I paid $10.00 and bought the online documentation on CMP. It doesn't even mention 'entity commands'.
Does anyone have any working example of how to use 'entity commands'?
- walker rustin
18 years ago
I am using jboss with mysql. Mysql supports auto generation of the primary key. Does JBoss supports this too? It will really take a lot of burden off the developer's shoulder.
- Walk rustin
18 years ago
Since EJB 2.0 does not support ejb-ql with MAX function, I was wondering how the primary keys are being created. The only way I could think of is to have a seperate table which could keep track of the next increment id for a table.
any suggestions.
- Walk rustin
18 years ago
The answer is correct. Don't let the unidirectional thing blurry your judgement. Look at the cardinality. A bar can have atmost only one foo.
After the operation, f2 is connected to b1.
If B is a wrong answer ( which is not) then b2 is still connected to some foo. What foo is that? The operation has left both f1 and b2 without any partner.
Hope it helps.
- walk rustin
I have implemented JTree which is dynamically updated. It works like charm except when the horizonal widht is enough to bring into picture the horizontal scroll bar. When the bar comes up, the message becomes fuzzy. In stread of "user:message" it's like "user:mesmes" or "useuseme". When I click on the node which has this blurry message, of course, that node displays the correct value. This problem comes up only when the scroll bar comes. Please have a look at the code. All suggestions are welcome.
Thank YOu.
- Walk Rustin
package com.info.chatclient;
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.util.*;
public class DynamicTree extends JPanel {
protected DefaultMutableTreeNode rootNode;
protected DefaultTreeModel treeModel;
protected JTree tree;
private ChatClient client;
MyTreeSelectionListener myTreeSelectionListener;
boolean isLoadingData=true;
public DynamicTree(ChatClient c) {
super(new GridLayout(1,0));
client = c;
try {
/** UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" ); */
}catch( Exception e ) {
rootNode = new DefaultMutableTreeNode("Welcome");
treeModel = new DefaultTreeModel(rootNode);
tree = new JTree(treeModel);

/** Tell the tree it is being rendered by custom cell renderer */
tree.setCellRenderer( new CustomCellRenderer() );
myTreeSelectionListener = new MyTreeSelectionListener();
JScrollPane scrollPane = new JScrollPane(tree);
public String getSelectedMessageID(){
DefaultMutableTreeNode parentNode = null;
TreePath parentPath = tree.getSelectionPath();
String messageID;
if (parentPath == null) {
messageID= "-1";
} else {
parentNode = (DefaultMutableTreeNode)(parentPath.getLastPathComponent());
messageID= "0";
}else {
MessageInfo messageInfo = (MessageInfo)parentNode.getUserObject();
messageID = messageInfo.getMessageID();
/** also change the status of the node from new to not-new */
return messageID;

public DefaultMutableTreeNode addObject(Object child) {
DefaultMutableTreeNode parentNode = null;
TreePath parentPath = tree.getSelectionPath();
if (parentPath == null) {
parentNode = rootNode;
} else {
parentNode = (DefaultMutableTreeNode)(parentPath.getLastPathComponent());
return addObject(parentNode, child, true);
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parentNode,Object child) {
return addObject(parentNode, child, true);
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parentNode,Object child,
boolean shouldBeVisible) {
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
if (parentNode == null) {
parentNode = rootNode;
treeModel.insertNodeInto(childNode, parentNode,parentNode.getChildCount());
/** Make sure the user can see the lovely new node. */
if (shouldBeVisible) {
tree.scrollPathToVisible(new TreePath(childNode.getPath()));
return childNode;

public DefaultMutableTreeNode getMatchingNode(String messageID){
TreeModel model = tree.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode)model.getRoot();
DefaultMutableTreeNode node = null;
if (root != null){
for (Enumeration e = root.breadthFirstEnumeration(); e.hasMoreElements() {
DefaultMutableTreeNode current = (DefaultMutableTreeNode)e.nextElement();
if (current.isRoot()){
} else{
MessageInfo messageInfo = (MessageInfo)current.getUserObject();
if (messageID.equals(messageInfo.getMessageID())) {
node = current;
}// end of current.isRoot()
}// end of for loop
} // end of if loop
return node;
}// end of method

public void addTheNewNode(String messageID, MessageInfo messageInfo){

DefaultMutableTreeNode selectedNode = getMatchingNode(messageID);
addObject(selectedNode, messageInfo);
/** make sure that the newly added line shows up in the message panel */
/** use this only if you want nothing be selected
tree.clearSelection(); */
/** disable the send screen */
/**** ********************************************************/
/** NEW CLASS */
/**** ********************************************************/
class MyTreeSelectionListener implements TreeSelectionListener {
public void valueChanged(TreeSelectionEvent e) {
/** enable the send message panel */

public void manageSelection(String messageID){
MessageInfo messageInfo = new MessageInfo();
boolean moreRecords = true;
Vector useridV = new Vector();
Vector displayMessageV = new Vector();
Vector messageIDV = new Vector();
String message = (String)client.messagesHashTable.get(messageID);
if (message == null){
moreRecords = false;
} else {
String USERID = messageInfo.getUserID();
String NMID = messageInfo.getMessageID();
String TMID = messageInfo.getToMessageID();
String BMSG = messageInfo.getBMSG();
displayMessageV.addElement(BMSG + "\n");
messageID = TMID;
}// while
int numberOfElements = useridV.size();
/**start printing the messages to the window now */
if (useridV.size() > 0){
for (int i=useridV.size()-1;i>=0 ;i-- ){
String userid = (String)useridV.elementAt(i);
String messageid = (String)messageIDV.elementAt(i);
String BMSG = (String)displayMessageV.elementAt(i);
if (!isLoadingData){
client.myTable.m_data.add(userid + ":", messageid + " - " + BMSG);
/** numberOfElements minus i is done to reverse the order of entry */
client.smallHashTable.put(Integer.toString(numberOfElements - i),messageid);
}//for loop
if (!isLoadingData){
client.myTable.table.tableChanged(new TableModelEvent(client.myTable.m_data));
int rowCount = client.myTable.m_data.getRowCount();
int columnCount = client.myTable.m_data.getColumnCount();
for (int i=0;i<rowCount ;i++ ) {
for(int j=0;j<columnCount;j++){
} // if isLoadingData
}//end of method
public void setValueAt(Object value,int nRow, int nCol) {
TableCellRenderer renderer= client.myTable.table.getCellRenderer(nRow,nCol);
Component c=renderer.getTableCellRendererComponent(client.myTable.table,value,true,true,nRow,nCol);
Dimension size=c.getPreferredSize();
// Adjust row's height
int width = client.myTable.table.getColumnModel().getColumn(nCol).getWidth();
int rowHeight = c.getPreferredSize().height;
client.myTable.table.setRowHeight(nRow, rowHeight - 15);
}//class MyTreeSelectionListener
}// class DynamicTree
18 years ago
I have a JTable and I use table model. I also use TableCellRenderer. Now when i use tableChange() method the method getValueAt(int nRow, int nCol) in the model is called recursively forever. It starts with row zero to row 7 and then starts again. I have spent quite some time on it and have been unable to solve it. Please help me.
class StockTableData extends AbstractTableModel {}
for (int k = 0; k < m_data.getColumnCount(); k++ ) {
System.out.println("k is " + k);
TableCellRenderer renderer = new TextAreaCellRenderer();
TableColumn column = new TableColumn(k, StockTableData.m_columns[k].m_width, renderer, null);

class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
protected static Border m_noFocusBorder = new EmptyBorder(1, 1, 1, 1);
protected static Border m_focusBorder = UIManager.getBorder("Table.focusCellHighlightBorder");
public TextAreaCellRenderer() {
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int nRow, int nCol)
if (value instanceof ColorData) {
ColorData cvalue = (ColorData)value;
setBackground(isSelected && !hasFocus ?
table.getSelectionBackground() : table.getBackground());
setForeground(isSelected && !hasFocus ?
table.getSelectionForeground() : cvalue.m_color);
setBorder(hasFocus ? m_focusBorder : m_noFocusBorder);
// Adjust row's height
int width = table.getColumnModel().getColumn(nCol).getWidth();
setSize(width, 1000);
int rowHeight = getPreferredSize().height;
System.out.println("-- ");
if (table.getRowHeight(nRow) != rowHeight)
table.setRowHeight(nRow, rowHeight);
return this;
// To fix JDK bug
public String getToolTipText(MouseEvent event) {
return null;

- Walk
18 years ago
I have been working with Java (JSP + Servelt) for over two years now. I am all set to get my SCEA certification. The main goal of getting SCEA certification was to get an EJB related job. People suggested that I should also go for websphere app server or BEA app server certification. I don't have much industry experience to decide one way or another. Any suggestions!! 1) should i go for extra certification? 2) If yes then which one. I guess both IBM and BEA have tons of them.
- Walk