Any way to modify document safely?

If you extend AbstractDocument (at some level), and you want to write a method that does a whole lot of operations on a document at once...like cutting, pasting, changing attributes, etc.. in one method call, is there ANY way to be able to do this safely (without the chance of another thread changing the document while you're working on it.)
You can't use readLock() obviously, you also can't use writeLock() since all the lower level methods (that you DEPEND on) also use writeLock() before modifying the document, and calling writeLock() from a thread that already has the lock throws an exception.
You can't control all edit paths since you don't have access to the undo stuff, otherwise you could add your own level of locks.
Why in the world was AbstractDocument designed this way? It makes it virtually useless to extend it for functionality since all the functionality is effectively confined in AbstractDocument.

Why "obviously"? The JavaDoc says:
@exception IllegalStateException thrown on illegal lock
attempt. If the document is implemented properly, this can
only happen if a document listener attempts to mutate the
document. This situation violates the bean event model
where order of delivery is not guaranteed and all listeners
should be notified before further mutations are allowed.
So if you're getting the exception, you're doing it wrong.

Similar Messages

  • Any way to modify an app to another sort of readable (not from ipod/ipad) document?

    i downloaded an app - it's a shopping guide i wrote - is there any way to change the file type so that i can view it as a pdf or any other sort of readable (not from ipod/ipad) document?

    No, that is not possible. If you wrote the app, though, then you have all the content. You'll need to take that content and assemble it into a document which you can then turn into a PDF. You might want to consider recasting your app as an iBook. With iBooks Author you can create interactive books as well as PDFs of the same content.
    Regards.
    Message was edited by: varjak paw

  • Is there any way to print document pages according to their master?

    I have a large document with multiple master pages in use. At different instances I often need to print only document pages that are "A" Master, "B" master, etc. Is there any way to do this, rather than entering the page numbers manually?

    Might be scriptable. Ask over in InDesign Scripting

  • [bug tracker issue] Any way to modify the bug detail of mine?

    Greetings,
    I just found i can't modify the bug report  after i reported a new bug in the bug tracker of archlinux.
    it is quite inconvent and weird, since it's quite common that you want to update the bug detail or change something wrong. 
    at least , in my opinion. -_-
    so Is any reason for such restirction?
    and is any way to make me modify my bug report?
    -Roadt
    Last edited by roadt (2009-12-28 06:55:52)

    Just add  your update as a comment.

  • Is there any way to display document page numbers and section page numbers at the same time?

    Hi, I have different sections within my document starting the page numbering at 1. Besides the section page numbers I would also like to display the actual document page numbers in the header (eg. you are on page 10 of the document and page 4 of the section). Is there any way to do that? Thanks

    You can maybe use the Find/Change
    Command+i
    See if that can work for you.
    But like Steve said it is good practice to use Paragraph Style whenever you have lots of Type, I just get lazy sometimes.. lol
    Thanks

  • TS4123 Is there any way to modify Bonjour to work with other LSP?

    I'm having the problem pointed here http://support.apple.com/kb/TS4123 and the cause is a proxy software I use. It's a program I use every day and I cannot just disable it, is there any workaround to this? Any way to fix Bonjour instead? I really don't see why other companies must adapt their software to be compatible with iTunes and not the other way around.

    Not at present. It is built to use the frameworks of OS X.
    You could have both running on an Intel-based Mac with Parallels Desktop virtualization, but I don't think that's what you're looking for. Would you consider switching to OS X completely?

  • Any way to modify headers/footers added to reply/forwarded messages?

    Is there any way to change or eliminate the standard headers and footers that Mail adds to replies and forwarded messages (i.e. "on 11/30 name.com wrote" on replies; "begin forwarded message" on forwarded messages)?

    There is not a setting to do it. You can delete them in the message though.

  • Any Way to modify a users Library / Font as admin?

    The Users account Takes around 25-45 minutes to login...
    Im sure that the user has multiple Corrupt fonts and need to replace all of them with known good fonts.
    After the log in window the Desktop Background Image shows the Blue Spot light icon show up but noting else loads.. for around 25-45 minutes...
    Working at a News Paper the User has 1345 font's under her user account... While we only use around 500 fonts normally..
    using any other account login takes around 15 seconds or so.
    Should I try Safe mode and Nuke her fonts that way.. Or is it possible for me to modify her library font file form my admin account?
    Thanks

    Open the Terminal in the /Applications/Utilities/ folder and run the following:
    sudo mv /path1/ /path2/
    where path1 is the current location of the folder or file targeted and path2 is the desired location of it. This command will prompt for the administrator password, which won't produce anything in the Terminal.
    (35583)

  • Any way of modify base directory at runtime (in loaded jars )?

    Hello all,
    Well, I'm using tomcat to run my web application, which loads
    dinamically many jars and execute them. My problem is that these jars
    sometimes have a method that uses relative paths to do something (read
    files, create files, etc). Currently, the current base dir is given
    wrong for these loaded applications! Instead of the right path, it's
    given "C:\tomcat" or something.
    If it were with my Web Application itself, it would be easy to get over
    this problem by using the getRealPath("") method provided by api. But
    since I can't modify the jar code I will load, what can I do? Some
    ideas?
    Thanks you!
    Bruno

    I have found the solution. This is the code to write-access files from within JavaServer Faces backing bean:
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    ServletContext sc = (ServletContext) ec.getContext();
    String realPath = sc.getRealPath(getDocumentURI());
    FileOutputStream fos = new FileOutputStream(realPath);where getDocumentURI() is the method that returns the virtual path for document to write to.

  • Is there any way to modify the photo book size after I have created the book?

    I created a photo book then realized it was not the correct size. Is there a way to correct the size or do I have to start from scratch?
    I Found the answer after I posted this- CTRL D to duplicate, then choose new theme - Worked like a charm.

    Yes.  First click on the book in the Projects section and type Command +D (duplicate).  Open the book, click on Change Themes and in the next window select the size and type you want.
    The duplicate is to have in case you find any text that was removed in the resizing.  You can cut and past from the duplicate copy to the original.  Also verify that the resized book has all of its text, not text warning indicators and that all photos are there and in the correct order.
    Always create a PDF version of the book according to this Apple doucment, iPhoto, Aperture: Previewing an order in iPhoto or Aperture, to check for any errors, i.e. typos, missing text, etc., before ordering the book.  Keep the pdf file to compare with the printed version when it arrives.
    Opps!  Answered your question from the title without reading the full body of your post. However, the last 2 paragraphs are worth reviewing.
    OT
    Message was edited by: Old Toad

  • Any way to preview document for web at 72dpi?

    I do mostly work for print, but today was asked to save a web graphic created by one of our designers in InDesign. Unfortunately, our designer created something that looks good on screen, but when saved to a png or jpeg, is completely unusable (type too small, unreadable). The file was created at the proper dimensions (95px x 150px), but since he only viewed it @ high resolution on screen and printout, and didn't view it @ the actual pixel dimensions, we now have to completely recreate this job.
    Is there a way to preview the current document in InDesign on screen at a specific resolution, so that he will know what the final product will look like without having to export it?

    If you are using CS6 choose web intent when you create a new document and set the Page Dimension to the desired pixel dimensions. Then double click the Magnifier tool to set the view to a 1:1 screen to pixel ratio.
    If you are using an earlier version set your rulers to pixels or points and set the view at 100%

  • Is there any way to use -useLegacyAOT option in FlashBuilder 4.6?

    I need to build my ipa with old version of Engine because i have some problems about loading images from outside. Since with Air 15 it is default engine, and i cannot quit Air 15 because of the iTunes specs. I cannot add -useLegacyAOT=yes to compiler options on Adobe Flash Builder 4.6 because it seems that it can be added at FB4.7.
    So is there any way to add this options when i am using FB4.6
    Thanks in advance.

    DeepakJ wrote:
    Hi,
    Is there any way to use a control break on Dept column in a SQL query to have a Output-2 instead of Output-1.
    Is there any way to modify the SQL query.
    SQL
    select dept, loc, count(*)
    from dept
    group by dept, locOutput-1
    Dept      Loc       Count(*)
    10         AA        1
    10         BB        2
    10         CC        2
    20         AA        2
    20         BB        2Output-2
    Dept      Loc       Count(*)
    10         AA        1
    BB        2
    CC        2
    20         AA        2
    BB        2
    Yes, using the <tt>lag</tt> analytic function and specified ordering of the data:
    select
        nullif(d.deptno, lag(d.deptno) over (order by d.deptno, d.loc, e.mgr nulls first)) deptno
      , nullif(d.loc, lag(d.loc) over (order by d.deptno, d.loc, e.mgr nulls first)) loc
      , e.mgr
      , count(*) n
    from
        dept d
          join emp e
            on d.deptno = e.deptno
    group by
        d.deptno
      , d.loc
      , e.mgr
    order by
        d.deptno
      , d.loc
      , e.mgr nulls first;
    DEPTNO  LOC       MGR   N
        10  NEW YORK         1
                      7782   1
                      7839   1
        20  DALLAS    7566   2
                      7788   1
                      7839   1
        30  CHICAGO   7698   4
                      7839   1
        40  BOSTON    7698   2
                      7902   1

  • Any way to get more than 100% zoom on print jobs when printing multiple pages?

    I know how to increase the size of a print job, when I am printing one page at a time. But when I go to print 2 pages at once (the multiple page print function), there are always large margins around the page. I'm ok with saving paper and printing up two pages, but it seems silly to see small print and wide blank margins. Is there any way to increase the print zoom, when printing multiple pages per sheet of paper?

    I once overshot the limit by marking too many photos to fit within 99 pages, but I could never figure out how to fool the application and had to give up trying to add those 14 extra photos.
    I asked a friend (who practically lives in Terminal) if he had any way of modifying that limit, but he reminded me that if their printing services are set up to bind books and bill for only 99 pages, fooling the application might be useless if the service only prints me a 99 page book and discards the additional pages.
    I can understand that you wouldn't want to let people print 1000 page books, but I sent feedback anyway to allow me to increase the limit. Anyone know of any service that lets you print beyond iPhoto's limits?

  • Is there any way to use Control Break in a SQL Query

    Hi,
    Is there any way to use a control break on Dept column in a SQL query to have a Output-2 instead of Output-1.
    Is there any way to modify the SQL query.
    SQL
    select dept, loc, count(*)
      from dept
    group by dept, locOutput-1
      Dept      Loc       Count(*)
      10         AA        1
      10         BB        2
      10         CC        2
      20         AA        2
      20         BB        2Output-2
      Dept      Loc       Count(*)
      10         AA        1
                 BB        2
                 CC        2
      20         AA        2
                 BB        2Thanks,
    Deepak

    DeepakJ wrote:
    Hi,
    Is there any way to use a control break on Dept column in a SQL query to have a Output-2 instead of Output-1.
    Is there any way to modify the SQL query.
    SQL
    select dept, loc, count(*)
    from dept
    group by dept, locOutput-1
    Dept      Loc       Count(*)
    10         AA        1
    10         BB        2
    10         CC        2
    20         AA        2
    20         BB        2Output-2
    Dept      Loc       Count(*)
    10         AA        1
    BB        2
    CC        2
    20         AA        2
    BB        2
    Yes, using the <tt>lag</tt> analytic function and specified ordering of the data:
    select
        nullif(d.deptno, lag(d.deptno) over (order by d.deptno, d.loc, e.mgr nulls first)) deptno
      , nullif(d.loc, lag(d.loc) over (order by d.deptno, d.loc, e.mgr nulls first)) loc
      , e.mgr
      , count(*) n
    from
        dept d
          join emp e
            on d.deptno = e.deptno
    group by
        d.deptno
      , d.loc
      , e.mgr
    order by
        d.deptno
      , d.loc
      , e.mgr nulls first;
    DEPTNO  LOC       MGR   N
        10  NEW YORK         1
                      7782   1
                      7839   1
        20  DALLAS    7566   2
                      7788   1
                      7839   1
        30  CHICAGO   7698   4
                      7839   1
        40  BOSTON    7698   2
                      7902   1

  • Any way to customize the view?

    I’m new to Mail. Have been using either Entourage or PowerMail since I switched to a Mac 4 years ago. But I'm switching to Mail now to take advantage of other apps that work with it but not with other email clients.
    Anyway, the left side of the screen, the mailbox pane, is a light blue. Any way to modify that color?

    yeah, this isn’t some big functionality deal, but I just don’t like the look with that color. Seems like something we should be able to easily change. If I can change the color used to denote message from the same topic, why not this?

Maybe you are looking for

  • Need some help with the PDF ActiveX!

    I have an application that call a vi which will open a selected PDF file. during the first ran, the document will be properly open.But after that if i close the VI and recall them for another pdf document, I cannot open the file ( nothing happens....

  • Installing Oracle 11g R 2 on Oracle Enterprise Linux 5.0 32 bit

    Hello All, I am installing the oracle 11g on Oracle Enterprise Linux 5.0 32 bit, when i modified the bash_profile. i am facing the below error: Please can you help to solve the issue the error i am facing while trying to switch to oracle user (su - o

  • I need to reload Acrobat form the cloud

    I need to reload Acrobat to a new computer from my current cloud account

  • Apple Earpods - Not Working. Help?

    I have apple earpods and recently one of the sides stop working. You can hardly hear on the side that isn't working. Would Apple trade my earpods for new ones? - I still have my 1 year warrenty and it doesn't expire until December 25, 2013.

  • Problem with IPV6 Firewall since firmware 7.6.1

    I have problem with IPV6 Firewall (port forwarding using a HE tunnel) since firmware 7.6.1 upgrade,  IPV6 oubound is working, but ports are not forwarding to my local IPV6 adress, have used IPV6 Firewall, and it worked before Ant sugesttions, solutio