Working Sets And Source Control

If you have not yet discovered Working Sets in Domino Designer then now is the time to start using them. They can help you manage the number of applications listed in the Applications pane and help you group applications into different projects etc.

If your using Working Sets and Source Control then you have probably noticed that the SCM version of your application doesn’t show in the Application pane and only shows in the Navigator or Package Explorer pane and that these panes show all your applications AND SCM versions and can become a little unmanageable. Well don’t worry, they are actually very easy to get back under your control…

First things first, forget about the ‘Navigator’ pane. Close it, you don’t need it. Use the ‘Package Explorer’ pane instead. Why? Well the ‘Package Explorer’ pane has a handy little option called ‘Window Working Set’ which sets that panes working set to whatever working set is selected elsewhere, so when you change the working set in the Applications pane the working set in the Package Explorer pane will change automatically. This is a big time saver.

To select the ‘Window Working Set’ make sure you select the ‘Package Explorer’ pane and then click the menu button in the upper right as highlighted below.

This opens a small menu and ‘Window Working Set’ is the first working set option. Now back on the Application pane change your working set and then switch to the Package Explorer pane and you’ll see that it has also changed. Pretty cool.

Unfortunately your Source Control flat file version of a database isn’t added to a working set by default but that is also easy to fix. Back on the Package Explorer pane click that menu option again and you’ll see an ‘Edit Active Working Set’ option but it is grayed out. This is because ‘Window Working Set’ is a virtual working set, so first things first is select the correct working set from the menu and then use the ‘Edit Active Working Set’ option.

A dialog box will appear where you can select what should show in the working set. Select your SCM flat file project and click Finish

Your Package Explorer pane will now show your NSF/NTF and the SCM Flat File versions of the project.

Once you have your SCM Flat File versions setup correctly for all your working sets just change the displayed working set in the Package Explorer pane back to ‘Window Working Set’ and then as you switch working sets in the Applications pane the Package Explorer pane will keep up and show all the correct entries.

 

 

Tagged with: , ,
Posted in None

Sometimes You Have To Go Directly To the Source

When you have been writing XPage applications for a while you may notice that you start using the source pane a lot more then the design pane. Sometimes it is so you can copy/paste parts of the markup from one place to another, sometimes so you can duplicate a bit of code but sometimes you need to because what your trying to do isn’t accessible from the design pane.

A case in point is the combobox control. Add a combobox to your page and then on the ‘values’ tab of the properties box add in a number of different values. The only options you have here is the value text and the actual value. If you go to the source pane and click on one of the SelectItem controls that were generated when you added the values on the values properties box you will see that the SelectItem has it’s own set of properties so you can do things like add a ‘rendered’ property to determine if a particular value should even display as an option to the end user of the application.

You can also get to additional properties on controls via the ‘Outline’ pane which is another underused part of Domino Designer. A good example of this is when you add an event handler to something you can find the eventhandler in the Outline pane and when you select it there will be additional properties that you can set on that event like the onStart and onComplete properties which allow you to specify some client side javascript that runs before and after the event.

So don’t forget to check out the source…

Tagged with: ,
Posted in None

An update on using Mercurial in Domino Designer

Recently there have been a few changes to the MercurialEclipse project which is what I have recommended in the past to use to enable Mercurial source control in Domino Designer so if you need to use Mercurial here are the updated instructions that I’ve been able to get working.

The first big change is that the project has moved from JavaForge to BitBucket so the update site has also changed. Its new URL is http://mercurialeclipse.eclipselabs.org.codespot.com/hg.wiki/update_site/stable

When installing the MercurialEclipse plugin you do need to install an older version. I’ve found the highest version of the plugin that works is V1.7.2, anything higher and the Mercurial options don’t appear anywhere in Domino Designer. This is due to the fact that Domino Designer is based on Eclipse v3.4 and the newer MercurialEclipse builds require a minimum of Eclipse 3.5

Secondly the update site no longer contains the Mercurial binaries, you will need to install Mercurial manually on your machine yourself. You can download Mercurial from here. I used the standard MSI installer for my testing and found that the latest version ( v2.3.2 ) worked fine. Once installed you need to tell the MercurialEclipse plugin where the binaries are. To do this load up the File -> Preferences menu in Domino Designer and then go to the Team – Mercurial menu  and then set that path to hg.exe in the options.

Once the link between Mercurial and MercurialEclipse is set then your all done.

Hope this helps somebody out.

Tagged with: , ,
Posted in None

Simple Date Formatting in SSJS

When it comes to Date and Times in any programing language there is always a little bit of ‘hair pulling out’ when you realize that there are a multitude of ways to store and manipulate the DateTime object and that how you did it in one language is not always the same as how it is done in another language.

With SSJS in XPages it doesn’t get any less confusing. You may have dates that are stored in the NotesDateTime format but you can also have dates that are in the JavaDate format which are completely different, but thankfully converting between the two has been made nice and easy. if you have a NotesDateTime then you can use the .toJavaDate() method to return a date in the JavaDate format. If you have a JavaDate then you can use session.createDateTime(JavaDate) to create a new NotesDateTime object from the existing JavaDate object.

When it comes to building a string out of the date in a particular format, for example for the filename of a report, you could write a load of code that uses the .getMonth(), .getYear() and .getDate() methods, adds 1 to the methods that return zero based ints and then convert them to strings and concatenate them to build your specially formatted string OR you could just make use of the SimpleDateFormatter class that is available in Java and have that do all the hard work for you…

First we need to import the Java package that contains the SimpleDateFormatter so that SSJS knows about it so add the following at the top of your script

importPackage(java.text);

then we need to get our JavaDate object. Lets assume that we have a Notes document with a field called ReportDate on it with the date in there…

var reportDateNotes:NotesDateTime = document.getFirstItem(“ReportDate”);
var reportDateJava:Date = reportDateNotes.toJavaDate();

Now that we have our JavaDate object we need to create a SimpleDateFormat object and pass in the format that we need in the constructor

var dateFormatter:SimpleDateFormat = new SimpleDateFormat(“yyyyMMdd-hhmma”);

and finally to get the JavaDate formatted using the format that we have specified we just call the .format() method and pass in the JavaDate that we need formatted.

return dateFormatter.format(reportDateJava);

For the SimpleDateFormat constructor you can pass in any of the codes details in it’s javaDoc which is available here to format the date any way that you want.

Tagged with: ,
Posted in None
Archives