Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AED501055E for ; Sun, 26 Jan 2014 11:22:12 +0000 (UTC) Received: (qmail 24894 invoked by uid 500); 26 Jan 2014 11:22:12 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 24706 invoked by uid 500); 26 Jan 2014 11:22:02 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 24686 invoked by uid 99); 26 Jan 2014 11:22:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jan 2014 11:22:00 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sandro.martini@gmail.com designates 209.85.215.47 as permitted sender) Received: from [209.85.215.47] (HELO mail-la0-f47.google.com) (209.85.215.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jan 2014 11:21:54 +0000 Received: by mail-la0-f47.google.com with SMTP id hr17so3750202lab.34 for ; Sun, 26 Jan 2014 03:21:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=JNSvVBW7nITltt43AY6bvbopXzAYAC1bBM0EMNLAt7I=; b=DCNcZZXDYUz0nmL9cQlpc2r2DTgSjBvETs+CfgbcwPbrzv9vydtQ6s0FITJ47za389 NoDSY2GSnlccsd6ykfckTNawhQECZUeXuCHb0BTUCxMVUzGOuRexoQK5FyfMfIwvi83X wp/2lwUhYSJGlUfuGhSYXMSIgS/+gh+SF2FPlf3a6FZI+bd1KyVbyqFckVdVjkrYlc0e kMsrw4i9/fBCamHXibgW4SK5JadfCFt8Bj6AT37V1mLQGOY7AKFFkN1nN10WWTy6tBGO UgJnuTI/1GFvCPW8cN+twzP+DlZLWcs7bJw3JX3TtMElpkgoSnNplFTnrwrPC+/J1wsn nKVg== MIME-Version: 1.0 X-Received: by 10.153.0.33 with SMTP id av1mr9207617lad.14.1390735293787; Sun, 26 Jan 2014 03:21:33 -0800 (PST) Received: by 10.112.220.3 with HTTP; Sun, 26 Jan 2014 03:21:33 -0800 (PST) In-Reply-To: <52E41BF6.4050209@rbwhitcomb.com> References: <001701cf15e9$704a1420$50de3c60$@mrchambers.org> <5878b11f983b4ec4990a287cca53e6c3@BN1PR06MB405.namprd06.prod.outlook.com> <002b01cf1652$75d22770$61767650$@mrchambers.org> <3762664bb99a4f84a6110e5db73d1028@BN1PR06MB405.namprd06.prod.outlook.com> <006001cf19f2$23a3c870$6aeb5950$@mrchambers.org> <52E41BF6.4050209@rbwhitcomb.com> Date: Sun, 26 Jan 2014 12:21:33 +0100 Message-ID: Subject: Re: How to Run Application without DesktopApplicationContext From: Sandro Martini To: Users - Apache Pivot Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi all, Roger note that the additional version of main with an Application instance as argument exist already in DesktopApplicationContext (I put it with the changes for ...), take a look at: main(Application applicationInstance, String[] applicationArgs) which calls the usual version of main main(Class applicationClass, String[] applicationArgs) As a sample (minimal) usage look at ApplicationWithPropertiesTest. So I think that all should already be in trunk, anyway tell us for other changes/improvements (that's the main reason for us to develop 2.1.x). For a non-GUI contric implementation of ApplicationContext, could be useful so if someone has an idea / some sample code we could try to look at it ... but in the meantime I hope that existing code in trunk (for 2.1.x) should be enough :-) . Tell us for suggestions, improvements, etc ... Bye, Sandro 2014/1/25 Roger and Beth Whitcomb : > Hi Mark, > I have to apologize for confusing the issue. When I said "create an > application class" I meant "write the code for an application class". Of > course, the actual class object is created inside > DesktopApplicationContext.main, so (right now) there is no way to create it > first before this call. So, (again right now) you would have to use > Sandro's mechanism to pass parameters to your main class, or what you have > come up with. > I'm thinking, though, that we could possibly add an alternate signature > for DesktopApplicationContext.main that would accept an already created > application object, instead of the class object. Maybe I will look into > that, if it would help you in your use case?! Looking at the code, it is a > little tricky, but I think I can rearrange the code to accommodate the > existing signatures (Class, String[]) and (String[]) as well as provide a > (Application object, String[]) as well by delegating to some other internal > methods. Maybe this would help with Sandro's use case with Groovy as well?? > BTW, are you using the release (2.0.3) version or are you building from > SVN trunk? If the latter, I could perhaps provide a patch for you to try. > > Again, thanks for using Pivot, > ~Roger > > > On 1/25/14 9:23 AM, Mark R. Chambers wrote: >> >> Hi All, >> >> Thanks Sandros for your feedback I will take a look at the classes. >> Roger I don't understand how you think you can call >> DesktopApplicationContect.main after you create a class and still pass >> variables back and forwards, unless you are talking using super for the >> constructor, which has the same problems as using Startup. >> Currently I have changed my code so the main class extends Application and >> then I change the constructor to the Startup method, it works fine, but >> does >> make the application GUI centric... >> >> Anyway thanks again both of you for your support. >> >> Regards, >> Mark. >> -----Original Message----- >> From: Roger L. Whitcomb [mailto:Roger.Whitcomb@actian.com] >> Sent: Wednesday, 22 January 2014 12:36 AM >> To: user@pivot.apache.org >> Subject: RE: How to Run Application without DesktopApplicationContext >> >> So, our application is a desktop app, but there is a considerable amount >> of >> work that is done in the "main" method of the application before it ever >> calls DesktopApplicationContext.main(...), which in turn invokes the >> "startup" method of the main class, and etc. So, there is no particular >> reason that you can't create an application class that has all the >> variables >> / state that you need, and when you need to display the GUI, at that time, >> call DesktopApplicationContext.main.... And as Sandro has said, his new >> classes give you some further help passing state into the Pivot >> application >> (in addition to what I just described). >> >> HTH, >> ~Roger >> >> -----Original Message----- >> From: Sandro Martini [mailto:sandro.martini@gmail.com] >> Sent: Tuesday, January 21, 2014 5:39 AM >> To: Users - Apache Pivot >> Subject: Re: How to Run Application without DesktopApplicationContext >> >> Hi all, >> >>> My application is not GUI centric, and I don't want to make the GUI the >> >> main part of the application. >>> >>> How can I pass variables back from DesktopApplicationContext or start a >> >> pivot application without DesktopApplicationContext? >> >> Under trunk (for Pivot-2.1.0, still in development) I put some new classes >> related to this: >> ApplicationWithProperties and ApplicationWithPropertiesTest . >> >> Take a look and tell us if there is something that should be >> updated/improved, even for your needs. >> >> >> Note that some month ago I put some test Groovy scripts and classes under >> Pivot-Stuff ( http://code.google.com/a/apache-extras.org/p/pivot-stuff/ ) >> in >> the project pivot-stuff-common-groovy ... under scripts and test you can >> find some minimal example fro using Pivot in a little different way. >> As soon as I find some time I should update these examples (or add >> others) using the new method added in ApplicationWithProperties , so for >> example I could get GroovyClassLoader from Groovy and set into Pivot >> application, etc ... I hope this can help you. >> >> >> Bye, >> Sandro >> >> >> 2014/1/21 Mark R. Chambers : >>> >>> Hi Roger, >>> >>> >>> >>> Thanks for your reply. Previously I was using Swing and my own XML >>> parser to create the GUI. So it was called with for example GUIPanel >>> mGUIPanel = new GUIPanel() from my main application class that >>> controlled various devices and the database connections; >>> >>> Then I could just access the MGUIPanel.mState information etc... >>> >>> The application can be run headless, so sometimes there is not a GUI, >>> but I guess I can hack around that... >>> >>> >>> >>> I can probably modify the DesktopApplicationContext.main (to maybe >>> mainReturn) to return, a reference to the application return type(Just >>> calls main and then returns the reference....) >>> >>> Or I could change the architecture to have it GUI centric... It just >>> that my diagrams would then need to change... and they would not look >>> at neat:] >>> >>> >>> >>> Anyway I think your answer is, that currently it is not supported:] It >>> would be a nice feature, since probably not everybody wants to use >>> Pivot from main... >>> >>> >>> >>> PS-Thanks for the Pivot Framework, I like the code;] Although the >>> documentation still needs massive amounts of work;] And the Component >>> Explorer needs to be finished;] >>> >>> PS2- If I get some time I will start adding to the Wiki... to try to >>> minimise the learning cliff;] >>> >>> Regards, >>> >>> Mark. >>> >>> >>> >>> From: Roger L. Whitcomb [mailto:Roger.Whitcomb@actian.com] >>> Sent: Tuesday, 21 January 2014 1:35 AM >>> To: user@pivot.apache.org >>> Subject: RE: How to Run Application without DesktopApplicationContext >>> >>> >>> >>> Hi Mark, >>> >>> Welcome to Pivot. I'm sorry that you're having >>> trouble, but let me see if I can help. To start with, could you tell >>> me what the original application was written in (i.e., what GUI >>> framework you were using)? How did you pass information back and >>> forth between the GUI and the main application before (i.e., was it some >> >> kind of RPC, or what)? >>> >>> Currently Pivot has just two modes of operation: as a >>> desktop app, or as a browser applet. These two would use >>> DesktopApplicationContext and BrowserApplicationContext. There is >>> probably no real reason we couldn't have a third type of application >>> (maybe an "EmbeddedApplicationContext" that would act more like the >>> GUI object that you're talking about). At this moment I wouldn't know >>> exactly how to go about writing such a class, but I don't know of any >>> technical reason why it couldn't be done. At some point you have to >>> hook into AWT and connect to a GUI widget and the event handling >>> (event loop) for it, but that (I'm pretty >>> sure) could be wrapped in a slightly different way than >>> DesktopApplicationContext does it (which pretty much assumes it is the >>> main program of the application), but maybe more like >>> BrowserApplicationContext (which obviously is assuming it is wrapped >> >> inside a browser as an applet). >>> >>> There should be no reason you couldn't pass >>> application arguments even to a DesktopApplicationContext via the >>> command line stuff even now. Or if you are using a message bus, or >>> some other RPC mechanism, why you couldn't use that with Pivot also. >>> Unless I'm misunderstanding the way your app is architected. So, maybe >> >> you could explain a bit more. >>> >>> Again, thanks for trying Pivot, and I hope we can get >>> you going! >>> >>> >>> >>> ~Roger >>> >>> >>> >>> From: Mark R. Chambers [mailto:mark@mrchambers.org] >>> Sent: Monday, January 20, 2014 6:11 AM >>> To: user@pivot.apache.org >>> Subject: How to Run Application without DesktopApplicationContext >>> >>> >>> >>> Hi Pivot, >>> >>> >>> >>> My application is not GUI centric, and I don't want to make the GUI >>> the main part of the application. >>> >>> How can I pass variables back from DesktopApplicationContext or start >>> a pivot application without DesktopApplicationContext? >>> >>> >>> >>> BACKGROUND: >>> >>> I have an existing application and I am replacing the GUI component >>> with Pivot, it is a component of a much larger application. I >>> previously just had a GUI object that I called and it made the GUI >>> etc. and I could pass state information and values back to the main >>> application. Is there any way to do this with pivot? Or do I need to >>> modify the pivot src? (Or choose another GUI option, although I have >>> battled with pivot for 3 days. to convert my GUI, and now find out >>> that I can't seem to be able to get any variables back to the main >>> program.) >>> >>> >>> >>> Regards, >>> >>> Mark >>> >>> >> >> >> >