Vous êtes sur la page 1sur 11

JavaFXResearchPaper

MADIntensiveProgramme2009
MattiasDeparcq ArtesisHogeschoolAntwerpen PeterKrammer FHJoanneum LudovicSchelfaut HautecoleProvincialedeMonsBorinageCentre RafalJasiak WyzszaSzkolaInformatyki PauloDuarte EscolaSuperiordeComunicaoSocial FilipWest CentralOstrobothnia

Index
1Introduction..........................................................................................................................................3 2Platform................................................................................................................................................4 2.1 Hardware......................................................................................................................................4 2.2 OperatingSystem(s).....................................................................................................................4 2.3 Security.........................................................................................................................................5 2.4 Performance.................................................................................................................................6 2.5 Futurepossibilities........................................................................................................................6 3SoftwareDevelopment........................................................................................................................7 3.1 DevelopmentRequirements.........................................................................................................7 3.2 IDEandTools................................................................................................................................7 3.3 Programminglanguage(s).............................................................................................................9 4OverallEvaluation..............................................................................................................................10 4.1 Advantages.................................................................................................................................10 4.2 Limitations..................................................................................................................................11 4.3 Conclusion..................................................................................................................................11 .

1Introduction
AttheannualJavaOneconferenceinMay2007,SunMicrosystemsannouncedanewproductfamily namedJavaFX.ThevisionoftheJavaFXproductfamilyistodelivertheabilitytocreateinteractive content,applicationsandservicesfromdesktoptomobiledevicestothelivingroom.Itcurrently consistsoftwotechnologies:JavaFXScriptandJavaFXMobile. JavaFXScriptisalanguagethatistargetedatcontentauthors.Usingsimple,declarativescripts, contentauthorscancreateveryrichuserinterfaces.Aswellashavingdeclarativescripting,JavaFXis afullyobject)orientedlanguage. JavaFXMobileisessentiallyalayeredsoftwaresystemformobiledevicesonwhichprograms developedinJavaFXScriptcanexecute.WithJavaFXMobiletheapplicationhasaccesstothe capabilitiesofthephonelikethefilesystem,GPS,Bluetooth,camera.JavaFXMobileiscapableof runningonmultiplemobileOperatingsystems,includingAndroid,WindowsMobileandproprietary realtimeoperatingsystems.

2Platform
2.1 Hardware
Javaisdeployedonbillionsofdevicesgloballyandhasadeveloperbaseoversixmillion.Thisenables JavaFX content designers and developers to reach a larger audience than any other technology. JavaFXapplicationscanrunseamlesslyandconsistentlyonthevastmajorityoftheworld'sdesktops and laptops, and in the future will run on mobile phones (from the lowestend to highestend), as wellastelevisionsandotherdevices.

2.2 OperatingSystem(s)
JavaFX applications will run on any desktop and browser that runs the Java Runtime Environment and easily integrates with Java ME,openingupthedoortobillionsofmobile phonesandotherconnecteddevices. The JavaFX platform contains crossplatform and platformspecific runtime environments andsupportlibraries.Itincludesadeclarative languagecalledJavaFXScript,aswellasaset of development and design tools. This ensures that applications can provide a consistent look and feel across devices with diverseformfactorsandcapabilities. The platformspecific elements are desktop elements, such as mouse input or webcam, mobile elements, such as communications and TV elements, such as recording and watchinglivevideo.

2.3 Security
Thesecurityissimilartothewayappletsaresecured.Therearesomedifferenttechniques. Unsignedapplication Youcanchoosenottosigntheapplicationatall.Usuallyitisthebestchoice.Thiswaytheapplication willruninasandboxandwillnotbeabletoexecuteanypotentiallydangerouscode.Ontheother hand it will be safe for user to run it and he will not be troubled by any security alert. If the application attempts to execute dangerous code, the JRE will throw a security exception. So if you dontneedtodoanythingdangerousandyouarehappytoplayinthesandbox,unsignedapplication isthebestchoice. Selfsignedapplication Ifanapplicationisselfsigned,itmeansthattheJARis signed by a certificate that is not verified by any certification authority.Thisisoneoftheworstoption youcanchoose.Youforcetheusertoanswerfollowing securitydialog. BasicallyitsthesameasexecutingEXE(orbinary)file only more dangerous. Some users already know that they should not execute EXE files from unknown sources, but they dont know that they shouldnt executeJavaapplicationsfromunknownsources If the user clicks on Run, the application can do whateveritwant,iftheuserclicksonCancel,theapplicationwillnotrunatall. Signedapplication We can sign the application by a certificate that is validated by a certification authority. If you open the example, you will see following security warning. It looks less threatening than with the self signed certificate. It looks less dangerous. The Always trustcheckboxisevencheckedbydefault.Butin fact,itsnot muchsafer.Itismore complicatedto generate such certificate but anyone can do it. It might be even more dangerous. Everyone who is abletogenerateacertificatethatisvalidatedbythesameCAwillbeallowedtoexecutethecode(if you leave the check box checked). And again, it is all or nothing choice. User can either give the applicationallpermissionsordonotrunitatall. UnsignedapplicationwithsignedJAR Incaseyoureallyneedtodosomethingpotentiallydangerousandyoudonotwanttoscaretheuser atthestartoftheapplication,youcanusesignedJARinanunsignedapplication.Basicallyyoucan put all the dangerous stuff into a jar and sign only this jar. Most of the code can live in the main applicationwhichisunsigned.Thiswaytheapplicationwillstartasunsignedandwhenyouattempt toexecutethedangerouspartsthesignedjarwillbeloadedandthesecuritywarningwillbeshown. Thiswayusercanuseanapplicationandisnotifiedonlywhentheapplicationneedstodosomething insecure.Andevenifhedecidesthathedoesnttrustit,hecanstillusetheapplication.

Toreiterate,themostsecurechoiceistowriteaJavaFXapplicationthatdoesnotneedanysecurity permissions.Ifyoudonotsignit,itrunsinthesandboxandeverythingisfine.Ifyouneedtoexecute some dangerous code, you have to ask user for permission. Which is good, but users should be instructedthattheyshouldntexecuteanyJavaFXcodeiftheyarenotsurewhatitdoes.Sothereisa possibilitythattheywillnotexecuteyourapplicationsbecausetheywillbeafraidtodoso.Maybein thenextversionsofJavaFXtherewillbeasignedlibraryprovidedbySunthatwillcontainoperations thatarepotentiallydangerousbutthatareinfactsafe.LikeopeningafileusingOpenFiledialog etc.

2.4 Performance
TheperformanceofJavaFXisratherslowatthemomentwhencomparedtoitscompetitors,butin speedcritical portions off the program ordinary java code can be used to speed up the program. HerearesomegeneraltipstospeedupyourJavaFXcode. The(unofficial)bubblemarkscoresareasfollowing: JavaFXVectors:20fps,50%CPU FlashFlex:21fps,83%CPU SilverlightCLR:40fps,82%CPU FlashcacheAsBitmap:64fps,58%CPU JavaSwing(optimized):163fps,50%CPU JavaPulpCore:200fps,50%CPU

2.5 Futurepossibilities
Sunhasreveledtheirroadmapasfollowing: 12/04/2008JavaFXSDK1.0w/betaMobile 02/12/2009JavaFXw/finalMobile JavaOne09JavaFXNextbta JavaOne09Java7bta Before2010finalJavaFXNext&Java7 Onecanonlyhopethatmoredeviceswillbesupportedinthefuture

3SoftwareDevelopment
3.1 DevelopmentRequirements
TostartdevelopingJavaFXyouwillneedWindowsorMac.ThereissupportforLinuxandOpenSolaris butitsabetaversion. Minimumsystemrequirements: Memory:512MBofRAM(1GBrecommended) Diskspace:778MBoffreediskspace(1GBrecommended) Webbrowser:InternetExplorer6minimumofFireFox3.0minimum JavaSEDevelopmentKit(JDK) o Windows,Linux,OpenSolaris:JDK6Update13minimum(Update14recommended) o Mac:JDK5Update16minimum OnlyforLinuxandOpenSolaris:GStreamer OnlyforWindows:AppleQuickTimePlayerandDirectShowFilters

3.2 IDEandTools
The available IDEs and tools are organized by the functionality you need to start developing with JavaFX.Thediagramshowsthedifferentbundlesandtherecontent,thefollowingsectionscontaina detaileddescriptionofeachbundle.

DeveloperBundle Thedeveloperbundlecontainsthefollowingtools.

NetBeansIDEforJavaFX TheJavaFXtechnologyisintegratedwiththeNetBeansIDE,amatureandpowerful developmentenvironmentthatmakesiteasytobuild,preview,anddebugJavaFX applications. TheNetBeansIDEforJavaFXiseasytolearn,anditcomesbundledwiththeJavaFXSDKand lotsofsampleapplications. TheNetBeanseditorfeaturesadraganddroppalettetoquicklyaddJavaFXstatements, includingtransformations,effectsandanimation. JavaFXPluginforNetBeans IfyouarealreadyusingtheNetBeansIDE,youcanaddtheJavaFXplugintoincludesupport fordevelopingJavaFXapplications.

DesignerBundle The designer bundle consists of JavaFX Production Suite, a single download that contains the followingtoolstoenabledesignerstoexchangevisualassetswithdevelopers.Thedesignerbundleis notavailableforLinuxorOpenSolaris.

JavaFXPluginforAdobePhotoshopandJavaFXPluginforAdobeIllustrator PluggingforAdobePhotoshopandAdobeIllustratorexportgraphicassetsfromcreative designertoolstotheJavaFXformat. Developerscanstartbuildingtheirapplicationsbasedonmockupsthatthedesignercreates. Asthevisualdesignevolves,itiseasyforthedevelopertoincorporatechangesinthe artworkforthefinalversionoftheirapplication. WhendesignerssavetheirgraphictotheJavaFXformattheycancomparehowthegraphic willlookindesktopandmobileapplications,andtheycanviewmetricsthatenablethemto minimizeresourcedemandsonmobiledevices. JavaFXMediaFactory JavaFXMediaFactorycontainstwoseparatetools:
o o

SVGConverter:ConvertSVGgraphicsintotheJavaFXformat JavaFXGraphicsViewer:ViewgraphicassetsthatwereconvertedtotheJavaFX format.JavaFXGraphicsViewerallowsyoutoprevieweachgraphicasitwillappear ineitherdesktopormobileapplications.

StandaloneSDK Ifyoupreferusingothertools,ordevelopingdirectlyviathecommandline,youcandownloadthe standaloneSDK.

JavaFXSDK TheSDKincludesthefollowingcomponents(alsoincludedwhenyoudownloadNetBeansIDE forJavaFX):


o o o o o o

JavaFXDesktopRuntime JavaFXMobileEmulator(forWindows) JavaFXAPIs JavaFXCompiler JavaFXAPIdocumentation Samples

Additionaltools JavaFX1.2PluginforEclipse WiththispluginyoucanstartdevelopingJavaFXapplicationinEclipseIDE3.4ornewer. ItrequirestheJavaFX1.2SDK ReportMillJFXBuilderVisualJavaFXScriptDesigner JFXBuilderisavisualdesigntoolthatgeneratesJavaFXScript. On2FlixEncoder Flixencodesanytypeofvideo,audioandimagefilesforseamlessplaybackinJavaFX.

3.3 Programminglanguage(s)
The language to make JavaFX programsiscalledJavaFXScript.Itisa compiled,staticallytyped,declarative, scripting language for the Java Platform. It provides automatic data binding, mutation triggers a declarative animation, using an expressionlanguagesyntax. Everything in JavaFX is an expression. This means that all the blocks are expressions. The diagram shows the JavaFX Technology stack. As you can see JavaFXScriptcancallanyJavaAPI Theprimitivedatatypesare: Theavailableoperators: Boolean +/* Integer ++ Number *=/=+== String Andornot Duration ===!= Theprimitivescannotbenull mod Flowcontrolcomponents: if(booleanExpression)thenaelseb if(booleanExpression)aelseb if(booleanExpression){a}else{b} while(booleanExpression){...} for(iinsequence){...} Cangetindexofitemibyindexofi break continue AverypowerfulfeatureofJavaFXScriptisaBind.Abindisawaytotiethevalueofonevariableto thevalueofanexpression.Bindingsarestaticallycompiledandmustbedefinedwhenthevariableis initializedandboundvariablescannotbesetmanually. publicclassDistanceextends{ publicvarx1:Number; publicvarx2:Number; //Wheneverx2orx1changes,distancewillbeupdated publicreadvardistance:Number=bindx2x1; }

4OverallEvaluation
4.1 Advantages
HereisalistofsomekeyfeaturesofJavaFX. Commonprofile JavaFX is based on the concept of a Common profile that is intended to span across all devices supportedbyJavaFX.Thisapproachmakesitpossiblefordeveloperstousecommonprogramming modelwhilebuildinganapplicationtargetedforbothdesktopandmobiledevicesandtosharemuch ofthecode,graphicsassetsandcontentbetweendesktopandmobileversions.Toaddresstheneed for tuning applications for the needs of specific class of devices, the JavaFX 1.1 platform includes API's that are desktop or mobilespecific. For example JavaFX Desktop profile includes SWING and advancedvisualeffects. DragtoInstall. From the point of view of the end user DragtoInstall allows them to drag a JavaFX widget or application residing in a website within the browser window and drop it onto their desktop. The applicationwillnotloseitsstateorcontextevenafterthebrowserisclosed.Applicationcanalsobe relaunched by clicking on a shortcut that gets automatically created on the users desktop. This behavior is enabled outofthebox by the Java applet mechanism and is leveraged by JavaFX from theunderlayingJavalayer.SuntoutsDragtoInstallasopeningupofanewdistributionmodeland allowingdeveloperstobreakawayfromthebrowser. Integratinggraphicscreatedwiththirdpartytools. JavaFXincludesasetofpluginsforAdobePhotoshopandIllustratorthatenableadvancedgraphics to be integrated directly into JavaFX applications. The plugins generates JavaFX Script code that preserveslayersandstructureofthegraphics.Developerscantheneasilyaddanimationoreffectsto thestaticgraphicsimported.ThereisalsoanSVGgraphicsconvertertool(a.k.a.MediaFactory)that allowsforimportinggraphicsandpreviewingassetsaftertheconversiontoJavaFXformat. FullintegrationintoWebpages. WhenJavaFXcontentishostedasanappletonawebpage,theJavaFXScriptcodecaninteractwith the web page, and JavaScript code on the web page can interact with the JavaFX Script code. JavaScriptcodeonthewebpagecanaccesstheJavaFXScriptappletandperformmanyoperations, suchascallingJavaFXScriptfunctions,gettingandsettingvariables,passingdatafromJavaScriptto JavaFXScript,anddescendingintotheJavaFXScriptscenegraph. ThefollowinglistdescribessomeofthestrengthsofJavaFXScript: Its simple, declarative syntax used to express user interfaces, including a very rich set of layoutwidgetsthatmakeeasyworkoflayingoutauserinterfaceinaplatformindependent way. Content developers can create great looking, functional user interfaces without being expertprogrammers. Its innate ability to support the modelviewcontroller pattern because of its very powerful bind capability. This complements and enables the declarative programming syntax because attributes of objects, including user interface objects, can be bound to valuescontainedinmodelclasses,oftenbidirectionally. The concept of triggers (functionality that is automatically invoked when certain conditions take place, such as when the value of an attribute changes). This enables the declarative syntax as well, and makes UI development relatively easy, because setters and getters are replaced by triggers that are automatically invoked when the valueofanattributechanges.

10

Its very powerful syntax for defining, modifying, and querying sequences, because its an SQLalikesyntax. Asidebenefitisthatitisenablesfastdevelopmentofapplicationprototypes.Anotherside benefitisthatitwouldbeagreatlanguagetouseinschoolstoteachprogrammingconcepts.

4.2 Limitations
JavaFXhasaweakPerformance.ThisisbecausetheapplicationsrunonJVM,whichinturn runsonthenativehardware. Its dependence on competitors from the design stand point is risky. SUN doesnt bring anythingnewtothetableintermsofdesigntools,whichcouldleadtocompaniesfavoring moreintegratedIDEs. Notallthepromisedplatformsaresupportedyet Ittakesalongtimetoloadanapplication.

4.3 Conclusion
As of now the future of JavaFX is uncertain, the programming language is not complete yet and changes to the reference may happen that will make some code unusable. If sun is able to draw developersfrommoreestablishedtechnologiesasActionScriptand.NETisyettobeseen.Wewould notrecommendanydevelopertousethisplatforminitscurrentstate. Thecellphoneindustryisgrowingupbestperformance,betterconnections,etc.thustheJavaFX platformhasgreatpotentialtobeamaincommonplatforminthemarket.Forthistohappen,the JavaFXcommunityhastoovercometheircurrentproblems!

11

Vous aimerez peut-être aussi