Reordering Tree Node in GWT - gwt

I am using GWT 2.4. I am using Tree in my project. I want to move tree node up or down on Button click next to particular node. Is there any way to do so?

#Janki, You can try the following property of Tree to reorder TreeItems attached to it.
myTree.insertItem(beforeIndex, item);
This property inserts a child tree item at the specified index containing the specified
text, where beforeIndex is the index where the item will be inserted
& itemText is the text to be added.

Related

Drools Business Central Workbench - Test Scenario: List subproperty on object

Is there a way to populate a List property on an object being tested under the "new style" test scenario?
I see some "legacy" test cases which seem to achieve this so am wondering if the new style test scenario handles this.
I added the List model to my test case, which enabled me to expand the sub-property on the object, however there is only one field available there, "empty" (boolean). Is there a way to add an object here? If it makes any difference, the model is an external java dependency.
Update
The reason I wasn't able to add the List of objects was because I didn't explicitly import that object dependency into the test. Once you import it you can follow the steps given in the answer below.
It's definitely possible to manage a List property under the Test Scenario Editor.
Please consider the following example: A Book class with a List<String> property named topics.
Creating a new Test Scenario assets, please select the column where you need to add the List property, and in the right part of the editor select the property expanding the Book class, as shown below:
Pressing Insert Data Ojbect button will assign the selected List property to the selected column:
To fill the data in the List property, please double click on the Insert value cell, in the first scenario data row. A popup will appear. Its aim is to fill data inside a collection
To add a value, please press the Add list value link in the bottom part of the popup. Here, you'll be able to fill a single item on the list
Repeat this step for all the items you need to add to the list. When completed, simply press to Save button
The popup will close and you should see the previously selected data cell filled with a label similar to List(2), the number represents the number of the items in the list.

Locating TreeObject in large Tree

I have a large tree and I can 'select' (i.e.highlight) any node of it. But if I have a large tree with all nodes expanded the user still needs to manually scroll down or up in order to locate the highlighted element. Is there a way which not only highlights the selected element but also locates it by automatically scrolling up/down in the tree?
TreePath path = createTreePath(editorID, treeObject);
getTreeViewer().setSelection(new TreeSelection(path), true);
getTreeViewer().refresh();
getTreeViewer().jumpToSelectedElement(true); // I need something like this. I made up the name of this imaginary method.
Use
public void reveal(Object elementOrTreePath)
As its name suggests elementOrTreePath can be a tree path or just an element.

Adding Listener for TreeViewerColumn

I have a treeviewer with dynamic number of columns. I am using ColumnLabelProvider. Every column cell is populated with a image (not text) using getImage() method of labelProvider.
I need a listener that will be triggered when i double click on column cell and an editor should be opened upon double click. I tried using selection listener for tree column but that doesn't work.
My tree item already has a listener that performs another operation so this listener that i add for column should be independent of it. This is the reason
i didnt create my tree using SWT.FULL_SELECTION because if i use full selection the operation intended for my tree item is performed though i double click the column cell.

How to mark part dirty when a text field value is changed?

I have Part containing a TreeViewer with Nodes and each Node has a name property. I have a text field to edit the name of the currently selected node. I have bound the current selection and this text field as below:
IViewerObservableValue observedElementSingleSelection = ViewersObservables
.observeSingleSelection(treeViewer);
IObservableValue detailValue = PojoProperties.value(Node.PROPERTY_NAME, String.class)
.observeDetail(observedElementSingleSelection);
ISWTObservableValue observableNameText = WidgetProperties.text(SWT.Modify)
.observe(nameText);
dataBindingContext.bindValue(observableNameText, detailValue);
Now I would like to mark the part with this treeViewer as dirty whenever the user edits the name of any Node.
When this Part opens the Nodes are retrieved from the database and the tree is created. If I add a ModifyListener to the text field to mark the Part dirty then on initial loading the Part is marked dirty, which I do not want. Is there any way to mark the Part dirty only when the user edits the name of any Node but not at the time of initial loading?
I have tried to set UpdateStrategyso that the data binding is one-way i.e. only from view to model, but then on selection the Node name does not appear in the text field.
I have tried with KeyListener, but then I have to filter all non-printable keys to mark the Part as dirty. Is there any better solution?
You could add the ModifyListener after the load has been done, or remove the modify listener while the load is being done, or set a flag during the load that the modify listener can test and not set the part to be dirty.

delete selected item from text item

i have got multi lined text item like gridview in my forms project. i want to select an item and click delete button and the system must delete selected index but i didnt find the perfect function. it's not bind into the database so its not complicated i just want to delete the line from the text item. i tried to find the properties of the current record, i use some of loops but it didnt find the selected item index. does it have "selected item" function like c#, java. Or do i have to create a function to find selected item. which way is the best and how could i do that.
This code may help you(I didn't get a chance to test this) :
GO_BLOCK('Gridview_BLOCK_NAME');
GO_RECORD(record_index);
DELETE_RECORD;
GO_ITEM('block.delete_button');--if you want the cursor back to delete button