192 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
XPages webmail – Using Mime Inspector to debug Mime
Tue, Feb 14th 2017 66
Pasting Images into XPages CKEditor
Sun, Feb 12th 2017 46
Preventing pasting of remotely hosted images in CKEditor
Mon, Nov 14th 2016 4
Preventing Pasting of Images in CKEditor
Mon, Nov 14th 2016 4
Controlling the order of Script Resources (e.g. Jquery) with a Custom ViewRootRenderer
Mon, Sep 19th 2016 3
Review: JRebel with Domino OSGi development
Mon, Sep 5th 2016 7
Extended Messages Control available as an XspLibrary
Tue, Jul 12th 2016 5
Top 10
XPages webmail – Using Mime Inspector to debug Mime
Tue, Feb 14th 2017 66
Pasting Images into XPages CKEditor
Sun, Feb 12th 2017 46
Build System for XPages and OSGi plugins
Fri, Aug 8th 2014 9
Uploading Plugins Headlessly to Open Eclipse Update Site
Sat, Jul 18th 2015 7
Uploading Plugins Headlessly to Open Eclipse Update Site
Sat, Jul 18th 2015 7
Review: JRebel with Domino OSGi development
Mon, Sep 5th 2016 7
Select themeIds from plugins in Designer Xsp Properties Editor
Mon, Sep 8th 2014 5
Build Automation for XPages Presentation Slides - AUSLUG/Inform 2015
Thu, Jun 11th 2015 5
Welcome to my blog
Tue, Mar 11th 2014 5
Associating *.theme and *.xsp-config with Eclipse XML Editor
Wed, Mar 9th 2016 5


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

http://www.gregorbyte.com/2015/02/xpages-phonenumber-control-part-1.html
Feb 18, 2015
3 hits



Recent Blog Posts
66
XPages webmail – Using Mime Inspector to debug Mime
Tue, Feb 14th 2017 11:12a   Cameron Gregor
In a previous post in this series I did a bit of an overview on how MIME works. We also did a little bit about how MIME works in XPages + Domino land. With this knowledge in hand we can now start to analyse the different ways a ‘Pretty words, pictures and attachments’ can be stored in the document. During development of the ‘XPages Webmail’ interface, I encountered many problems which could only be solved by investigating the MIME content in detail. To help me do this, I
46
Pasting Images into XPages CKEditor
Sun, Feb 12th 2017 10:00p   Cameron Gregor
Programs like ‘Snipping Tool’ on Windows, are super useful for users to make a quick snapshot, do some quick markup on the image, paste into chat/email and send. Unfortunately when using the default configuration of CKEditor in XPages (the inputRichText control), support for pasting images is not available for all browsers, and even for the ones that do support it, the images are only pasted as a PNG data URI. I have explained data URI images in a previous post, so check that out if
4
Preventing pasting of remotely hosted images in CKEditor
Mon, Nov 14th 2016 11:21p   Cameron Gregor
In the previous post, I showed how to prevent a user from pasting Images from the Clipboard into CKEditor. This post is of a similar nature but is designed to ensure that users don’t paste images with URLs to external / internal applications. This post is part of my XPages webmail tips series, and addresses a problem where, a user copies and pastes some HTML that includes images, from a webpage and pastes it into CKEditor for a message that is then sent via email. The recipient is then una
4
Preventing Pasting of Images in CKEditor
Mon, Nov 14th 2016 12:43a   Cameron Gregor
In the process of developing our XPages ‘Webmail’ interface, we discovered that many recipients were unable to view embedded images in the emails. After investigating, it was caused by the images being embedded using Data URIs. Support for Data URI Images is not universal, and because it is supported in IBM Notes, everything looked like it was working ok, but a quick test viewing an email in Gmail confirmed a problem when images could not be seen. What is a Data URI? You are most lik
3
Controlling the order of Script Resources (e.g. Jquery) with a Custom ViewRootRenderer
Mon, Sep 19th 2016 9:28a   Cameron Gregor
When loading Client Side Javascript libraries in XPages, sometimes the order that the libraries are ‘encoded’ (or written in HTML) in the tag is important. For example jQuery and some of it’s plugins can have some issues if Dojo is encoded first. By default in XPages you don’t have too much say in what is written out first, a nifty workaround for this has been shared by Sven Hasselbach (here and here) which utilises the lesser known tag. This workaround ensures t
7
Review: JRebel with Domino OSGi development
Mon, Sep 5th 2016 11:53p   Cameron Gregor
Last year I finally figured out how to use JRebel with Domino, and I posted a how-to video. I thought I would do a quick follow up to say how it’s going. It is going great! I can’t imagine giving back my JRebel license. I have gone entire days without restarting my http server. If you are only developing xpages from within an NSF, and don’t do any OSGi plugin development, then you really don’t have much need for JRebel. But if you are involved in any OSGi Library developm
5
Extended Messages Control available as an XspLibrary
Tue, Jul 12th 2016 8:49a   Cameron Gregor
A while ago I shared an Extended version of the messages control which allows for multiple messages to be displayed for a single control at the same time. Originally this was just shared as a ‘control within an NSF’. One of the problems with the control within an NSF approach is that you repeatedly get an ‘unknown tag’ compilation problem which eventually goes away after a ‘project clean’ but it is very annoying nonetheless. I receiving a request to package
5
Webmail UI – You must learn about MIME
Wed, Apr 20th 2016 10:14a   Cameron Gregor
If you were like me, you spent many years developing classic Notes applications before making the switch to XPages. If this was the case, you were no doubt comfortable with the notion of a RichText field. You probably even occasionally did some RichText manipulation in LotusScript, adding Paragraphs and formatting using RichTextStyles and RichTextNavigators, attaching Files using EmbeddedObjects. And then XPages comes along, and says “If you want to edit any RichText through XPages, it i
3
Tips for Creating a Webmail UI with XPages
Tue, Apr 19th 2016 8:38a   Cameron Gregor
Over the past year my main project has been an XPages application for project-related Email correspondence, with formal document management thrown it as well and a bunch of Action Item / comment functionality surrounding it all. Developing the application as it’s own email client presented a few different challenges that may not be encountered in normal xpages development. Along the way I have come across a few different gotchas that I thought I better make record of, both the the benefit
4
My Slides from AUSLUG 2016 Presentations
Fri, Apr 15th 2016 2:45a   Cameron Gregor
This year at AUSLUG I presented 2 sessions. ‘Anatomy of a UI Control’ and ‘Using Source Control for Domino Development’. I have just uploaded the slides to the AUSLUG community and thought I would also share to the wider world! Slides and description of sessions are below. If you have any questions please let me know! I hope to share more about extension library / control development soon. Anatomy of a UI Control This session was designed to just spark a bit of curiosity




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