You are on page 1of 11

AdvancedUITechniques

eLearningCourseTranscript

Copyright 2008
Pegasystems Inc., Cambridge, MA
Allrightsreserved.
ThisdocumentdescribesproductsandservicesofPegasystemsInc.Itmaycontaintradesecrets
andproprietaryinformation.Thedocumentandproductareprotectedbycopyrightand
distributedunderlicensesrestrictingtheiruse,copyingdistribution,ortransmittalinanyform
withoutpriorwrittenauthorizationofPegasystemsInc.
Thisdocumentiscurrentasofthedateofpublicationonly.Changesinthedocumentmaybe
madefromtimetotimeatthediscretionofPegasystems.Thisdocumentremainstheproperty
ofPegasystemsandmustbereturnedtoituponrequest.Thisdocumentdoesnotimplyany
commitmenttoofferordelivertheproductsorservicesdescribed.
ThisdocumentmayincludereferencestoPegasystemsproductfeaturesthathavenotbeen
licensedbyyourcompany.Ifyouhavequestionsaboutwhetheraparticularcapabilityis
includedinyourinstallation,pleaseconsultyourPegasystemsserviceconsultant.
ForPegasystemstrademarksandregisteredtrademarks,allrightsreserved.Otherbrandor
productnamesaretrademarksoftheirrespectiveholders.
AlthoughPegasystemsInc.strivesforaccuracyinitspublications,anypublicationmaycontain
inaccuraciesortypographicalerrors.ThisdocumentorHelpSystemcouldcontaintechnical
inaccuraciesortypographicalerrors.Changesareperiodicallyaddedtotheinformationherein.
PegasystemsInc.maymakeimprovementsand/orchangesintheinformationdescribedherein
atanytime.

Thisdocumentisthepropertyof:
PegasystemsInc.
101MainStreet
Cambridge,MA021421590

Phone:(617)3749600
Fax:(617)3749620
www.pega.com

Updated:April9,2008



Contents
Maximizing Reuse of Harnesses and Sections .................................................................................... 1
Maintaining Guardrail Compliance with Harnesses and Sections ..................................................... 1
Utilizing the Action Formfor Harnesses and Sections ....................................................................... 2
Utilizing Field Values with Harnesses and Sections ............................................................................ 2
Read/Write Access for Harnesses and Sections .................................................................................. 3
Referencing HTML Property Rules in Harnesses and Sections ......................................................... 4
Parameterizing Rule-HTML-Properties .................................................................................................. 5
Defining CustomButtons ....................................................................................................................... 5
Repeating Elements for List Views ........................................................................................................ 6


MaximizingReuseofHarnessesandSections
AswithmanyrulesinPRPC,therearemultiplewaysofmaximizingreusein
harnesses,sections,andflowactions.Themostobviouswayofachieving
optimumreuseisbyplacingtheruleintheappropriatelocationwithinyour
classstructure.
BybuildingHTMLformrulestodisplaycommonembeddedcontentinthe
Workpartoftheclassstructure,itcanbereusedacrossallworkobjecttypes.
However,thelimitationisthatyoumustfullyqualifythepathoftheembedded
property.
BybuildingtheHTMLformruleinthesameclassastheproperty,youinherently
achievereuse.Youcanusethisruletodisplayanypropertyofanytypeofthis
class.Thebenefitsofdoingthisarethatyou
Donothavetofullyqualifythereferencestotheproperties
Candisplaydataelementswithouttheneedfordetailedworkobject
propertystructures
Areallowingforquickdevelopmentatthestartofaproject
Achieveaconsistentdisplayofdataacrosstheapplication
Forinstance,ifasectionrulehasbeendefinedintheWorkpartofourclass
structureanddisplaysaddressdetails,youmustfullyqualifythepathtoeach
individualpropertyrelativetotheworkobject.Althoughthisfunctionalitywill
work,itcanonlybeusedtodisplayanaddresswhentheaddressispartofa
pagepropertynamedAddress,andthesectionrulethatthispropertyisdefined
onhaslimitedreusability.
LookingatthesamesectionruledefinedwithintheDataAddressPostalclass,
youonlyneedtoputreferencesrelativetotheclassyouarecurrentlyin,which
allowsfortheuseofthisformwhereveranaddressistobedisplayed.
Therefore,aworkobjectcandisplaytwoaddresses,whichrelatetotwo
differentaddresspropertiesonourworkobject,butcanusethesamesection
ruletodisplayboth.
MaintainingGuardrailCompliancewithHarnesses
andSections
Toshowcaseasmooth,featurerichUIcoupledwithapreflightreportthat
showseverythinghasbeenautogenerated,useJSPtagsdefineddirectlyinto
2 Advanced UI Techniques
RuleHTMLSectioncellstoincludeRuleObjHTML,RuleHTMLFragment,and
RuleObjListViewrules.
Hereweareusingasectiontodisplayanindividualelementwithinapagegroup
property.
ARuleHTMLFragmenthasbeendefinedthattakestheindextodisplayfroma
propertyontheworkobjectcalledAddressInterest.Thissetsthesubscriptof
thedesiredpage.
Historically,thiswouldhavebeendefineddirectlyinacustombuiltRuleHTML
Section.However,tomaintainguardrailcompliance,theJSPiswithintheHTML
fragment,andthefragmentiswithinasectionlayout
UtilizingtheActionFormforHarnessesand
Sections
Traditionally,abuttonoriconwithacustomactivitywasusedtoinvokeand
followanewprocessfromthemiddleofanexistingprocess.Thisisfinefor
somesituationsbutdoesnotworkwellwhentheactivityinquestioncreatesa
newworkobjectanddisplaysanassignmentonthatnewworkobject.
TheCPMFrameworktakesadvantageofaminimalchangetotheActionform
onthePerformHarnesstosolvethisrequirementwhilestillbeingguardrail
compliant.
Forexample,weareinteractingwithacustomerandattemptingtosearchfor
thecustomerrecord.Whenthecustomerrecordisnotfound,wearerequired
toregisterthecustomer.Interactingwiththecustomerandcreatinganew
customeraretwoseparateprocesses.
BychangingthetargetoftheActionform,youcandirectthesubmissionofthe
formtosubmittheentireformratherthanjusttheActionform.Thiscanbe
achievedbyembeddingafragmentwithasmallpieceofJavaScriptthat
modifiesthetargetattributeoftheform.
UtilizingFieldValueswithHarnessesandSections
Fieldvalueswithinharnessesandsectionsallowforcompletereuseofprocess
flowsandtheircomponents.
TheoutoftheboxRuleObjHTMLruleActionDropDownisusedtodefinethe
contentsofthedropdownonthePerformharnesseswithintheactionform.
Advanced UI Techniques 3


Minormodificationswillallowfortheuseofdynamicfieldvaluestoworkandto
maximizethefullreusecapabilityofflowactions.
TheWork.ActionDropDownruleusesaPublicAPImethod
getLocalizedTextForStringtoreturnthelocalizedvalueoffieldvalueinstances.
Toallowthisruletousedynamicfieldvalues,theActionDropDownHTMLmust
bemodifiedtousetheLookupJSPtagasopposedtoaPublicAPImethodcall.
TheoutoftheboxActionDropDownruleisafinalrule.However,thisdoesnot
meanthatitcannotbecustomizedwithinyourapplicationwithoutbreakingany
guardrails.
SavingtherulewithanAppliesToclassotherthanaclassthatinheritsfrom
Workallowsyoutocreateyourownversionofthisrule.Thismeansthatthe
ruleisfoundbypatterninheritancefirstbeforeanydirectedinheritancefinds
theWorkrule.
Read/WriteAccessforHarnessesandSections
Itissometimesrequiredwithinaprocesstodisplaypreviouslycaptureddatain
areadonlyformatinaconfirmationstep.Thesamesectioncould,and
probablyshould,beusedforboththecaptureandtheconfirmation.
Toachievethis
DefineaprivilegesuchasReadOnlythatyouneverassigntoauserrole
AddthisprivilegeastheUpdatePrivilegeattributewhenyouembedthe
section
Thisensuresthatwhenevertheparentsectionisdisplayedtheembedded
sectionisalwaysshownasReadOnly.
PRPC5.3hassomeveryinterestingimplementationofthePerformHarness,
takingscreenflowsinparticulartoanewlevel.SeeWork.TabbedScreenFlow
andWork.TreeNavigationformoreinformationregardingadvancedharness
useswithinscreenflows.
4 Advanced UI Techniques
ReferencingHTMLPropertyRulesinHarnessesand
Sections
TheuseofRuleHTMLPropertyrulesallowsfortheconsistentdisplayof
propertieswherevertheyarereferenced,forexampleinHTMLformsor
Correspondencetemplates.
ThefollowingruletypeshaveformsthatallowRuleHTMLPropertyrulestobe
referenceddirectly:
RuleObjProperty,withtheHTMLinputinthepresentationpartoftheform
RuleHTMLSection,whereyoucanoverridethedefaultpresentationfora
particularproperty
RuleObjFlowAction,whereagainyouareallowedtooverridethedefault
presentationforaparticularproperty
RuleObjListView
RuleObjSummaryView
AllotherHTMLrulesallowforthemanualinclusionofRuleHTMLProperty
referencesviatheReferenceJSPtagsorHTMLdirectives(whichisdeprecated).
WhendefiningcustomRuleHTMLPropertyrules,itisimportanttoincludetwo
outoftheboxrules:
ValidationMessages:toensurethefullfunctionalityofvalidationdisplay
ClientSideValidation:toensureclientsideeventshandlingismaintained
IftheValidationMessagesisnotused,whenthatpropertyisvalidated,for
exampleinaflowactionpostactivity,theerrormessageregardingthat
validationisseeninanerrorselementatthetopoftheHTML.Whilethisserves
apurposeanddisplaysmessagesbacktotheuser,itisnotthemostuser
friendlywayofalertingtheuser.
ByincludingthemessagesRuleHTMLPropertyrule,whenvalidatingproperty
valuesforflowactionvalidaterulesorpostactivities,theuserseestheoutof
theboxredcrossandthedesiredvalidationmessageuponhoverover.
ThemorecomplextheRuleHTMLPropertybecomes,thelongertheformsthat
referencestherelatedpropertywilltaketoload.Thisbecomesevenmore
importantwhenconsideringreportingtyperulessuchaslistviewandsummary
viewrules.
Advanced UI Techniques 5


ParameterizingRuleHTMLProperties
ParameterizationofRuleHTMLPropertyrulesallowsyoutobuildoneruleto
fulfillarequirementinmultipleareas,whichresultsinlowerdevelopmentand
maintenancecosts.Anidealuseofparameterizationiswithdynamicselects.
Anoutoftheboxexampleexiststhatallowsyoutoquicklydefinedynamic
selectpresentations.Thishasalargenumberofparametersenablingyouto
rapidlydeploydynamicselectfunctionalitythroughouttheapplication.
Parameterscanonlybepasseddirectlyusingtheoutoftheboxformwiththe
followingruletypes:
RuleObjProperty(fromv5.3)
RuleHTMLSection
RuleObjFlowAction
ParameterscanbepassedtoRuleHTMLPropertyruleswithinnonauto
generatedStreamrulesusingthePegaParamJSPtags.
EarlyversionsofPRPC(pre5.3)didnotallowparameterstobepassedtoaRule
HTMLPropertydirectlyfromthePropertydefinition.Thislimitationstillexists
inversion5.3whenreferencedfromListViewandSummaryViewrules.
DefiningCustomButtons
CustomRadioButtons
ListViewscanbeusedtoformatresultssets.Inherently,ListViewrulesallow
forthesingleandmultipleselectionsofresultsforfurtherprocessing.However,
therearesituationswherethisfunctionalitycannotbeused,suchasdisplaying
PageListelementsembeddedwithinanotherobject.
InPRPC5.3thereisacomprehensivesetofradiobuttondefinitionsthatallow
youtoselectresultsfromalistview.Ifyouhaveversion5.3orlater,investigate
theoutoftheboxofferingbeforeusingthesolutiondetailedabove.
CustomButtons
UsingstandardRuleHTMLSectionfunctionality,itispossibletoincludea
buttononascreenthatcallsanactivitytoperformanactionandultimately
repaintthescreen.However,therearesituationswhereitismorepracticalto
includethebuttonwithinaRuleHTMLPropertydefinitionsothateachtimethe
propertyisdisplayedadefinedactivitycanalsobeinvoked.
6 Advanced UI Techniques
Forexample,foreachdisplaywhereyouintendtocaptureanaddress,abutton
hasbeenincludedtocallanactivitytoperformanaddresslookup.Thisbutton
hasbeendefinedwithintheRuleHTMLProperty.WithintheAddressLookup
RuleHTMLPropertyrule,thereisthedefinedlogicandadisplayoftheentered
value,aswellasthesimplescripttoinvokeanactivity.
Ouractivityhassetsimplevaluesonthepageandrepaintsthescreen.When
theAddressLookupbuttonisclicked,theactivityisinvoked,propertiesare
populated,andthescreenisredisplayed.
RepeatingElementsforListViews
Listviewrulesareaverypowerfultoolforformattingrepeatingelementsof
data.Traditionally,theyareusedtodefinethecriteriatoretrieve,sort,and
displaydata,suchasworklists,thatdisplayonourdefaultportal.
Listviewsprovidetheabilitytosortrepeatingelementswithouttheneedto
buildcomplexcustomJavaScript.Thisfunctionalitycanalsobeusedtoformat
repeatingrowsofdata.
WithintheCPMframework,listviewsareoftenusedtoformatrepeating
elementsofdatareturnedfromexternalservicecalls.Forexample,when
searchingforacontact,anactivityisprocessedthatlooksforcustomersonan
externaldatabaseandretrievestheresultssetpriortothescreenbeing
rendered.
YoucandefineanactivitywithintheReportSourcesectionoftheform.
Essentially,youractivitycouldensurethecontentyouwishtodisplayispresent
ontheclipboard.Ifnot,itcreatesablankpagewithzeroresultsenablingthe
listviewtodisplaywithouterror.
ThislistviewisthenembeddedwithinanormalsectionusingaPegaListView
JSPtagthatallowsyoutostayguardrailcompliant.
Note:Whendefininglistviewstopurelyformatdata,youmustalwaysdefine
oneelementintheGetTheseFieldssectionoftheform.Thisneednotrelateto
anythingyouwishtodisplay.Leavingthiselementblankwillnotallowtherule
tosave,andaddinginapropertythatisnotexposedwillcauseguardrail
compliancealertstobegenerated.Asimplewayaroundthisistodefine
pyLabelasthefieldintheGetTheseFieldssectionwithineachofyourcustom
listviewrules.

Advanced UI Techniques 7


Withinthelistviewdefinition,youcanthendefinewhatrowsareselectable.
Singleeachresultisdisplayedwitharadiobutton.
Multipleeachresultisdisplayedwithacheckbox.
DependingontheCopyTomethodchosen,theselectedrowsaremappedto
theclipboardinanumberofdifferentways.ThisisparticularlyusefulinSearch
andSelectfunctionality.

You might also like