1 Reply Latest reply: Oct 16, 2012 11:24 AM by AutoVueAU RSS

    How to clear the mark-up listener queue


      I have this VueBean question is becoming a matter of urgency for us. I have raised it as SR 3-632147109, but it will definitely need answering by a developer so I thought you might be able to help.

      We have worked on a project that produces an output PDF with uniquely numbered comments. Since we could not set the font for the ‘Note X’ description, we decided to programmatically insert a text entity with the number close by the Note entity. We do this after communicating with a web service to save the comments data back in a SQL database.

      This has worked well, but the users are complaining about the amount of time to save the mark-up when they are working with a multi-page PDF file with 100 or so mark-up entities added.
      We use the markup listener to allow us to create the Note dialog automatically for entities that can have them as a child entity.

      Eventually the steps we use to save the mark-up are basically:

      1)     Unregister the mark-up listeners (we need these to detect when the user adds an entity so we can automatically add and display the note entity)
      2)     Call the web service to save the comments in the SQL database
      3)     Process the return details from the web service, programmatically adding text entities at the correct location
      4)     Call markupbean.saveMarkup()
      5)     Register the mark-up listener

      The issue we are seeing is that when the mark-up listener is registered in (5), the queue is full of all the mark-up event related to adding the note numbers (there are a set of markup events for each not number – 6, 6, 4, 3), and it takes 10 seconds to process all these events for 100 mark-up entities and complete the save.

      Is it possible to clear the mark-up listener queue prior to registering it again? We tried setBroadcast(false) but that does not appear to have an effect.

      Thanks in advance.

        • 1. Re: How to clear the mark-up listener queue
          The MarkupBean uses its own broadcaster (MarkupBroadcaster).
          The setBroadcast(boolean b) is available only in the VueEventBroadcaster.
          We may work on better solution to fix the issue.
          Probably the issue is not related to the number of notifications!. Try this workaround to confirm...!

          Workaround (I do not recommend to do this):
          - Save the current markup broadcaster : oldBroadcaster = getMarkupBean().getMarkupBroadcaster()'
          - Set an empty broadcaster (getMarkupBean().setMarkupBroadcaster(new MarkupBroadcaster())). All the listeners are copied into the new broadcaster
          - getMarkupBean().getMarkupBroadcaster().removeAllMarkupEventListeners(); // Remove the copied listeners
          - .../
          - Put back the old broadcaster (markup listeners).