• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom View loops in sendEvent, and looking for FOPers.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom View loops in sendEvent, and looking for FOPers.


  • Subject: Re: Custom View loops in sendEvent, and looking for FOPers.
  • From: Rich Van Deren (äèä) <email@hidden>
  • Date: Wed, 20 Mar 2002 09:49:43 -0800

To reply to myself. The problem seems to be java / objective-c related.
created pdf data in java and sent it in a notification then loaded it
the same way as it did when reading a pdf file.

I am currently at a lost again, but, I now feel more focused on my
problem. Anyone use java and objective-c in the same app? I used the
TextEdit java as an example. In my case objective-c was the main part
of my program and the java part just processed my apache.org FOP
processing.

If anyone is using FOP with Cocoa I would be happy to here about it.

code from my java action:

public void createFopOutput(Object sender)
throws FOPException
{
char[] foBuffer;

foBuffer =
resumeFormattingObjectsTextView.string().toCharArray();
CharArrayReader myFoInputStream = new CharArrayReader(foBuffer);
InputSource myFoInputSource = new InputSource(myFoInputStream);

ByteArrayOutputStream myPdfOutputStream = new
ByteArrayOutputStream();

try{
Driver driver = new Driver ( myFoInputSource,
myPdfOutputStream );
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
options = new Options(userConfigFile);
driver.run();


}
catch (Exception ex) {

mainMessageField.setStringValue("You have an error.");
throw new FOPException(ex);
}

NSData myPdfData = new NSData(myPdfOutputStream.toByteArray());
resumePdfRep = new NSPDFImageRep(myPdfData);
resumePdfRep.setCurrentPage(1);

// post notification to show PDF window to ResumeDocument
NSNotificationCenter center =
(NSNotificationCenter)NSNotificationCenter.defaultCenter();

NSNotification myNotif = new
NSNotification(showPdfWindowNotification, myPdfData, null);
center.postNotification(myNotif);

mainMessageField.setStringValue("Here is your output");
}

from my NSDocument class.
- (void)showPdfWindow:(NSNotification *)notification
{
[self loadPdfCustomViewData:[notification object]];
}
- (void)loadPdfCustomViewData:(NSData *)data
{
NSRect topLeftRect;
NSPoint topLeftPoint;

// resumePdfRep = [[NSPDFImageRep alloc] init];

resumePdfRep = [[NSPDFImageRep alloc] initWithData:data];
[resumePdfCustomView setImageRep: resumePdfRep ];

topLeftRect = [resumePdfRep bounds];
topLeftPoint.x = topLeftRect.origin.x;
topLeftPoint.y = topLeftRect.origin.y + topLeftRect.size.height - 1;

[resumePdfCustomView scrollPoint: topLeftPoint];
[resumePdfCustomView display];
[resumePdfCustomView setNeedsDisplay:YES];

[resumePdfWindow makeKeyAndOrderFront: self];


}
shows up then windows 'freeze'. works if i 'read' the pdf instead of
FOPing it with java.

On Tuesday, March 19, 2002, at 03:22 , Rich Van Deren (d8h>>d;) wrote:

> From: Rich Van Deren (d8h>>d;) <email@hidden>
> Date: Tue Mar 19, 2002 03:22:47 US/Pacific
> To: email@hidden
> Subject: Custom View loops in sendEvent
>
> I have been lost for a couple of days so I thought that I would ask for
> help.
>
> My multi-document application was working great until I added another
> window with a custom view.
>
> It looks like I lost some connections to the main application somehow.
>
> I can catch the sendEvent with the debugger in the window class however
> nothing 'super' catches it. My main window and new view window do not
> respond to anything, no close no toolbar no scroll. Checked all the
> connections in IB that I can think of. I used TexShop as an example
> to view a PDF.
>
> I also threw in some Java code to process my PDF. Does not seem to be
> a problem. This was an big plus for me to use Java when needed.
>
> I know without the whole program it is impossible to 'see' my error,
> but, if anyone could give me a direction I would be grateful.
>
> Here is the code that leads to my problem
> The notification comes from the Java code.
>
> - (void)showPdfWindow:(NSNotification *)notification
> {
> NSRect topLeftRect;
> NSPoint topLeftPoint;
> [resumePdfWindow setTitle: @"my funny test"];
> myImageType = isPDF;
> [resumePdfCustomView setImageRep: [notification object] ]; // this
> releases old one!
> topLeftRect = [[notification object] bounds];
> topLeftPoint.x = topLeftRect.origin.x;
> topLeftPoint.y = topLeftRect.origin.y + topLeftRect.size.height - 1;
> [resumePdfCustomView scrollPoint: topLeftPoint];
> [resumePdfCustomView display]; // does not display the PDF
> [resumePdfCustomView setNeedsDisplay:YES];
>
> [resumePdfWindow makeKeyAndOrderFront: self];
>
>
> }
>
> displays a window with a toolbar, but, no PDF image and no response to
> keyboard events.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Custom View loops in sendEvent (From: Rich Van Deren (äèä) <email@hidden>)

  • Prev by Date: Re: Cocoa's Popularity
  • Next by Date: Re: 8-bit chars in @""
  • Previous by thread: Custom View loops in sendEvent
  • Next by thread: I have exorcised the deamons!
  • Index(es):
    • Date
    • Thread