How to trigger event when double click on a tree node

I have this code which creates new tab in a remote Java Class.
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<String>>()
   @Override
   public void changed(ObservableValue<? extends TreeItem<String>> observable, TreeItem<String> oldValue, TreeItem<String> newValue)
   System.out.println("Selected Text : " + newValue.getValue());
   // Create New Tab
   Tab tabdata = new Tab();
   Label tabALabel = new Label("Test");
  tabdata.setGraphic(tabALabel);
   DataStage.addNewTab(tabdata);
Can you tell me how I can modify the code to open new tab when I double click on a tree node. In my code the tab is opened when I click once. What event handler do I need?

import java.util.Arrays;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.control.TreeCell;
import javafx.scene.control.TreeView;
import javafx.scene.control.TreeItem;
import javafx.scene.control.SelectionMode;
import javafx.util.Callback;
public class TreeTest extends Application {
  public static void main(String[] args) {
    launch(args);
  @Override
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("TreeView Test");
    primaryStage.setScene(createScene());
    primaryStage.show();
  private Scene createScene() {
    final StackPane stackPane = new StackPane();
    final TreeView<String> treeView = new TreeView<String>();
    treeView.setRoot(createModel());
    treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    treeView.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
      @Override
      public TreeCell<String> call(TreeView<String> treeView) {
        return new ClickableTreeCell();
    stackPane.getChildren().add(treeView);
    return new Scene(stackPane);
  private TreeItem<String> createModel() {
    TreeItem<String> root = new TreeItem<String>("RootNode");
    TreeItem<String> packageA = new TreeItem<String>("package A");
    packageA.getChildren().addAll(
        Arrays.asList(new TreeItem<String>("A1"), new TreeItem<String>("A2"), new TreeItem<String>("A3"))
    TreeItem<String> packageB = new TreeItem<String>("package B");
    packageB.getChildren().addAll(
        Arrays.asList(new TreeItem<String>("B1"), new TreeItem<String>("B2"), new TreeItem<String>("B3"))
    root.getChildren().addAll(Arrays.asList(packageA, packageB));
    return root;
  private class ClickableTreeCell extends TreeCell<String> {
    ClickableTreeCell() {
      setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
          // Handle double-clicks on non-empty cells:
          if (event.getClickCount()==2 && ! isEmpty()) {
            System.out.println("Mouse double-clicked on: " + getItem());
    @Override
    protected void updateItem(String item, boolean empty) {
      super.updateItem(item, empty);
      if (empty) {
        setText(null);
      } else {
        setText(item);

Similar Messages

  • How to trigger event when changing user status?

    hi,
    I'm having problems in triggering my workflow.
    In CIC0, When a status of a service request is changed to 'solution provided' then after saving service request, it should send a notification mail. I'm using ZBUS200116 which is deligated to BUS2000116. I've created event 'change' in ZBUS200116 which is in the start events of my workflow.
    I've tried creating an action profile which uses my workflow. The action profile is attached to the transaction but still it doesn't trigger my workflow.
    i've checked other existing workflows which uses the same object type BUS2000116 or ZBUS200116. These workflows were triggered by 'created' and 'completed' events only. Other added events in ZBUS200116 like 'changed' is not triggered. How is this possible when ZBUS200116 is deligated to BUS2000116?
    Your response would be highly appreciated.
    Thanks in advance.

    hi juan
    so here we are,now i got complete understanding of what u r doing and why
    you know you need not have created that change event because it wont serve your purpose anyway
    the reason is that because the way process in your workflow is flowing ,it wont happen that way using change event
    you just follow these  steps:
    1, use created event in your workflow
    2. that way when your contract ios created in rpocess status the event will be triggered only because you are creating a transaction whatever may be the status,so in all such cases you should use event created.
    3. now coming to the point of change in status or documents in contract
    in this case using loop will put you in deadlock and you will only be haing the error in such case
    you use WAIT step instead ,inside it use wait using conditions out of every option
    there you give your condition as change in whatever status
    like if you are chaning the status from in process to some other status ,put that status inside the condition
    as soon as that conditioon is met ,the WAIT step will be executed,
    that way you will be able to trigger the change in status through thje workflow
    so thats the solution with the approach you are using
    there are many approaches you can follow in workflows ,so depending upon that you can follow the different worlkflow tools u have there.
    also remember when your wait step gets executed there is always the time lag of 20-25 minutes after which changes will be reflected
    hope it will solve ur probs
    best regards
    ashish

  • How to get the alv grid report in another screen when double click on basic

    Hi.
    I have created an alv report using class cl_gui_alv_grid.I got another report in the same screen,when double clicked on basic list(using double_click event).I want to get this report in another screen.What i have to do?(In classical reports i worked with sy-lsind = 1 ,but how to do here?)
    How to set color to the selected rows in the alv grid report?I worked with change_data_from_inside method of cl_gui_alv_grid.But it didn't work out..
    With Regards,
    Ramana.

    On double click event . you will have to call another screen say 9000.
    now within screen 900 PBO.. you will have to prepare the fieldcatalog/layout.. and the table to be displayed there.
    in PAI of screen 9000, you can return to the original ALV.
    method double_click.
    call screen 9000.
    endmethod.
    " now in PBO create a module display_alv2
    module display_alv2.
    'prepare the fieldcat/layout info for new alv
    'add the data to the new ALV table
    'instantiate the grid call.. etc
    'call the ALV
    endmodule
    "in PAI
    module exit.
    case sy-ucomm.
    when 'ENT1'.
      leave to screen 0.
    endcase.
    endmodule
    while preparing the field catalog you can mention the EMPHASIZE field, whish will give color to tht column
    E.g
    *--Service Order
        ls_fieldcat-tabname   = 'IT_FINAL_VALID'.
        ls_fieldcat-fieldname = 'AUFNR'.
        ls_fieldcat-scrtext_m = 'Service Order'.
        ls_fieldcat-ref_table = 'AUFK'.
        ls_fieldcat-ref_field = 'AUFNR'.
        ls_fieldcat-col_pos   = 1.
        ls_fieldcat-outputlen = 12.
        ls_fieldcat-emphasize = 'C400'.  "This will add color to the cell
        APPEND ls_fieldcat TO fcat_valid.
    Hope this helps.

  • How does this happen: The picture of recent apps you get when double clicking the home button showed in Settings-Wifi that I had been connected to a network I have not been near for two months. Its not a recent "image" of Settings-Wifi. Can anyone explain

    How does this happen: The picture of recent apps you get when double clicking the home button showed in Settings-Wifi that I had been connected to a network I have not been near for two months. Its not a recent "image" of Settings-Wifi. Can anyone explain?

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • How to open each CS version file in its proper version program when double-clicked?

    Hello everyone,
    This one is about the coexistence of Indesign CS4 and CS5.
    In my company: I'm working with Indesign CS4, but a colleague is testing CS5 in real day-to-day works, and everyday I come across CS5 files that I need to correct, so I have CS5 installed too. Now, when I boot in the morning, and no Indesign program is open yet, whenever I double-click on an Indesign file, the system will open it with CS5, no matter if the file is CS4 or CS5. I find this quite annoying, of course. I want each version file to get open right away in the proper version of the program. I'd think this is happening to a lot of people, but I've been looking for the issue in the forums and haven't found anything.
    Of course I'm using roundabouts like having my colleague write "_CS5" at the end of each file, put CS4 in my startup items (so that once the program is open, the issue works the other way around and any Indesign file opens just in CS4 when double-clicked…).
    Also, all the Indesign files appear on the desktop as CS5 files
    I would welcome any ideas on the subject, thanks!

    Muchas gracias! really useful. I'm gonna try it.

  • Audio and video don't open together in viewer when double clicked

    Hello everyone!
    I'm having an annoying problem... it isn't something terribly important, but has decreased my work flow speed. Recently, I've had some trouble opening clips from the timeline in the viewer with the double click.
    If I double click the video portion of the clip, even if both the video and two audio tracks are highlighted (and are still linked) only the video portion of the clip will appear (along with "filters" and "motion" tabs) in the viewer, and similarly when double clicking the audio tracks, though both video and audio are highlighted, only the audio tracks and "Filters" tab show up in the viewer. Additionally, once the item is double clicked at the left with the jigsaw pieces that can be used to set video and audio destinations, if I've clicked on an audio portion so only audio shows up in the viewer, only the jigsaw pieces for the two audio tracks (a1, a2) are visible, video track (v1) is no longer present, and vice versa.
    I'd appreciate any advice that you all have! It's really driving me batty, in addition to not knowing what I did to make it that way, I can't figure out how to change it back!
    Heather

    Thanks for the advice.
    The clips already appeared to be linked, and the selection "link" was checked, however when I unlinked and then relinked I found that the audio and video would open up at the same time in the viewer... problem apparently solved! However, the clips I had been working with I had to nudge audio and video a few frames apart (out of sync) to get the audio and video to line up. (gives the little red box with a +or- number in it on the clip).
    When I unlinked and then relinked, the clip lost those red boxes and went back to being synced (as far as FCP is concerned) with the audio and video unaligned.
    So, the problem appears to be coming from when I move the audio and video of a clip out of sync... why is this? Is this something I'm just going to have to deal with?
    Thanks
    H

  • When Double-Clicking In CSS Panel missing in Dreamweaver CC 2014

    Hello,
    Please help me. I not have this option in Edit > Prefrences > CSS Styles > "When Double-Clicking In CSS Panel" in Dreamweaver CC 2014.
    How to show it
    I use windows 8.1

    Use the new CSS Designer Panel.
    Dreamweaver Help | CSS Designer panel
    Nancy O.

  • How to get event when app is minimized.

    How to get event when app is minimized in only windows app, not phone version.

    Hi,
    Suspending Event will be called when a windows store app is minimized. It will not hit the Suspending Event when minimised while debugging, So you need to trigger it manually from the VisualStudio Toolbar.
    Also Read
    Application Lifecycle for windows apps
    Pradeep AJ

  • How to get event when any library object added to indesign doc?

    I want to do some operation when any library object is added to doc. So please tell me how to get event when any library object is added to the doc. better provide some code snippet.

    Daves61,
    I need to clarify what kind of event you're interested in.
    1. When you click once on page/spead widget in the Pages panel and only widget becomes selected. The layout window remains unchanged. OR
    2. When you doubleclick on page/spread widget the selected master spread appears in the layout window.
    In the first case you work with Pages panel.
    Have a look to file PageTransitionsPanelObserver.cpp from SDK. 
    PageTransitionsPanelObserver::LazyUpdate()
    In the second case you work with Layout window.

  • Problem while displaying the data when double clicked on JTable element

    Hi All,
    i have one List box( JList ) and one table (JTable). Both JTable and JList are positioned on the same Frame. I am able to drag the elements from JList to JTable and also i have added the mouse click action on both List box and JTable.
    if i double click on JList element, that will popup one dialog box.
    if i double click on JTable cell element that was dragged from JList, that will popup same dialog box which was opened earlier for JList action.
    But my problem here is:
    Suppose if i drag the four elements one by one from JList to JTable and (after four elements dragged) double clicked the first element which was dragged first that displayed the popup dialog box structure correctly but the data displayed in that was not correct. It is showing the data of recent dragged element( i.e, fourth element).
    But if i double click on JList element that is showing the correct data according to the double clicked element.
    What might be the problem here, why it was not displaying the correct data when double clicked on JTable element.
    Please help me here.
    Many thanks in advance.
    The following code is used in mouse clicked event method of JList
    private void listMouseClicked(java.awt.event.MouseEvent evt) {                                              
             if(evt.getClickCount()==2){
             AssigningResourcesUI assignResource=new AssigningResourcesUI(this,true);
             assignResource.show();
    }                AND The following code is used in mouse click enevet method of JTable.
    private void tableMouseClicked(java.awt.event.MouseEvent evt) {                                          
            if(evt.getClickCount()==2){
             int row=table.rowAtPoint(new Point(evt.getX(), evt.getY()));
             int col=table.columnAtPoint(new Point(evt.getX(), evt.getY()));
             if(row==-1||col==-1){
                 return;
              Object obj=table.getModel().getValueAt(row, col);
             if(obj==null||(obj.equals(""))){
               }else{
             AssigningResourcesUI assignResource=new AssigningResourcesUI(this,true);
             assignResource.show();
         }            Thanks & Regards,
    Maadhav....
    Edited by: maadhav on Jul 1, 2009 7:22 AM

    I doubt it is related to your problem but:
    int row=table.rowAtPoint(new Point(evt.getX(), evt.getY()));Why are you creating a new Point? Just use evt.getPoint().
    Object obj=table.getModel().getValueAt(row, col);Don't get the data through the model method, get the data through the table method:
    Object obj = table.getValueAt(...)
    This way it will work even if the table happens to be sorted.
    Instead of creating a AssigningResourcesUI object, just disply the value retrieved from the model. That way you know whether the problem is with the mouse event code or your UI class. Like Walter suggested above I"m guess the problem is with your UI class.

  • When double clicking on alv ,want to get the column name

    Hello there,
        I'm displaying the value of internal table in an alv using Reuse_alv_grid_display method ,using fieldcatalog.I want to know the column name when double clicking on a particular line .If the the fieldname is 'MATNR' then i want to check that column name.
        If anybody have any idea plz terply me.
    Thanking you neon

    for that you have to use the USER_COMMAND event.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_USER_COMMAND      = 'USER_COMMAND'
       IT_FIELDCAT                       = it_fcat
      TABLES
        t_outtab                          = itab
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM USER_COMMAND using ucomm type sy-ucomm
                                                   selfield type slis_selfield.
    data: fieldname(30).
    case ucomm.
    when '&IC1'.
    case selfield-fieldname.
       when 'MATNR'.
        message 'clicked on Matnr' type 'I'.
       when 'POSNR'.
       endcase.
    endcase.
    ENDFORM.

  • IE Script error when double clicking on a view in Abap Webdynpro component

    Hello experts,
    I am running mini SAP trial version 2004 with Internet explorer 7.0 and also installed gui patch 23.
    I am making a sample application in SE80 and when double clicking on a view in Abap Webdynpro component I get following error:
    <b>Internet Explorer Script Error</b>
    An error has occured in the script on this page.
    Line: 1
    Char: 1
    Error: 'wdp_show_menu' is undefined
    Code: 0
    URL: http://satellite5200:8000/sap/bc/wdvd/painting.html?_vdrespkey=EOJ6V1JQMX0VLTQ7AP6DQM64Y&_vdframe=painting&sap-client=000
    Do you want to continue running scripts on this page?
    Thanks in advance.
    Bhupendra

    Hi Bhupendra,
       If you are seeing this error in the Se 80 editor , i guess you can ignoire that ...While running the application it will not show any error.
    Thanks
    Anzy

  • RH7 HTML - Receive IE script error message when double-clicking link to auto-size pop-up

    Hi, all,
    Anybody ever seen this situation? When double-clicking on a link to an auto-size pop-up, I get the following Internet Explorer script error message:
    This error also occurs when I double-click the link in preview mode within the project. A colleague that is running the same version of IE with the same settings is not receiving this error. A couple of other co-workers are running a different version of IE, and one gets this error and one does not.
    This error does not occur if you single-click the link (which you would normally do), nor does it occur if you double-click a link to a fixed-size pop-up. Once you receive this message and click Yes or No, the link sometimes works correctly when you double-click. I haven't been able to establish a pattern. Also, if you single click the link to display the pop-up, click off of it, and then double-click the link, the error does not occur.
    As you can tell by now, this problem is kind of hard to pin down. I've done some research and I have yet to stumble upon anything that deals with this issue. Unless there is a solution out there, I can do one of two things: 1) change all of the auto-size pop-ups in the project to fixed-sized, which defeats the purpose of creating auto-size pop-ups, or 2) tell our customer not to double-click links.
    Any advice you could give would be welcome.

    Hi there
    Indeed it has been reported on many occasions over the years. Unless someone like Willam has some way cool error detection magick with the scripts, the best approach we have always offered is this.
    Educate your users on the way computers and HTML works. HTML works using SINGLE clicks, not DOUBLE clicks.
    The reason for the error is because the first click caused the computer to launch a JavaScript command to open the sized popup. The second click that followed in rapid succession confused things by asking the script to stop what it was doing and run again.
    Maybe it would help to explain it to your users like this. If you visited a restaurant and when the server asked what you wanted to order, would the become confused if you said to them: I'll have the T-Bone Steak and nearly immediately you repeated it by saying again I'll have the T-Bone Steak.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • When double click itunes icon it shows " The file itunes library.itl can not be read because it was created by a newer version of itunes" so what can i do?

    when double click itunes icon it shows " The file itunes library.itl can not be read because it was created by a newer version of itunes" so what can i do?

    Unless you have attempted to downgrade to an older version of iTunes this is likely to be a sign of a corrupt library. See Empty/corrupt library after upgrade/crash.
    tt2

  • Excel cant find this file when double clicking to open

    Hi,
    Our Imacs 10.8.2 and 10.7.3 joined to windows 2008 domain cant open certain excel files from the network share. When double clicking the file or opening from excel -> file open it says it cant find the file. If I drag the file to the desktop then it will open when double clicked. I have tried disconnecting the network drive and reconnecting. I checked permissions and even tried a few cleaner products such as mac keeper and ccleaner and still the same issue. I even upgraded one of the macs from 10.6.8 to 10.7.3 and the issue persisted. Its very strange as some users can open but others cant. Any insight greatly appreciated.
    Thanks
    Lorne

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the ''Safe mode'' start window.
    You have to close and restart Firefox after each change via "File > Exit" (on Mac: "Firefox > Quit")

Maybe you are looking for