Tree's DragSource changes at DragDrop event handler?

I try to drag a node A into node B. When the DragDrop event
handler is called, the dragSource is changed to the drop source?
I have declared the following:
<mx:Tree ......... dragDrop="OnDragDrop(event)"....../>
In the function:
private function OnDragDrop( event:DragEvent ):void
var ds:DragSource = event.dragSource;
items = new XML( ds.dataForFormat("treeItems")[0] );
I was expecting the "items" has a copy of the dragged item
(node A). However, it has all the drop node's info (node B). How do
I get teh drag and drop nodes in this event?
P.S. I am trying to drag and drop at the same tree control.
Could that be why? Is it suppose to be like this? Or, its a bug?
-Alan

Regarding your button look and feel issue, the easiest thing to do would be to copy the button template you are using for the template-based buttons and modify that to add in your onClick handlers.
The builtin button template for the theme I am using (Theme 12) looks like this
<table class="t10Button" cellspacing="0" cellpadding="0" border="0"  summary="">
    <tr>
        <td class="t10L"><img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /></td>
        <td class="t10C">#LABEL#</td>
        <td class="t10R"><img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" /></td>
    </tr>
</table>In other words, each button is rendered in its own HTML table.
Copy this button template, call it mybutton and have it look like
<table class="t10Button" cellspacing="0" cellpadding="0" border="0"  summary="">
    <tr>
        <td class="t10L"><img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /></td>
        <td class="t10C">#LABEL#</td>
        <td class="t10R"><img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" /></td>
    </tr>
</table>Notice that I put a no-op in the href tag for the button and added a onClick handler that will do the real work. In your case, you would use the URL Redirect on the Button attributes page to call your SavePage() function. Since the onClick is called before the href, it should (hopefully) do what you are looking for.
I put up these changes at
http://htmldb.oracle.com/pls/otn/f?p=24317:26
Do let us know.
Thanks

Similar Messages

  • Facing difficulties in dragdrop event handler while moving images from tilelist to canvas

    1) my tile list contains images which are coming from
    database.
    2) i have to drag and drop those images from tile list to
    canvas.
    3) In tile list we don't have to write mouseMove event
    handler where we can define dragInitiator . (if dragEnabled = true)
    4) my dragEnter and dragOver is working properly . Problem is
    in dragDrop .
    5 ) how can i collect there dragged image
    (event.draggedsource.....what must be write)
    ERROR : Cannot access a property or method of a null object
    reference

    import java.util.Timer;
    import java.util.TimerTask;
    public class Test {
        public static void main (String[] args) {
            final Timer timer = new Timer ();
            System.out.println ("I'm gonna do something in 5 seconds.");
            timer.schedule (new TimerTask () {
                public void run () {
                    System.out.println ("Time's up !");
                    timer.cancel ();
            }, 5000);
    }if you want to display the time left it's better to make your own Thread that updates a "timeleft variable:
    {code}
    public class Test {
    //set the time Left to 3 mins.
    private long secondsLeft = 3 * 60;
    public Test () {
    new Thread (new Runnable () {
    public void run () {
    try {
    while (secondsLeft > 0) {
    //Let's update the timer every second.
    Thread.sleep (1000);
    secondsLeft = secondsLeft - 1;
    System.out.println ("Time left: " + (secondsLeft / 60) + ":" + (secondsLeft % 60));
    System.out.println ("Grats !");
    } catch (InterruptedException e) {}
    }).start ();
    public static void main (String[] args) {
    new Test ();
    {code}

  • Can't reject drag/drop moves in event handler

    How does one reject a move from within the dragDrop event
    handler? I cannot figure out how to do this.
    I have dragMoveEnabled in the tree and I need to reject
    certain attempts like moving a 'folder' node to a certain node
    type.
    I can easily detect any combination of things that would
    constitute a rejection signal, but I can't seem to force the move
    to be canceled. I'm handling copies myself within the dragDrop
    handler, but I would like to let it do the moves for me since they
    are pretty simple and don't require any extra processing. I just
    need to cancel certain ones.
    anyone try this?

    update: changing the batteries on the wireless Logitech mouse slightly improved the situation--but not by much.
    update 2: when I swap in an old corded one-button Apple mouse, the problem disappears, which places the blame squarely on the wireless mouse. I should have thought of doing this before posting in this forum, sorry.
    Do wireless mice really lose it so abruptly like this? rats, I've gotten accustomed to those programmable buttons and the scroll wheel...

  • Unregister Event Handler OIM 11g

    Hi
    I have created a event handler and registered the same within OIM 11g. it gets executed as expected after create user (post process). next i changed some of the code within my custom event handler. and registered the plugin after i unregistered the old one. unfortunately i still see the old output in my logs
    i have purged the metadata chache, i have bounced the OIM but no luck..
    Are there any steps / checks i need to follow after i unregister the event handler.. and also plz confirm whether we need to follow all the steps of registration of event handler every time we make changes to the event handler class. uhhh.. its really time consuming when
    thanks
    shiv

    Hi,
    Please make sure you are shipping updated JAR files in plugin.zip and re-register.
    Follow below steps to re-register plugin,
    1.     Unregister plugin using below command
    ant -f pluginregistration.xml unregister
    2.     Prepare plugin.zip with updated JAR file.
    3.     register plugin using below command
    ant -f pluginregistration.xml register
    You do not need to restart OIM server after re-register and need not to import eventhandler.xml unless you change version of plugin.
    Also you can verify registered plugin details in plugin table with following query (Run on OIM DB),
    select * from plugins;
    Thanks,
    Pradeep.

  • Make asynchronous event handler as synchronous using Powershell

    Hi All,
    Using custom coding i am able to change the asynchronous event handle to synchronous.
    Can anybody let me know Is there any other way to change the same. Like Powershell script or any.
    Without deploying the solution i want to change the event handler type.
    Please advice.
    Thanks & Regards
    MD.Liakath ali

      
    Hi 
    you can use power shell to do so
    Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue 
    $web = Get-SPWeb -Identity http://...
    $list = $web.GetList($web.Url + "/Lists/" + “list name”) 
    $type = "ItemAdded" #or any other type, like ItemDeleting, ItemAdding, ItemUpdating, ... 
    $numberOfEventReceivers = $list.EventReceivers.Count 
    if ($numberOfEventReceivers -gt 0)
     for( $index = $numberOfEventReceivers -1; $index -gt -1; $index–-) {
        $receiver = $list.EventReceivers[$index] ;
        $name = $receiver.Name
        $typ = $receiver.Type ;
     if ($typ -eq $type)  #or you can check ($name -eq "event receiver's name") if you have more then one event receivers of the same type
        $receiver.Synchronization = "Synchronous"
        $receiver.Update()
        Write-Host "Event receiver " $name " is changed to Synchronous"
    else
        Write-Host " There is no EventReceiver of type " $type " registered for this list "
    $web.Dispose()
    or
    $list = (get-spweb http://sharepoint/sites/test).lists['somelist']
    $def = $list.EventReceivers.Add()
    $def.Assembly = "MyReceiverAssembly, Version=1.0.0.0, Culture=Neutral,PublicKeyToken=a00000000a000ce0"
    $def.Class = "MyReceiverAssembly.MyReceiverClass"
    $def.Type = [Microsoft.SharePoint.SPEventReceiverType]::ItemAdded
    $def.Name = "My ItemAdded Event Receiver";
    $def.Synchronization = [Microsoft.SharePoint.SPEventReceiverSynchronization]::Synchronous
    $def.Update()
    this should be done at each level where list is present.
    or you can Edit the Elements.xml file of the event receiver in(14 hive layouts/feature folder) and set the synchronization element as below..
    <Synchronization>Synchronous</Synchronization>
    Synchronous</Synchronization> https://naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/">https://naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/
    Regards,
    Rajendra Singh
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
    http://sharepointundefind.wordpress.com/

  • Event Handling for tree structure using "CL_GUI_ALV_TREE_SIMPLE"

    Hi,
    I have created a tree structure using class CL_GUI_ALV_TREE_SIMPLE.
    Now I wanted to insert a check and give message when the user opens the last node in my structure.
    I checked the events available in the class , but there in none which gets trigered when we try to open a node.
    Please guide me with this scenario.
    Thanks & Regards,
    Omkar M.

    Hello Omkar
    The solution is somewhat odd but apparently works. As sample report please check BCALV_TREE_SIMPLE_DEMO.
    Copy this report and make the following changes:
    class lcl_tree_event_receiver definition.
      public section.
        methods:
        on_expand_no_children " new event handler method
          for event expand_no_children of cl_gui_column_tree
            importing NODE_KEY,  " class = CL_GUI_COLUMN_TREE !!!
        on_add_hierarchy_node
                  for event on_add_hierarchy_node of cl_gui_alv_tree_simple
                        importing grouplevel
                                  index_outtab.
    endclass.
    CLASS lcl_tree_event_receiver IMPLEMENTATION.
      METHOD on_expand_no_children.
        BREAK-POINT.
      ENDMETHOD.                    "on_expand_no_children
    FORM register_events.
    * define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
      CALL METHOD tree1->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    * set Handler
      DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->on_add_hierarchy_node
                                                            FOR tree1.  " CL_GUI_ALV_TREE_SIMPLE
      SET HANDLER l_event_receiver->on_expand_no_children
                                              FOR ALL INSTANCES. " CL_GUI_COLUMN_TREE !!!
    ENDFORM.                               " register_events
    As soon as you open a node in the ALV tree the report will stop at the break-point.
    Now you need to check if there are still children nodes to be displayed.
    If not then trigger your special coding.
    Regards
      Uwe

  • JDEV 10.1.2 UIX Tree Event Handler

    Hi,
    I have built my tree bound to two ADF entities/views.
    It works fine in a small standalone application, but as soon as I try to integrate it with my main app it fails to call either the "null" or the "expand" event handler (null for page rendering and expand for... well expanding the node (see below))
    I've run it in debug and the event code just isn't getting fired
    There must be something in my main app that is intercepting the event handler before it gets to my uix handlers.
    New to all this so any help greatly appreciated!
    In summary, what would intercept default event handling in a uix page.
    Thanks
    Mark
    <handlers>
    <event name="expand">
    <method class="view.TreeUtils" method="doTreeEvent"/>
    </event>
    <event name="null">
    <method class="view.TreeUtils" method="doTreeEvent"/>
    </event>
    </handlers>

    Hi,
    it appears that if I change the forward to have 'redirect="true"' within the struts config file then this works fine now.
    Mark

  • OIM 11.1.1.5: Post Process Event Handler, change password notification

    Hi,
    Products
    OIM 11.1.1.5 BP02
    OAM 11.1.1.5
    OID 11.1.1.5
    Problem
    I have written a post-process event handler which fires when a role is assigned to a user. The event handler calls a plugin which uses the UserManager API to generate and change the user's password.
    I've tested this by assigning a role to the user via the OIM web console. I can see my log messages indicating that the event handler has fired and that the password has been changed.
    However, I expected that when UserManager.changePassword completed, a notification email would then be sent to the user informing them of the new password, but no notification email has been sent.
    The email notifications have been set up correctly, because I have changed the same user's password via the OIM web console and successfully received a Reset Password email.
    So, my questions are:
    1) Am I right in thinking that when you call UserManager.changePassword(), an out-of-the-box ResetPassword email notification should be sent to the user?
    2) Has anyone got this working in 11.1.1.5?
    Some more detailed info
    In my plugin class I'm calling the following from both execute methods (EventResult and BulkEventResult):
    char newpasswd[] = new RandomPasswordGeneratorImpl().generatePassword(user);
    getUserManager().changePassword(userKey, newpasswd, false, null, true);
    logger.info(("Successfully changed password"));
    plugin.xml
         <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
         <plugin
         pluginclass="oracle.iam.PostInsertPlugin"
         version="1.0"
         name="PostInsertPlugin">
         </plugin>
         </plugins>
         </oimplugins>
    $OIM_HOME/server/bin/weblogic.properties
              wls_servername = oim_server1
              app = OIMMetadata
              metadata_from_loc=/home/oracle/eventhandlers
              metadata_file=/metadata/roleuser/custom/EventHandlers.xml
    /home/oracle/eventhandlers/import/metadata/roleuser/custom/EventHandlers.xml
    <?xml version='1.0' encoding='utf-8'?>
    <eventhandlers
    xmlns="http://www.oracle.com/schema/oim/platform/kernel"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
    <action-handler
    class="oracle.iam.PostInsertPlugin"
    entity-type="RoleUser"
    operation="CREATE"
    name="PostInsertPlugin"
    stage="postprocess"
    order="1002"
    sync="TRUE"/>
    </eventhandlers>
    There are no errors in the OIM out and diagnostic logs apart from the following which occur at OIM startup:
    [2013-01-07T16:29:23.425+00:00] [oim_server1] [ERROR] [IAM-0080075] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '13' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 2e903d7ef060ab65:66b2de91:13c15d6d9ce:-8000-0000000000000002,0] [APP: oim#11.1.1.3.0] XML schema validation failed for XML /metadata/iam-features-OIMMigration/EventHandlers.xml and it will not be loaded by kernel.
    [2013-01-07T16:29:24.267+00:00] [oim_server1] [ERROR] [IAM-0080075] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '13' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 2e903d7ef060ab65:66b2de91:13c15d6d9ce:-8000-0000000000000002,0] [APP: oim#11.1.1.3.0] XML schema validation failed for XML /metadata/iam-features-callbacks/event_configuration/EventHandlers.xml and it will not be loaded by kernel.
    Thanks
    dty
    Edited by: oim_user on Jan 7, 2013 5:37 PM

    No notification will be sent if you changepassword using the method from usermanager api.
    You have to trigger the resetpassword event manullay in your code.
    Here is a sample code to create an event for reset password. Once you create event, invoke it from notification service - notify method.
    NotificationEvent event = new NotificationEvent();
    String[] receiverUserIds= {userLogin};
    event.setUserIds(receiverUserIds);
    event.setTemplateName("ResetPasswordNotification");
    event.setSender(null);
    HashMap<String, Object> resolvedData = new HashMap<String, Object>();
    resolvedData.put("userLoginId", userLogin);
    event.setParams(resolvedData);

  • Event handler for disclosureopenicon in tree in flex 4

    hi all,
              Is it possible to write event handler to disclosureopenicon for tree control in flex?
    if its possible means, h w can i write?

    Hi Ananth,
    You can do this by firing a Navigation event for Opening and closing of these tree nodes.
    Cheers,
    Jeevan

  • Action Event Handler on Tree nodes

    I have an actionListener event handler registered on a tree node as follows:
    <af:tree value="#{bindings.SomeViewObj1.treeModel}" var="node" rowSelection="none" id="t1"
    binding="#{EditFormBean.tree1}" displayRow="selected" summary="Tree"
    partialTriggers=":::cb1 :::cb2">
    <f:facet name="nodeStamp">
    <af:panelGroupLayout id="pgl3">
    <af:outputText value="#{node}" id="ot1"/>
    <af:commandImageLink text="E" id="cil3" partialSubmit="true"
    *actionListener="#{EditFormBean.onEdit}"* binding="#{EditFormBean.cmdImageLink}">
    <af:setPropertyListener from="#{node.hiertType.structureDefName}" type="action"
    to="#{viewScope.formView}"/>
    <f:attribute name="node" value="#{node}"/>
    </af:commandImageLink>
    <af:commandImageLink text="A" id="cil1"/>
    <af:commandImageLink text="D" id="cil2"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:tree>
    I have at each node stamp facet a panelGroup Layout that contains the node value and a command Image link. The tree has two hierarchical levels. When I press the command Image link on the first tree noe level, the actioListener method in teh managed bean (EditFormBean.onEdit) gets called. When I press the same commandImage link on the second tree level, the same action listener does not get called. I need to get past this problem before I code the actionListener which needs to set the current row in the iterator based on the key selected on the tree node. I simply have a print statement in the action listener method which shows something when the first level command image link is clicked but does not print anything when the second level command image link is clicked.
    I am using JDeveloper 11.1.2.1.0
    There is also adf faces code around this snippet that uses an af:switcher facea component to display the appropriate form based on the nodee level in which the comman d image link is clicled but it is irrelevant to the problem I am getting.
    Any help on that would be appreciated

    Hi,
    hard to say . Didn't see this before. Can yoiu remove "binding="#{EditFormBean.cmdImageLink}"" from the command link. The tree stamps its children so that it doesn't make sense to keep a handle to the component instance
    Frank

  • How to configure which changes in the document triggers Event Handler again

    Hi Experts
    Due to some reason after creation of Purchase Order, the event handler is not created in EM system. Now is there any way to resend this PO to EM? For example, is it possible to trigger Event Handler by changing some field in PO? If it is possible that way, Could you guide how to configure which changes in the document (PO/SO/Delivery/Shipment) can trigger Event Handler in EM system?
    Thanks
    Ravi

    Hello Ravi,
    if you change the PO Header/Item the respective EH  should be created if the Relevance condition is fullfilled.
    I'm not sure if it also works in the case that you change the PO Header and EH for PO Items will be created.
    Best regards,
    Steffen

  • Programmat​ic change in multicolum​n listbox value ignored by internal key event handler

    The attached LabVIEW 8.5 vi demonstrates a problem I noticed using multicolumn listboxes.  Upon changing the value (selected row) of the listbox programmatically, the very next press of the up or down arrow key behaves as if the value was never changed.  For example, if the 3rd row is selected and then the listbox value is changed programmatically via a local variable or the value property to select the 0th row, pressing the down arrow key should now select the 1st row, but instead the 4th row is selected.
    A workaround is to handle the Key Down? event myself as I've demonstrated in the attachment, but if this is a bug, I hope it can be corrected in a future release.
    Larry
    Attachments:
    MC Listbox Bug.vi ‏30 KB

    Hi Larry,
    Pnt is correct and this is a known bug and relates to how the current row/ active row is handled when changing the values programmatically.  Perhaps if you post your code we both can have a look and provide additional guidance.
    Alternatively this forum post is related to your work around for using the event handler.
    Regards,
    Rishi L
    National Instruments
    Applications Engineer

  • ALV Tree - Event Handler

    Hi All,
    I amd currently developing an ALV tree program to capture the hierarchy of functional location. I managed to display the hierarchy in ALV Tree using cl_gui_column_tree.
    Now, i am working on double clicking the functional location and it will bring me to tcode IL03. But, it seems like i cannot capture of the field value clicked. Below are my source code.  Can anyone pls help me on this? Thank you very much
    *&      Form  register_events
          text
    -->  p1        text
    <--  p2        text
    FORM register_events .
    Define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
      CALL METHOD gd_tree->get_registered_events
        IMPORTING
          events = lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      l_event-appl_event = 'X'.
      APPEND l_event TO lt_events.
      CALL METHOD gd_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.
      ENDIF.
    Set Handler
      DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->handle_item_double_click FOR gd_tree.
    ENDFORM.                    " register_events
    CLASS lcl_tree_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS handle_item_double_click
          FOR EVENT item_double_click OF cl_gui_alv_tree
          IMPORTING node_key
                    fieldname.
    ENDCLASS.                    "lcl_tree_event_receiver DEFINITION
    CLASS lcl_tree_event_receiver IMPLEMENTATION.
      METHOD handle_item_double_click.
        DATA: lt_selected_nodes TYPE lvc_nkey,
              lt_fieldname      TYPE lvc_fname.
    Determine which line is selected
        CALL METHOD gd_tree->get_selected_item
          IMPORTING
            e_selected_node = lt_selected_nodes
            e_fieldname     = lt_fieldname.
        CALL METHOD cl_gui_cfw=>flush.
        SET PARAMETER ID 'IFL' FIELD lt_fieldname.
        SET PARAMETER ID 'ISR' FIELD 'MOB01'.
        CALL TRANSACTION 'IL03' AND SKIP FIRST SCREEN.
      ENDMETHOD.                    "handle_item_double_click
    ENDCLASS.                    "lcl_tree_event_receiver IMPLEMENTATION

    Hello Goh
    Based on your coding you are using CL_GUI_ALV_TREE instead of CL_GUI_COLUMN_TREE.
    Calling method get_selected_item within your event handler method is unnecessary because these data are already provided by the event interface.
    [code]METHOD handle_item_double_click.
    DATA: lt_selected_nodes TYPE lvc_nkey,
    lt_fieldname TYPE lvc_fname.
    *$Comment: unnecessary because these data are already provided
    by the event interface (IMPORTING nodekey fieldname).
    Determine which line is selected
    **CALL METHOD gd_tree->get_selected_item
    **IMPORTING
    **e_selected_node = lt_selected_nodes
    **e_fieldname = lt_fieldname.
    ENDMETHOD. "handle_item_double_click[/code]
    The following sample is based in report BCALV_TREE_04 but can be simply applied to your application:
    [code]  METHOD handle_item_double_click.
      define local data
        DATA:
          ls_outtab     TYPE sflight.
        FIELD-SYMBOLS:
          <ld_fld>      TYPE ANY.
      Call this method to get the values of the selected tree line
        CALL METHOD g_alv_tree->get_outtab_line
          EXPORTING
            i_node_key     = node_key
          IMPORTING
            e_outtab_line  = ls_outtab
           E_NODE_TEXT    =
           et_item_layout =
           ES_NODE_LAYOUT =
          EXCEPTIONS
            node_not_found = 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.
        ASSIGN COMPONENT fieldname OF STRUCTURE ls_outtab TO <ld_fld>.
        IF ( <ld_fld> IS ASSIGNED ).
      ... Call transaction with selected (item) value.
        ENDIF.
      ENDMETHOD.                    "handle_item_double_click[/code]
    The ASSIGN statement will work if no item of the hierarchy part is selected.
    Regards
      Uwe

  • Event handling to listen directory file changes?

    I want to write a Java program that watches directories for changes. If there are any new files, or files are deleted in a directory, notify the user. I think this is a multi-thread program that watches files changes in specific directories. But I don't know what listener that the program should implements. please help!!

    There are no events that do what you ask (actually, there are native OS events in Win32 that do this, but I suspect that isn't what you are going for).
    You'll need to write your own event source for this (and hey, if you are feeling crazy, you could even create your own event type - FolderChangedEvent or such).
    Start a thread that wakes up periodically and checks the contents of a specified folder for changes. If there is a change, fire your event to any listeners.
    Now, how you actually define a change in a folder is an entirely different matter. It may be sufficient to calculate a CRC (or Adler32) on the modified date of all files in the folder, then compare that to a previous version to see if there has been a change.
    If you have to drop into sub-folders, you'll need to create a recursive call to do that.
    - K

  • Global event handler for preinitialize

    Is there anyway to add a global event handler on the
    components preinitialize event?
    What I need to do is to be able to enable / disable, and show
    / hide component dynamically based on a access list. My plan was to
    have a global event handler that listens to the preinitialize
    event, at that time, checks if the user has access to the component
    or not. If not, I'll disable / hide the component.
    What I did so far is:
    in my main app.mxml file, I have:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    preinitialize="preinit(event)"
    so the preinit() function is invoked on the app's
    preinitialize event.
    Then I have the preinit() function (see attached code below).
    However, it does work as there is no trace message printed.
    I changed to use KeyBoardEvent.KEY_DOWN and that seems
    working when I press any key.
    I also tried to use the app.stage.addEventListener() but the
    stage object is null in the preinitialize event.
    Thanks in advance for your help.

    Thank you for follow up on my question.
    I do know these two properties. But that does not solve the
    problem. Let me explain it with an example.
    That's say, when the user logs in, I loads the access list.
    Then the app displays a panel with some form entries. If I am able
    to register a global event listener for the component
    initialization events, I can check the permission and optionally
    hide some components. Otherwise, I would need to programmatically
    travels my component tree to evaluate each component individually
    to set there visible/includeInLayout properties, which is error
    prone.
    The problem is that the component is visible to one user but
    would be hidden to another, so it can not be set at the design
    time.
    The approach I am using right now is to extend the default
    components to add an event listener. But I'd like to know if it is
    possible to register a global event listener to be notified when
    any component is created. As my first post says, I tried to use the
    systemManager and listen to the PREINITIALIZE event, but that
    didn't get always get invoked.

Maybe you are looking for

  • 5 ghz versus 2.4 ghz

    Hi - When the Time Capsule wireless router is set to run on "n" draft at 5 gigahertz is the 5 merely with regard to the frequency or does it also indicate improved speed and range over 2.4? My friend's unit keeps disconnecting when it is set to 5, an

  • Premiere Pro CC 2014 Crashing and Bogging Down on Documentary Film Project

    We have been working in Premiere on this documentary film for months. As we reach completion it is beginning to really bog down and crash a lot. Equipment is iMac 27 inch 3.5 GHz Intel Core i7 Late 2013 Model Apple Cinema HD Display 32 GB 1600 Mhz DD

  • P6 Predecessors & Successors - Display Activity Name in Gantt Chart column

    Is there a way to include the full text description of predecessors and successors (i.e. Activity Name) in a column in Gantt charts rather than just their Activity ID?

  • FLASH PROBLEM IN N73

    hello guyz.howz the day? well i have a serious problem with my N73, when i record any video my flash comes on. and i tried every thing to turn it off but nothing happened. and it surely consuming my battery life too. plzzz can any one let me know how

  • Battling Hardware MPE, Episode 2: Chunky Blurs

    Round Two of my hardware acceleration MPE tests... When using direct export with hardware MPE, any effect that renders a blurred alpha channel (Fast Blur, Gaussian Blur, etc.) creates an extremely ugly/chunky/unusable result. The source footage and s