Sorting tree items manually
I am trying to allow the user a way of shifting through items
in a tree 2 levels deep. This will give the user a chance to order
the items within the tree so they can be sent to word in the
desired sequence. I have working code for shifting through items at
the lowest level but I can't get it to work correctly for the
folder level items. I have some code that works okay but has a
little problem. I found that if you stick with moving one folder up
the tree then you won't encounter the problem. However, if you
switch to a different folder to move then you will encounter the
problem sooner. The problem seems to be copying a portion of the
tree and appending it to the end. I don't know what exactly is
happening! I was hoping that someone could help me out on this.
Does anybody know a way to do this? Ohh yeah and I would like
the selectedIndex to stay with the folder selected as well.
(I also posted this in the “Advanced Techniques”
forum.)
Thanks for your help.
Jeff
Code:
Has Anybody even attempted this before?
Similar Messages
-
Can Reminders in ML sort/order items per dates?
Can Reminders in ML sort/order items per dates? It was possible when it was part of Calendar in its previous incarnation. Doing it manually is a drag (no pun intended). Seeing uncompleted reminders as well as what is imminent, without sifting through the whole list would be very useful.
ops
i mean
about the 1 screenshot
can i have the list
caeram data exit
iptc core
camera raw
file properties
second screeshot
can i have the filter list
aperture value
exosure time
file type
keywords
and so on
thanks -
Hierarchical Tree Items question, in Oracle9i forms builder ^^;
Hi,I'm kind of new to using the Hierachical Tree item in Oracle9i Forms builder. so anyway,in the book it was explaining how it's done clearly,but, what I want to do using that item is kind of different;
in the book it has the way of making it like a navigator for the items/fields/tables in the database,either by creating a view for those fields by using Select Statements or using the whole table itself.
however,what I'm trying to do is to have that tree list the names of Forms I have already created and probably the list of Reports I got,so it would sort of like a Menu and I could add a trigger to open the form/report once an item in the tree is double clicked on
here's an example of what I'm talking about :
http://i7.photobucket.com/albums/y264/_Crzy_Chck_/Htree.jpg
sorry the screen shot isn't the best ^^;
that's from a company my friend works at,they have that tree as a menu for their forms and reports,once u double click on a form name or a report,it opens up ^^;
I tried google/yahoo,I got the same info I found on the book.Or you may want to check out this code:
PROCEDURE next_menu(
menu_in IN OUT NUMBER
, master_menu_in IN NUMBER
, master_name_in IN VARCHAR2
, context_menu_in IN VARCHAR2
, node_in IN ftree.node
, no_rows_out IN OUT BOOLEAN )
IS
CURSOR c_menu(
b_master_menu NUMBER
, b_prev_menu NUMBER
, b_context_menu gba_tpivmnu.kmenu%TYPE )
IS
SELECT p.ofnk MASTER
, m.ofnk
, m.napp || m.kfnk_sub napplus
, m.rid
, m.rid_mas
FROM gba_tpivmnu p -- parent menu
, gba_tpivmnu m -- menu
WHERE m.rid_mas = p.rid
AND m.kmenu = b_context_menu
AND (
m.rid_mas = b_master_menu
OR ( b_master_menu IS NULL
AND m.rid_mas IS NULL ) )
AND ( m.rid > b_prev_menu
OR b_prev_menu IS NULL )
ORDER BY m.rid;
r_menu c_menu%ROWTYPE;
l_prev_menu tmenu.kode%TYPE;
l_teller PLS_INTEGER := 0;
new_node ftree.node;
this_node ftree.node;
tree_itm item := FIND_ITEM( tree_item );
l_top_node_name VARCHAR2( 512 );
BEGIN
IF master_menu_in IS NOT NULL
THEN
IF node_in IS NULL
THEN
/* eerste keer, dus dit wordt de bovenste node */
l_top_node_name := master_name_in;
glob.set_current_menu( context_menu_in );
new_node :=
ftree.ADD_TREE_NODE(
tree_itm
, ftree.root_node
, ftree.parent_offset
, ftree.last_child
, ftree.expanded_node
, master_name_in
, 'favorites'
, master_menu_in );
END IF;
LOOP
r_menu.rid := NULL;
OPEN c_menu(
master_menu_in
, l_prev_menu
, context_menu_in );
FETCH c_menu
INTO r_menu;
CLOSE c_menu;
l_teller := l_teller + 1;
l_prev_menu := r_menu.rid;
EXIT WHEN r_menu.rid IS NULL;
this_node :=
ftree.ADD_TREE_NODE(
tree_itm
, NVL( node_in, new_node )
, ftree.parent_offset
, ftree.last_child
, ftree.expanded_node
, r_menu.ofnk
, NULL
, r_menu.napplus );
next_menu(
menu_in => menu_in
, master_menu_in => r_menu.rid
, master_name_in => r_menu.ofnk
, context_menu_in => context_menu_in
, node_in => this_node
, no_rows_out => no_rows_out );
END LOOP;
IF l_teller = 0
THEN
no_rows_out := TRUE;
END IF;
IF l_top_node_name IS NOT NULL
THEN
set_tree_item_top_node( l_top_node_name );
END IF;
END IF;
END next_menu;tree_item contains the name of the tree item you are using. the select statement is based on a table that is like EMP, where one EMP van be another EMP's manager. In this table a menu-option can be another menu-option's master.
this is a recursive function that keeps calling itself untill the query finds no more record.
Good Luck! -
How to get a tree item when my mouse moves
I want to get the tree item which my cursor points to when my
cursor moves over a tree.
I can get a row index in itemRollOver event, but it seems
useless.
And I don't know how to use getObjectsUnderPoint method.
Is there anyone who can help me?Take a look this example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="srv.send()">
<mx:Script>
<![CDATA[
[Bindable]
public var selectedNode:Object;
[Bindable]
public var XLC:XML;
public function initList(event:Event) : void
XLC = event.target.lastResult;
public function treeChanged(event:Event) : void
selectedNode=Tree(event.target).selectedItem;
]]>
</mx:Script>
<mx:HTTPService id="srv" url="../assets/tree.xml"
resultFormat="e4x"
result="initList(event)"/>
<mx:HDividedBox width="100%" height="100%">
<mx:Tree id="myTree" width="50%" height="100%"
labelField="@label"
showRoot="false" dataProvider="{XLC}"
change="treeChanged(event)"/>
<mx:TextArea height="100%" width="50%"
text="Selected Item: {selectedNode.@label}"/>
</mx:HDividedBox>
</mx:Application>
"hybak" <[email protected]> wrote in message
news:fd5gao$229$[email protected]..
>I want to get the tree item which my cursor points to
when my cursor moves
>over
> a tree.
> I can get a row index in itemRollOver event, but it
seems useless.
> And I don't know how to use getObjectsUnderPoint method.
> Is there anyone who can help me?
> -
Tree item when-tree-node-selected fires differently from 6i to 10g.
In forms 6i, when you keyboard navigate between tree nodes, the wtns trigger will fire. In 10g it does not. In 10g, it will fire if you press the tab key or mouse click on a node.
Anyone know if this was done on purpose?
I ran into this after finally trying my props.fmb in 10g. It works fine in 6i, but not in 10g
copy of my form is here:
http://www.tailboom.com/oracle.php
Forms [32 Bit] Version 6.0.8.18.3 (Production) cleint server
Forms [32 Bit] Version 10.1.2.0.2 (Production)
I wrote most of the tree handling code for oracle apps APPTREE. This is the code that most if not all tree's in apps uses to build standard tree. So I have a pretty good understanding of the forms tree item. And know the wtns fired for web forms 6i on every node like 6i client server. This is very strange IMO.
Thanks.
--patOleg,
thanks for the reference. Although the bug you identify deals with when-tree-node-activated, it is possible they fixed the when-tree-node-selected issue at the same time. With my test tree, i can currently duplicate both issues. I tried to download the patch, but it is only available for linux and unix. No windows patch. I don't have my linux env up and running to where I can test yet. So I can not confirm.
--pat -
Using Javascript to prevent a tab or tree item from navigating?
Hello there,
I have been trying to implement the functionality across my forms that if a user has entered data but attempts to navigate away by clicking on another tab or item in a tree list they are notified that they have not clicked submit and they will ose there changes.
Using the help from: Re: detecting changes to items prior to submitting page I managed to get this working, so that if they (the user) have edited any items, an alert displays "Data has been changed. Continue anyway?", with the options OK and Cancel. However even if the user clicks cancel, the page will still navigate away losing the changes.
In the provided link from the other thread, 'grahamr' appears to have provided the solution for this but later removed this code as he couldnt get it to display properly in the forums.
Is there anyone else who might know how I can get the javascript to "block" navigation if the user selects cancel?
Thankyou for any insight anyone can provide,
JordanHmm,
I had a look at your example application on the supplied link, however I cannot find any instructions or steps on how to go about implementing this method.
Using my current method (from the thread linked in the first post of this thread) I have no problem getting the javascript to recognise changes and prompt the user on trying to leave - it's just that the href continues regardless of the user clicking cancel (wish grahamr managed to resolve somehow). Do you know why this might be?
My javascript (2 posts above) is fired within the Anchor tag of my tabs and tree items like so; (Im only using [ ] brackets here so that it will display in the forum)
[a onclick="javascript:checkForChangedData();" href="#TAB_LINK#" ][font color="#FFFFFF"]#TAB_LABEL#[font][a]
Or if possible is there any assistance you could provide for implementing the method in your sample application? (I dowloaded the app but that page was not in it)
Any help you can provide is greatly appreciated,
Jordan -
hi
I would like to know if there is a way to get rid of the scroll bar in a tree item.. normally in other applications, windows explorer for eg. when the contents of the explorer is within the view, the scroll bar disappears automatically and when the contents exceeds the view, the scroll bar appears...
is it possible to change the line style of the tree nodes to doted or broken lines...
moreover.. is it possible to rename or edit a tree node just like windows explorer.. right now im calling another canvas on 'when-tree-node-activated' trigger..
i have written a search function just like the one in the forms object navigator... in forms 6. the hi-liter don't position itself if the search result exceeds the view.. it works in 6i.. i wish all the above queries can be met with 6i..
plz help.. thanx in advance1) Scroll bars - scroll bars appear and disappear automatically based on the tree length when run over the web. Unfortunately there is no property for this in client-server
2) You cannt change the line style, just the icons
3) In order to rename or edit a tree node use
FTREE.SET_TREE_NODE_PROEPRTY you can use it to change the node label and node value
Hope this helps,
Candace Stover
Forms Product Management -
Flex SDK 3.4 Tree Item Renderer Root Folder displays Tooltip for Child
I have a Flex Tree that uses a custom item renderer. The item renderer extends Tree Item Renderer and I add my button in commit properties (since the data is dynamic) and I use update displaylist to move it to the right position. I set the button to be visible on rollover and make the icon invisible. On rollout I reverse that logic.
When I have my item renderer add the button, it causes only one problem and it seems to be under certain conditions:
- Single root folder for the tree
- Upon opening the tree, the root folder displays the tool tip for the last child in the tree
Any idea why the tooltip comes up?
public function AssetTreeItemRenderer ()
super();
addEventListener(MouseEvent.ROLL_OVER, onItemRollover);
addEventListener(MouseEvent.ROLL_OUT, onItemRollout);
addEventListener(ToolTipEvent.TOOL_TIP_SHOWN, toolTipShown);
addEventListener(ToolTipEvent.TOOL_TIP_CREATE, onCreateToolTip);
// OVERRIDEN FUNCTIONS
* override createChildren
override protected function commitProperties():void {
super.commitProperties();
if(data is IAsset) {
if(playBtn === null) {
playBtn = new Button();
playBtn.styleName = "previewPlayButton";
playBtn.toolTip = "Play";
playBtn.width = icon.width + 2;
playBtn.height = icon.height + 2;
playBtn.visible = false;
playBtn.addEventListener(MouseEvent.CLICK, onPlayBtnClick);
addChild(playBtn);
} else {
if(playBtn !== null) {
removeChild(playBtn);
playBtn = null;
* override updateDisplayList
* @param Number unscaledWidth
* @param Number unscaledHeight
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
//Move our play button to the correct place
if(super.data && playBtn !== null)
playBtn.x = icon.x;
playBtn.y = icon.y;You are not clearing tooltip if data is not IAsset
-
Problem encountere​d in inserting tree items
Hello All.
I am encountering problem in inserting tree items in a parent child recurring manner. My requirement is that everytime i presses the button, one parent should be inserted in the tree along with its child. Its output should be just like
Fault Code: 7400
Fault Code: 7400
Fault Code: 7401
Fault Code: 7401
and so on.
I am not getting the desired output. What should be way of doing this. Please find the attached project too.
Regards.
Solved!
Go to Solution.
Attachments:
Tree Problem.zip 1128 KBI have no CVI on this machine to run your project, but in a fast look at the code I noticed that you are always using 0 as the item index. You mustr save the index of the parent item and use it for the childs instead:
idx = InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING, 0, VAL_LAST,temp_buffer, "",0, -1);
InsertTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, idx, VAL_LAST,temp_buffer, "",0, -1);
but I don't understand what the child means: the code above will produce the following output ( + here mimics the tree symbols):
Fault code: 7400
+ Fault code: 7400
Fault code: 7401
+ Fault code: 7401
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
I created an album from photos taken off three different cameras. I am sorting the photos manually and when I close iPhoto, the photos move back either by date or by camera import time. How can I keep the photos from moving around?
Don't tell us, tell them
http://www.apple.com/feedback/macosx.html is the place for feature requests and feedback -
Hierarchical tree item - how to improve performance
I'm loading hierarchical tree item with query.
Problem is that it takes very long to load all the items(300, but can be more) to the hierarchical item.
Query takes 0.5 sec., but loading it into the item with Set_Tree_Property(htree, Ftree.RECORD_GROUP
the code:
PL1 := Create_Group_From_Query('pl1', query);
v_ignore := Populate_Group(PL1); -- 0.5 sec
Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, PL1); -- 3 sec.
Does anyone have any idea what to do to improve tree loading?Hello,
try to play a little bit with the state-column of your query. If you only display the first hierarchy level
and set the state of the "hidden" nodes to open, I think ist is the state 1, then it works much faster.
cu
Matthias M|ller -
How can we use "tooltip " option in heirarchical tree item in oracle 11g?
how can we use "tooltip " option in heirarchical tree item properties in oracle 11g forms?
hi user11973188
how can we use "tooltip " option in heirarchical tree item properties in oracle 11g forms?isn't it exist in the tree item's property itself... ?!
Regards,
Abdetu... -
Sort list items according to predifined order
hi all,
I wonder is there any way to sort the items of a list
according to a predefined order (e.g., 2,3,1)?
Many thanksAs far as I know the only predefined sort order is
alphabetic. You could write a function using
list.addAt(position,value) to add new items in the proper location
and maintain the sort order yourself. This might involve a lot of
looping through the target list, depends on how complex your sort
rules are.
I had a project where I needed to keep a list of file names
sorted by rules other than alphabetic. I actually used a big lookup
table (case statement) to append letters to the beginning of each
name just before adding them to the list, the letters were stripped
off when data was retrieved from the list. This trick allowed me to
use list.sort() to maintain the sort order. It’s an ugly
solution and I’m not proud of it, but it got the job done. -
State Change causing tree item to loss selected item highlight
I'm looking for some guidance on a situation i'm encountering. I've an application with a tree component which will be used as a report selector in all view states. The parent nodes are not selectable but the children are. Each child has a for a lack of a better term parameter classification. When a report item is selected in the tree then a state change occurs and displays the appropriate parameter selection view.
My issue is this. Upon clicking an item and displaying the new state for the first time, the selected item in the tree losses the visual representation or highlight around the selected item. But within the debugger it still shows which item is the selectedItem. Once the state has been displayed at least once...i.e. I select other items and then eventually back to initial tree item when the state changes it does not loss the highlight on the selected tree item.
Couple things I've tried to see if i'm in the right neck of the woods is use the currentStateChange and currentStateChanging handlers to do a bit of tracing and found that the tree item remains selected all the way through both currentStateChanging and then even in the currentStateChange...the redraw occurs just after which is when the tree item losses its highlight.
Does anyone have any ideas or even encounter this?Good question. Well you're right in asking. Just using a spark Label to show me the label of the selectedItem, upon the first time I click on the selection nothing populates the label's text BUT the state changes as its suppose to. Took me clicking on it a second time to get the item to be highlighted and the label to show me what had been selected.
My question here is...is there another event which is occurring after the changeState? -
Assign focus on text field associated with tree item in edit mode
The JavaFX home page has an example for how to edit the label associated with a tree item using a cell factory (see sample code below). However, if you select a tree item and then either mouse click or select the Enter key to start editing, the text field doesn't get focus even though the startEdit() method invokes textField.selectAll(). I tried invoking textField.requestFocus(), but that didn't work. Is there a way to ensure that the text field gets focus when the tree item is in edit mode?
I'm using JavaFX 2.1 GA version on Windows 7.
Thanks.
Stefan
@Override
public void startEdit() {
super.startEdit();
if (textField == null) {
createTextField();
setText(null);
setGraphic(textField);
textField.selectAll();
public class TreeViewSample extends Application {
private final Node rootIcon =
new ImageView(new Image(getClass().getResourceAsStream("root.png")));
private final Image depIcon =
new Image(getClass().getResourceAsStream("department.png"));
List<Employee> employees = Arrays.<Employee>asList(
new Employee("Ethan Williams", "Sales Department"),
new Employee("Emma Jones", "Sales Department"),
new Employee("Michael Brown", "Sales Department"),
new Employee("Anna Black", "Sales Department"),
new Employee("Rodger York", "Sales Department"),
new Employee("Susan Collins", "Sales Department"),
new Employee("Mike Graham", "IT Support"),
new Employee("Judy Mayer", "IT Support"),
new Employee("Gregory Smith", "IT Support"),
new Employee("Jacob Smith", "Accounts Department"),
new Employee("Isabella Johnson", "Accounts Department"));
TreeItem<String> rootNode =
new TreeItem<String>("MyCompany Human Resources", rootIcon);
public static void main(String[] args) {
Application.launch(args);
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
for (Employee employee : employees) {
TreeItem<String> empLeaf = new TreeItem<String>(employee.getName());
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())){
depNode.getChildren().add(empLeaf);
found = true;
break;
if (!found) {
TreeItem<String> depNode = new TreeItem<String>(
employee.getDepartment(),
new ImageView(depIcon)
rootNode.getChildren().add(depNode);
depNode.getChildren().add(empLeaf);
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
TreeView<String> treeView = new TreeView<String>(rootNode);
treeView.setEditable(true);
treeView.setCellFactory(new Callback<TreeView<String>,TreeCell<String>>(){
@Override
public TreeCell<String> call(TreeView<String> p) {
return new TextFieldTreeCellImpl();
box.getChildren().add(treeView);
stage.setScene(scene);
stage.show();
private final class TextFieldTreeCellImpl extends TreeCell<String> {
private TextField textField;
public TextFieldTreeCellImpl() {
@Override
public void startEdit() {
super.startEdit();
if (textField == null) {
createTextField();
setText(null);
setGraphic(textField);
textField.selectAll();
@Override
public void cancelEdit() {
super.cancelEdit();
setText((String) getItem());
setGraphic(getTreeItem().getGraphic());
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (isEditing()) {
if (textField != null) {
textField.setText(getString());
setText(null);
setGraphic(textField);
} else {
setText(getString());
setGraphic(getTreeItem().getGraphic());
private void createTextField() {
textField = new TextField(getString());
textField.setOnKeyReleased(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent t) {
if (t.getCode() == KeyCode.ENTER) {
commitEdit(textField.getText());
} else if (t.getCode() == KeyCode.ESCAPE) {
cancelEdit();
private String getString() {
return getItem() == null ? "" : getItem().toString();
public static class Employee {
private final SimpleStringProperty name;
private final SimpleStringProperty department;
private Employee(String name, String department) {
this.name = new SimpleStringProperty(name);
this.department = new SimpleStringProperty(department);
public String getName() {
return name.get();
public void setName(String fName) {
name.set(fName);
public String getDepartment() {
return department.get();
public void setDepartment(String fName) {
department.set(fName);
Edited by: 882590 on May 22, 2012 8:24 AM
Edited by: 882590 on May 22, 2012 8:24 AMWhen you click on a selected tree item to start the edit process is the text in the text field selected? In my case the text is not selected and the focus is not on the text field so I have to click in the text field before I can make a change, which makes it seem as if the method call textfield.selectAll() is ignored or something else gets focus after method startEdit() executes.
Maybe you are looking for
-
How do I connect my Macbook air to a hp laserjet 3380?
How do i connect my macbook air to a hp laserjet 3380? Please provide instructions if possible! thaaanks!
-
Yosemite won't Boot from External SSD with Firewire Connection
Seeking help, I boot from external SSD drives from my 2010 iMac. I recently installed Yosemite on an External SSD with a firewire connection and all went well with the installation and first boot. After completing set up and restarting my iMac Yosemi
-
Hyperlinks not working correctly when converting word doc to Web Page, Filtered
I have created a word document (MS Word 2013) with Table of Contents and their links to particular sections and all the hyperlinks works fine in the word document. But when I convert this document into Web Page, Filtered then after a specific point t
-
TransformerFactory.newInstance cannot be resolved to a type"
Hi Techies, i am writing simple application for creation of XML using java, but while compiling i am getting the following error "Exception in thread "main" java.lang.Error: Unresolved compilation problem: TransformerFactory.newInstance cannot b
-
How do I disable a Mac Safari Extension?
Everytime I look at anything, including my OWN website of items for sale, I can't see the copy under the photo because the darn box of comparable items (which are NOT so comparable) hides all of my text and prices. I have tried everything and can't f