Hi,
I am using a ULCTableTree. In it, I have a checkbox in an editable cell.
I wish to be informed of any changes to the checkbox's state. But with
ULC, the change of state is not conveyed immediately. That is, the event
is propogated to the server only AFTER some other GUI event has
triggered a server roundtrip. I am attaching a sample application
demonstrating the problem.
Environment:
- ULC Version: 6.1.1
- Java: 1.4.2 on both client and server.
To reproduce the problem:
1. Please run the following application and click the checkboxes a few
times. Nothing happens.
2. Close the application, and the text "Nodes changed!!!!" gets printed.
Right now, the workaround I am using is to add dummy listeners
'IListSelectionListener' and 'ITreeSelectionListener' to the
ULCTableTree to force a server roundtrip. But this does not satisfy some
complex use cases. It would be highly desirable that either a bug fix is
done or a workaround to this issue is provided.
Thanks and Regards
Indukumar
X----------------------------------
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.DefaultCellEditor;
import com.ulcjava.base.application.IEditorComponent;
import com.ulcjava.base.application.IRendererComponent;
import com.ulcjava.base.application.ULCCheckBox;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCScrollPane;
import com.ulcjava.base.application.ULCTableTree;
import com.ulcjava.base.application.event.ITableTreeModelListener;
import com.ulcjava.base.application.event.TableTreeModelEvent;
import
com.ulcjava.base.application.tabletree.DefaultMutableTableTreeNode;
import com.ulcjava.base.application.tabletree.DefaultTableTreeModel;
import com.ulcjava.base.application.tabletree.ITableTreeCellRenderer;
import com.ulcjava.base.development.DevelopmentRunner;
public class ULCTableTreeTest extends AbstractApplication {
public void start() {
ULCFrame frame = new ULCFrame();
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
DefaultMutableTableTreeNode root = new
DefaultMutableTableTreeNode(new Object[] {"root", "root", "root"},
new boolean[] {false, false, true}, false);
DefaultMutableTableTreeNode row1 = new
DefaultMutableTableTreeNode(new Object[] {"AAA", "BBB", "CCC"},
new boolean[] {false, false, true}, false);
DefaultMutableTableTreeNode row1a = new
DefaultMutableTableTreeNode(new Object[] {"aaa", "bbb", "ccc"},
new boolean[] {false, false, true}, true);
DefaultMutableTableTreeNode row2 = new
DefaultMutableTableTreeNode(new Object[] {"DDD", "EEE", "FFF"},
new boolean[] {false, false, true}, false);
DefaultMutableTableTreeNode row2a = new
DefaultMutableTableTreeNode(new Object[] {"ddd", "eee", "fff"},
new boolean[] {false, false, true}, true);
row1.add(row1a);
row2.add(row2a);
root.add(row1);
root.add(row2);
DefaultTableTreeModel model = new
DefaultTableTreeModel(root, new String[] {"As", "Bs", "Cs"});
model.setRoot(root);
ULCTableTree tree = new ULCTableTree(model);
tree.setRootVisible(false);
tree.setShowsRootHandles(true);
for (int i = 0; i < 5; i++) {
// Will you add a method in the ULCTableTree to
expand all nodes in
// future?
tree.expandRow(i);
}
final ULCCheckBox checkBox = new ULCCheckBox();
tree.getColumnModel().getColumn(2).setCellEditor(new
DefaultCellEditor(checkBox) {
public IEditorComponent
getTableTreeCellEditorComponent(ULCTableTree tableTree, Object value,
boolean selected, boolean expanded,
boolean leaf, Object node) {
return checkBox;
}
});
tree.getColumnModel().getColumn(2).setCellRenderer(new
ITableTreeCellRenderer() {
public IRendererComponent
getTableTreeCellRendererComponent(ULCTableTree arg0, Object arg1,
boolean arg2,
boolean arg3, boolean arg4, boolean
arg5, Object arg6) {
return checkBox;
}
});
model.addTableTreeModelListener(new
ITableTreeModelListener() {
public void
tableTreeStructureChanged(TableTreeModelEvent event) {
}
public void
tableTreeNodeStructureChanged(TableTreeModelEvent event) {
}
public void
tableTreeNodesInserted(TableTreeModelEvent event) {
}
public void
tableTreeNodesRemoved(TableTreeModelEvent event) {
}
public void
tableTreeNodesChanged(TableTreeModelEvent event) {
/*
* This method gets called only AFTER
the window is closed! It
* seems that the valueChanged events
are not synchronous.
*/
System.out.println("Nodes changed!!!!");
}
});
frame.add(new ULCScrollPane(tree));
frame.setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(ULCTableTreeTest.class);
DevelopmentRunner.run();
}
}
X----------------------------------
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer