198 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
Latest 7 Posts
Embedded Experiences not rendering after IBM Notes FP9
Wed, Sep 27th 2017 4
BuildXPages Deployment Automation Tools – v1.0.0
Thu, Sep 21st 2017 4
Generating and Downloading Files Using XPages’ Persistence Service
Wed, Sep 13th 2017 8
Bundle Inspector – Diagnosing XPages Plugin Resolution problems
Wed, Aug 2nd 2017 7
Swiper Official Version 2 Release
Fri, Jul 21st 2017 1
Auto-width Bootstrap Column XPages Controls
Tue, Mar 21st 2017 2
Swiper FP8 Version Beta Release
Thu, Mar 16th 2017 6
Top 10
Pasting Images into XPages CKEditor
Sun, Feb 12th 2017 11
Build System for XPages and OSGi plugins
Fri, Aug 8th 2014 9
Email Address Validator for XPages
Wed, Feb 11th 2015 8
Review: JRebel with Domino OSGi development
Mon, Sep 5th 2016 8
Preventing Pasting of Images in CKEditor
Mon, Nov 14th 2016 8
Generating and Downloading Files Using XPages’ Persistence Service
Wed, Sep 13th 2017 8
Tips for Creating a Webmail UI with XPages
Tue, Apr 19th 2016 7
XPages webmail – Using Mime Inspector to debug Mime
Tue, Feb 14th 2017 7
Bundle Inspector – Diagnosing XPages Plugin Resolution problems
Wed, Aug 2nd 2017 7
Select Bootstrap Themes from Drop-down
Fri, Jul 11th 2014 6

XPages PhoneNumber Control - Part 1 Creating a Converter
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious

This is the first of a multi-post series of creating a Phone Number control for XPages.

What good is a phone number if it isn't a valid one? and What good is a phone number if you don't know how to dial it from the country you are in? What if you want to restrict phone number entry to just one country? or maybe a just a few Countries?
In this series we will go through the steps of creating our own re-usable phone number entry/display control, that can be installed once, and re-used in every nsf.

Our first step will be to create our own Phone Number Converter. Our converter's task it to take the input string and convert it to a standard format for storing phone numbers.

Thanks to the nature of open source, someone else has already done the hard part for us we will be using google's libphonenumber library to convert, validate and manipulate phone numbers.

After this post we won't have our own control yet, but at least we will have a converter that we can use for a normal inputText control.

Lets get started, but before we do, a quick word on how to deploy this solution. I will be doing all the initial development within a single NSF. XPages Component development is much easier when done within an NSF as you can test your changes easily without package / reinstalling / restarting Domino Designer. In the last blog post I will take the code out of the NSF and put it in an XspLibrary OSGi plugin so that it can be reused throughout any NSF.
So, if you are only interested in deploying this solution for one NSF then you can just ignore the last 'plugin' post. If you want to deploy via a plugin, then pay attention to everything!

 Download and Install the libphonenumber library

The github repository for the library is googlei18n/libphonenumber. Have a look at the README file for this project for latest instruction on where to download the jar.
At the time of writing, it said to go to http://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/

7.0.2 was the latest version at time of writing

Then within the 7.0.2 folder I downloaded libphonenumber-7.0.2.jar

 Once you have the Jar import it into the Jars design element section

How will we use the library?

The libphonenumber library allows us to take a string that *might* be a phone number, attempt to parse it into a phone number and report if it is a valid one or not.
If it is a valid number then we could choose to format it many different ways.

The phone number library has the concept of a 'national' number and an 'international' number. The national number is the number you would dial if you are within the same country, and the international number is the number that you would dial from another country. Our converter will make sure that all numbers are stored as the international number.

For example here in Australia, the national and international number for Google's Sydney office
National Number : 02 9374 4000
International Number : +61 2 9374 4000

Many users would simply enter a 'national' number, without a country dialing code.
When users enter a national phone number we can provide a hint as to which country the number might be from so that we can correctly convert it into an international number.

Create Version 1 of the PhoneNumberConverter

To start with, our converter will try to convert the input to an international number, if there is no international dialing code included in the input string, will use Australia (AU) as the default code. Later on we will add options so that the default Country can be changed but for now we will hard code it as AU.

To create our converter, we create a new Java Class in the Code -> Java design elements.
The main point is that the class should implement the javax.faces.convert.Converter interface

Feb 18, 2015
5 hits

Recent Blog Posts
Embedded Experiences not rendering after IBM Notes FP9
Wed, Sep 27th 2017 5:36a   Cameron Gregor
Embedded Experiences are no longer rendering after upgrading to FP9. I suspect it is something to do with the changes to Embedded Browser, either removing it or upgrading it or something else. I haven’t had a chance to investigate fully. Perhaps there may be a workaround, or perhaps this is specific to the way we are using embedded experiences. We use embedded experiences quite a bit at our company so we have rolled back for now. If I figure anything out I will post an update but just be a
BuildXPages Deployment Automation Tools – v1.0.0
Thu, Sep 21st 2017 12:47p   Cameron Gregor
After quite a bit of work I have finally published the first release of BuildXPages! What is BuildXPages? BuildXPages is a project which is useful if you are interested in Automating tasks that are involved in building XPages. For example you may be interested in automating some of these tasks: Building NSFs from an On-Disk Project Building Plugins and Features Refreshing NSF Designs Setting Template Inheritance of NSFs Start, Stop and Restart Http server Uploading Plugins to an NSF Update
Generating and Downloading Files Using XPages’ Persistence Service
Wed, Sep 13th 2017 4:42p   Cameron Gregor
When developing an XPages application you may run into the need to generate files to be downloaded by the user. For example: Generating a PDF Report Exporting Data to Excel Spreadsheet Creating a Zip File of several attachments Achieving these tasks usually raises 2 main problems to solve; What temporary place can I use to generate the files? How do I allow the user to download the generated files? For the temporary place problem, some common solution is to either generate the files to some
Bundle Inspector – Diagnosing XPages Plugin Resolution problems
Wed, Aug 2nd 2017 12:26p   Cameron Gregor
A common task with XPages development is to installing some plugins that provide additional functionality. If you do any plugin development of your own, you end up doing this task a lot more as you create new plugins, install new versions etc. It is also common to encounter some problems after installing plugins to your Domino Server! Maybe your expected plugin doesn’t load up at all? maybe the wrong version is loading? The standard method of diagnosing these problems is to use the OSGi c
Swiper Official Version 2 Release
Fri, Jul 21st 2017 1:52p   Cameron Gregor
So I have finally posted Swiper version 2 to OpenNTF! (and Github of course) Swiper OpenNTF Project Page Swiper Github Releases The latest version is 2.0.1,  and is the same as 2.0.0beta but with a bug fix for the toolbar buttons. Swiper 2.0.0 beta has been available on the Github project site for a few months, and the core functionality of it works as planned. There was however a bug within the shortcut buttons that I added to the menu bar, and this is a bit of a nasty bug that can cause del
Auto-width Bootstrap Column XPages Controls
Tue, Mar 21st 2017 1:13p   Cameron Gregor
I’ve been stuck working with OneUI Version 3 for the past couple of years, due to a regretful decision made at the beginning of my major project. OneUI was better than nothing but very frustrating at times. Finally, I have moved on to my next project and I am now using bootstrap (version 3) A common task when laying out a page using bootstrap is to divide sections up into rows and columns, and use the appropriate css styles to do so. I’m going to assume you are familiar with bo
Swiper FP8 Version Beta Release
Thu, Mar 16th 2017 12:50p   Cameron Gregor
Last week I released the ‘alpha’ version of Swiper which was untested on FP8 but presumed to be ok. So far I have only had good reports from the pioneers who have gone ahead and installed FP8 + the alpha version. I have since managed to ugrade my home office setup to FP8 which unfortunately has broken my ability to launch designer from eclipse but I am seeking some advice on fixing this up. In the meantime I have to test the slow way of building plugins, import plugins, restart R
Swiper FP8 Integration Rollout
Wed, Mar 8th 2017 12:43p   Cameron Gregor
Notes Domino 9.0.1 FP8 is finally here and as far as I know (I have yet to download it) it includes the necessary changes which will allow Swiper to swipe whatever it wants, whenever it wants, which is good news for people who don’t like to have ‘Build Automatically’ turned on. Plan of Attack for release of Swiper version 2.0.0 So, I haven’t actually downloaded FP8 yet,  so I can’t say for sure that the updated version works perfectly. Here is a bit of backgrou
Markdown XPages UIControl
Sun, Mar 5th 2017 11:44a   Cameron Gregor
Often when I’m designing an xpage, there might be a section of the page in which I want to explain some instructions to the user. Some options here are to: write the Instructions using html and embed directly in the xpage markup write the Instructions directly in the design pane and format using designer’s ui e.g. bold, color, size etc use some native xpage controls to achieve the desired result. Write the instructions in a richtext field on a notes document that is loaded to dis
TextDiff XPages control – For visual comparison of text
Tue, Feb 28th 2017 12:00p   Cameron Gregor
A few years back I stumbled across Google’s diff-match-patch project which provides some handy algorithms for text manipulation. At the time of discovery I was doing ‘classic’ notes development. Although I probably could have implemented something that worked in lotuscript with RichText or Mime, it wasn’t a priority at the time and I never bothered. Since then, I have been doing mainly XPages, and now that I have been also doing a bit of XPages Control development. I was

Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition