Make child node listen for parent's event
Is it possible?and how?
parent.addEventListener("someEvent",functionInChildComponet);
or parentApplication, or parentDocument, or
Application.application...
Tracy
Similar Messages
-
How to retrieve a child node's immediate parent node from a tree table?
Hello
Hi,
I have a category_subcategories table, and I would like to know how to construct a sql and sub-sql for retrieving a child node's immediate parent node.
Here is my first part of the sql, it only returns the node "Flash"'s parent and its grand-parents:
SELECT parent.category_name, node.lft, node.rgt
FROM category_subcategories AS node,
category_subcategories AS parent
WHERE node.lft > parent.lft AND node.lft < parent.rgt
AND node.category_name = 'FLASH'
ORDER BY parent.lft;
| name |
| ELECTRONICS |
| PORTABLE ELECTRONICS |
| MP3 PLAYERS | |
how can I modify this query so that it returns Flash' parent - 'MP3 Players'?
Thanks a lot
SamHi,
This is an Oracle forum. If you're not iusing Oracle, make that clear. Always say what version of your softwate you're using, whether it's Oracle or anything else.
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain how you get those results from that data.
It looks like you're using the Nested Sets technique for modeling a tree. To get the parents of given nodes, do something like this:
SELECT parent.category_name
, node.lft
, node.rgt
FROM category_subcategories node -- Can't use AS with table alias in Oracle
, category_subcategories parent
WHERE parent.lft IN (
SELECT MAX (lft)
FROM category_subcategories
WHERE lft < node.lft
AND rgt > node.rgt
AND node.category_name = 'FLASH'
ORDER BY parent.lft; This should work in Oracle 8.1 and up. (I can't actually test it unless you post CREATE TABLE and INSERT statements for some sample data). You may need to modify the syntax a little for your database.
785102 wrote:
Hello,
I tried to implement the solution as follow:
mysql> select parent.*
-> from category_subcategories as parent
-> having parent.lft =
-> (select max(parent.lft) from
-> (SELECT parent.category_name, parent.lft, parent.rgt
-> FROM category_subcategories AS node,
-> category_subcategories AS parent
-> WHERE node.lft > parent.lft AND node.lft < parent.rgt
-> AND node.category_name = 'Sofa'
-> ORDER BY parent.lft
-> )
-> );
ERROR 1248 (42000): Every derived table must have its own alias
mysql>
But I got an error.
What is wrong with it?What does the error message say?
Apparantly, in your system (unlike Oracle), every sub-query must have a name. Try something like this:
select parent.*
from category_subcategories as parent
having parent.lft = (
select max(parent.lft)
from (
SELECT parent.category_name
, parent.lft
, parent.rgt
FROM category_subcategories AS node,
category_subcategories AS parent
WHERE node.lft > parent.lft
AND node.lft < parent.rgt
AND node.category_name = 'Sofa'
ORDER BY parent.lft -- Is this a waste of effort?
) AS got_name_lft_and_rgt
) AS got_lft
;What is the purpose of having the inner sub-query, the one I called got_name_lft_and_rgt?
Also, in Oracle, an ORDER BY clause in a sub-query doesn;t guarantee that any super-queries will keep that order. Why do you have an ORDER BY clause in the sub-query, and not in the main query? -
How to make component listen for a specific event of another component
for example, i have several buttons and want them listen for a TreeSelectionEvent... in case anything selected they become active
i don't want a JTree component activate these buttons...here's an overkill,
import java.util.*;
abstract class DoWhatever {
public static Hashtable ht = null;
public static Object DoWhat( String s, Object obj ) {
if( null == ht ) {
ht = new Hashtable();
ht.put( ThisDoWhatever.NAME, new ThisDoWhatever() );
ht.put( ThatDoWhatever.NAME, new ThatDoWhatever() );
return ( (DoWhatever) ht.get( s ) ).doWhatever( obj );
public abstract Object doWhatever( Object obj );
class ThisDoWhatever extends DoWhatever {
public final static String NAME = "this";
public Object doWhatever( Object obj ) {
System.out.println( NAME );
return null;
class ThatDoWhatever extends DoWhatever {
public final static String NAME = "that";
public Object doWhatever( Object obj ) {
System.out.println( NAME );
return null;
public class DoThisOrThat {
public static void main( String[] args ) {
DoWhatever.DoWhat( args[ 0 ], null );
} -
Listening for bubble-clicked event on trayicon
i'm trying to listen to mouse clicks on balloon messages that are displayed when you call TrayIcon#displayMessage.
i added an action listener (TrayIcon#addActionListener), which gets called, but it also gets called when you double-click
on the tray icon itself, so i want to differentiate between clicking on a balloon message and double-clicking on the tray icon.
its basically the same question as in two previous threads, but one of the administrators (DarrylBurke) said i needed to create a new thread.
http://forums.sun.com/thread.jspa?threadID=5284529&tstart=0
http://forums.sun.com/thread.jspa?threadID=5403857&tstart=0
any ideas appreciated.a code sample doesn't help when the functionality of a balloon action listener doesn't exist.
anyhow, it looks like the original jdesktop project had the concept of adding a balloon listener:
http://download.java.net/javadesktop/swinglabs/releases/0.8/docs/api/org/jdesktop/jdic/tray/TrayIcon.html
specifically method TrayIcon#addBalloonActionListener, which lets one listen for interaction with a balloon message.
looks like that functionality was lost/not added to the java.awt version of the system tray class. -
Air for iOS 7 App - Listen for wireless Keyboard events
Greetings i've been reviewing this older posting relating to the same problem that I have, but cannot surmise the solution from the thread. Could someone help point me in the right direction?
https://forums.adobe.com/message/5618417
I've built a flash ios app that relies on the input from 5 keys to function. I'm using Flash CS6 and AIR 13.0.0.111 for iOS. The app wont recognize the input from my bluetooth keyboard though.
This code works until loaded onto the iPhone:
stage.addEventListener(KeyboardEvent.KEY_DOWN, ScrollDown);
function ScrollDown(e:KeyboardEvent):void{
if (e.keyCode == 83){
I guess in need to use a event.CHANGE listener but I can't find any similar tutorials to follow.
Any help would be greatly appreciated.I don't know how wireless keyboard work for iDevices...
Try to add StageText, tap on it and try to edit text using your keyboard. Could StageText hook keyboard input? -
How to make menuBar UI listen for top level click
Hi,
The menubar only listen to the sub level menu item(i mean click), and I would like to make menubar listen to top level also.
for eg:
NEWS-> worldnews.
it listen the sublevel item worldnews ,i would like to make top level NEWS also.
I tried using selected index. sometimes -1 was returned when I clicked the “NEWS” item. I assume this is because it has sub-menu items.
can anyone give solution for this???????hi Neobox75,
I have created an air application for a news website( i didnt finsh it fully) . I display the images ,news everythng using feed. I used httpservice to get the values from the feed. now my problem is if i deploy this package to the user means if he has the internet connection ...All my information wil be displayed to him as i read all the information through feed . if the network conection is not available(offline) means i have to display the previous news and images to him( if v use timer to refresh it wil be cached in user system but i dnt knw how to retreive from cache if the user is offline ).how it can be done please give the solution for it...
regards,
divya. -
How to find Last Child (Node) of a parent
Hi All
I have following data:
PARENT CHILD
1 2
2 3
3 4
4 5
100 101
101 102
200 201
300 301
301 302
302 303
303 304
Now I need the output as below:
Parent Final Child
1 5
100 102
200 201
300 304
Which means, for the parent, it should start with immediate child and traverse through all subsequent parent-child relation ship and should find at ending with the last child for that group.
When the parent child relation is as below: i need to output 1 (first parent in the group) & 5 (last child in the group)
1 - 2 - 3 - 4 - 5
Quick solution could be helpful.
Thanks in advance,
Ram.It seem that you asked for leafs from all roots.
If so try this
Processing ...
with Test_Data as (
select 1 as parent, 2 as child from dual union all
select 2, 3 from dual union all
select 3, 4 from dual union all
select 4, 5 from dual union all
select 4, 6 from dual union all
select 100, 101 from dual union all
select 101, 102 from dual union all
select 200, 201 from dual union all
select 300, 301 from dual union all
select 301, 302 from dual union all
select 302, 303 from dual union all
select 303, 304 from dual
Levels as (
select child, level as lvl, connect_by_root parent as root
from test_data td
start with parent not in (select child from Test_Data)
connect by parent = prior child
), paths as (
select child,root,lvl,
max(lvl) over (partition by root) max_lvl
from Levels
select root,child
from paths
where lvl= max_lvl
Query finished, retrieving results...
ROOT CHILD
1 5
1 6
100 102
200 201
300 304
5 row(s) retrievedBye Alessandro
Edited by: Alessandro Rossi on 1-set-2008 12.41
I've never imagined that a simple copy and past would do that!
I won't leave it so the new forum supporters ( if any exist ) could see what the cr4p we are using now -
Listen for JTabbedPane scroll events
I want to execute a method each time the op scrolls through the tabs in a JTabbedPane in "SCROLL_TAB_LAYOUT". I have tried implementing ChangeListener, propertychangelistener and componentlistener but none of them seem to notify me when the op scrolls through tabs?
Thanks in adavce
CalypsoThanks Camickr, sorry for the late reply below is working solution
These are my custom actions which extends wrappedAction
class ScrollRight extends WrappedAction {
public ScrollRight(JComponent component, KeyStroke keyStroke) {
super(component, keyStroke);
public void actionPerformed(ActionEvent e) {
this.invokeOriginalAction(e);
System.out.println("\nScrolling Right");
class ScrollLeft extends WrappedAction {
public ScrollLeft(JComponent component, KeyStroke keyStroke) {
super(component, keyStroke);
public void actionPerformed(ActionEvent e) {
this.invokeOriginalAction(e);
System.out.println("\nScrolling Left");
}This code was added to my constructor
KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK);
KeyStroke left = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK);
InputMap im = tabbedPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(right, "scrollTabsForwardAction");
im.put(left, "scrollTabsBackwardAction");
ScrollLeft sl = new ScrollLeft(tabbedPane,left);
tabbedPane.getActionMap().put(sl.getValue(Action.NAME),sl);
ScrollRight sr = new ScrollRight(tabbedPane,right);
tabbedPane.getActionMap().put(sr.getValue(Action.NAME),sr);Thanks again
Calypso -
Drag Child node to make it a Parent Node
Hello All
I have implemented Drag -Drop functionality in my tree. Which
consists of root and child nodes. I hide the Root node of the tree now
is there any way to make a child node as a parent node because when I
drag the child node in backward( <--) direction at the level of parent
node no drop method calls in this case then how can I make this child
node a parent node ????? I will be very thankful to your for your kind
suggestion
Regards
Sunny KhanAh
I think it is actually an Apple App switcher thing.
So if the finder window does noy cover the After Effects Project window, it works, but if you have to use the app switcher, sometimes it works and sometimes it doesn't.
I don't think it is a file type issue, so much as a live application issue, or maybe GPU related.
It's a weird thing, not that important, but it does limit where you can and can't drag from.
Tris -
I am curious, how can you have a child mxml page listen for
an event from the parent?
Let's say you have a button, call it 'btn1' on page1.mxml and
you want to listen for the click event on page2.mxml. So far this
is what I have:
page1.mxml:
<mx:Button id="btn1" />
page2.mxml:
<mx:Script>
<![CDATA[
private function btnListener(e:MouseEvent){
Application.application.btn.addEventListener(MouseEvent.CLICK,
setState(1));
]]>
</mx:Script>"spacehog" <[email protected]> wrote in
message
news:glljts$g04$[email protected]..
>I am curious, how can you have a child mxml page listen
for an event from
>the
> parent?
>
> Let's say you have a button, call it 'btn1' on
page1.mxml and you want to
> listen for the click event on page2.mxml. So far this is
what I have:
>
> page1.mxml:
>
> <mx:Button id="btn1" />
>
> page2.mxml:
>
> <mx:Script>
> <![CDATA[
>
>
> private function btnListener(e:MouseEvent){
>
Application.application.btn.addEventListener(MouseEvent.CLICK,
> setState(1));
> }
> ]]>
> </mx:Script>
Check out Q3:
http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf -
How to set the horisontal offset for a node relative its parent in JTree?
When using large icons for nodes in a JTree the whole tree looks very compact. I found a method setRowHeight(int height) to set the row height that got med some space between the rows. But I couldn't find a simular method to increase the offset between a child node and its parent.
Any suggestions?You can control the offset through the BasicTreeUI, as discussed in this thread:
http://forum.java.sun.com/thread.jspa?threadID=630707&messageID=3636590
See reply #8 and #9. -
Component listening for a event
I need to make 1 component listen for an event in another component..
JMenuItem listens for a TreeSelectionEvent and in case something selected enables... and disables otherwise...
addTreeSelectionListener() is not possible for a JMenuItem component...
so how do i do that?
the code below is not acceptable because there is a lot of JMenuItem objects and it's a bit messy and difficult to add each...
tree.addTreeSelectionListener(blah) {
JMenuItem.setEnabled(false);
i want a component checking himself for a proper condition...
in case it will require too much hardware resourses what would you suggest?Do you ever get to a point in programming where you think that perhaps i have choosen the wrong hobby to get infatuated about
That code worked really well targetplanet but it had a side effect that just makes me nutts lol
as it triggered a mouse event function in the component that was initialized in Main and just made my web site go nuts . the component that we initialized was a skin but its itemRenderer component that followed had the mouse event! perhaps i better start again with me learning perhaps i missed something
or perhaps i should just have one component to one job instead of trying to be clever and mutitask with less components! -
Runtime ik springs: child nodes break when a parent node is moved
There is something wrong with IK armature springs when used in runtime mode. Child nodes become disjointed with user interaction of parent nodes.
Drag spring on right from different points to see bug here: http://gardenofpossibilities.org/flash/ik_spring_runtime_bug/spring_runtimebug.html
I filed this as a bug, but wanted to mention it here in case others have a similar problem or anyone has a workaround:
Steps to reproduce bug:
1. Build simple movieclip based armature
2. add springs to bones
3. set armature to runtime and publish
Results:
Armature child nodes become disjointed with user interaction of parent nodes. Same disjointed behavior occurs when armature is moved with actionscript 3 ik.mover.
Expected results:
Armature nodes should remain properly connected when user or actionscript 3 ik_mover moves any node.
My Analysis:
When springs are 0 (no spring) armature works correctly. It appears that the problem is caused by child nodes pivoting at parent node head, when they should actually pivot at parent node tail. Also, when armature becomes disjointed, dragging or moving tail node (furthest from root) restores joints.
I've posted and example of the bug here: http://gardenofpossibilities.org/flash/ik_spring_runtime_bug/spring_runtimebug.html
...and a .zip archive of the fla: http://gardenofpossibilities.org/flash/ik_spring_runtime_bug/
Please enlighten me on what is wrong, how to fix (if possible). If this is a documented bug, please provide a reference to it.
Thanks!I posted this two months ago. Does anybody have anything to add on this issue? Are there any Adobe programmer/engineers out there? I've even filed a bug report, but have not received any feedback. Not a peep. Please?
-
With big apps it's boring to wait 10 minutes to package ios app just to be able to retry something. Is there a way to make flash builder listen for usb debugging like after the debug packaging bug without re-package ?
Just FYI, Whatsapp is not free indefinitely even on Android phones. They give a one-year trial period after which you have to pay per year for the subscription (a miniscule amount, but you have to pay nonetheless), whereas with the iOS app you pay once up front and then don't have to pay again. So in the long run, the iOS version comes out cheaper (at least unless Whatsapp changes their pricing model). And also just FYI, Whatsapp doesn't work on the iPod touch, only on the iPhone.
In any case, as planb77 said, pricing is totally up to the developer of the app. It's completely the developer's choice what price to charge for an app.
Regards. -
Need to chart attribute value of just one child node of XML document
I have a XML document with (for example) 7 parent nodes, each
parent node has 5 child nodes. The parent nodes have an attribute
@EarlierDTS (DateTime type) that is the x-axis category of a chart.
Each child node has an attribute @eventid which specifies the id of
the event, and another atttribute @NumOccurs which specifies how
many times that event occured in that period.
How do I tell Flex I want a simple line chart of the eventID
= 215? What if I want two lines, for both eventID=215 and
eventid=307?
I have studied the posts and blogs for over a week now, and
have seen this question or similar come up quite a few places, with
no answer.
1) Should I focus on learning how to create a filterfunction
for the XMLList that underlies my XMLListCollection so that the
filtered data view is just one child node per parent node ( or two
child nodes for the second case)? And set the filtered data view as
the dataprovider of my chart's vertical series?
2) Should I focus on learning how to create a XML Filter
query that selects just one or two child nodes for each parent
node, and set the charts' series' dataprovider to this filter
expression? (I don't think this is allowed - but I'm checking with
the forum members...)
3) Should I focus on learning how to convert the
XMLListCollection into a HierarchicalData object, and then learning
how to filter this object so there is only one (or two) childs per
parent? This seems like a lot of coding - I almost have to create a
pair of classes - one for the parent and one for the child - so I
can create nested ArrayObjects.
4) Should I create a brand new XMLList by walking the
original XML list, and inserting Parent nodes and just the child
nodes that match the eventID(s) I want to chart, into the new
XMLList?
I believe that the easiest way would be to create a
Filterfunction for the XMLList, and bind the chart series to the
(filtered) XML List. But the problem with this approach is that I
have seen more than 2 posts asking how to accomplish filtering that
removes specific children from the view, with no solutions posted.
Help! What is the best way to get just one child for each
parent, from an XMLList?"whertzing" <[email protected]> wrote in
message
news:[email protected]...
>I have a XML document with (for example) 7 parent nodes,
each parent node
>has 5
> child nodes. The parent nodes have an attribute
@EarlierDTS (DateTime
> type)
> that is the x-axis category of a chart. Each child node
has an attribute
> @eventid which specifies the id of the event, and
another atttribute
> @NumOccurs
> which specifies how many times that event occured in
that period.
>
> How do I tell Flex I want a simple line chart of the
eventID = 215? What
> if I
> want two lines, for both eventID=215 and eventid=307?
>
> I have studied the posts and blogs for over a week now,
and have seen this
> question or similar come up quite a few places, with no
answer.
>
> 1) Should I focus on learning how to create a
filterfunction for the
> XMLList
> that underlies my XMLListCollection so that the filtered
data view is just
> one
> child node per parent node ( or two child nodes for the
second case)? And
> set
> the filtered data view as the dataprovider of my chart's
vertical series?
>
> 2) Should I focus on learning how to create a XML Filter
query that
> selects
> just one or two child nodes for each parent node, and
set the charts'
> series'
> dataprovider to this filter expression? (I don't think
this is allowed -
> but
> I'm checking with the forum members...)
>
> 3) Should I focus on learning how to convert the
XMLListCollection into a
> HierarchicalData object, and then learning how to filter
this object so
> there
> is only one (or two) childs per parent? This seems like
a lot of coding -
> I
> almost have to create a pair of classes - one for the
parent and one for
> the
> child - so I can create nested ArrayObjects.
>
> 4) Should I create a brand new XMLList by walking the
original XML list,
> and
> inserting Parent nodes and just the child nodes that
match the eventID(s)
> I
> want to chart, into the new XMLList?
>
> I believe that the easiest way would be to create a
Filterfunction for the
> XMLList, and bind the chart series to the (filtered) XML
List. But the
> problem
> with this approach is that I have seen more than 2 posts
asking how to
> accomplish filtering that removes specific children from
the view, with no
> solutions posted.
>
> Help! What is the best way to get just one child for
each parent, from an
> XMLList?
I'd just look at a dataFunction. There's an example here that
may point you
in the right direction:
http://flexdiary.blogspot.com/2008/08/charting-example.html
HTH;
Amy
Maybe you are looking for
-
How do I remove/prevent a random and unwanted PC from "sharing" my Mac?
Whenever I go to save a paper that I am working on, on the left hand side of the save menu there is an area labeled "Sharing." Underneath this title there is a Dell that is evidently sharing my information. I do not know this person and I do not know
-
I've been having problems logging into the store just to write reviews from my iOS devices, (3-4 Months) so not iOS7 related. I'm prompted to enter my AppleID password multiple times with little to no success. If I do manage to get to the review sect
-
Urgent help needed - deadline - iDVD project suddenly gone corrupt?
Ive literally finished and ironed out the problems Ive had with a big Dual Layer project Ive been working on for 2 weeks. Yesterday I successfully burned a project to DVD - and I had not been having any problems. Then suddenly I tried another burn la
-
When I connect my iPhone to my iTunes, my iTunes doesn't detect the phone
When I connect my iPhone (iPhone 3GS) to my Mac laptop, my iTunes (10.5.2) doesn't detect my phone, but the phone sti charges and acts like it's properly connected. On the iTunes, there is no icon revealing that the iPhone is detected, what can I do
-
Hi all, Iam new to user exits can any body send me some examples for Function Module exits Thanks in Advace WIth Regards Ranjith