tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/80-md-initial-home-page-opencreateimport-file-page-hooksInfinite Kind: Discussion 2015-03-31T16:14:37Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T09:53:07Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>btw, I did posted that on the ML before I realised everything
moved in here (might be a good thing to state this explicitely on
moneydance developer page for noobs like me ;) )</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T10:00:27Z2012-02-05T10:00:27ZMD initial home page (open/create/import file page) hooks<div><p>Hi Florian,<br>
Sounds like a great idea for a plugin.</p>
<p>I think what you want is a HomePageView. You can see an example
of how to implement one in the following code:<br>
<a href=
"http://code.google.com/p/moneydance-forecaster/source/browse/tags/moneydance-forecaster-18/src/main/java/com/moneydance/modules/features/forecaster/Main.java">
http://code.google.com/p/moneydance-forecaster/source/browse/tags/m...</a><br>
<a href=
"http://code.google.com/p/moneydance-forecaster/source/browse/tags/moneydance-forecaster-18/src/main/java/com/moneydance/modules/features/forecaster/homepage/ForecasterHomePageController.java">
http://code.google.com/p/moneydance-forecaster/source/browse/tags/m...</a></p>
<p>Cheers,<br>
Kevin</p></div>Kevin Stembridgetag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T10:09:29Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>Hum,</p>
<p>correct me if I am wrong, but isn’t the HomePageView only
integrating into the HomePage (that is, the frame displayed when
there already is a dataFile loaded ?)</p>
<p>I am looking to integrate into the startup page , that is,
before any datafile is created.</p>
<p>So far, I tried to get the underlying JFrame object of the
startup page, but for some reasons :</p>
<p>java.swing.Frame.getFrames() returns an empty array O_o ?
(meaning that the frame displayed as the startup screen is actually
… not a frame …).</p>
<p>Any other idea ?</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T10:23:04Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>hum, I meant</p>
<p>java.awt.Frame.getFrames()</p>
<p>(not swing).</p>
<p>btw, java.awt.Window.getWindows() get me the same result :-/</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T10:53:29Z2012-02-05T10:53:29ZMD initial home page (open/create/import file page) hooks<div><p>Yes, you're correct. The HomePageView is just for the home page.
Sorry, I thought that was the page you were referring to.</p>
<p>So if I understand you correctly, you want to be notified before
the data file is loaded and then display a button that allows the
user to perform an svn checkout of some other data file and load
that one instead.</p>
<p>If that's the case then I don't think it would be a big deal to
allow Moneydance to complete its normal startup with the default
data file and then give the user the option to switch to a
different data file, the one in svn.</p>
<p>Maybe I don't understand your use case very well. I was thinking
that the main benefit of using svn was for the version history
aspect of it. i.e. this would allow the user to roll back to a
previous version of the file. Can you describe the use cases you
had in mind?</p></div>Kevin Stembridgetag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T11:02:56Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>Well, I guess I should explain my goal a little further then
:</p>
<p>Think of a workgroup in which all moneydance data files are
stopred onto an svn server. That allows different operators to work
on the same file (but not simultaneously off course). Then, the
workflow must stick with svn, that is :</p>
<ul>
<li>Before you work on a new file, first check it out of the svn
tree (svn checkout)</li>
<li>If you already have a working copy of your file, then update it
(svn update) or at least check that no new version is present on
the server</li>
<li>Check that the file is not locked (otherwise conflicts may
happen), if so open readonly</li>
<li>Lock your file on the depot (svn lock) to prevent other to
modify it while you do</li>
<li>work on your file (modifications)</li>
<li>upon exiting, commit and ulock the file (svn commit)</li>
</ul>
<p>The point is then, that I need to integrate at different places
:</p>
<ol>
<li>First on the startup screen to allow to user to choose to open
a file from the svn server (that is, checking it out into a local
directory then open it)</li>
<li>Then before the file is loaded (to check that no new version is
present on the server, and that the file itself is not locked by
another user)</li>
<li>And finally upon exiting (to send modifications to the
server)</li>
</ol>
<p>I am currently trying to figure out a way to do 1 and 2</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T15:47:32Z2012-02-05T15:47:32ZMD initial home page (open/create/import file page) hooks<div><p>Sounds interesting. I'm afraid I don't know about any hooks
though. Maybe one of the Moneydance developers will chip in with
some advice.</p></div>Kevin Stembridgetag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T15:51:36Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>Anyway, for now, I can use the (very) ugly way to show a popup
when the startup screen is displayed offering the choice to
checkout a document from the server …</p>
<p>But man I hate popups (especially like this).</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-05T22:40:21Z2012-02-05T22:58:55ZMD initial home page (open/create/import file page) hooks<div><p>After some research, it seems that what I am looking like is
tapping into the StartupWindow object created in the MoneydanceGUI
object upon startup.</p>
<p>Now the problem is that the code I saw is from the
moneydance.jar shipped with MD, but is not present in the extension
itself. Moreover, in that software the StartWindow is a local
variable (local to a local block of the MoneydanceGUI.run()
method), so there is nothing to access this particular object.</p>
<p>Now, what really bother me is that the StartupWindow object
inherits from JFrame, which should make it detectable using the
java.awt.Frame.getFrames() way …</p>
<p>OK, this is where I would be glad to have some info from the MD
developers here.</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-06T11:15:07Z2012-02-06T11:15:07ZMD initial home page (open/create/import file page) hooks<div><p>Well, I found a super uber ugly way out :</p>
<ol>
<li>
<p>first in my ant build.xml file, I add the mainstream
moneydance.jar :</p>
<p><pathelement path="/opt/Moneydance/moneydance.jar"/></p>
</li>
<li>
<p>I create a class to override
com.moneydance.apps.md.view.gui.StartupWindow</p>
</li>
<li>I add everything I need to it</li>
<li>when I detect (using events) that the startupwindow is being
shown, I display mine too</li>
</ol>
<p>this way I do have a customized startupwindow, but for now it
show first (under the default one). So to be sure that mine is
gonna show up, I use</p>
<pre>
<code>JFrame.setAlwaysOnTop(true)</code>
</pre>
<p>Once the startup window does its job it will exit the two
displayed window anyway, so that seems to work :)</p>
<p>Ok, I warned you, this is super uber ugly !</p></div>florian.delizytag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-06T15:51:34Z2012-02-06T15:51:34ZMD initial home page (open/create/import file page) hooks<div><p>Wouldn't it be easier for what you're doing to just create a
wrapper/launcher for instead of an add in? i.e. Click this OTHER
icon to run money dance, before launching money dance, which would
do the cvs/svn magic to pull the file, run money dance from within
your program, on exit your launcher could push the cvs/svn file
back onto the server. I say this because I don't know about you but
for me, Moneydance doesn't usually pop up that startup window you
mention, once you've told it where the file is, it seems smart
enough to just open it next time without prompting you. As a
result, i don't think an add in that runs when the startup screen
pops up would be terribly useful.</p></div>robwilkenstag:infinitekind.tenderapp.com,2009-01-14:Comment/134489692012-02-06T16:08:12Z2012-02-06T16:08:12ZMD initial home page (open/create/import file page) hooks<div><p>Indeed, but the startup process is only part of the
integration.</p>
<p>The rest will also happen magically (based on events), so that
when you open a file already in a svn workcopy the plugin will be
aware of it.</p>
<p>Well, I’ll keep my hack as long as a dev don’t drop
by here to give a better way (for now it works pretty well).</p></div>florian.delizy