Sharing Events/Handlers for Tree and List

I have a Tree component and a List component that both share
very similar functionality. In particular, I have setup
functionality to edit the labels in each component only when I
trigger a custom event from a ContextMenu, preventing the default
action of editing the item when it is selected.
Since Tree extends List, I was wondering if there was some
easy way to make a Class/Component that could contain all the logic
for this functionality that could be shared across Tree and List
(or any List-based) components.
I'm basically trying to avoid duplicating code.
Any thoughts/suggestions?
Thanks!

"ericbelair" <[email protected]> wrote in
message
news:ga8h3q$9pn$[email protected]..
>I have a Tree component and a List component that both
share very similar
> functionality. In particular, I have setup functionality
to edit the
> labels in
> each component only when I trigger a custom event from a
ContextMenu,
> preventing the default action of editing the item when
it is selected.
>
> Since Tree extends List, I was wondering if there was
some easy way to
> make a
> Class/Component that could contain all the logic for
this functionality
> that
> could be shared across Tree and List (or any List-based)
components.
>
> I'm basically trying to avoid duplicating code.
>
> Any thoughts/suggestions?
I think what you're looking for is called "monkey patching",
which involves
putting a file of the same name and directory structure in
your project as
the original was in the Framework. I don't know much more
about it than
that, though.

Similar Messages

  • How to remove event handlers for a content type currently in use?

    Hi,
    We had a SP 2007 solution that managed event handlers as described in
    Brian Wilson's blog regarding event handlers. We then did a in-place upgrade to SP 2010. It so happend that we wanted to remove some of our old event handlers and this is where our problem started. We managed to delete event handlers
    (SPEventReceiverDefinitions) for
    Site and List by using the ui from Brian Wilsons feature "Manage Event Handlers" (ref the link above), but not anyone at all for
    Content Types... It simply wouldn't be deleted
    (remove was grayed out in the ui). 
    We then tried to do it by code. Below is a code snippet illustrating how we tried to delete the event handlers for content types:
    using (SPWeb web = properties.Feature.Parent as SPWeb)
    string targetClassName = "targetClassName.";
    web.AllowUnsafeUpdates = true;
    // Removing Content Type event handlers
    foreach (SPContentType ct in web.ContentTypes)
    for (int i = ct.EventReceivers.Count - 1; i >= 0; i--)
    if (ct.EventReceivers[i].Class.StartsWith(targetClassName))
    ct.EventReceivers[i].Delete();
    ct.Update(true);
    web.Update();
    The Content Types are not sealed and are
    not readonly. When debugging, we can see that the
    Delete() method are called on one of the Content Types we wanted to delete event handlers for. We noted that the
    ct.EventReceivers.Count remains the same, before and after Delete() is called. We did not get any exceptions when running this code.
    When running the code a second time and debugging again, we see that the very same Content Type still has the very same event handler attached... As in, it wasn't deleted....
    We also tried to delete the event handlers through PowerShell as described
    here in the post by Per Jakobsen. However, the script did not really seem to find any EventReceivers... We tried to write the
    $site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} | % {$_.EventReceivers} list to file, but it was empty.. We did however get a long list when writing $site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} to file. We could then in
    that file see the event handler references we want to remove registered to our Content Types, as we did during code debugging earlier on. So PowerShell might still be the way to go here...
    So, does anyone know if there is a way to force this delete through, either by code, PowerShell or some other means? Any help regarding this matter would be very much appreciated :)

    Hi,
    For your information, there's two versions (at least) exists for each content types. One is Site Content Type - exists in Root web and another is list content type. Once you add a content type to a list, a copy of the site content type is taken and stored
    in the list. If you update the site content type, it may or may not affect the list conten type. So make sure you are updating the both - site content and list content type. Once you update site content type with passing paramater true to 'ct.Update(true)',
    the list content types are supposed to updated too.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Event handlers for backbutton

    Hi,
    I want perform some validations when I press back button.how to find event handlers for back button,because F2
    is not giving full info for back button.
    Regards,
    Brahmaji

    Hi,
    the back button is always part of toolbar buttons.
    So you can open the view controller class and open the GET_TOOLBAR_BUTTONS method from that class.
    In this method you see how the BACK button is defined. One of the attribute of button structure is ON_CLICK.
    The value of this attribute should be the event name that is triggered when the button is clicked.
    Now open the DO_HANDLE_EVENT method from the view controller class, you will have methods with prefix EH_ON
    after the prefix you see the event name. If you find one that mached to the event name of the BACK button, then this is the event handler that is triggered by the BACK button.
    Regards,
    Steve

  • SP2013 Remote Event Receivers for Office365 and Custom Web Service

    Hello I'm starting to work with remote event receivers for Office365 and I read that the RERs runs only as Provider-Hosted or Auto-Hosted Apps, so If I wanted to implement for example prevent to the user add items to some list, my question is : 
    is it needed an account in a  platform cloud like Azure(to support .net apps) or have a custom server like IIS(with public IP, dns) in order to hosting my WFC service and to be able to manage the events registered into office365 ? or exist another option
    to achieve this goal(prevent to users perform some actions) ? please, can you help me to clarify this ?....

    Hi,
    The following articles would be helpful:
    Deploying SP2013 provider-hosted apps/Remote Event Receivers to Azure Websites (for Office 365 apps)
    http://www.sharepointnutsandbolts.com/2013/07/deploying-sp2013-provider-hosted.html
    Remote Event Receiver (RER) for Host Web using SharePoint Provider Hosted App in Office 365/SharePoint Online Environment
    http://blog.kloud.com.au/2014/03/13/remote-event-receiver-rer-for-host-web-using-sharepoint-provider-hosted-app-in-office-365sharepoint-online-environment/
    About Office 365 questions, you can also post it to Office 365 Forum, you will get more help and confirmed answers from there.
    http://community.office365.com/en-us/forums/default.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Shared home folder for OSX and Windows

    Hello,
    I am wondering if it is possible to have a shared home folder for Windows and OSX.
    We have an AD and ODS. Is this possible, if it is, using CIFS?
    Hope hearing from anyone
    Best Regards.

    hallo victor,
    thanks for your answer. unfortunately this does not solve my problem. my sap landscape is more complex.
    there are several sap installations in diverent windows domains and some are on as/400 (and there is another windows domain) all are in different networks and are protected by firewall. furthermore there is a rule (maybe some exceptions are allowed) that there must not be qntc connections over these firewalls.
    with a shared folder between a windows workstation in one network and an as/400 in another network it works fine. but as a mentioned first - there is the problem with the sapservice<sid> userid which is to long for as/400 environment. I think there must be a tricky solution (hope so).
    kind regards
    helmut

  • Ap Store shows update for DropCopy and lists it as installed yet it will no clear my updates page in my account.

    Ap Store shows update for DropCopy and lists it as installed yet it will not clear the updates page in my account. How do I clear this?

    I tried the debug mode in mac app store too >> Fail.
    The first time I feel disapointing from apple software.

  • Multiple event handlers for one button

    I'm trying to create a button with 2 event handlers, such
    that when you roll-over the button, a submenu pops up, and when you
    click the button, you go to a certain frame. I feel like this
    shouldn't be hard at all, but it's not working. Below is the
    actionscript I have tried. Both event handlers work as I want them
    to if alone, but the on(release) functionality does not work when I
    try to put them together.(I have Flash 8). Thanks for your help!
    on (release) {
    _root.gotoAndStop("one1");
    tellTarget (_root.navigation) {
    gotoAndStop (1);
    on (rollOver) {
    this.gotoAndPlay("links");
    tellTarget (_root.navigation.introduction) {
    gotoAndStop (1);
    tellTarget (_root.navigation.overview) {
    gotoAndStop (16);
    tellTarget (_root.navigation.coronary) {
    gotoAndStop (1);

    this code is ok, it seems that when u rollover on the button,
    the event is fired and it keeps on running the time u r on it. i
    think just add
    delete this.onRollOver inside rollOver event.

  • SDK 3.4 - Tree and List rollover update flicker

    I have a rollover issue with items in a tree or list.  When the item is rolled over in a tree or list, an update to that item is made from our server.  It seems that the update causes the rollover indication to disappear.  It's like the item is being redrawn.  Is there a way to disable the item invalidation?  Is this a bug with my sdk?
    I also have a button on the item renderer that disappears too.  It is added and removed in commit properties, since it extends TreeItemRenderer and it's displayed over the icon.  Since the icon is added and removed in commitProperties, the button has to be added and removed in commitProperties to keep it's child index above the icon.

    Here is some code.  Notice when you rollover, the highlight goes away.
    Test.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"
                         height="100%" width="100%">
         <mx:List
              dataProvider="{dp}"
              itemRollOver="onRollover()"
              labelField="label"
              height="100%"
              width="100%"/>
         <mx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   [Bindable]
                   public var dp:ArrayCollection = new ArrayCollection([new Asset(), new Asset()]);
                   protected function onRollover():void {
                             for each(var item:Object in dp)
                                  if(item is Asset)
                                       Asset(item).name += "test";
              ]]>
         </mx:Script>
    </mx:Application>
    And Asset.as:
    package
         [Bindable]
         public class Asset
              public function Asset()
              public var name:String = "test";
              public var label:String = "test";

  • Event Handlers for Dynamic Buttons

    Hi, I hope someone can help. I just can't figure out how to
    solve this problem:
    I am creating an number of buttons dynamically that
    correspond each to a filename read from a directory. The problem is
    I don't know ahead of time how many buttons (files) I will have so
    I create them dynamically in action script. -- this much I can do.
    What I can't figure out is how do I assign each of these
    dynamically created buttons individually specific event handlers?
    ie. I need to know which file icon you clicked on and then take
    action based on that info.
    for example: "folder" is a button icon I have linked from my
    library - i name each instance "folder"+i -- what I need to do is
    do something for folder1, folder2 etc.
    for (i=1;i<numdirs;i++) {
    graphics.attachMovie("folder","folder"+i,depth);
    graphics["folder"+i]._y= coordy2;
    // want to put an event handler here for each
    graphics["folder"+i] button
    I wanted to do something like:
    graphics["folder"+i].onRelease = function() {
    test_txt.text = i;
    but each button I click on gives me i= numdirs (ie the max
    number -- for example 6 if there are 6 files, I can't identify
    which button you actually clicked on -- button1 through 6 all
    deliver the number 6 to test_txt.text)
    I hope that makes sense - if someone can take a swag at this
    and point me in the right direction I will be very appreciative.
    Best Regards,
    Tom

    There is other way to do that.. whenever you call a
    attachMovie or loadMovie
    function there is a return value that corresponds to the
    actual movieclip
    created on the flash movie. ie
    for (i=1;i<numdirs;i++) {
    var temp_mc:MovieClip =
    graphics.attachMovie("folder","folder"+i,depth);
    that new reference temp_mc is the newly created movieclip and
    you can do
    whatever you want with it, ie:
    for (i=1;i<numdirs;i++) {
    var temp_mc:MovieClip =
    graphics.attachMovie("folder","folder"+i,depth);
    temp_mc._y = 30
    temp_mc.id = I
    //even assign new funtions to events
    temp_mc.onRelease = releaseFunction
    function releaseFunction(){
    trace("do something on the release event")
    <DIV>&quot;charmcityMD&quot;
    &lt;[email protected]&gt; wrote in
    message
    news:ed2l97$n8$[email protected]..</DIV>> THANK YOU
    soo
    much -- I have been pondering this and scanning the web for
    hours. Your
    solution is perfect. I very very much appreciate your help.
    >
    > Best Regards,
    > Tom

  • How can I create events dynamic for a Group/List?

    Hey,
    atm I'm programming a little application where i want to add elements to my center-pane.
    Simpyfied I got:
    - Center Pane : here shall the elements appear on right click in bottom-pane. This pane shall be used as anything like a playground where you can drag/drop and connect items from the bottom-pane
    - Bottom Pane: here I got about 180 elements which are quite equal. This is sth like a menu of items which you can use. I realised them in java classes extended from a parent class with differend calulations.
    What I want:
    I want to create an event handler for EACH of the "menu" elements dynamically. Just sth like:
        for (int i = 0; i < basic_menu_list.size(); i++)
          final Element el = hbox_bottom.getChildren().get(i);
          hbox_bottom.getChildren().get(i).setOnMouseClicked(new EventHandler<MouseEvent>()
            public void handle(MouseEvent event)
              if (event.isSecondaryButtonDown())
                playground.add(el);
                redrawPlayground();
        }But as i expected this doesnt work...
    Now my question:
    How can I solve this problem? Is there any option to listen to all elements of a group without hard-coding every single listener?
    Thanks for your help,
    Martin

    Hello User,
    Why did you expect that it wouldn't work?
    You have an example with "transition" apply on a bunch of circles in the Getting Started with JavaFx (http://download.oracle.com/javafx/2.0/get_started/jfxpub-get_started.htm)
    Here a basic example class...
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.TextBox;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.Pane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class HelloWorld extends Application {
        //~ ----------------------------------------------------------------------------------------------------------------
        //~ Methods
        //~ ----------------------------------------------------------------------------------------------------------------
        public static void main(String[] args) {
            // Entry point
            Application.launch(args);
        @Override
        public void start(Stage mainStage) throws Exception {
            Pane pane = new Pane();
            Scene scene = new Scene(pane, 200, 200);
            VBox vBox = new VBox();
            TextBox input1 = new TextBox();
            TextBox input2 = new TextBox();
            vBox.getChildren().addAll(input1, input2);
            for (Node input : vBox.getChildren()) {
                input.setOnMouseClicked(new EventHandler<MouseEvent>() {
                        public void handle(MouseEvent event) {
                            System.out.println("test click");
            pane.getChildren().add(vBox);
            mainStage.setScene(scene);
            mainStage.setVisible(true);
    }Niculaiu

  • Photoshop cc enhanced scripting for tree and picture frame patterns

    the flame, tree and picture frame patterns are missing my drop down box in the fill window. They are in the
    Deco folder, as is symmetry fill, all with javascript extensions, but symmetry fill is the only one that shows in my drop down menu. Can anyone help me fix this?

    Hi Kmjc,
    If you are using the Photoshop CC 2014 version, you need to click on the filter menu and choose render and you will be able to see Flame, Picture frame and Tree options.
    Thank you for posting on Adobe Forums.

  • Where to register event handlers for a content type

    Hello,
    I'm developing a feature that creates site columns, content types, event receivers (class libraries) and binds all together - everything using code and not xml.  The web application should have 1 site collection and several hundreads sites. 
    For example:
    field1 = web.createtextfield(...); spcontenttype ct = web.createNewContenttype(...); ct.FieldLinks.Add(field1);
    I have a question about binding the event receivers: Should this be done in site collection level or it should be done for every subsite?
    the code is:                  
    string evClass = typeof(SampleEvReceiver).FullName;string evAssembly = typeof(SampleEvReceiver).Assembly.FullName; RegisterEventHandler(currentCT, "Content Type Event Receiver", 1010, evAssembly, evClass, SPEventReceiverType.ItemUpdated); //my function.
    Also, I've put the event receivers in a different project - i.e. different dll. The idea is to change the event receivers's code, copy the dll file to the gac, iisreset and have the new code running. Is this correct?
    Thank you
    Christos

    Hi Christos,
    1. This should be done in site collection level.
    2. This is correct and Restart Timer Service if as need.
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Defining event handlers for renaming, moving, copying and deleting of files.

    Hi every one.
    I had created a tool for InDesign CS6 written using Javascript to manipulate portions of text in nested way by marking them with small non-printing small anchored text frames contains sequenced numbers and storing these portions as snippets in a spicific folder beside the InDesign documents.
    This tool is open source and free of charge, the only this that I want from you (after downloading) as a user to feedback and as a developer to improve it and join me.
    sourceforge.net/projects/livesnippets
    My question is not about this but I want to trace when the user rename, move, copy or delete a file of these snippets or any container folder and interact according to that by reserving the links between snippet files and their instances which interspersed in InDesign documents.
    Thanks.

    Here is an example of using Bridge events… What this scrript will do if you add it to Bridge scripts… is set *all* indesign snippets in the folders you browse to… to be locked/readonly… This means that users will get an extra dialog if they want to delete the file… Finder or Bridge… You can't just rename the file Finder or Bridge… and Bridge's Batch Rename will only function if the user makes copies to new location… You could set this property using the File Object with indesign…
    #target bridge
    onDocLoaded = function( event ) {
        if ( event.object instanceof Document && event.type == 'loaded' ) {
            lockIDSnippets();
            return { handled: true };
    function lockIDSnippets() {
        var i, count, doc, thum;
        doc = app.document;
        count = doc.visibleThumbnailsLength;
        for ( var i = 0; i < count; i++ ) {
            thum = doc.visibleThumbnails[i];
            if ( /\.idms/.test( thum.spec.name ) ) {
                thum.spec.readonly = true;
    // Register event handler
    app.eventHandlers.push( { handler: onDocLoaded } );

  • 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

  • Who to use "xfa.event.newText" for value and not text

    Hello,
    What is the righr method for returning the value from a "list".
    xfa.event.newText return's the texte value i want le value.
    exemple :
    Text = USA  Value=us
    Text=France Value=fr
    Thanks

    Hi,
    A sample is here: https://acrobat.com/#d=eBF-l8sBTVN6-jqDUDw6lA
    It shows how to access the display value and the bound value.
    Good luck,
    Niall

Maybe you are looking for

  • Ds in bw 3.0

    Hi created new ds in r/3 and want get in bw. replicate source system will bring in BI 7.0 use rsds

  • Is it Possible to 'Re-view' a Report?

    I see the ease of 'Re-running' something in the history, but can I 'Re-view' a report or result for which the result window was closed. Thanks.

  • Audigy 4, difficulty with 24/96 ASIO recording

    I just purchased an Audigy 4 (SB0610, not Pro) with the intention of using it fir 24-bit recording with n-Track Studio (24-bit). When I'm in n-Track and select the Audigy 4 24/96 ASIO [D000] drivers, I can only get input from the left side of the lin

  • Importing a dump into Oracle...

    I have a dump file (*.dmp) from an Oracle database. How do I import it into my Oracle database? The tables are alll created in my Oracle database. The import utility only seems to import from XML or Excel files. I have the Oracle Database 10g Express

  • Compressor is going to take 19 hrs??

    I know I don't have the best system, but to convert 40 minutes of Apple ProRes 422 for HD on Vimeo is going to take 19 hours? This seems unreal.