SlideShare a Scribd company logo
Welcome
Flex in Portal Presentation By: Sunil Patil
Our sponsors:
Agenda AGENDA FOR THE SESSION This presentation is targeted to J2EE/Portal developers who are not familiar with Flex What is Flex ? Flex development environment Developing “Hello World” Flex  application How Flex fits into your application Communicating with JavaScript from Flex  HTTPService Web Service Flex RemoteObject + BlazeDS Flex in enterprise application Spring Flex Integration CairnGorm Sample code
What is Flex ? WHAT IS FLEX ? Adobe Flex is user interface framework for developing rich internet application(RIA) You can use it for developing web application type of UI Forms Spread sheets Tree control Use MXML, CSS and Action Script to develop application and then compile your code into .swf file You can use flex player for executing .swf file Same flex player that we use for watching videos
Traditional J2EE Application architecture Browser J2EE App REST Service Http Client Application  Server Web Service
Flex application architecture Browser J2EE App REST Service Web Service Flex Application Browser
Why Flex ? WHY FLEX IS GOOD CHOICE FOR DEVELOPING RIA Advantages Flash player is available on 95 % computers Support for HTML 5 is still few years away Good for building complex RIA Compiled code Object oriented Disadvantages Not available on every platform Ex. Iphone J2EE developers are familiar with HTML, JavaScript, CSS but not MXML, ActionScript
Developing “Hello World” flex application 1
Flex Application Components FLEX APPLICATION  Flex applications are made up of three components MXML,CSS and ActionScript. These components perform same function as HTML, CSS and JavaScript in traditional web application ActionScript MXML CSS HTML CSS JavaScript
MXML WHAT IS MXML MXML is XML based markup language that is used for defining user interface in Flex Application. Macromedia does not give any official meaning for MXML, but some developers say that it stands for “Magic extendible markup language” MXML tags are similar to HTML tags MXML has a richer tag set compared to HTML Tags for data grid, tree Tags for non-visual components Ex. HTTPService. RemoteObject You can extend MXML by creating custom components using either MXML or ActionScript
Hello MXML
ActionScript WHAT IS ACTIONSCRIPT ? Action Script is object-oriented programming language based on ECMAScript – 4 You can use it for writing Event Handlers Making remote calls Data conversion Creating custom UI components You can write the ActionScript either inline your MXML page using <mx:Script> tag or your can create .as files You can import a ActionScript library in .swf format and use its classes from ActionScript
Hello ActionScript
CSS WHAT IS CSS ? You modify the appearance of Flex components through style properties. These properties can define the size of a font used in a Label control, or the background color used in the Tree control.  You can declare styles based on Cascading Style Sheet standards  You can define styles inside the mxml document using <mx:Style> element or inside separate .css file Flex builder provides very good environment for working with styles Flex does not support controlling all aspects of component layout with CSS. Properties such as x, y, width, and height are properties, not styles, of the UIComponent class, and therefore cannot be set in CSS
Hello CSS
Flex Development environment 3
Compiling Flex Application HOW TO COMPILE FLEX Application You need a Flex compiler to compile your application into .swf file. You can use either standalone Flex SDK or Flash builder ActionScript MXML CSS .swf Compile
Adobe Flash builder 4
Flex Player Debug Version
FlashBug
How flex fits in your J2EE web application 4
How to integrate flex in your application HOW TO INTEGRATE FLEX IN YOUR APPLICATION You can include the flex application (.swf file) on your web page using <object> tag in the HTML. Once the flex application is started it can directly start communicating to different components of your application for getting data, performing actions,.. You can use one of the following options for communicating to remote server from flex application JavaScript HTTPService WebService BlazeDS RemoteObject Consumer/Producer
JavaScript ACCESSING FLEX FROM JAVASCRIPT Use ExternalInterface API inside flex to communicating with HTML wrapper. You can call a JavaScript method from ActionScript and ActionScript method from JavaScript Communicate with other HTML components on the HTML page Use Dojo publish/ subscribe to modify other widgets on the page Use this method when you want to take advantage of client side logic implemented in the JavaScript  WebSphere Portal’s client side API for manipulating preferences, user profile
Calling JavaScript method from ActionScript HOW TO CALL  JAVASCRIPT  METHOD FROM ACTIONSCRIPT You will have to follow these steps for calling JavaScript method from ActionScript Add JavaScript function to the HTML page function javaScriptMethod(){ alert(“called from actionscript”); } Use ExternalInterface API for calling JavaScript if(ExternalInterface.available) ExternalInterface.call(‘javaScriptMethod’);
Calling ActionScript method from JavaScript HOW TO CALL  JAVASCRIPT  METHOD FROM ACTIONSCRIPT You will have to follow these steps if you want to call ActionScript method from JavaScript Define a flex function that can be called from outside function actionScriptMethod(): void{} Register this function with ExternalInterface to make it available from outside ExternalInterface.addCallback(“actionScriptMethod”,”actionScriptMethod”) Add this code to your JavaScript   function getFlexApp(appName){   if (navigator.appName.indexOf (&quot;Microsoft&quot;) !=-1){   return window[appName];   } else{ return document[appName]; }   } getFlexApp(“<flexobjectid>”).actionScriptMethod();
HTTPService USING FLEX HTTPSERVICE API You can use HTTPService API to make a http request and get response asynchronously (Similar to XHR ). You can use HTTPService method for making GET and POST call and pass parameters. If you want to make PUT, DELETE call you can use BlazeDS proxy service.  Use  this method if you want to Communicate with REST Service Internal as well as external such as Youtube or Flickr Communicate with Servlet based application You can use the HTTPService API in two different ways Declaratively using MXML Programmatically using ActionScript
Declarative HTTPService HOW TO USE HTTPSERVICE API IN MXML You can use HTTPService declaratively using HTTPService tag in MXML <mx:HTTPService id=&quot;youTubeService&quot; url=&quot;http://gdata.youtube.com/feeds/api/videos&quot;  resultFormat=&quot;text&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot;> <mx:request> <q>{searchTxt.text}</q> </mx:request> </mx:HTTPService>
Programmatic HTTPService HOW TO USE HTTPSERVICE API IN ACTIONSCRIPT If you want to support advanced use case then you can create object of HTTPService inside your ActionScript and use it for making call service = new HTTPService(); service.url = <someurl>; service.resultFormat = HTTPService.RESULT_FORMAT_TEXT; service.method = httpMethod.text; service.addEventListener(&quot;result&quot;, httpResult); service.addEventListener(&quot;fault&quot;, httpFault); service.send(parameters); public function httpResult(event:ResultEvent):void { var result:Object = event.result; displayText.text = event.result.toString(); }
HTTPService data exchange formats WHICH DATA FORMAT TO USE FOR EXCHANGING DATA The HTTPService API has a resultFormat field that you can set to define how the response of HTTP request be treated Object : It will assume the response is XML, so parse and convert it into ActionScript objects XML : Parse xml into XMLNode object instead of ActionScript object Text :  It will return the response as text string and you can parse it Flashvars : Will take string in name=value pair’s separated by &, parse it into ActionScript object
JSON for data exchange HOW YOU CAN USE JSON FORMAT FOR DATA EXCHANGE JSON is very popular format for exchanging data between server and client side HTTPService API does not have ability to convert JSON to ActionScript and other way around as3corelib  is flex library that you can use for converting JSON to ActionScript object and other way around Convert JSON to ActionScript object import com.adobe.serialization.json.JSON; JSON.decode(<jsonstring>) Convert ActionScript object into JSON  import com.adobe.serialization.json.JSON; JSON.encode(<actionscriptobject>)
Flex in WebSphere Portal HOW TO USE HTTPSERVICE FOR COMMUNICATING WITH PORTAL The doView() method of your portlet should return HTML with flex on it. Once the flex application is loaded you have two option, You can add a servlet in your portlet application and communicate with it You can communicate with portlet, these are the various options that you have for communicating with portlets Action request Render request with parameters Resource request Changing portlet mode, window state
Flex in WebSphere Portal - JavaScript HOW TO YOU CAN USE JAVASCRIPT FOR SOLVING PROBLEMS You can use the Flex’s ability to communicate with JavaScript to communicate with portlet. You will have to use following steps for communicating with portlets Generate URL’s in HTML where .swf file is embedded Use <portlet:resourceURL> tags Use single portlet refresh URL’s for generating either action or render url or mode change url Use ExternalInterface API to read these URLs from ActionScript Use HTTPService to make call and get response, the response can have further action, render URLs In WebSphere Portal the action URL’s not reusable, so your action response markup should have action URL, that you can use next time.
WebService HOW YOU CAN COMMUNICATE WITH WEBSERVICE FROM FLEX Flex applications can interact with web services that define their interfaces in a Web Services Description Language 1.1 (WSDL 1.1) document, which is available as a URL You might want to use web services communication option in following situation Communicating with existing web service that you built Communicating with web service built by some one else Flex provides infrastructure that you can use for communicating with web service, you have two options ActionScript MXML
Declarative WebService HOW TO USE HTTPSERVICE API IN MXML You can use WebService declaratively using WebService tag in MXML <mx:WebService id=&quot;userRequest&quot; wsdl=&quot;http://localhost:10040/flexapp/returnusers.cfc?wsdl&quot;>  <mx:operation name=&quot;returnRecords&quot; resultFormat=&quot;object&quot; fault=“handleFault(event)&quot; result=&quot;remotingCFCHandler(event)&quot;/>  <mx:operation name=&quot;insertRecord&quot; result=&quot;insertCFCHandler()&quot; fault=&quot;handleFault(event)&quot;/>  </mx:WebService>
Programmatic Web Service HOW TO USE WEBSERVICE API IN ACTIONSCRIPT If you want to support advanced use case then you can create object of WebService inside your ActionScript and use it for making call public function useWebService(intArg:int, strArg:String):void { ws = new WebService(); ws.destination = “insertRecord&quot;; ws.echoArgs.addEventListener(&quot;result&quot;, echoResultHandler); ws.loadWSDL(); ws.echoArgs(intArg, strArg); }
BlazeDS WHAT IS BLAZEDS BlazeDS  is a open source project that provides J2EE based server side infrastructure for developing Flex application. You can add BlazeDS to any J2EE web application by adding set of .jar files and a servlet to your web.xml. The BlazeDS functionality can be divided into following types Remoting Messaging Proxy
Blaze DS Architecture
BlazeDS Remoting WHAT IS BLAZEDS Remoting BlazeDS remoting allows flex application to call methods of java objects directly It takes care of converting Java Object into Action Script object and other way round transparently AMF(Action Message Format) is used as data exchange format between server and flex AMF is proprietary binary format  AMF provides more efficient data exchange The data exchange happens over HTTP connection but in proprietary optimized format
BlazeDS Remoting SAMPLE OF HOW YOU CAN USE BLAZEDS REMOTING Server side, add these lines to remoting-config.xml <destination id=&quot;product&quot;> <properties> <source>com.atech.flex.ProductService</source> </properties> </destination> Client side <mx:RemoteObject id=&quot;srv&quot; destination=&quot;product&quot;/>  <mx:Button label=&quot;Get Data&quot; click=&quot;srv.getProducts()&quot;/>  <mx:DataGrid dataProvider=&quot;{srv.getProducts.lastResult} &quot;/>
BlazeDS Remoting in ActionScript HOW TO USE BLAZEDS REMOTING IN ACTIONSCRIPT You can also create RemoteObject in the ActionScript and call its methods, handle its result in ActionScript method var srv:mx.rpc.remoting.RemoteObject; srv = new mx.rpc.remoting.RemoteObject(); srv.destination = &quot;product&quot;; helloWorldRO.getProducts.addEventListener(&quot;result&quot;, resultHandler); helloWorldRO.addEventListener(&quot;fault&quot;, faultHandler); helloWorldRO.getProducts(&quot;Hello from portal&quot;);
BlazeDS Messaging WHAT IS BLAZEDS MESSAGNING BlazeDS messaging provides a client-side API and a corresponding server-side Message Service (BlazeDS Message Service) for creating BlazeDS messaging applications. BlazeDS messaging also enables participation in Java Message Service (JMS) messaging. There are two components available in the Flex frame work for messaging, mx:Producer and mx:Consumer.  Producer is the component which is used for producing messages to a destination  Consumer is used for subscribing to a destination and receiving messages published to that destination. Consumer also gives option to filter the messages based on user defined constraints.
BlazeDS Messaging SAMPLE OF HOW YOU CAN USE BLAZEDS MESSAGING Server side, add these lines to messaging-config.xml <destination id=&quot;chat&quot;/> Client side, in flex application <mx:Consumer id=&quot;consumer&quot; destination=&quot;chat&quot; message=&quot;messageHandler(event.message)&quot;/> <mx:Producer id=&quot;producer&quot; destination=&quot;chat&quot;/>
BlazeDS Proxy WHAT IS BLAZEDS PROXY SERVICE You can use the BlazeDS proxy service for Making crossdomain calls, other option is to use crossdomain.xml For making REST calls, in that case the actual call is made as HTTP GET and underlying service takes care of necessary conversion You can configure BlazeDS proxy service by changing proxy-config.xml
Flex in enterprise 5
Flex in enterprise WHAT ADDITIONAL TECHNOLOGIES YOU SHOULD LOOK AT If you trying to build a reasonably big complex Flex application then you should think about using some infrastructural components  Spring Flex Integration Cairngorm Ant/ maven build script for flex
Spring flex integration WHAT IS SPRING FLEX INTEGRATION The  Spring Flex Integration  project is a spring project that makes it easier to build Flex UI for Spring application No need for adding BlazeDS MessageBroker Servlet All the requests will be routed through Spring’s DispatcherServlet and it will talk to MessageBroker bean to convert Java objects into AMF and other way round You can use the Spring Integration framework to integrate flex messaging with JMS provider You can use it build Spring application that provide both Ajax and Flex UI
Cairngorm WHAT IS CAIRNGORM Cairngorm was one of the primary  open source  frameworks for application architecture in  Adobe Flex It provides Model view controller architecture for building Flex applications You can use it for creating multi-page application
THANK YOU FOR WATCHING CONTACT INFO: ASCENDANT TECHNOLOGY, LLC 8601 Ranch Road 2222 Building I, Suite 205 Austin, TX  78730 Phone (512) 346-9580 Thank You Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. December 19, 2010

More Related Content

PPT
Flex_rest_optimization
Khou Suylong
 
PPT
MTaulty_DevWeek_Silverlight
ukdpe
 
KEY
Introduction to ASP.NET MVC
LearnNowOnline
 
PPTX
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
PPT
Better Adobe Flex and AIR applications with AJAX
guestdb10f0
 
PPT
Php
Mindtree
 
PPT
Migrate To Lightning Web Components from Aura framework to increase performance
Bohdan Dovhań
 
PPT
Skinning in Flex 4
Saurabh Narula
 
Flex_rest_optimization
Khou Suylong
 
MTaulty_DevWeek_Silverlight
ukdpe
 
Introduction to ASP.NET MVC
LearnNowOnline
 
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
Better Adobe Flex and AIR applications with AJAX
guestdb10f0
 
Migrate To Lightning Web Components from Aura framework to increase performance
Bohdan Dovhań
 
Skinning in Flex 4
Saurabh Narula
 

What's hot (20)

PDF
Flutter State Management Using GetX.pdf
Katy Slemon
 
DOCX
Portfolio
Gun Hyuk Go
 
PPT
Developing Java Web Applications
hchen1
 
PPT
Web II - 01 - Introduction to server-side development
Randy Connolly
 
PDF
PLASTIC 2011: "Enterprise JavaScript with Jangaroo"
Frank Wienberg
 
PPT
Your First ASP_Net project part 1
Biswadip Goswami
 
PDF
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
PPT
Flex Camp London
guest1cb483
 
POT
intoduction to Grails Framework
Harshdeep Kaur
 
PDF
PhoneGap JavaScript API vs Native Components
TechAhead
 
PPTX
Quality sdk for your apis in minutes!
Son Nguyen
 
PPTX
API Design Best Practices by Igor Miniailo
Magecom UK Limited
 
PPTX
Rits Brown Bag - TypeScript
Right IT Services
 
PDF
Introduction to React for Frontend Developers
Sergio Nakamura
 
PDF
Web components are the future of the web - Take advantage of new web technolo...
Marios Fakiolas
 
PPTX
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB
 
PPTX
Building modern share point apps (angularjs, npm, bower, grunt, VS2015)
Sergei Sergeev
 
PPT
Designer & Developer Work Flow for Flex Builder
Bess Ho
 
PDF
Vaadin Introduction, 7.3 edition
Joonas Lehtinen
 
PDF
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
GoogleTecTalks
 
Flutter State Management Using GetX.pdf
Katy Slemon
 
Portfolio
Gun Hyuk Go
 
Developing Java Web Applications
hchen1
 
Web II - 01 - Introduction to server-side development
Randy Connolly
 
PLASTIC 2011: "Enterprise JavaScript with Jangaroo"
Frank Wienberg
 
Your First ASP_Net project part 1
Biswadip Goswami
 
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
Flex Camp London
guest1cb483
 
intoduction to Grails Framework
Harshdeep Kaur
 
PhoneGap JavaScript API vs Native Components
TechAhead
 
Quality sdk for your apis in minutes!
Son Nguyen
 
API Design Best Practices by Igor Miniailo
Magecom UK Limited
 
Rits Brown Bag - TypeScript
Right IT Services
 
Introduction to React for Frontend Developers
Sergio Nakamura
 
Web components are the future of the web - Take advantage of new web technolo...
Marios Fakiolas
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB
 
Building modern share point apps (angularjs, npm, bower, grunt, VS2015)
Sergei Sergeev
 
Designer & Developer Work Flow for Flex Builder
Bess Ho
 
Vaadin Introduction, 7.3 edition
Joonas Lehtinen
 
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
GoogleTecTalks
 
Ad

Viewers also liked (7)

PPTX
Exposicion Tarjetas Madre Grupo 1
wilmer92
 
PPT
D22 portlet development with open source frameworks
Sunil Patil
 
PPT
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
PPT
Web site optimization
Sunil Patil
 
PPTX
The Consistency and Controversy of Gender: Egalitarian Educational Norms and ...
Alexander Wiseman
 
PPTX
Comparing National and Non-national Student Achievement in Saudi Arabia:
Alexander Wiseman
 
PPTX
Wiseman, A. W. (2013, May). The Global “Crisis” in Education and the US Polic...
Alexander Wiseman
 
Exposicion Tarjetas Madre Grupo 1
wilmer92
 
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
Web site optimization
Sunil Patil
 
The Consistency and Controversy of Gender: Egalitarian Educational Norms and ...
Alexander Wiseman
 
Comparing National and Non-national Student Achievement in Saudi Arabia:
Alexander Wiseman
 
Wiseman, A. W. (2013, May). The Global “Crisis” in Education and the US Polic...
Alexander Wiseman
 
Ad

Similar to Flex In Portal Final (20)

PPT
Flex in portal
Sunil Patil
 
PPT
Flex And Ria
ravinxg
 
PPT
Flex RIA
rssharma
 
PPT
Introduction to Adobe Flex - Zaloni
Joseph Khan
 
PDF
Flex Rails Pres
philipsexton
 
ODP
Better Drupal Interaction Design with Flex
Chris Charlton
 
PPT
Flex & Drupal Integration
Matthew Connerton
 
ZIP
A Brief Intro to Adobe Flex
Chad Udell
 
PPTX
Flex Introduction
senthil0809
 
PDF
A Look at Flex and PHP
elliando dias
 
PPT
Flex introduction
iamprajyot
 
PDF
A Look At Flex And Php
Michael Girouard
 
PPTX
Exploring Adobe Flex
senthil0809
 
PPT
Introduction To Rich Internet Applications
Abdelmonaim Remani
 
PPT
Developing RIAs... 10 reasons to use Adobe Flex
Matthias Zeller
 
PPT
Adobe Flex
Mullaikani Karthikeyan
 
PPT
Flex_Basic_Training
guest25cec3
 
PDF
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 
PDF
Apache Flex and the imperfect Web
masuland
 
PDF
Data exchange between flex and java script, 2007
Evgenios Skitsanos
 
Flex in portal
Sunil Patil
 
Flex And Ria
ravinxg
 
Flex RIA
rssharma
 
Introduction to Adobe Flex - Zaloni
Joseph Khan
 
Flex Rails Pres
philipsexton
 
Better Drupal Interaction Design with Flex
Chris Charlton
 
Flex & Drupal Integration
Matthew Connerton
 
A Brief Intro to Adobe Flex
Chad Udell
 
Flex Introduction
senthil0809
 
A Look at Flex and PHP
elliando dias
 
Flex introduction
iamprajyot
 
A Look At Flex And Php
Michael Girouard
 
Exploring Adobe Flex
senthil0809
 
Introduction To Rich Internet Applications
Abdelmonaim Remani
 
Developing RIAs... 10 reasons to use Adobe Flex
Matthias Zeller
 
Flex_Basic_Training
guest25cec3
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 
Apache Flex and the imperfect Web
masuland
 
Data exchange between flex and java script, 2007
Evgenios Skitsanos
 

Recently uploaded (20)

PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
The Future of Artificial Intelligence (AI)
Mukul
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Doc9.....................................
SofiaCollazos
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 

Flex In Portal Final

  • 2. Flex in Portal Presentation By: Sunil Patil
  • 4. Agenda AGENDA FOR THE SESSION This presentation is targeted to J2EE/Portal developers who are not familiar with Flex What is Flex ? Flex development environment Developing “Hello World” Flex application How Flex fits into your application Communicating with JavaScript from Flex HTTPService Web Service Flex RemoteObject + BlazeDS Flex in enterprise application Spring Flex Integration CairnGorm Sample code
  • 5. What is Flex ? WHAT IS FLEX ? Adobe Flex is user interface framework for developing rich internet application(RIA) You can use it for developing web application type of UI Forms Spread sheets Tree control Use MXML, CSS and Action Script to develop application and then compile your code into .swf file You can use flex player for executing .swf file Same flex player that we use for watching videos
  • 6. Traditional J2EE Application architecture Browser J2EE App REST Service Http Client Application Server Web Service
  • 7. Flex application architecture Browser J2EE App REST Service Web Service Flex Application Browser
  • 8. Why Flex ? WHY FLEX IS GOOD CHOICE FOR DEVELOPING RIA Advantages Flash player is available on 95 % computers Support for HTML 5 is still few years away Good for building complex RIA Compiled code Object oriented Disadvantages Not available on every platform Ex. Iphone J2EE developers are familiar with HTML, JavaScript, CSS but not MXML, ActionScript
  • 9. Developing “Hello World” flex application 1
  • 10. Flex Application Components FLEX APPLICATION Flex applications are made up of three components MXML,CSS and ActionScript. These components perform same function as HTML, CSS and JavaScript in traditional web application ActionScript MXML CSS HTML CSS JavaScript
  • 11. MXML WHAT IS MXML MXML is XML based markup language that is used for defining user interface in Flex Application. Macromedia does not give any official meaning for MXML, but some developers say that it stands for “Magic extendible markup language” MXML tags are similar to HTML tags MXML has a richer tag set compared to HTML Tags for data grid, tree Tags for non-visual components Ex. HTTPService. RemoteObject You can extend MXML by creating custom components using either MXML or ActionScript
  • 13. ActionScript WHAT IS ACTIONSCRIPT ? Action Script is object-oriented programming language based on ECMAScript – 4 You can use it for writing Event Handlers Making remote calls Data conversion Creating custom UI components You can write the ActionScript either inline your MXML page using <mx:Script> tag or your can create .as files You can import a ActionScript library in .swf format and use its classes from ActionScript
  • 15. CSS WHAT IS CSS ? You modify the appearance of Flex components through style properties. These properties can define the size of a font used in a Label control, or the background color used in the Tree control. You can declare styles based on Cascading Style Sheet standards You can define styles inside the mxml document using <mx:Style> element or inside separate .css file Flex builder provides very good environment for working with styles Flex does not support controlling all aspects of component layout with CSS. Properties such as x, y, width, and height are properties, not styles, of the UIComponent class, and therefore cannot be set in CSS
  • 18. Compiling Flex Application HOW TO COMPILE FLEX Application You need a Flex compiler to compile your application into .swf file. You can use either standalone Flex SDK or Flash builder ActionScript MXML CSS .swf Compile
  • 20. Flex Player Debug Version
  • 22. How flex fits in your J2EE web application 4
  • 23. How to integrate flex in your application HOW TO INTEGRATE FLEX IN YOUR APPLICATION You can include the flex application (.swf file) on your web page using <object> tag in the HTML. Once the flex application is started it can directly start communicating to different components of your application for getting data, performing actions,.. You can use one of the following options for communicating to remote server from flex application JavaScript HTTPService WebService BlazeDS RemoteObject Consumer/Producer
  • 24. JavaScript ACCESSING FLEX FROM JAVASCRIPT Use ExternalInterface API inside flex to communicating with HTML wrapper. You can call a JavaScript method from ActionScript and ActionScript method from JavaScript Communicate with other HTML components on the HTML page Use Dojo publish/ subscribe to modify other widgets on the page Use this method when you want to take advantage of client side logic implemented in the JavaScript WebSphere Portal’s client side API for manipulating preferences, user profile
  • 25. Calling JavaScript method from ActionScript HOW TO CALL JAVASCRIPT METHOD FROM ACTIONSCRIPT You will have to follow these steps for calling JavaScript method from ActionScript Add JavaScript function to the HTML page function javaScriptMethod(){ alert(“called from actionscript”); } Use ExternalInterface API for calling JavaScript if(ExternalInterface.available) ExternalInterface.call(‘javaScriptMethod’);
  • 26. Calling ActionScript method from JavaScript HOW TO CALL JAVASCRIPT METHOD FROM ACTIONSCRIPT You will have to follow these steps if you want to call ActionScript method from JavaScript Define a flex function that can be called from outside function actionScriptMethod(): void{} Register this function with ExternalInterface to make it available from outside ExternalInterface.addCallback(“actionScriptMethod”,”actionScriptMethod”) Add this code to your JavaScript function getFlexApp(appName){ if (navigator.appName.indexOf (&quot;Microsoft&quot;) !=-1){ return window[appName]; } else{ return document[appName]; } } getFlexApp(“<flexobjectid>”).actionScriptMethod();
  • 27. HTTPService USING FLEX HTTPSERVICE API You can use HTTPService API to make a http request and get response asynchronously (Similar to XHR ). You can use HTTPService method for making GET and POST call and pass parameters. If you want to make PUT, DELETE call you can use BlazeDS proxy service. Use this method if you want to Communicate with REST Service Internal as well as external such as Youtube or Flickr Communicate with Servlet based application You can use the HTTPService API in two different ways Declaratively using MXML Programmatically using ActionScript
  • 28. Declarative HTTPService HOW TO USE HTTPSERVICE API IN MXML You can use HTTPService declaratively using HTTPService tag in MXML <mx:HTTPService id=&quot;youTubeService&quot; url=&quot;http://gdata.youtube.com/feeds/api/videos&quot; resultFormat=&quot;text&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot;> <mx:request> <q>{searchTxt.text}</q> </mx:request> </mx:HTTPService>
  • 29. Programmatic HTTPService HOW TO USE HTTPSERVICE API IN ACTIONSCRIPT If you want to support advanced use case then you can create object of HTTPService inside your ActionScript and use it for making call service = new HTTPService(); service.url = <someurl>; service.resultFormat = HTTPService.RESULT_FORMAT_TEXT; service.method = httpMethod.text; service.addEventListener(&quot;result&quot;, httpResult); service.addEventListener(&quot;fault&quot;, httpFault); service.send(parameters); public function httpResult(event:ResultEvent):void { var result:Object = event.result; displayText.text = event.result.toString(); }
  • 30. HTTPService data exchange formats WHICH DATA FORMAT TO USE FOR EXCHANGING DATA The HTTPService API has a resultFormat field that you can set to define how the response of HTTP request be treated Object : It will assume the response is XML, so parse and convert it into ActionScript objects XML : Parse xml into XMLNode object instead of ActionScript object Text : It will return the response as text string and you can parse it Flashvars : Will take string in name=value pair’s separated by &, parse it into ActionScript object
  • 31. JSON for data exchange HOW YOU CAN USE JSON FORMAT FOR DATA EXCHANGE JSON is very popular format for exchanging data between server and client side HTTPService API does not have ability to convert JSON to ActionScript and other way around as3corelib is flex library that you can use for converting JSON to ActionScript object and other way around Convert JSON to ActionScript object import com.adobe.serialization.json.JSON; JSON.decode(<jsonstring>) Convert ActionScript object into JSON import com.adobe.serialization.json.JSON; JSON.encode(<actionscriptobject>)
  • 32. Flex in WebSphere Portal HOW TO USE HTTPSERVICE FOR COMMUNICATING WITH PORTAL The doView() method of your portlet should return HTML with flex on it. Once the flex application is loaded you have two option, You can add a servlet in your portlet application and communicate with it You can communicate with portlet, these are the various options that you have for communicating with portlets Action request Render request with parameters Resource request Changing portlet mode, window state
  • 33. Flex in WebSphere Portal - JavaScript HOW TO YOU CAN USE JAVASCRIPT FOR SOLVING PROBLEMS You can use the Flex’s ability to communicate with JavaScript to communicate with portlet. You will have to use following steps for communicating with portlets Generate URL’s in HTML where .swf file is embedded Use <portlet:resourceURL> tags Use single portlet refresh URL’s for generating either action or render url or mode change url Use ExternalInterface API to read these URLs from ActionScript Use HTTPService to make call and get response, the response can have further action, render URLs In WebSphere Portal the action URL’s not reusable, so your action response markup should have action URL, that you can use next time.
  • 34. WebService HOW YOU CAN COMMUNICATE WITH WEBSERVICE FROM FLEX Flex applications can interact with web services that define their interfaces in a Web Services Description Language 1.1 (WSDL 1.1) document, which is available as a URL You might want to use web services communication option in following situation Communicating with existing web service that you built Communicating with web service built by some one else Flex provides infrastructure that you can use for communicating with web service, you have two options ActionScript MXML
  • 35. Declarative WebService HOW TO USE HTTPSERVICE API IN MXML You can use WebService declaratively using WebService tag in MXML <mx:WebService id=&quot;userRequest&quot; wsdl=&quot;http://localhost:10040/flexapp/returnusers.cfc?wsdl&quot;> <mx:operation name=&quot;returnRecords&quot; resultFormat=&quot;object&quot; fault=“handleFault(event)&quot; result=&quot;remotingCFCHandler(event)&quot;/> <mx:operation name=&quot;insertRecord&quot; result=&quot;insertCFCHandler()&quot; fault=&quot;handleFault(event)&quot;/> </mx:WebService>
  • 36. Programmatic Web Service HOW TO USE WEBSERVICE API IN ACTIONSCRIPT If you want to support advanced use case then you can create object of WebService inside your ActionScript and use it for making call public function useWebService(intArg:int, strArg:String):void { ws = new WebService(); ws.destination = “insertRecord&quot;; ws.echoArgs.addEventListener(&quot;result&quot;, echoResultHandler); ws.loadWSDL(); ws.echoArgs(intArg, strArg); }
  • 37. BlazeDS WHAT IS BLAZEDS BlazeDS is a open source project that provides J2EE based server side infrastructure for developing Flex application. You can add BlazeDS to any J2EE web application by adding set of .jar files and a servlet to your web.xml. The BlazeDS functionality can be divided into following types Remoting Messaging Proxy
  • 39. BlazeDS Remoting WHAT IS BLAZEDS Remoting BlazeDS remoting allows flex application to call methods of java objects directly It takes care of converting Java Object into Action Script object and other way round transparently AMF(Action Message Format) is used as data exchange format between server and flex AMF is proprietary binary format AMF provides more efficient data exchange The data exchange happens over HTTP connection but in proprietary optimized format
  • 40. BlazeDS Remoting SAMPLE OF HOW YOU CAN USE BLAZEDS REMOTING Server side, add these lines to remoting-config.xml <destination id=&quot;product&quot;> <properties> <source>com.atech.flex.ProductService</source> </properties> </destination> Client side <mx:RemoteObject id=&quot;srv&quot; destination=&quot;product&quot;/> <mx:Button label=&quot;Get Data&quot; click=&quot;srv.getProducts()&quot;/> <mx:DataGrid dataProvider=&quot;{srv.getProducts.lastResult} &quot;/>
  • 41. BlazeDS Remoting in ActionScript HOW TO USE BLAZEDS REMOTING IN ACTIONSCRIPT You can also create RemoteObject in the ActionScript and call its methods, handle its result in ActionScript method var srv:mx.rpc.remoting.RemoteObject; srv = new mx.rpc.remoting.RemoteObject(); srv.destination = &quot;product&quot;; helloWorldRO.getProducts.addEventListener(&quot;result&quot;, resultHandler); helloWorldRO.addEventListener(&quot;fault&quot;, faultHandler); helloWorldRO.getProducts(&quot;Hello from portal&quot;);
  • 42. BlazeDS Messaging WHAT IS BLAZEDS MESSAGNING BlazeDS messaging provides a client-side API and a corresponding server-side Message Service (BlazeDS Message Service) for creating BlazeDS messaging applications. BlazeDS messaging also enables participation in Java Message Service (JMS) messaging. There are two components available in the Flex frame work for messaging, mx:Producer and mx:Consumer. Producer is the component which is used for producing messages to a destination Consumer is used for subscribing to a destination and receiving messages published to that destination. Consumer also gives option to filter the messages based on user defined constraints.
  • 43. BlazeDS Messaging SAMPLE OF HOW YOU CAN USE BLAZEDS MESSAGING Server side, add these lines to messaging-config.xml <destination id=&quot;chat&quot;/> Client side, in flex application <mx:Consumer id=&quot;consumer&quot; destination=&quot;chat&quot; message=&quot;messageHandler(event.message)&quot;/> <mx:Producer id=&quot;producer&quot; destination=&quot;chat&quot;/>
  • 44. BlazeDS Proxy WHAT IS BLAZEDS PROXY SERVICE You can use the BlazeDS proxy service for Making crossdomain calls, other option is to use crossdomain.xml For making REST calls, in that case the actual call is made as HTTP GET and underlying service takes care of necessary conversion You can configure BlazeDS proxy service by changing proxy-config.xml
  • 46. Flex in enterprise WHAT ADDITIONAL TECHNOLOGIES YOU SHOULD LOOK AT If you trying to build a reasonably big complex Flex application then you should think about using some infrastructural components Spring Flex Integration Cairngorm Ant/ maven build script for flex
  • 47. Spring flex integration WHAT IS SPRING FLEX INTEGRATION The Spring Flex Integration project is a spring project that makes it easier to build Flex UI for Spring application No need for adding BlazeDS MessageBroker Servlet All the requests will be routed through Spring’s DispatcherServlet and it will talk to MessageBroker bean to convert Java objects into AMF and other way round You can use the Spring Integration framework to integrate flex messaging with JMS provider You can use it build Spring application that provide both Ajax and Flex UI
  • 48. Cairngorm WHAT IS CAIRNGORM Cairngorm was one of the primary  open source  frameworks for application architecture in  Adobe Flex It provides Model view controller architecture for building Flex applications You can use it for creating multi-page application
  • 49. THANK YOU FOR WATCHING CONTACT INFO: ASCENDANT TECHNOLOGY, LLC 8601 Ranch Road 2222 Building I, Suite 205 Austin, TX 78730 Phone (512) 346-9580 Thank You Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. December 19, 2010

Editor's Notes

  • #20: You can install standalone Flash builder or you can install Eclipse Plug-in. The Eclipse plug-in is preferred