Tree Field in Scout Kepler [message #1449380] |
Tue, 21 October 2014 09:07 |
|
Hi all,
I define a TreeField in my form and I load it dinamically when my application start, but I have a couple of questions regarding the operation of this field:
- first: after initial load on the inizialization of the field, the user can set different filter and reload the information in the Tree Field. This operation doesn't produce visible results but in the debug mode I see that the tree is filled correctly.
- Second: when I expand the node I set on the node a different icon but the layout the control isn't updated.
I think that the problem is the same in this two points but at the moment I don't understand where is my mistake.
Here the code to inizialize the Tree Field and to load the data:
protected void execInitField() throws ProcessingException {
this.getTree().setCheckable(true);
this.getTree().setMultiSelect(false);
this.getTree().setEnabled(true);
this.getTree().setMultiCheck(true);
if (getGroupOrderForOrderFileField().isChecked()) {
this.setLabel(TEXTS.get("FileOrderList"));
}
else {
this.setLabel(TEXTS.get("OrderList"));
}
//Load Tree Node
loadTreeNodes();
//Listener on tree changed
this.getTree().addTreeListener(new TreeAdapter() {
@Override
public void treeChanged(TreeEvent e) {
System.out.println("TestTree : " + e.getType());
//Check event
if (e.getType() == TreeEvent.TYPE_NODE_EXPANDED) {
//Check if the node is locked or not
if (e.getNode().isChecked()) {
//Node locked
e.getNode().setExpanded(false);
MessageBox.showOkMessage("Node Locked", "Node", e.getNode().getCell().getText());
}
else {
//Node not locked
MessageBox.showOkMessage("Node Expanded", "Node", e.getNode().getCell().getText());
e.getNode().getCellForUpdate().setIconId(Icons.Padlock16);
e.getNode().setChecked(true);
}
}
else if (e.getType() == TreeEvent.TYPE_NODE_COLLAPSED) {
MessageBox.showOkMessage("Node Collapsed", "Node", e.getNode().getCell().getText());
e.getNode().getCellForUpdate().setIconId("");
e.getNode().setChecked(false);
}
}
});
}
.....
public void loadTreeNodes() {
Tree tree = new Tree();
AbstractTreeNode node;
AbstractTreeNode parent = null;
AbstractTreeNode node1 = null;
boolean loadTree = false;
//Prepare search criteria
List<String> listCountryId = new ArrayList<String>();
String interfaceID = "";
//Country ID
if (getCountryIDField() != null) {
if (getCountryIDField().getTable().getSelectedRowCount() > 0) {
//Create a list of country for the filter
for (ITableRow row : getCountryIDField().getTable().getSelectedRows()) {
listCountryId.add(row.getCell(0).toString());
}
}
else {
listCountryId = Arrays.asList("");
}
}
else {
listCountryId = Arrays.asList("");
}
//Interface
if (getInterfaceField() != null) {
if (getInterfaceField().getTable().getSelectedRowCount() > 0) {
interfaceID = getInterfaceField().getTable().getSelectedRow().getCell(0).toString();
}
else {
interfaceID = "";
}
}
else {
interfaceID = "";
}
IDesktopService service = SERVICES.getService(IDesktopService.class);
Object[][] result = service.loadNode(getRefNr(), getCustomerId(), isFielmannFilter(), isFeedbackFilter(), getLowerLimit(),
getUpperLimit(), getUsesTimeIntervalField().isChecked(), getDoubleFileField().isChecked(),
listCountryId, interfaceID);
if (result != null) {
if (result.length > 0) {
String lastFile = "";
//Fill the tree
for (int index = 0; index < result.length; index++) {
if (!lastFile.toLowerCase().equals(result[index][2].toString().toLowerCase())) {
//Parent + leaf
lastFile = result[index][2].toString();
//Definition of node
node = getAbstractTree(result[index][2].toString(), Integer.parseInt(result[index][0].toString()));
node.setEnabled(true);
//Check reorder
if (Integer.parseInt(result[index][6].toString()) > 0) {
node.getCellForUpdate().setForegroundColor("FF0000");
}
//Check if locked
if (Integer.parseInt(result[index][3].toString()) > 0) {
node.setChecked(true);
node.getCellForUpdate().setIconId(Icons.Padlock16);
}
else {
node.setChecked(false);
node.getCellForUpdate().setIconId("");
}
parent = node;
//Definition of leaf
node1 = getAbstractTree(result[index][4].toString(), Integer.parseInt(result[index][1].toString()));
node1.setEnabled(true);
node1.setLeaf(true);
if (Integer.parseInt(result[index][6].toString()) > 0) {
node1.getCellForUpdate().setForegroundColor("FF0000");
}
if (Integer.parseInt(result[index][5].toString()) > 0) {
node1.setChecked(true);
}
if (index == 0) {
node.setLeaf(false);
tree.addChildNode(tree.getRootNode(), node);
}
else {
node.setLeaf(false);
tree.addChildNode(tree.getRootNode(), node);
}
//Connect leaf with his parent
tree.addChildNode(parent, node1);
}
else {
//Only leaf
node1 = getAbstractTree(result[index][4].toString(), Integer.parseInt(result[index][1].toString()));
node1.setEnabled(true);
node1.setLeaf(true);
if (Integer.parseInt(result[index][6].toString()) > 0) {
node1.getCellForUpdate().setForegroundColor("FF0000");
tree.findNode(parent.getPrimaryKey()).getCellForUpdate().setForegroundColor("FF0000");
}
if (Integer.parseInt(result[index][5].toString()) > 0) {
node1.setChecked(true);
}
//Connect leaf with his parent
tree.addChildNode(parent, node1);
}
}
loadTree = true;
}
}
if (!loadTree) {
MessageBox.showOkMessage("No Value", "Tree Load Operation", "No data");
}
setTree(tree, false);
}
Can someone help me understand this issue?
Thanks in advance for any help
|
|
|
Re: Tree Field in Scout Kepler [message #1449385 is a reply to message #1449380] |
Tue, 21 October 2014 09:20 |
|
Hi all,
I partially solved the first question or better I find the right way to solve it.
The problem about this point is linked on the source-code of button that exec the load of data in base at the filter set by user.
Wrongly, I used to call the method "loadRootNode()" instead my method to load the tree:
//Destroy and recreate Tree
getTestTreeField().getTree().disposeTree();
getTestTreeField().getTree().initTree();
//Load data in to tree
getTestTreeField().loadTreeNodes();
Instead the second point remains opened. I accept any help and suggestion.
Thanks in advance at all
|
|
|
Re: Tree Field in Scout Kepler [message #1450482 is a reply to message #1449385] |
Wed, 22 October 2014 13:47 |
|
Hi all,
I find my mistake also for the second point.
The error is: after reinitialized the tree I don't associated the handler to manage the various event and for this reason I don't see the expected modify on the layout of the node.
I hope that helps other persons that have a similar error
|
|
|
|
Re: Tree Field in Scout Kepler [message #1454570 is a reply to message #1450482] |
Tue, 28 October 2014 14:39 |
|
Hi all,
I have noticed a difference in the operation of the Tree Field between SWT and RAP interface.
When I load a new set of data and use the istruction:
In SWT interface appears correctly the new tree and it works fine. Instead in RAP interface nothing appears and the Tree field remains empty.
In the first time, I think a problem linked to the istructions:
getTestTreeField().getTree().disposeTree();
getTestTreeField().getTree().initTree();
and for this reason, I comment these two rows but nothing has changed in the behavior.
Can someone help me understand this issue?
Thanks in advance for any help
|
|
|
Re: Tree Field in Scout Kepler [message #1454595 is a reply to message #1450527] |
Tue, 28 October 2014 15:09 |
|
Hi all,
I have another problem with this type of field, I have found two different behaviors between SWT and RAP interface:
- In SWT when I load a new set of information, the tree field is correctly populated and works fine
- In RAP, when I do the same operation to obtain the same result, the tree field remains empty
In the first time, I thinked that the problem is linked with these two istructions:
getTestTreeField().getTree().disposeTree();
getTestTreeField().getTree().initTree();
and for this reason I commented these two rows, but nothing has changed in the behavior. The code is in the first message of this topic.
This is the result in these two interfaces:
Can someone help me understand this issue?
Thanks in advance for any help
-
Attachment: Cattura.PNG
(Size: 19.33KB, Downloaded 252 times)
[Updated on: Wed, 29 October 2014 08:39] Report message to a moderator
|
|
|
Re: Tree Field in Scout Kepler [message #1455359 is a reply to message #1454595] |
Wed, 29 October 2014 09:33 |
|
Hi all,
is it possible that one reason of this problem is linked to this error message
!ENTRY org.eclipse.scout.rt.ui.rap 4 0 2014-10-29 10:27:14.936
!MESSAGE org.eclipse.scout.rt.ui.rap.internal.servletfilter.DelegateFilter$1.service(DelegateFilter.java:66) IOException
UserAgent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
RemoteIP: 127.0.0.1
What exactly does this error message?
|
|
|
Powered by
FUDForum. Page generated in 0.02760 seconds