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<? extends Application> 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 <rogerandb...@rbwhitcomb.com>: > 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.whitc...@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.mart...@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 <m...@mrchambers.org>: >>> >>> 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.whitc...@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:m...@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 >>> >>> >> >> >> >