XPages Blast - Ideas, Tips and More

1,876 views
1,767 views

Published on

XPages Blast - Ideas, Tips and More.

This session will take you on a roller-coaster ride through the "best of the best" ideas and time-saving techniques for creating world-class XPages applications.

Thirty all new top tips - this is going to be fast-paced and packed with loads of information you will refer to time and time again! Everything from introductory tips on getting started with XPages, to complex tips - such as making use of Java. Also, the support app showing all of the tips and tricks.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,876
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
75
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

XPages Blast - Ideas, Tips and More

  1. 1. XPagesBlast Tweetaboutthisevent:#xpagesandmen:onus:@teamstudio@TLCCLTD@ma?white@TimsterC March26,2013
  2. 2. @teamstudioteamstudio.com
  3. 3. Taline$Badrikian$ Marke:ngDirector Dan$Colbert$ VicePresident NorthAmericaandLa:nAmerica
  4. 4. Whoweare•  Ourbackgroundisincrea:ngtoolsforcollabora:ve compu:nginmidQsizeandlargeenterprises,primarilyfor LotusNotes•  EasyQtoQusetoolsfordevelopersandadministrators•  2300+ac:vecustomers,47countries•  OfficesinUS,UKandJapan•  Enteredmobilespacein2010withUnplugged–easy mobiliza:onofNotesappstoBlackberry,AndroidandiOS
  5. 5. Teamstudio Unplugged•  Your Mobile Domino Server – take your Notes apps with you!•  End users access Notes applications from mobile devices whether online or offline•  Leverages existing skills and technology – Xpages – Replication model you already know•  IBMCollabora:onSolu:onsAwardWinner2013
  6. 6. Teamstudio Continuity•  Mobile BCM application for smartphones and tablets –  iOS, Android and BB•  Offline access to all your BCM and Disaster Recovery data•  Store plans, contacts, call trees, and more•  Client available for download from app stores
  7. 7. Teamstudio•  Visit us at IamLUG - May 6 & 7•  Next webinar – jQuery and XPages apps, Mark Roden – April 23
  8. 8. XPages BlastYour Hosts Today: Howard Greenberg Paul Della-Nebbia TLCC TLCC @TLCCLtd @paulDN #XPages © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 1
  9. 9. Upcoming and Recorded WebinarsNext Webinar on April 23rdjQuery: The Worlds Most Popular JavaScript Library Comes to XPages with Mark Rodenwww.tlcc.com/xpages-webinarSame web page has a link to previous webinars © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 2
  10. 10. TLCC XPages Offerings• Seven XPages Courses! On Sale, Save $200! Rapid XPages Development using Application Layout and Dojo UI Controls FREE !! Introduction to XPages Development JavaScript for XPages Development Developing XPages Using Domino Designer 8.5 XPages Development 2 for Notes and Domino 8.5 Mobile XPages for Domino 8.5 Java 1 for XPages Developers• Self Paced Training – Learn anywhere! – An Instructor is a click away• Instructor Led (Private)• TLCC Mentoring Services © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 3
  11. 11. Upcoming EventsIamLUG in St. Louis May 6th and 7th … FREE!!TackItOn the day after (May 8th) Rapid XPages Development using Application Layout and Dojo UI Controls • One full day with TLCC’s expert instructor Paul Della-Nebbia • TLCC’s Rapid XPages Development using Application Layout and Dojo UI Controls (8.5 or 9.0) self-paced course (28 hours) • A year of continued instructor support All for only $495! IamLUG exclusive offer!! www.iamlug.org © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 4
  12. 12. Asking QuestionsQ & A at the end!Type in yourquestions as theycome up © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 5
  13. 13. Your Presenters Today:Matt White, IBM Champion Tim Clark, IBM Champion @mattwhite @timsterc #XPages © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 6
  14. 14. XPages Blast (2013)Matt White | London Developer Co-opTim Clark | TC Soft Consulting 1
  15. 15. Matt White–Consultant with London Developer Co-op–Lead Developer with Elguji Software–Owner of XPages101.net–In the last year has; – Got married – Become a father – Bought a new house – Oh... and developed some XPages apps! #xpages 2
  16. 16. Tim Clark–Owner of TC Soft Consulting–IBM Champion–Prince2 Practitioner (Project Management)–ITIL certified–Manager of; – People – Projects – My family ;o) #xpages 3
  17. 17. Products we’re using–IBM Lotus® Domino® Server 8.5.3 – If we use other versions for a tip we’ll highlight it–IBM Lotus® Notes® 8.5.3–IBM Notes® 9.0–IBM Lotus® Domino Designer® 8.5.3–IBM Domino Designer® 9.0–We will use this logo to highlight any slide that has IBM Domino Designer® 9.0 items #xpages 4
  18. 18. Agenda–Config Tips–Client Side Tips–Server Side Tips–Debugging Tips #xpages 5
  19. 19. Designer Tweaks–Working Sets – Great for grouping together similar applications–Perspectives – Switch between XPages, Domino Designer and Debug–Turn on Line Numbers in code editor – Right click in the gutter and select “Show Line Numbers” #xpages 6
  20. 20. Designer Tweaks–XPages Palette to control which controls you see in the sidebar (new in 9.0) #xpages 7
  21. 21. Disable Build Automatically–It is enabled by default–When you save a design element the application is recompiled–This is bad if – you’re working in a team – you’re working on remote servers–Turn it off and get used to using Ctrl-B #xpages 8
  22. 22. Disable Build Automatically–Bonus Tip: if you close other applications the build process is quicker – Can only be done in Package Explorer in 8.5.3, in 9.0 it can be done from Applications pane #xpages 9
  23. 23. Source Control– Acts as a great backup tool for you– Even if you don’t have a team Repository, set up a local one– We use Github, allows for better team development– Set up Source Control for the application and choose a disk location– Then set up the Github project– Link the two by creating a new Git project in the same disk location– Video of how to set it all up at http://bit.ly/xpb_github– We use a client to control the Committing, rollbacks etc, but command line works equally well– https://github.com/tcsoft/xpb2013 #xpages 10
  24. 24. Designer Memory Settings– 8.5.3 Designer client can be a little crashy, but we can fix that!– Open the file at: <Notes program dir>/framework/rcp/deploy/ jvm.properties– Default settings in 8.5.3 are: vmarg.Xmx=-Xmx256m vmarg.Xms=-Xms48m vmarg.Xmca=-Xmca8k– Also still like this is Domino Designer 9.0 (beta) #xpages 11
  25. 25. Designer Memory Settings– New settings should be: vmarg.Xmx=-Xmx1024m vmarg.Xms=-Xms512m vmarg.Xmca=-Xmca512k– Took my machine from crashing nearly every day at 3pm to almost never crashing– Technote: http://www-01.ibm.com/support/docview.wss? uid=swg21617708 #xpages 12
  26. 26. Agenda–Config Tips–Client Side Tips–Server Side Tips–Debugging Tips #xpages 13
  27. 27. Know your versions– Dojo • 8.5.0 == 1.1.1 • 8.5.1 == 1.3.2 • 8.5.2 == 1.4.3 • 8.5.3 == 1.6.1 • 9.0 == 1.8– OneUI • < 8.5.3 == 2.0.1 • 8.5.3 == 2.1 • 9.0 == 3.0.2– CKEditor • 8.5.2 == 3.2.1.6 • 8.5.3 == 3.5.3 • 9.0 == 3.6.4 #xpages 14
  28. 28. Think Mobile–Mobile Controls in the Extension Library–But even if not going that far then it’s always worth setting meta tags and field types–Meta tags configure the page for optimal viewing in iOS–Set them by adding a metadata resource to your XPage: #xpages 15
  29. 29. Think Mobile–By default consider these...–viewport: width = device-width, initial-scale = 2.3, user-scalable = yes • scales the page to fit on the page–apple-mobile-web-app-capable: yes • allows you to add to the iOS workspace and run without the Safari controls–apple-mobile-web-app-status-bar-style: black • changes the header bar colour #xpages 16
  30. 30. Think Mobile–There is no overhead at all to setting the “type” property of fields so that when you are using a mobile device the user gets the correct keyboard–In All Properties for a field set type, most important being: • date (displays a native picker, but beware date formats) • email • number • url #xpages 17
  31. 31. Use jQuery–If you want to use the most popular JavaScript framework on the Internet add jQuery to your application–Extra overhead but on a fast network not a huge problem–Check out http://xomino.com for great tips–Gives access to huge number of resources in your applications–Code is often easier to write (ymmv!) #xpages 18
  32. 32. Use the extension library application layout–Check out the companion application for this session.–The extension library application layout has lots of options and can be made to suit your application. #xpages 19
  33. 33. Use Bootstrap–OneUI is one way to go for the look and feel of your app–Bootstrap is an alternative • Open source, released by Twitter • Easy to use • Integrates with jQuery • Has useful built in widgets #xpages 20
  34. 34. Use Bootstrap#xpages 21
  35. 35. Use Bootstrap#xpages 22
  36. 36. Agenda–Config Tips–Client Side Tips–Server Side Tips–Debugging Tips #xpages 23
  37. 37. Using Themes–For simple things like including CSS files on all XPages–For more advanced things as well...–Add a CSS class to all controls of a particular type: #xpages 24
  38. 38. Using Themes–Using the Theme ID we can create our own sub types of field:–Or we can add custom classes to the <body> #xpages 25
  39. 39. Using Attributes–Pretty much every control has a property called “attrs”–You can add as many attributes as you like to a control–Often used in conjunction with the tagName property • To make a panel into an anchor for example #xpages 26
  40. 40. Using Attributes–Ones we use a lot are: • href • onclick (and other events) • data-toggle (and other jQuery tags)–Will result in this being generated: <a id="id1:_id2:mylink" onclick="doSomething()"> My Link </a> #xpages 27
  41. 41. Document Locking–Scoped Variables are great for in memory tasks–Such as knowing who has documents in edit mode–So when a page is loaded we can call some code to decide whether to allow the user to edit it–We can use applicationScope variables to store a Java Hashmap of who has locked individual documents #xpages 28
  42. 42. Document Lockingfunction processDocumentLocking(){ if (context.getUrlParameter("documentId") != "" &&context.getUrlParameter("action").toLowerCase() == "editdocument"){ if (!applicationScope.containsKey("documentlocks")){ applicationScope.documentlocks = new java.util.Hashtable(); } var hash:java.util.Hashtable = applicationScope.documentlocks; if (hash.containsKey(context.getUrlParameter("documentId"))){ var lock = hash.get(context.getUrlParameter("documentId")); if (lock.person != @UserName()){ viewScope.locked = lock; } }else{ var lock = new DocumentLock(); lock.unid = context.getUrlParameter("documentId"); lock.person = @UserName(); lock.time = new java.util.Date(); hash.put(lock.unid, lock); applicationScope.documentlocks = hash; }... #xpages 29
  43. 43. Document Locking... }else if (context.getUrlParameter("documentId") != "" && context.getUrlParameter("action").toLowerCase() == "opendocument"){ if (!applicationScope.containsKey("documentlocks")){ applicationScope.documentlocks = new java.util.Hashtable(); } var hash:java.util.Hashtable = applicationScope.documentlocks; if (hash.containsKey(context.getUrlParameter("documentId"))){ var lock = hash.get(context.getUrlParameter("documentId")); if (lock.person == @UserName()){ unlockDocument( context.getUrlParameter("documentId") ); }else{ viewScope.locked = lock; } } }} #xpages 30
  44. 44. Document Lockingfunction unlockDocument(unid){ if (applicationScope.containsKey("documentlocks")){ var hash:java.util.Hashtable = applicationScope.documentlocks; if (hash.containsKey(unid)){ var lock = hash.get(unid); if (lock.person == @UserName()){ hash.remove(unid); applicationScope.documentlocks = hash; } } }}var DocumentLock = function(){ this.unid; this.person; this.time;} #xpages 31
  45. 45. Document Locking#xpages 32
  46. 46. Expression Language– You’re probably already using it even if you don’t realise it with Simple Data Binding– It’s just a simple shorthand to access properties quickly– You just need to use the Advanced - Expression Language binding #xpages 33
  47. 47. Expression Language–If you want to get clever you can mix and match EL with SSJS–In the Advanced - Custom binding #xpages 34
  48. 48. Managed Beans–Not as scary as you might think–Made up of two things • Java Class that does something • XML Config to set up the “managed” bit–The idea is that the server looks after creation of the objects for you–So say we want to create an HTML Email... #xpages 35
  49. 49. Managed Beans–Tony McGuckin contributed the XSnippet: http://bit.ly/xpb_managedbean–It does a single thing, in this case sends an email: #xpages 36
  50. 50. Managed Beans– Then we set up the XML Configuration– In the faces-config.xml file found in Package Explorer •WebContentWEB-INFfaces-config.xml– We need to define the name of the bean, the Java class being used and the Scope it will operate with #xpages 37
  51. 51. Managed Beans–Now we can use the managed bean in our SSJS #xpages 38
  52. 52. FacesMessage–Often we want to be able to send messages to the browser window–Just add add an “Error Messages” control to your XPage and use this code:–In this example the code runs when a button is clicked and shows the current time #xpages 39
  53. 53. Custom Validators–For complex or common validation we can centralise the logic into Java classes using Custom Validators–First we create the Java class: #xpages 40
  54. 54. Custom Validators–Next we set up the validator configuration in the faces-config.xml file •WebContentWEB-INFfaces-config.xml #xpages 41
  55. 55. Custom Validators–And finally we can make use of the validator in our XPage #xpages 42
  56. 56. Apache Commons–Taking the Custom Validator, what if we want “real” validation–Lots of common tasks have already been covered by Apache Commons: http://commons.apache.org/validator/–Import the commons-validator.jar file into WebContentWEB-INFLib–Then right click and “Add to Build Path” #xpages 43
  57. 57. Apache Commons–Now we can edit our Java class to use the EmailValidator: #xpages 44
  58. 58. Agenda–Config Tips–Client Side Tips–Server Side Tips–Debugging Tips #xpages 45
  59. 59. Log File Viewer–A project on OpenNTF by Jakob Majkilde http://bit.ly/xpb_logfileviewer–Makes watching log files (especially on remote servers) much easier #xpages 46
  60. 60. Log File Viewer#xpages 47
  61. 61. Debug Toolbar–A project on OpenNTF by Mark Leusink http://bit.ly/xpb_debugtoolbar–Very useful for following debug messages, timing code and more #xpages 48
  62. 62. Java Debugging–Built into Domino Designer since 8.5.3–Easy to set up–Add lines to notes.ini on the dev server: JavaEnableDebug=1 JavaDebugOptions=transport=dt_socket,server=y,suspend=n,addre ss=8000–Restart the server #xpages 49
  63. 63. Java Debugging–In Domino Designer switch to the Debug Perspective–Create a new Remote Java Application Debug Configuration #xpages 50
  64. 64. Java Debugging–Now we can add a breakpoint to our code and load the XPage in a browser and then step through the code #xpages 51
  65. 65. SSJS Debugging–Server Side JavaScript debugging is almost exactly the same in Domino 9.0–The notes.ini lines to add are: JavaEnableDebug=1 JavascriptEnableDebug=1 JavaDebugOptions=transport=dt_socket,server=y,suspend=n,addre ss=8000–There was a whole session on this @ Connect13: AD202 Debug Server Side Javascript, Java, and XPages Apps Using the SSJS Debugger M Blout & D OConnor #xpages 52
  66. 66. SSJS Debugging–The Debug Configuration will look like this: #xpages 53
  67. 67. SSJS Debugging–And then we can set a breakpoint in the source XML of our XPage or Script Library: #xpages 54
  68. 68. Pasting source code from extension library– ‘The prefix "xe" for element "xe:navigator" is not bound.’– This happens when you paste in some source code from one custom control to another for a control that is from the extension library.– The View tag is where you can solve this issue. <xp:view xmlns:xp="http://www.ibm.com/xsp/ core"> <xp:view xmlns:xp="http://www.ibm.com/xsp/ core" xmlns:xe="http://www.ibm.com/xsp/coreex">– Does not happen if you drag and drop from the extension library palette. #xpages 55
  69. 69. Contact Us–Matt White • matthew.white@fclonline.com • @mattwhite–Tim Clark • tim@tc-soft.com • @timsterc #xpages 56
  70. 70. Question and Answer Time! Howard Greenberg Paul Della-Nebbia Matt White Tim Clark TLCC Questions? Teamstudio Questions? howardg@tlcc.com paul@tlcc.com contactus@teamstudio.com 888-241-8522 or 561-953-0095Save $200! Rapid XPages Development using 877-228-6178Application Layout and Dojo UI Controls until 4/12 www.teamstudio.comIamLUG in St. Louis, May 6th and 7th TackItOn May 8th Rapid XPages Development #XPages using Application Layout and Dojo UI Controls @PaulDN www.iamlug.org @TLCCLtd @Teamstudio © 2013 The Learning Continuum Company, Ltd – This material can not be reproduced or distributed without the express permission of TLCC 7

×