settingzblog模板
zblog模板 时间:2021-01-17 阅读:(
)
Java/Domino4.
6,BobBalabanPage4-1Chapter4NOIPart3:Item,RichTextItem,RichTextStyle,EmbeddedObject,DateTime,DateRangeThischaptergoesintomoredetailabouttheclassesrelatingtodatavaluesanddatatypes,withafairamountofattentionpaidtorichtextandembeddedobjects.
Thelotus.
notes.
ItemClassTheItemclassiswherewereallystarttogetnittygrittyaboutdatavalues,sinceitisthesetofItemsinaDocumentthatreallyholdallthedata.
NOIconsidersanItem'svaluetobeanattributeoftheItem,somostofthecallsintheItemclassareproperties.
I'vearrangedthesetofpropertiesintotwogroups:valuepropertiesandattributes.
You'llseewhatImean.
ItemValuePropertiesThesecallsareequivalenttotheDocument.
getItemValueXXX()calls.
java.
util.
VectorgetValues()voidsetValues(java.
util.
Vector)Unlikecolumnvaluesorviewlookupkeys,Itemsthatcontainmultiplevaluesarealwayshomogeneouswithrespecttodatatype.
Thus,anItemthatcontainsatextlistcannotalsocontainanumber,andviceversa.
TheValuespropertyishowyouaccessallthevaluesofanItematonetime.
ThegetValues()callalwaysreturnsaVector,evenifthereisonlyasinglevalue.
ThesetValuescallalwaystakesaVectorasinput,evenifyouhaveputonlyonevalueinit.
UsethestandardVectormethodstodiscoverhowmanyvaluesthereare(Vector.
size()),andtoiteratethroughthem.
StringgetValueString()Java/Domino4.
6,BobBalabanPage4-2voidsetValueString(Stringtext)ThesecallsallowyoutoretrieveandsettextvaluesforanItem.
IfyoucallgetValueString()onanItemthatcontainsanotherdatatype,NOIwillattempttocoercethevaluetoaStringforyou.
IfyoucallsetValueString()onanItemthatcontainsavalueofadifferentdatatype,thenthatvalueisreplacedandthetypeoftheItemischangedtotext.
Ifthereisnovalue,orifthevaluecannotbecoerced,anullisreturned.
doublegetValueDouble()voidsetValueDouble(doublevalue)LiketheStringversionofthisproperty,itattemptstocoercethevaluetypeonthereadside,andoverwritesanyexistingvaluetypeonthewriteside.
Ifthevaluetypecannotbecoerced,a0isreturned.
intgetValueInteger()voidsetValueInteger(intvalue)AswithStringsanddoubles,theIntegerversionoftheValuePropertycoercesonretrieval(ifpossible).
Ifthevaluecannotbecoerced,a0isreturned.
lotus.
notes.
DateTimegetDateTimeValue()voidsetDateTimeValue(lotus.
notes.
DateTime)NotesstoresDateTimevaluesinternallyasnumbers,soweaddedaspecialpropertytoretrieveadatevalueasaDateTimeobject.
ThisisreallyonlyusefulwhenyoualreadyknowthattheItemcontainsaDateTimevalue,orwhenyouwanttosetanItemtoaDateTimevalueregardlessofwhatdatamighthavebeenstoredtherebefore.
IfyouaskforaDateTimeobjectfromanItemthatdoesnotcontainadate/timevalue,thenanullisreturned.
DateTimevaluesareprettymuchuselessrepresentedasnumbers,becauseunlikeinLotusScript,wheredatevaluesaredoubleprecisionnumbers,Notesusesitsowninternalformat,composedoftwo4-byteintegervalues,onefordateandonefortimeJava/Domino4.
6,BobBalabanPage4-3(someofthebitsareactuallyallocatedtoaDaylightSavingsTimeflagandtoatimezoneid).
ItemAttributeslotus.
notes.
DateTimegetLastModified()ReturnsthedateandtimethattheItemwaslastmodifiedwithintheDocument.
TheItemlevelinformationonmodificationisupdatedwhentheDocumentissaved,notwhenthein-memoryvalueismodified.
ThustheItem'sLastModifiedpropertycanneverbelaterthantheDocument's,althoughdifferentItemsinthesameDocumentcanhavedifferentLastModifiedvalues.
IftheDocumentisnew(hasneverbeensaved),thenthiscallreturnsnull.
ThisisthepropertyNotesusestoimplementfieldlevelreplication.
StringgetName()ReturnsthenameoftheItem.
AllItemshaveaname.
lotus.
notes.
DocumentgetParent()ReturnstheparentDocumentoftheItem.
AllItemshaveaparentDocumentinstance.
intgetType()ReturnsaconstantrepresentingthetypeoftheItem'svalue.
Theseconstantsare(asusual)declaredpublicstaticfinalintintheItemclass.
Mostoftheitemtypeslistedbelowareeitherobsolete(fromoldversionsoftheproduct)orbelongtovariousdesignelements,andassucharenotinterestingtomostdevelopers.
Theyarealllistedhereanyway,forthesakeofcompleteness.
Thepossiblevaluesare:ITEM.
ACTIONCD.
SimpleactioninformationforAgents.
ITEM.
ASSISTANTINFO.
Agentdesigndata.
ITEM.
ATTACHMENT.
Afileattachment.
Alwaysnamed$FILE.
ITEM.
AUTHORS.
ItemisoftypeText,buttheAuthorsflaghasbeenset.
ThismeansthattheItemcontainsthenamesofusers/groupsallowedtoreadandwritetheDocument.
Java/Domino4.
6,BobBalabanPage4-4ITEM.
COLLATION.
Specialcharactersetcollationdata.
ITEM.
DATETIMES.
Itemcontainsoneormoredate/timevalues.
ITEM.
EMBEDDEDOBJECT.
ItemispartofanembeddedOLEorotherobjectintheDocument.
Usuallynamed$FILE.
ITEM.
ERRORITEM.
Erroritem(obsolete).
ITEM.
FORMULA.
Formulaitem(obsolete).
ITEM.
HTML.
ItemcontainsrawHTMLtext,whichhasalso(often,butnotnecessarily)beenrenderedintoNotesrichtextformatelsewhereinthisDocument.
ITEM.
ICON.
Iconitem(obsolete).
ITEM.
LSOBJECT.
ItemcontainsLotusScriptprogramdata.
ITEM.
NAMES.
TheItemisanamesItem,containinguserand/orgroupnames.
IfanItemisoftypeAUTHORSorREADERS,itisalsoimplicitlyoftypeNAMES.
ITEM.
NOTELINKS.
ItemcontainslinkstootherDocuments.
ITEM.
NOTEREFS.
ItemcontainstheUNIDofDocument'sparent.
ITEM.
NUMBERS.
Itemcontainsoneormorenumericvalues.
ITEM.
OTHEROBJECT.
Itemreferencesanobjectotherthanafileattachmentorembeddedobject.
Notoftenseen.
ITEM.
QUERYCD.
ItemcontainsasavedqueryforanAgent.
ITEM.
READERS.
Itemisanameslistcontainingthenamesofuser/groupsallowedreadaccesstotheDocument.
ITEM.
RICHTEXT.
ItemcontainsrichtextCD(CompositeDocument)records.
ITEM.
SIGNATURE.
Itemcontainsasignature.
Alwaysnamed$Signature.
ITEM.
TEXT.
Itemcontainstext(oratextlist).
ITEM.
UNAVAILABLE.
Obsolete.
ITEM.
UNKNOWN.
Item'stypeisunknown.
ITEM.
USERDATA.
ItemisusedbyanAPIprogram(notNotesitself)tostoredatainaformatthatNotesdoesnotknowabout.
A"bitbucket"forsomeapplication.
ITEM.
USERID.
ItemcontainsausernamefromNotesRelease2.
ITEM.
VIEWMAPDATA.
Viewmapdesigninformation.
ITEM.
VIEWMAPLAYOUT.
Viewmapdesigninformation.
intgetValueLength()Java/Domino4.
6,BobBalabanPage4-5ReturnsthesizeinbytesoftheItem'svalue.
DoesnotincludeanyoverheadforItemleveldataotherthanthevalue.
booleanisAuthors()voidsetAuthors(booleanflag)TheAuthorspropertyisusedtoattachalistofusers/groupstoaDocumenttoprovideDocumentlevelaccesscontrol.
AnAuthorsItemisusuallynamed$Authors,andcontainsthelistofpeopleallowedtomodifytheDocument.
SettingtheAuthorspropertytotruewillsettheNamesflagaswellastheAuthorsflagontheitem.
SettingtheAuthorspropertytofalsewillnotcleartheNamesflag,however.
booleanisEncrypted()voidsetEncrypted(booleanflag)WhenyouencryptaDocument,onlytheItemsmarkedforencryptionactuallygetencrypted.
UsetheEncryptedpropertyontheItemclasstomarkorunmarkItemsindividually.
booleanisNames()voidsetNames(booleanflag)TheNamespropertyindicateswhichItem(s)inaDocumentcontainuser/groupnames.
SettingtheAuthorsorReaderspropertywillalsosettheNamesflagontheItem,butyoumightwanttosettheNamesflagalone.
AfewplacesintheNotesUIcheckforaNamesflagonanItem,andwillletyoudospecialkindsofaddressbooklookupsautomaticallyonthecorrespondingfieldsinaform.
YoucansettheNamesflagonaform'sfieldinthefieldpropertyboxwhenyou'reinformdesignmode.
booleanisProtected()voidsetProtected(booleanflag)Java/Domino4.
6,BobBalabanPage4-6SetthispropertytotrueifyouwantonlyuserswithEditor(orbetter)accesstobeabletomodifytheItem.
booleanisReaders()voidsetReaders(booleanflag)SimilartotheAuthorsproperty:definesthelistofusers/groupswhohavereadaccesstotheDocument.
booleanisSaveToDisk()voidsetSaveToDisk(booleanflag)ThispropertyisexceptionallyusefulinthoseapplicationswhereyouwanttotemporarilystoredatainaDocument,butdon'twantthatdatawrittentodiskwhentheDocumentissaved.
ThestandardmailtemplateusesitextensivelyforCalendaringandScheduling.
IftheSaveToDiskflagonanItemistrue(thedefault),thenthatItemgetswrittentodiskwhentheDocumentissaved.
Ifnot,thentheItemissimplyskippedatDocumentsave()time.
booleanisSigned()voidsetSigned(booleanflag)AswiththeEncryptedproperty,whenyousignaDocumentonlytheItemsmarkedforsigningareincludedinthe"digest"oftheDocument(seethediscussionofDocument.
encrypt()inChapter2).
UsethispropertytosetorcleartheflagforanItem.
booleanisSummary()voidsetSummary(booleanflag)OnlyItemswhoseSummarypropertyissetcanappearasvaluesinaView,becauseonlyItemswiththeirSummaryflagsetareincludedintheView'ssummarydata.
AuthorandReaderItemsneedtohavetheirSummaryflagssetaswell;otherwise,theJava/Domino4.
6,BobBalabanPage4-7accesscontrolfeaturesforwhichtheyweredesignedwon'twork.
SettingeithertheAuthorsorReaderspropertywillautomaticallyalsosettheNamesandSummaryflags.
NotallItemswiththeSummaryflagsetcanappearinaView,however.
RichtextItems,forexample,areexplicitlyexcluded,asaretextItemswherethelengthofthetextexceeds15KB.
YouwillalsobepreventedfromsettingtheSummaryflagonanyItemwhosesizeexceeds32KB(theflagisautomaticallycleared,thoughnoerrorisraised).
Apartfromtheserestrictions,whenyoucreateanItemusingNOI,theSummaryflagissetforyouautomatically.
ItemMethodsStringabstractText(intmaxlen,booleandropvowels,booleanusedict)ThislittleknownmethodisaninterestingwaytoshrinkthecontentsofatextItem.
UserssometimesuseittogetaroundthefactthatNOIhasamaximumstringlengthof32,000characters(64,000bytes,butwhenyouuseUnicodeinternallyitcutsthenumberofcharactersyoucanholdina64KBbufferdownto32,000),andmanyrichtextItemscontainmuchmoretextthanthat.
TheabstractText()callcompressestheoriginaltext(includingrichtext)inanItembyoptionallydroppingallvowels(ifyouspecifytrueforthe"dropvowels"parameter),andbyattemptingtoreplacewordswithcommonabbreviations.
Itoptionallydoestheabbreviatingusingadictionaryfileifyouspecifytrueforthe"usedict"parameter).
Thedictionaryfileisasimpletextfile,formattedwitheachwordanditsabbreviationonasingleline,separatedbyatleastonespace.
Theentriesshouldbeinalphabeticalorder.
Thefileisnamed"noteabbr.
txt"(inlowercaseforthoseoperatingsystemsthatcare),andmustbesomewhereonyourpath(yourexecutionpath,nottheNotesdatadirectory).
AsampledictionaryisincludedontheCD,youcanaddyourownabbreviationsatwill.
Java/Domino4.
6,BobBalabanPage4-8AbstractText()alsoautomaticallytrimswhitespace(compressingmultiplespacesintoasinglespace,andsoon),andtrimspunctuationwherepossible.
Themethodwillperformitsmagiconthefirst64KBoftextintheItem.
voidappendToTextList(Stringvalue)voidappendToTextList(java.
util.
Vectortextlist)ThismethodtakesaString,orVectorofStrings,andappendsittothecurrentItem'stextortextlist.
TheItemmustbyoftypeTextorTextListforthiscalltowork.
IftheoriginalItemvaluewasonlyasingleString,thenthiscallwillconverttheItemintoatextlist.
IftheoriginalItemcontainedaStringoratextlist,thenthenewStringortextlistisappendedtoit.
booleancontainsValue(Objectvalue)ReturnstrueiftheItemcontainsthevaluethatyoupassinasaparameter.
Thedatatypeoftheobjectthatyoupassindoesn'tneedtobeexactlythesameasthedatatypeoftheItem,buttheymustbecompatible.
Forexample,Textiscompatiblewithrichtext,text,andtextlist.
Numberiscompatiblewithnumberandnumberlist.
DateTimeiscompatiblewithDateTimeorDateRange.
Therulesforamatchvarysomewhatwithdatatype:Numbers.
IftheItemcontainsanumber,thetwomustmatchexactly.
IftheItemcontainsanumberlist,theinputargumentmustbeoneofthenumbersinthelist.
DateTime.
IftheItemcontainsaDateTimevalue,thetwomustmatchexactly.
IftheItemcontainsaDateTimelist,theinputargumentmustbeoneofthevaluesinthelist.
Text.
IftheItemcontainsrichtext,theinputStringmustbeasubstringintherichtextstream.
IftheItemcontainsasingleString,thenthetwomustmatchexactly.
IftheItemcontainsatextlist,thentheinputargumentmustexactlymatchoneoftheelementsinthelist(comparisonsarecase-andaccent-sensitive).
Onespecialcase:iftheItem'sNameflagisset(theJava/Domino4.
6,BobBalabanPage4-9Itemcontainsoneormoreuser/groupnames),thenthematchwillsucceediftheinputargumentisacommonnamethateithermatchesexactlyormatchesthecommonpartofadistinguishednameintheItem.
Forexample,iftheItemisaNameItemandcontains"CN=BobBalaban/O=Looseleaf"andIcallItem.
contains()withaninputargumentof"BobBalaban",thenthematchwillsucceed.
lotus.
notes.
ItemcopyItemToDocument(lotus.
notes.
Documentdestination)lotus.
notes.
ItemcopyItemToDocument(lotus.
notes.
Documentdestination,Stringnewname)ThismethodmakesacopyofthecurrentIteminthespecifiedDocument.
TheItem'sflags(Summary,Name,etc.
)aswellasitsvaluearecopied.
BydefaultthenewItemwillkeepthesamenameastheoriginal,butyoucanalsospecifyanewnameforit.
NocheckingisdonetoseewhetherthedestinationDocumentalreadycontainsanItemofthatname.
Ifitdoes,youwillendupwithaDocumentcontainingmultipleItemsofthesamenamewhich,whileokayforthingslikefileattachments,isadefiniteno-nofordataItems.
YoumayhaveproblemswiththiscallifyouuseitonaRichTextItem.
TheproblemwillariseifthesourceanddestinationDocumentsdonothavethesamefontlayouts:Therichtextmayhavedifferentfontsinthedestinationthanitdidinthesource.
Thereasonforthishastodowiththewayfontinformationisstored.
EachDocumenthasaspecialItem(named$Fonts)containingafonttable.
Eachfontnameinthetableisassociatedwithafontindex,andthetable'sscopeistheentireDocument.
AnyfontsettingscontainedinaRichTextItemwillcontainonlythefont'sindexintothetable,notthefullfontinformation.
WhenyoucopyaRichTextItemfromoneDocumenttoanother,the$Fontstablesarenotmerged.
Thus,ifthedestinationDocumenthasadifferentfonttablelayoutthanthesourceDocument(alikelyoccurrence,unlessyou'relucky),thefontindicesinthecopiedItemwillbewrong.
ThisisabugthatisscheduledtobefixedinDominoRelease5.
0.
OnepossibleworkaroundistoexplicitlycopytheJava/Domino4.
6,BobBalabanPage4-10$FontsItematthesametime.
Thatwon'twork,though,incaseswheretheDocumenthasmorethanoneRichTextIteminit.
WhenyoucopyaRichTextItem,allofitsembeddedobjects(fileattachments,OLEobjects)arecopiedaswell.
StringgetText()StringgetText(intmaxlen)ThegetText()methodreturnsatextversionofthecontentsoftheItem.
ItoperatesabitdifferentlyfromthegetValueString()call,however.
BothoperatethesamewhentheItemcontainsrichtext,butwhentheItemcontainsatextlist,getValueString()willonlyreturnthefirstelementofthelist,whilegetTextwillreturntheentirelist,witheachelementseparatedbythedefaulttextlistseparator(usuallyasemicolon).
ThegetText()callalsohasanoptionthatlimitsthelengthofthereturnedStringtoaspecifiedmaximum.
Thisisparticularlyusefulwhenyou'reaccessingrichtextandonlywantasmallpartofwhatmightbealargeString.
Themaximumlengthisspecifiedincharacters(notbytes).
voidremove()RemovesanItemfromthecurrentDocument.
IftheItemisamulti-partRichTextItem(seethediscussiononDocument.
getFirstItem()inChapter3fordetailsonmulti-partItems),allpartsareremoved.
Thelotus.
notes.
RichTextItemClassTheRichTextItemclassistheonlyinstanceinNOIofclassinheritance.
RichTextItemextends(theJavatermforinheritsfrom)theItemclass,meaningthatallofthemethodsandpropertiesthatyoufindinanItemarealsoavailabletoRichTextItem.
RichTextItemalsoaddssomeadditionalmethodsandpropertiesthatarespecifictomanipulatingrichtext,andthosearewhatwedocumentinthissection.
Java/Domino4.
6,BobBalabanPage4-11TheRichTextItemclassisnotasfullyfunctionalwithNotesrichtextasanyone(includingthedevelopersoftheinterface)wouldlike.
Itwillcontinuetoevolve,though,anditdoesallowyoutoexaminecertainaspectsofarichtextitem,andtoaddnewtext,styles,doclinks,andfileattachmentstothem.
RichTextItemPropertiesjava.
util.
VectorgetEmbeddedObjects()ThisistheonlypropertyintheRichTextItemclass(otherthantheonesthatRichTextIteminheritsfromItem).
ThegetEmbeddedObjects()callreturnsaVectorcontainingalloftheembeddedobjects(includingfileattachments,OLE/1objectsandOLE/2objects)intheRichTextItem.
YourprogramdoesnothavetoberunningonaWindowsmachineinordertosuccessfullyinstantiateEmbeddedObjectsforOLEobjects—itwillworkonanyplatform.
InLotusScriptNOIyoudohavetoberunningonaWindowsplatforminordertoactivateanOLEobject,becauseinordertorunanOLEobjecttheMicrosoftOLElibrarieshavetobeavailable.
Unfortunately,inJavaNOI(forDomino4.
6)OLEisn'tsupported.
SeethediscussionoftheEmbeddedObjectclasslaterinthischapterforallthegorydetails.
RichTextItemMethodsvoidaddNewLine()voidaddNewLine(intn)voidaddNewLine(intn,booleannewparagraph)Thismethodaddsanewlinetotherichtextstream.
Youcanspecifyhowmanynewlinestoadd,andyoucanalsospecify(usingthenewparagraphparameter)whetherthenewline(s)actsasaparagraphbreakornot(thedefaultvaluefornewparagraphistrue).
WhyshouldyoucareaboutthedistinctionbetweennewlinesandnewparagraphsUsually,youwon'tneedtocare,butyoushouldalsoknowthatNotesdoesmaketheJava/Domino4.
6,BobBalabanPage4-12distinction,andthatasingleparagraphinaRichTextItemcannotholdmorethan64KBworthofdata.
Ifyouweretosimplyappendtextforalongtimeeitherwithoutaddingnewlines,oraddingnewlinesthatwerenotparagraphbreaks,Noteswouldatsomepointmostlikelyinsertaparagraphbreakforyou,andtheresultantrenderingforthatRichTextItemintheUImightlookodd.
Or,youmightgetanexceptionfortheparagraphexceeding64KB.
UsingtheaddNewLine()callistherecommendedwaytoinsertnewlines.
Explicitlyincludingconstructssuchas"\n"or"\n\r"inyourtextstreamisnotrecommended,asthesetendtobeplatform-specificvalues(anewlineinWin95isnotthesameasanewlineontheMac,forexample).
TheaddNewLine()methodisguaranteedtoworkcorrectlyforallplatforms.
voidaddTab()voidaddTab(intn)Thiscalladdsoneormoretabcharacterstotherichtextstream.
Youshouldusethismethodinsteadofexplicitlyaddingconstructslike"\t"toyourtext.
voidappendDocLink(lotus.
notes.
Documentdoc)voidappendDocLink(lotus.
notes.
Documentdoc,Stringcomment)ThiscalladdsaNotesdoclinktothespecifiedDocumentinstancetothecurrentRichTextItem.
DuetoalastminuteproblemduringthedevelopmentofDomino4.
6(thedeveloper,yourstruly,screwedupabit),theinterfacetothismethodwasnotcorrectlyspecified,andtherewasnotimetocorrecttheerrorbeforetheproductshipped.
Thereshouldhavebeenthreesetsofmethodshere:oneeachforaddingalinktoaDocument,ViewandDatabase.
InLotusScripttheargumentisaVariant,sopassinginanyofthesethreeobjecttypesworks.
ButbecauseJavaisstronglytyped,there'snowaytofoolthecallintoacceptingaVieworaDatabase.
Sorry.
Java/Domino4.
6,BobBalabanPage4-13ThedoclinkisrenderedasthestandardlinkiconintheRichTextItem,andcontainsaserver"hint"aswelltoassistinlinkresolutionlater.
TheserverhintistakenfromtheinputDocument'sparentDatabase.
Youcanoptionallyaddacommenttothelinkaswell,whichdisplaysinthestatusbaroftheUIwhenyouhighlightthelink.
voidappendRTItem(lotus.
notes.
RichTextItemitem)UsethismethodtomergeaRichTextItem(couldbefromthesameDocumentorfromanotherone)intothecurrentRichTextItem.
Beaware,however,thatyoumayhavefontproblems,asdescribedaboveinthischapterfortheItem.
copyToDocument()method.
voidappendStyle(lotus.
notes.
RichTextStylestyle)AddsanewRichTextStyletothecurrentrichtextstream.
Itallowsyoutomodifythefont,color,size,andsoonoftextasyouappendittotheRichTextItem.
SeebelowformoredetailsontheRichTextStyleclass(newinRelease4.
6).
voidappendText(Stringtext)AddstexttothecurrentRichTextItem.
Textisalwaysappendedtotheendofthestream—thereisnoway(currently)toinsertormodifytextinthemiddleoftheItem.
Youshouldnotuseexplicittabs("\t")ornewlines("\n"or"\n\r")inthetextstream,astheyarenotalwaysplatformportable.
InsteadusetheaddTab()andaddNewLine()methods.
lotus.
notes.
EmbeddedObjectembedObject(inttype,Stringclassname,Stringsource,Stringname)AddsanEmbeddedObjecttotheRichTextItem.
EmbeddedObjectinstancesencompassfileattachmentsaswellasOLEobjects.
Unfortunately,OLEdoesn'treallyworkwiththeJavaNOIinRelease4.
6(shouldbefixedin5.
0),sothismethodin4.
6islimitedtoembeddingfileattachments.
SeethefollowingsectionontheEmbeddedObjectclassformoredetailsontheproblemswithOLE.
Java/Domino4.
6,BobBalabanPage4-14ThefirstargumenttotheembedObject()callisaconstantwhichspecifiesthetypeofembeddingyouwant:RichTextItem.
EMBED_ATTACHMENT.
Embedafileattachment.
RichTextItem.
EMBED_OBJECT.
EmbedanOLEobject.
RichTextItem.
EMBED_OBJECTLINK.
EmbedalinktoanOLEobject.
Embeddingafileattachmentsimplymeansthatthefileisattachedtothedocument,andaniconforitisrenderedintotheRichTextItematthecurrentlocation.
Theicondoesn'tlookexactlythewayitdoeswhenyouattachafileusingtheNotesUI:Yougetthesameicon,butthenameofthefiledoesn'tappearunderneathit;yougetthenamefollowingtheicon.
ThereasonforthisisthattheUIgeneratestheicon/namerenderingusingagraphicalmetafile,andtheback-endNOIclassesdon'thavetheabilitytodothat.
Insteadwejuststickagenericiconinthereandaddthenameofthefilefollowingit.
ThedifferencebetweenembeddinganOLEobjectandembeddinganOLEobjectlinkisthatinthefirstcasetheentireobject(andallitsinstancedata)isattachedtotheDocument,whereasinthelinkcaseonlyapointertoafileondiskisstoredintheDocument.
TheadvantageofalinkisthatitusesmuchlessspaceintheDatabase,howeveryoucan'treallymakeuseofalinkacrossreplicas.
Sincethelinkistoafileondisk,everyonewhoaccessedthelinkwouldhavetohavetheoriginalfileinthesamelocationonhisorherowndisk,notaveryeasysetuptomaintain.
The"classname"argumentisusedforOLEobjectsonly.
Itallowsyoutospecifyanapplication(say,1-2-3orExcel)andhaveNOIcreatean"empty"embeddedobjectofthatclassintheRichTextItem.
Ifyoudon'twantanemptyembedding,thenyouspecifynullfortheclassname,andprovideanexplicitfilepathforthe"source"argument.
ThefiletypeischeckedagainsttheOLEregistry,andifitisafilebelongingtoavalidOLEapplicationinstalledonyourmachine,thenOLEwill(inafuturereleaseofJavaNOI,remember,thoughitdoesworkfineinLotusScript)launchtheapplication,loadthefile,Java/Domino4.
6,BobBalabanPage4-15andre-saveitinyourDocument.
Youcannotspecifybothaclassnameandasourcepath(whenyouspecifyafile,theclassisimplied).
Thethirdargument,"name,"isthenamebywhichyouwanttheembeddedobjecttobeknowninDomino.
ThisisthenamethattheUIshowsyou(right-clickontheembeddedobjectintheUIandbringuptheObjectPropertiesbox),andthenameyoucanuseinthegetEmbeddedObject()calltoretrieveit.
Itcanbeanystringyoulike,thoughthenameshouldbeuniquewithintheDocument.
lotus.
notes.
EmbeddedObjectgetEmbeddedObject(Stringname)LocatestheEmbeddedObjectinstanceinthecurrentRichTextItemofthenameyouspecify,andreturnsit.
Thenameshouldbetheuser-definednameoftheobject,whichyoucanspecifyintheembedObject()call,oreditintheObjectPropertiesboxintheUI.
StringgetFormattedText(booleanstriptabs,intlinelength,intmaxlength)ThismethodconvertsaRichTextItemtoatextonlyrepresentation,andallowsyoutospecifywhethertabsshouldberemoved(eachtabisconvertedtoonespace),howlongeachlineshouldbe(newlinesareinsertedattheendofeachline),andthemaximumamountoftextyouwantreturned.
Ifyouspecify0forthelinelength,alengthof80isused.
ThemaximumlengththatNOIwillreturnforthiscallis32,000Unicodecharacters(64KB).
Thelotus.
notes.
RichTextStyleClassThisclassisnewinRelease4.
6,and(finally!
)addsfunctionalitytoNOIthatallowsyoutomanipulaterichtextstyleswhenappendingtexttoaRichTextItem.
FollowingtheappendmodeofinteractionwithRichTextItem,youusetheRichTextItem.
appendStyle()calltoaddastyletotherichtextstream.
Alltextappendedfollowingthestylewillberenderedwiththatstyle.
Java/Domino4.
6,BobBalabanPage4-16RichTextStylehasnomethods,onlyproperties.
Allpropertiesareread-write.
ThereareanumberofconstantsthatI'vedocumentedseparately.
Asusual,allconstantsaredefinedaspublicstaticfinalintintheRichTextStyleclass,soyouwouldreferencethemusingtheRichTextStyle.
prefix.
Thereasonforusingconstantsforcolorsandsoon(insteadof,say,allowingyoutospecifyRGBcombinations)isthatthiswastheonlywaytoguaranteeplatformportability:Wewantedyoutobeconfidentthatyouwouldgettherightcoloronalloperatingsystems.
Canyouuseanynumber,orareyoujustlimitedtothepredefinedconstantsTheactualansweristhat,forcolorsandfontsatleast,youarefreetouseanyintegeryoulike.
Theproblemis,though,thatonlythepre-definedonesareplatformportable.
Beawarethatifyoufindsomecolororfontthatyouliketouseon,say,Windows,thatisn'tpartofthepredefinedset,thenthat'sokay,butitmightverywelldisplaydifferentlyonOS/2ortheMac.
NotethatifyousetaRichTextStyleintoaRichTextItemandtheninvokeRichTextItem.
appendRichTextItem(),theincomingItem(whichhasitsownstylesinit)willnotbeaffectedbytheRichTextStyle.
YouinstantiateaRichTextStyleobjectusingtheSession.
createRichTextStyle()call.
StyleobjectsarescopedtotheSessionsothatyoucanreusetheminmultipleDatabases.
NotethattheRichTextStyleclasswasomittedfromtheJavaProgrammer'sGuidedatabasedistributedwithDomino4.
6,buttheLotusScriptversionoftheinterfaceisdocumentedintheonlinehelp.
RichTextStyleConstantsColorconstantsarelistedasfollows:RichTextStyle.
COLOR_BLACKRichTextStyle.
COLOR_BLUERichTextStyle.
COLOR_CYANRichTextStyle.
COLOR_DARK_BLUEJava/Domino4.
6,BobBalabanPage4-17RichTextStyle.
COLOR_DARK_CYANRichTextStyle.
COLOR_DARK_GREENRichTextStyle.
COLOR_DARK_MAGENTARichTextStyle.
COLOR_DARK_REDRichTextStyle.
COLOR_DARK_YELLOWRichTextStyle.
COLOR_GRAYRichTextStyle.
COLOR_GREENRichTextStyle.
COLOR_LIGHT_GRAYRichTextStyle.
COLOR_MAGENTARichTextStyle.
COLOR_REDRichTextStyle.
COLOR_WHITERichTextStyle.
COLOR_YELLOWFonteffectsarelistedasfollows:RichTextStyle.
EFFECTS_EMBOSSRichTextStyle.
EFFECTS_EXTRUDERichTextStyle.
EFFECTS_NONERichTextStyle.
EFFECTS_SHADOWRichTextStyle.
EFFECTS_SUBSCRIPTRichTextStyle.
EFFECTS_SUPERSCRIPTFontnamesarelistedasfollows:RichTextStyle.
FONT_COURIERRichTextStyle.
FONT_HELVRichTextStyle.
FONT_ROMANOtherconstantsare:RichTextStyle.
STYLE_NO_CHANGERichTextStyle.
YESRichTextStyle.
NORichTextStyle.
MAYBE(equivalenttoSTYLE_NO_CHANGE)RichTextStylePropertiesintgetBold()Java/Domino4.
6,BobBalabanPage4-18voidsetBold(intsetting)Retrievesorturnstheboldtextattributeonoroff(useYESorNO),orexplicitlycarriesovertheboldsettingofthemostrecentstyleobjectaddedtotherichtextstream(useSTYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetColor()voidsetColor(intcolor)Retrievesorsetsthecurrentcolor(useoneofthecolorconstants),orexplicitlytellsNOItocarryoverthemostrecentcolorsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetEffects()voidsetEffects(intvalue)Retrievesorsetsoneofthespecialeffectssettings(useoneoftheEFFECTSconstants),orcarriesoverthemostrecentsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetFont()voidsetFont(intfont)Retrievesorsetsthefontthatisusedfortext(useoneofthefontnameconstants),orcarriesoverthemostrecentfont(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetFontSize()voidsetFontSize(intsize)Retrievesorsetsthefontsize(inpoints)ormaintainsthemostrecentsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
Thevalidvaluesarebetween1and250,inclusive.
intgetItalic()voidsetItalic(intvalue)Java/Domino4.
6,BobBalabanPage4-19Retrievesorsetstheitalicpropertyofthetextstream(useYESorNO)ormaintainsthemostrecentsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetStrikeThrough()voidsetStrikeThrough(intvalue)Retrievesorsetsthestrike-throughattribute(useYESorNO)ormaintainsthemostrecentsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
intgetUnderline()voidsetUnderline(intvalue)Retrievesorsetstheunderlineattribute(YESorNO)ormaintainsthemostrecentsetting(STYLE_NO_CHANGE).
DefaultisSTYLE_NO_CHANGE.
Sincethisisanewclass,let'sdoasimpleexample(seeListing4.
1).
Listing4.
1RichTextStyleExample(Ex41RTStyle.
java)importjava.
lang.
*;importjava.
util.
*;importlotus.
notes.
*;publicclassEx41RTStyle{publicstaticvoidmain(Stringargv[]){try{NotesThread.
sinitThread();Sessions=Session.
newInstance();Databasedb=s.
getDatabase("","book\\Ex41.
nsf");Documentdoc=db.
createDocument();RichTextItemrti=doc.
createRichTextItem("body");//firststyleRichTextStylestyle1=s.
createRichTextStyle();Java/Domino4.
6,BobBalabanPage4-20style1.
setBold(RichTextStyle.
YES);style1.
setColor(RichTextStyle.
COLOR_DARK_CYAN);style1.
setEffects(RichTextStyle.
EFFECTS_EMBOSS);style1.
setFont(RichTextStyle.
FONT_ROMAN);style1.
setFontSize(24);//secondstyleRichTextStylestyle2=s.
createRichTextStyle();style2.
setBold(RichTextStyle.
NO);style2.
setColor(RichTextStyle.
COLOR_DARK_RED);style2.
setEffects(RichTextStyle.
EFFECTS_EXTRUDE);style2.
setFont(RichTextStyle.
FONT_HELV);style2.
setFontSize(18);rti.
appendText("Firstlineisdefaulteverything");rti.
addNewLine();rti.
appendStyle(style1);rti.
appendText("Thistextisinstyle1.
");rti.
addNewLine();rti.
appendStyle(style2);rti.
appendText("Thistextisinstyle2.
");//saveitdoc.
save();}//endtrycatch(Exceptione){e.
printStackTrace();}finally{NotesThread.
stermThread();}}//endmain}//endclassIfyouexaminethedocumentcreatedbythisprogramintheEx41.
nsfdatabaseonyourCD,you'llseethatwegotwhatmightbesomeunexpectedbehaviorwithrespecttospecialeffects.
Instyle1,IturnedontheEMBOSSeffectandusedthatforthesecondlineoftext.
Instyle2,IsettheeffecttoEXTRUDE,whichyoumightexpecttoreplaceJava/Domino4.
6,BobBalabanPage4-21theEMBOSSsetting,astheyarebothsetwiththesamecall.
However,thethirdlineoftextcomesoutwithbothEXTRUDEandEMBOSSset(youcanverifythisbyeditingthedocument,bringinguptheTextPropertiesboxandmovingthecursorbetweenthetwolines).
LuckilywecangetabehaviorbyaddingacalltoRichTextItem.
appendStyle()usingathirdRichTextStyleinstancewhoseEffectspropertyhasbeensettoEFFECTS_NONEbeforeappendingstyle2.
Thelotus.
notes.
EmbeddedObjectClassAsmentionedabove,theEmbeddedObjectclassencapsulatesbothfileattachmentsandOLEobjects.
WhiletheJavaNOIfullysupportsmanipulationoffileattachmentsthroughthisclass,unfortunately(atleastinDominoRelease4.
6)OLEobjectactivation(requiredforembeddingandactivatingembeddedobjectsandlinks)isnotsupportedinJava(itisfullysupportedviaLotusScript).
Thereweretworeasonsforthislimitationin4.
6:OLErequiresthateachthreadonwhichOLEcallswillbemademustnotonlyinitializeOLE(nobigdealthere),buteachthreadmustalsoimplementaWindowsmessagepump(usuallyimplementedasaGetMessage()/DispatchMessage()loop).
Ifthemessagepumpisnotrunoneachthread,thatthread'smessagequeuecangetbackedup,andthethreadwilleventuallyhang.
ThisisbecauseOLEusescross-processmessagingtocommunicatebetweenthecontainerprogram(usuallyNotes)andtheembeddedobject,especiallywhentheembeddedobjectorcontrolisanEXE("outofprocess")application,asopposedtoaDLL("inprocess")controlorActive/X.
ThisrequiredsomenontrivialarchitecturalchangesinNotes,andtherejustwasn'ttimetocompletethembeforeRelease4.
6shipped.
ThesecondreasonhadtodowiththescriptabilityofembeddedOLEobjectsinJava.
WithLotusScript,thelanguagehasbuilt-inOLEAutomationcapabilities,justasVisualBasicdoes.
YoucangetanJava/Domino4.
6,BobBalabanPage4-22Automation"handle"(anIDispatchinterface,forthoseofyouwhoknowaboutCOMinterfacesandOLE)toanyembeddedobjectjustby"activating"it,whichcausesOLEtoloadandrunit.
UsingtheAutomationhandle,LotusScriptcantransmitcommandsthatarespecifictotheembeddedapplication(orcontrol)throughtheIDispatchinterfacetotheobject.
ThisallowsyouaverynicescriptingcapabilitydirectlyfromLotusScript.
Java,however,doesn'thaveanythinglikethatbuiltin.
EvenifwehadbeenabletosolvetheOLE-per-threadproblemintime,wewouldhavehadtoinventanentirelynewIDispatchlikeinterfaceinJavainorderforyoutobeabletomanipulateembeddedobjects.
Thatwasjusttoomuchworkgiventhetimewehad,especiallysincetheforthcomingJavaBeans/COMBridgearchitecturesthatarecomingoutsoonwillsolvetheAutomationproblemforus.
HopefullyDomino5.
0willdoamuchbetterjobwithOLE.
Inthemeantime,someofthemethodsandpropertiescontinuetoworkintheJavaNOI.
YoucreateanewEmbeddedObjectinstancewiththeRichTextItem.
embedObject()call(allEmbeddedObjectsliveinarichtextitem).
YoucanalsoaccessexistingEmbeddedObjectsviatheRichTextItem.
getEmbeddedObjects(),RichTextItem.
getEmbeddedObject()andDocument.
getEmbeddedObjects()calls.
EmbeddedObjectPropertiesStringgetClassName()ReturnsthenameoftheOLEclassoftheembeddedobject,ifitisanOLEobject;itreturnsnullforothertypesofobjects.
ThiscallworksinJavaNOI,onanyplatform,solongastheclassisknowntoDomino.
intgetFileSize()Returnsthesizeofanattachedfile,inbytes.
IfyoumakethiscallonanEmbeddedObjectinstancethatrepresentsanOLEobject,youwillprobablygetmisleadingresults.
That'sbecauseOLEobjectsstoretheirdatain$FILEItemsinaNotesJava/Domino4.
6,BobBalabanPage4-23Document,justasfileattachmentsdo.
TheproblemisthatOLEobjectsmostalwaysusemorethanone$FILEitem,andthegetFileSize()callisn'tawareofthat.
StringgetName()Returnstheuser-definednameofthefileattachmentorembeddedobject.
WorksforOLEobjectsonallplatforms,ifauser-definednamewassuppliedwhentheobjectwasembedded.
intgetObject()ReturnstheOLEAutomationhandleforanembeddedOLEobject.
DoesnotworkintheJavaNOI.
lotus.
notes.
RichTextItemgetParent()ReturnstheRichTextIteminwhichthecurrentobjectisembedded/attached.
StringgetSource()ReturnsthefilenameoftheoriginalfileattachmentorOLEobject.
WorksonallplatformsforOLEobjects.
intgetType()Returnsaconstantrepresentingthekindofobjectthatisembedded/attached,oneof:EmbeddedObject.
EMBED_ATTACHMENT,EmbeddedObject.
EMBED_OBJECT,EmbeddedObject.
EMBED_OBJECTLINK.
TheseconstantsareidenticaltotheonesdescribedaboveintheRichTextItemclass.
Theyweredeclaredinbothclassesonlyforconvenience.
java.
util.
VectorgetVerbs()ReturnsaVectorcontainingthelistofOLE"verbs"supportedbytheembeddedobject.
Thiscallhasnomeaningforfileattachments.
Becauseitrequiresactivationoftheembeddedobject,thiscalldoesnotcurrentlyworkintheJavaNOI.
EmbeddedObjectMethodsintactivate(booleanshow)Java/Domino4.
6,BobBalabanPage4-24ActivatesanembeddedOLEobjectandreturnsanAutomationhandleforit.
TheargumentspecifieswhethertheOLEobjectshouldcreateaseparatewindowtodisplayitsUI("show"settotrue),ortoactivatein-place("show"=false).
ThismethoddoesnotcurrentlyworkintheJavaNOI.
voiddoVerb(Stringverb)Executeoneofthesupported"verbs"intheembeddedobject(typicalsupportedverbsareOpenandEdit).
DoesnotcurrentlyworkintheJavaNOI.
voidextractFile(Stringfilepath)Forfileattachmentsonly,makeacopyoftheattachmentondisk,atthespecifiedlocation.
voidremove()Removestheembeddedobject/attachmentfromtheRichTextItem,includingitsrendering.
WorksforOLEobjectsonallplatforms.
Youmustinvokesave()ontheDocumentinordertocommitthechangestodisk.
StringtoString()Returnstheuser-definedname(ifany)oftheobject.
Thelotus.
notes.
DateTimeClassTheDateTimeclassrepresentstheinternalformatofaNotesdatevalue,whichincludesadate,atime,atimezoneandaflagindicatingwhetherdaylightsavingstimeisineffect.
Themethodsandpropertiesofthisclassallowyoutodoseveralkindsofdatearithmetic(add/subtractmonths,days,hours,andsoon),andtoconvertbetweentheinternalformatandStrings,orbetweentheinternalformatandtheLotusScriptformat.
Itseemslogicaltowonderwhythere'snoconversionbetweentheNotesformatandtheJavaDateclass,whichactuallyhasalotofthesamefunctionality(thoughtheJavaimplementationwaskindofbuggy,atleastinRelease1.
1.
1).
ThereasonisthattheJavadateformatisan8-byteinteger(aJavalong),representingthenumberofmillisecondsJava/Domino4.
6,BobBalabanPage4-25since1/1/197000:00:00GMT.
Therejustwasn'ttimetowriteaplatformportableconversionroutinethatwouldhandlethisdatatype,whichisnotnativetoallplatformssupportedbyNotes.
Inthemeantime,youcanaccuratelyconvertbetweenNotesandJavanativedateformatsbyusingStrings.
TheLotusScriptdateformat(incaseyouwerecurious)followstheBASICconvention.
Itisadoubleprecisionnumber,wheretheintegerpartisthenumberofdayssincethereferencedate(12/30/1899),andthefractionistheratioofthenumberofsecondssincemidnighttothenumberofsecondsinaday.
Clearly,thisformatisnotasgranular,orasaccurate,aseithertheJavaorNotesformats.
Notethatasageneralrulewiththisclass,allStringformattedDateTimevaluesfollowthedefaultformattingassetforthecurrentlocation,andusuallyincludeatimezonedesignation(EDT,EST,whatever).
InputStringsshouldalsofollowthelocalformat,andcaneitherincludeoromitthetimezonedesignation.
NotesalwaysconvertsaDateTimevaluetoGMTforstorageinternally,thoughitremembersthetimezoneinwhichtheoriginalwasspecified.
ThevalueisaccessibleeitherinGMTorinthelocaltimezone.
YoucreateaDateTimeobjectusingtheSession.
createDateTime()call.
DateTimePropertiesStringgetDateOnly()StringgetTimeOnly()ReturnseitherthedateportionorthetimeportionoftheDateTimeinStringformat.
StringgetGMTTime()StringgetLocalTime()voidsetLocalTime(Stringtime)Java/Domino4.
6,BobBalabanPage4-26ReturnsthecurrentDateTimevalueinStringformatforeithertheGMTorlocalversionoftheDateTimevalue.
YoucanalsomodifythestoreddatevalueusingthesetLocalTime()call.
Notethatifadatevaluewasoriginallyspecifiedinatimezonedifferentfromthelocaltimezone,thegetLocalTime()andgetGMTTime()callsconvertthatvaluetotheirrespectivezones.
TogettheDateTimeasoriginallyspecified,youcanusethegetZoneTime()call.
intgetTimeZone()Returnsthetimezoneinwhichthedatevaluewasoriginallyspecified.
Thetimezonevalueisusually(butnotalways)anumberofhoursplusorminusthatyouaddtothecurrenttimetogetGreenwichMeanTime(GMT).
Somezoneshavespecialvalues,however.
StringgetZoneTime()ReturnstheStringversionoftheDateTimevalueforthetimezoneinwhichitwasoriginallyspecified.
Iftheoriginalvaluewasnotspecifiedwithatimezonedifferentfromthecurrentzone,thenthiscallisequivalenttogetLocalTime().
booleanisDST()ReturnstrueifdaylightsavingstimeisineffectforthecurrentDateTimevalue.
DateTimeMethodsvoidadjustSecond(intvalue)voidadjustSecond(intvalue,booleanlocalzone)voidadjustMinute(intvalue)voidadjustMinute(intvalue,booleanlocalzone)voidadjustHour(intvalue)voidadjustHour(intvalue,booleanlocalzone)Java/Domino4.
6,BobBalabanPage4-27voidadjustDay(intvalue)voidadjustDay(intvalue,booleanlocalzone)voidadjustMonth(intvalue)voidadjustMonth(intvalue,booleanlocalzone)voidadjustYear(intvalue)voidadjustYear(intvalue,booleanlocalzone)TheadjustXXX()methodsallworkessentiallythesameway:giventhecurrentDateTimevalue,adjustit(plusorminus)bythevalueprovided.
Optionally,youcanspecifythatthelocaltimezoneshouldbetakenintoaccountintheadjustment.
Thisbecomesimportantwhenanadjustment(eitherforwardorbackward)resultsinthestartandendtimesbeingonoppositesidesofaDaylightSavingsTimeboundary.
Insuchacase,ifyoudon'texplicitlyusetrueforthelocalzoneparameter,youmightendupwithunexpectedresults.
Forexample,ifyoustartedwithaDateTimeofMarch15,19972:00:00PMandadjustedbyonemonth(withouttakingtimezonesintoaccount),you'dendwithasimpleadjustmenttothemonthpartofthevalue:April15,19972:00:00PM,eventhoughDaylightSavingsTimewentintoeffectduringthatmonth.
If,however,youusedtheversionoftheadjustMonth()callthatletsyouspecifytrueforthelocalzoneparameter,3/15/972:00:00PM(implicitlyEasternStandardTime)becomes4/15/971:00:00PMEasternDaylightTime.
Thesecondcaseismoreaccurate,inthesensethattheseconddateisexactlyonemonthaheadofthefirst,whileinthefirstcasetheseconddateisonemonthandonehourahead.
Therearecases,especiallyinCalendaringapplications,wherethedistinctionisimportant.
voidconvertToZone(intnewzone,booleanisdst)ConvertsthecurrentDateTimevaluetoanewtimezone.
YoucanoptionallyspecifywhetherDaylightSavingsTimeshouldbeconsidered.
Java/Domino4.
6,BobBalabanPage4-28voidsetAnyDate()voidsetAnyTime()Notesimplementstheconceptofdateandtimevaluewildcards,whichnotallsystemsdo.
LotusScript(andVB),forexample,makenodistinctionbetweenadatevaluewith"notime"attachedtoit,andthatsamedateatmidnight(0timevalue).
Notesdoesmakethatdistinction,andyoucanhaveadatevaluewithnotimeattached,oratimevaluewithnodateattached.
Forexample,youcancreateadate-onlyDateTimeobjectbycallingSession.
createDateTime("today")(oryourlocallanguageequivalentkeyword).
Thisdatevalueismostdefinitelynotthesameas"today00:00:00"(oranyotherspecifictime).
Likewisefortimevalueswithoutdates.
YoucanconvertaDateTimevaluethatcontainsbothadateandatimetoonethatcontainsonlyoneortheotherwiththesetwomethods.
ThesetAnyDate()callconvertswhateverdatevalueisinthecurrentobjectto"nodate,"andthesetAnyTime()callconvertsthecurrenttimevalueto"notime.
"StringsformattedfromaDateTimeobjectcontainingoneofthesewildcardswillsimplyomitthewildcardportion.
voidsetLocalDate(intyear,intmonth,intday,booleanisdst)voidsetLocalTime(inthour,intminute,intsecond,inthundredth)ThesetwocallsarenotintheLotusScriptinterface,asLotusScripthasbuilt-infunctionsthatdothesamething.
Theyallowyoutospecifyadateand/ortimevaluebyprovidingthecomponentsofthevalueinintegerformat.
Theyearshouldbeafour-digityear,toavoidunexpectedresultswithYear2000defaultconversions.
Januaryisalways1.
voidsetNow()Storethecurrentdate/timeasthevalueoftheobject.
inttimeDifference(lotus.
notes.
DateTimet2)Java/Domino4.
6,BobBalabanPage4-29ReturnsthenumberofsecondsbetweenthecurrentDateTimevalueandtheoneprovidedasanargument(subtractsthevalueoft2fromthecurrentobject'svalue).
Thetwovaluesarefirstnormalizedtoacommontimezone.
StringtoString()ReturnstheresultofthegetLocalTime()method.
Thelotus.
notes.
DateRangeClassADateRangesimplyrepresentsapairofDateTimeobjects,referredtoasthestartandendtimes.
Itprovidesaconvenientwaytoformatrangesaswell.
YoucreateaDateRangeobjectusingtheSession.
createDateRange()call.
IfyouusetheflavorofcreateDateRangethattakesnoarguments,yougetan"empty"DateRange.
IfyouusetheflavorthattakesstartandendDateTimeobjects,thoseobjectsarelinkedtotheDateRange.
IfyoumodifyeitherDateTimeobjectafterinstantiatingtheDateRange,thevalueoftheDateRangeimplicitlychangestoo.
Becareful!
DateRangehasnomethods.
DateRangePropertieslotus.
notes.
DateTimegetStartDateTime()voidsetStartDateTime(lotus.
notes.
DateTime)lotus.
notes.
DateTimegetEndDateTime()voidsetEndDateTime(lotus.
notes.
DateTime)AcceptsorreturnsthestartingorendingDateTimeobject.
Ifyouusethistechniquetosetthestartandendvalues,thentheDateTimeobjectsarelinkedtotheDateRange.
Whenyou(oranyNOImethodthattakesaDateRangeasinput)accessesthevalueoftherange,thecurrentvaluesforthestartingandendingDateTimeinstancesareused.
ThusyoucanchangethevaluesofeitherDateTimeobjectafterlinkingittotherange,andtherange'svalueimplicitlychanges.
Java/Domino4.
6,BobBalabanPage4-30Besurenottomodifythevalueoftherangeunintentionally,andalsobesurenottomakethestartingtimelaterthantheendingtime.
StringgetText()voidsetText()SetsorretrievesavaluefortheDateRangeintextformat.
ThetextformatforadaterangeistwoDateTimestrings(inwhateverlocaldate/timeformatsaresupported),separatedbyahyphen.
IfyousetthevalueoftherangeusingaString,thenanypreviouslylinkedDateTimeobjectsareunlinked,andnewonesaregenerated.
Thus,thefollowingcodefragmentwillcorrectlymodifytheendingvalueoftheDateRange:DateRangedr=s.
createDateRange();dr.
setText("1/1/9712:01AM-10/13/973:29PM");DateTimeenddt=dr.
getEndDateTime();enddt.
adjustDay(1);StringtoString()ReturnsthevalueofDateRange.
getText().
SummaryNext,Chapter5continueswithadiscussionofstillmoreNOIclasses:Agent,AgentContext,International,Form,andName.
zoecloud怎么样?zoecloud是一家国人商家,5月成立,暂时主要提供香港BGP KVM VPS,线路为AS41378,并有首发永久8折优惠:HKBGP20OFF。目前,解锁香港区 Netflix、Youtube Premium ,但不保证一直解锁,谢绝以不是原生 IP 理由退款。不保证中国大陆连接速度,建议移动中转使用,配合广州移动食用效果更佳。点击进入:zoecloud官方网站地址zo...
易探云怎么样?易探云隶属于纯乐电商旗下网络服务品牌,香港NTT Communications合作伙伴,YiTanCloud Limited旗下合作云计算品牌,数十年云计算行业经验。发展至今,我们已凝聚起港内领先的开发和运维团队,积累起4年市场服务经验,提供电话热线/在线咨询/服务单系统等多种沟通渠道,7*24不间断服务,3分钟快速响应。目前,易探云提供香港大带宽20Mbps、16G DDR3内存、...
麻花云在7月特意为主机测评用户群定制了促销活动:香港宽频CN2云服务器、安徽移动云服务器(BGP网络,非单线,效果更好)、安徽移动独立服务器、安徽电信独立服务器,全部不限制流量,自带一个IPv4,默认5Gbps的DDoS防御。活动链接:https://www.mhyun.net/act/zjcp特价云服务器不限流量,自带一个IPv4,5Gbps防御香港宽频CN2全固态Ⅲ型 4核4G【KVM】内存:...
zblog模板为你推荐
me域名注册me 域名 还能备案吗免费虚拟主机空间谁知道有没有免费的虚拟主机空间免费云主机永久免费的云主机哎或者空间或者vpscom域名注册com域名注册要注意哪些情况啊?我想现在注册一个com域名~免费vps服务器免费VPS服务器。和免费的好用虚拟主机重庆网站空间重庆有没有发展空间?100m虚拟主机万网和新网虚拟主机有100M的吗虚拟主机管理系统虚拟主机管理系统那一家好?天津虚拟主机在天津哪个地方能买到较好的价格又实惠还可以送货上门的虚拟主机!免费域名有哪些免费域名
动态域名解析软件 中文域名交易中心 电信测速器 linode日本 cdn服务器 163网 mobaxterm 鲜果阅读 1g空间 美国独立日 宏讯 数据库空间 浙江服务器 中国联通宽带测速 宿迁服务器 开心online 香港博客 512内存 亿库 hosting24 更多