aspose file tools*
The moose likes Flex and the fly likes An integration with Flex question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Flex
Bookmark "An integration with Flex question" Watch "An integration with Flex question" New topic
Author

An integration with Flex question

Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 50

Hi

I'm developing an a web application that using xml's with xsl's files combined to produce web pages (ajax)

Is it possible to add/integrate Flex in such a system?

If the answer is yes, how can it be done? What are the first steps

Regards.

Daniel.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

What exactly is your goal for the pages, to output to HTML/CSS or a Flash application? Flex handle XML extremely well, but its predominately a front-end platform, rather than a middle tier for processing data.


My Blog: Down Home Country Coding with Scott Selikoff
Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 50

I would like to integrate the flash elements inside the jsp displayed pages

I'm not interested in using it as a processing data , but for visual purpose .

Right now we are using fusion charts swf files in our system...

And it will be great if it will be possible to integrate the Flex also....
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

You can create Flex widgets that read XML data, either from disk or from a backend Java server, and display beautiful charts/graphs. In fact, this is one of the most common uses of Flex.
Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 50

Flex widgets are .swf files?

Can i create them some how by using java/ with the help of java?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Yes, Flex can output to SWF (SWC as well), so once compiled they are quite similar to Flash-created SWFs. The difference is that it's a programming-oriented way to develop Flash applications, rather than a visual one, and is often done in Eclipse using the Flex Eclipse plugin.

The language is not the same, though, but most Java developers feel at home in ActionScript given the similar syntax.
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 199
    
    1

You're better at ease with Actionscript since its a strongly typed language, just in case you were coming from a Java background.
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 199
    
    1

Also, I think it's best use Flex for UI purposes and integrate them with server side logic through BlazeDS, Adobe LifeCycle DS or others. This reduces the size of your swf file greatly.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sai Hegde wrote:You're better at ease with Actionscript since its a strongly typed language, just in case you were coming from a Java background.


Well - ActionScript is really somewhere between the two. ActionScript allows you to access variables note defined for the type you have assigned it. e.g.:

will return the valuye of the property "a" of whatever type the object represents, or null if the property does not exist. So you can write ActionScript asd if it were weakly typed.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sai Hegde wrote:Also, I think it's best use Flex for UI purposes and integrate them with server side logic through BlazeDS, Adobe LifeCycle DS or others. This reduces the size of your swf file greatly.


Not sure I follow what you are saying here - how does BlazeDS or LCDS reduce the size of the SWF? The normal pattern for reducing download size is to break a single SWF in to components and load them on demand.
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 199
    
    1

My bad!!!
I meant to say do not process business logic on the client... I have come across many naive developers doing that.

Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 199
    
    1

ActionScript allows you to access variables note defined for the type you have assigned it.


Yeah, just because you can, you should not be doing that. Using AS as a weakly typed language is a source of frustration for many developers (count me in it too ) with especially hard to track bugs.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

To play devil's advocate a bit - why not? You write code to be more loosely coupled this way - which is a big reason why some people prefer weakly typed languages. Assuming good, test driven development practices, and a design that follows a well understood pattern, what do you have to fear?
Bj Allmon
author
Greenhorn

Joined: Oct 23, 2010
Posts: 13
For the original question... I suppose you have multiple options. I personally would create a "widget project" separately, as it's own project and development lifecycle. This would allow you to be able to add them to any page you are generating as a dependency somehow.

The other thing I think I hear you wondering about is if it's possible to use Java to actually build the component. To me this means using Java (or groovy ) to generate Flex MXML and Actionscript. Depending on the complexity of the component, I guess you could do that. HOWEVER, I fear it would be too messy coupling projects together when you can simply pull the flex component in as a "prebuilt dependency" (SWF, SWC) when generating the page.
Bj Allmon
author
Greenhorn

Joined: Oct 23, 2010
Posts: 13
Sai Hegde wrote:My bad!!!
I meant to say do not process business logic on the client... I have come across many naive developers doing that.



My two cents.. I feel that a "Rich Application" does care about business logic. If nothing beyond basic webapp capabilities is required for a project, Flex may not be the right choice. A plain old webapp framework should be considered instead to deliver everything the customer needs. However, if something more than just stuffing simple html forms and divs with data with the occasional AJAX call is required, then Flex is a viable option.

Flex has a place for business logic pertinent to the user's experience or the view. The concern should fall mainly in the way you design your Flex module. In the book, Flex on Java, we demonstrate using the MVP design pattern for keeping the code clean. This is a pretty clean design pattern common for stateful and rich applications.

Flex enables developers to build business objects that know how to manage state, communicate intelligently with a server-side, and provide captivating view components. All with unit tests.
Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 50

That was very enlightening discussion...

Thanks!

Daniel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: An integration with Flex question