Getting the windows user name into your Flex application

10
Mar/08
6

Got this question last week and found out you can get the windows user information into your Flex application. I’m not sure why you would wanna do this ;) But just for anyone trying to figure this out … here is how to do it.

Through javascript you can get the user Id (This only works through Internet Explore !), so by using ExternalInterface in Flex you can call the javascript function that will get you the user id.

So first you wanna add the javascript to your index.template.html (in html-template folder of your flex builder project). Add the script to the script tag just below the body tag.

var wshShell = new ActiveXObject(“WScript.Shell”);
function getUserName()
{
return wshShell.ExpandEnvironmentStrings(“%USERNAME%”);

Then you can add to your MXML application this code to get the user id …

           if (ExternalInterface.available) {

           try {
                    var name:String = ExternalInterface.call(‘getUserName’);
                    Alert.show(“name = ” + name);
                } catch (error:SecurityError) {
                    Alert.show(“A SecurityError occurred: ” + error.message + “\n”);
                } catch (error:Error) {
                    Alert.show(“An Error occurred: ” + error.message + “\n”);
                }
            } else {
                Alert.show(“External interface is not available for this container.”);
            }

 } 

 So as I said … it will only work on Internet Explore. Through the wshShell object you can also get the domainname if needed.

Filed under: Flex

Javapolis coming up …

14
Nov/07
3

It’s that time of the year again ! Javapolis is up in 4 weeks and Adobe will be attending again ! The exiting news is that one of the keynotes will discuss the use of Flex with Java. Besides that you can see Flex/AIR in a universtity session, a conference session, 2 quickies and 1 BOF session.

We’ll also have some Flex specialist at Adobe booth : James Ward, Christophe Coenraets, Marc Meewis and me. We also have invited Bruce Eckel to talk about his view on Flex and Java.

Ofcourse we’ll also try to have some fun by organizing the “Adobe Quest” … A cool way to get your hands on some cool Adobe gadgets … More on this later on …

And … just like last year I have 2 full conference passes to give away … How to win ? Post a comment to this item and tell me why you think Java and Flex/AIR are the perfect couple … The 2 most original posts will win a conference pass.

See you at Javapolis ? I’m looking forward to it ! ;)

Filed under: Flex, LiveCycle

Adobe Share Livecycle ES custom component

25
Oct/07
10

Persons that did attend the Bootcamp session at Max probably have seen this component. It’s a Livecycle ES component that will allow you to upload a file to your Adobe Share account.

So Livecycle ES has got an orchestration tool that allows you to build functionality by linking ”services” together. Each services stands for a specific piece of functionality. The product comes with a library of these services. (Generate PDF, Secure PDF, Read LDAP info, Send email, SQL, …) Livecycle ES Workbench, a tool build on top of eclipse, allows you to draw the orchestration in and configure it.  

By building a custom components you can extend the Livecycle ES functionality by creating your own services. A custom component is a Jar file that excist out of a java object, a configuration file and an icon which defines the visual representation in the Workbench. I have created the LC ES Share component, by building a java object that would call the Share Java API.
After writing the component, the component developer would hand over the Jar file to the Livecycle ES administrator so it can be deployed into the Livecycle ES platform. After deployement, it will become available as a service and will be visible in the Workbench. From this moment on you can drag and drop the service into the orchestration you would be building.

 

The image above shows a sample orchestration. In this orchestration I will first generate a PDF file, then I’ll upload it to Adobe Share and finally I send out an email with the notification. The Generate PDF and the email component are in the LC ES product, the Adobe Share component is the one I have build.

You would configer the Adobe Share component by defining it’s properties in the UI. Check out the screenshot below. The fields I have to define here, are the same as defined in my java object and configured in the xml configuration file.

Another advantage of the Livecycle ES platform is, that from the moment i deploy my Adobe Share component, it will not only become available as a service to my orchestration designer.The service containerr also automatically makes the functionality availabe as a SOAP service, EJB service and a Remoting endpoint. The Remoting endpoint allows you to interact with this piece of functionality from with a Flex application.
You can even add watched folders or email endpoints, to make the Share functionality available when dropping a file in a folder or receiving a file by email. Find more information on the service container in the Livecycle documentation. 

I have made the source available, and also the component which you can deploy directly into your LC ES platform. Find here how to deploy components. You can download Livecycle ES trial version if you don’t have it installed yet.

One nice extra  is that I added an ANT build file to the source,  that will build the java source, create the jar file and deploys it automatically to the Livecycle ES platform as discussed in this post.

Filed under: Flex, LiveCycle

Max Barcelona / Adobe Share API's released

15
Oct/07
1

Arrived in Barcelona yesterday … First night here wasn’t great fun … Had to finish up one of the presentations i was doing …

The Share guys have released Java and Actionscript API’s. So i guess it’s not going to take a long time now before we get the first  drag and drop Share application ;) I’ll try to make a Livecycle component that connect to share, using the Java API.

Back to Max now … First session done, went pretty well … and had a full room. Let’s go we’ll keep this up ;) . I have been taking some pictures with my new camera … I got a Canon Ixus 860 IS and am pretty happy with it … i’ll post some of the Max pictures so you can judge for yourself.

Back to Max now …

Max Barcelona : Some session you might want to check out !

10
Oct/07
0

So if you are coming to Max Barcelona, prepare yourself for 3 days of great content and networking ;)

Here is a list of some sessions i saw in Chicago and certainly can recommend :

  • Adobe Integrated Runtime (AIR) Security by Lucas Adamski : Great technical session that explains what’s the security model for AIR, but also will give you an insight on the why.
  • Flex Roadmap by Ely Greenfield : Get some insight in the Flex teams brains … It was interesting to see what might be the next steps …
  • Fifty Reasons Why ActionScript 3 Rocks by Grant Skinner : Very technical but certainly not boring ;)
  • Optimizing Search for Rich Internet Applications by Craig Hordlow : A question that pops ups quite a lot … Craig tells you what approach to take, and also will give you background on why to take that approach.

A session which is new for Barcelona is the “Flex/AIR & Java integration for Parleys.com” case study by Stephan Janssen. This one is interesting if you are a Java developer. Stephan is the founder of the Javapolis conference.

I’ll be presenting these 2 sessions :

  • Hands On: Building an Application Using LiveCycle ES
  • Advanced LiveCycle Data Services for Flex Developers

And also will be hosting the “Livecycle Bootcamp”.

I’m certainly looking forward to meet you all ! Don’t hesitate to ping me or say hello ;)

ps : only 18 registrations away from sold out … so you might need to hurry up if you haven’t subscribed yet ;)

Filed under: Flex, LiveCycle

Adobe Max Chicago : my highlights

9
Oct/07
0

Finally get to write some stuff about the event … the last days really have been crazy ! It was intensive but rewarding ;) Let me give you an overview of what i think are the highlights of Max 2007 Chicago.

  • Thermo, the RIA designer tool certainly impressed everybody. Even though it’s created for designers, I think even developers will love Thermo. Check out the screenshots at Adobe Labs.
  • Buzzword and Adobe Share : It’s great to see the Saas strategy is getting shape ! Share documents online using Adobe Share, and possible the entry point of all these great services that might come in the future. Buzzword, the text editor build on top of AIR, is probably a great example of such a service.
  • CoCoMo : One of my personal favorites ! Flex components that allows you to integrate Acrobat Connect functionality into your own application is just way to cool ! This one is going to be a hit !
  • Flex Builder goes Linux !
  • LiveCycle developers @ Max : it was impressive to see the growth of LC ES developers attendees. The “Meet the LiveCycle team” session was “sold out” ;) .
  • The new Adobe Developer website has been announced … Check it out : http://developer.adobe.com
  • Pacifica : High quality VOIP with the flash player ! Just imagine how this feature can improve the online shopping experience. Whenever you get stuck, you can talk to a representative just by clicking 1 button …

At the moment i’m in the airport of Chicago, going to Ottawa. Next week you’ll find me at Max Barcelona … Will post later this week with some of the must see sessions for Barcelona !

Simple Flex util component to support dragging files from Desktop into Flex-AIR application.

25
Jul/07
4

I created quickly this component to make your mxml code simpler if you want to support dragging files into your Flex/AIR application.

You would only have to add the FlexAIRDrag tag and link the UIComponent and react to the DropEvent which would occur the moment files are dropped inside the defined UIComponent.

Sample application :

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml” xmlns:etech=”com.adobe.etech.*” creationComplete=”this.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDownTitle);” layout=”absolute” >
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import flash.desktop.DragManager;
            import flash.desktop.DragActions;
            import mx.events.DragEvent;
            import flash.desktop.TransferableData;
            import flash.desktop.TransferableFormats;
            import flash.events.NativeDragEvent;
            import com.adobe.etech.DropEvent;       
            import flash.filesystem.File;   

        private function onMouseDownTitle(evt:MouseEvent):void
        {
            stage.window.startMove();
        }
        private function onDrop(event:DropEvent):void {
            for each (var file:File in event.dropfiles){
                  Alert.show("This file was dragged in window : " + file.name);
            }                               
        }
        ]]>
    </mx:Script>

    <etech:FlexAIRDrag uiComponent=”{panelDrop}” FlexAIRDrag=”onDrop(event)” />

    <mx:Panel id=”panelDrop”  width=”636″ height=”378″/>   
</mx:WindowedApplication>

You can download the source files here.

Filed under: Flex

LC DS 2.5 : Generating PDF from within a Flex application

23
Mar/07
27

Livecycle Data Services 2.5 (previously known as Flex Data Services) has got a new feature that will allow you to generate PDF files. Cool stuff certainly if look at the way we integrate a part of the Livecycle solution.

Adobe Livecycle allows you already a while to generate PDF based on a template and data (xml). The template is being build using Livecycle Designer. LC Designer offers you a WYSIWYG interface to build templates. The data(xml) you will be merging into the template is being displayed as a tree structure. By using drag and drop, you can link a data element with a visual control in the template. This solution is based on the XFA specification.

This functionality will now be available for Flex developers through LC Data Services. Your Flex application will have to generate a XML file, so LC DS can merge the XML data with your XFA template. (the template is being build with LC Designer). To build the XML within your flex application use the mx:XML tag. This makes life easy as you can just reference variables to fill up the XML.

<mx:XML id=”xmlModel”>
<CompanyReport>
<TitleText>{panel.title}</TitleText>
<OverviewText>{overviewText.text}</OverviewText>
<BalanceSheetImage>{balanceSheetImage}</BalanceSheetImage>
<EarningsImage>{earningsImage}</EarningsImage> </CompanyReport>
</mx:XML>

Nice thing is that you can put images into the XML and map them in the XFA template with an image control. And to make it complete, the ImageSnapshot actionscript object, allows you to create an image/screenshot from flex controls in your Flex application. Check out this code example …

var snapshot:ImageSnapshot = ImageSnapshot.captureImage(balanceSheet);
balanceSheetImage = ImageSnapshot.encodeImageAsBase64(snapshot);

You just have to reference the balanceSheetImage variable into the XML model. ImageSnapshot can take a snapshot from any UIComponent. Think especially on chart components that can be shown in PDF.

The actual creation of the PDF will happen on the server, by calling a Remote Object. You’ll have to create a POJO that will use the “flex.acrobat.pdf.XFAHelper” java object (part of LC DS). Here is an example on how this might look like …

example : calling the remote object in Flex

<mx:RemoteObject id=”service” destination=”PDFService” fault=”faultHandler(event)” result=”resultHandler(event)” />

// call the remote POJO method (as defined below), giving the XML model as an attribute … 
service.generatePDF(xmlModel);

example : java source code of object that calls XFAHelper

// define a string with a link to the XFA template
String source = FlexContext.getServletContext().getRealPath(“/pdfgen/company.pdf”);
XFAHelper helper = new XFAHelper();
helper.open(source);

// Import XFA dataset : dataset is the XML constructed in your Flex application. dataset is a org.w3c.dom.Document
helper.importDataset(dataset);

// Save new PDF as a byte array in the current session
byte[] bytes = helper.saveToByteArray();

Download the Livecycle DS beta from http://labs.adobe.com and try it out for yourself.

Don’t forget that this solution is generating the chart on the client. So this is not a solution for generating charts on the server and merge them with a XFA template. 

Here you can find an example of a PDF generated through LC DS.

Filed under: Flex, LiveCycle

Sun Tech Days in Paris and release Apollo alpha

22
Mar/07
3

I presented yesterday together with Michael Chaize to a bunch of java developers at SUN Tech Days here in Paris. We had about 250 people in the room and got great feedback. Java developers love our technology and the concept of Apollo.

Apollo alpha has been released for about 5 days and it’s impressive to see how many people already have been playing with it … We had about 10 java developers stepping up to us and talking about it. Also surprising to see the number of apollo apps that are already available … The coolest ones is the Apollo Finetunes client. I got it installed and totally love it ;)
Also yourminis.com came up with an apollo app that acts like a widget container … Another one to check out is Eli’s Apollo book … cool example that shows how Apollo allows us to combine flex and html.
Also the Apollo client for gmail is kind of interesting … This is a quite simple apollo app that will run the online google mail through the html component from Apollo, no Flex involved. It’s a 100% online experience as it’s online html. It is not the ideal Apollo application but a great way to get start. It can be the first step in a procces to build an Apollo application that will be able to run both online and offline. I expect you’ll see quite a few of these initiatives as i can imagine a lot of people like the fact that apollo makes your web application look like a real desktop application …

Anyway, I just have one advice … install it and get exited !

Filed under: Flex

Adobe MAX conference coming to EMEA !

1
Mar/07
3

The dates and venues for MAX 2007 are public …

  • MAX North America: September 30-October 3, 2007, Chicago, IL
  • MAX Europe: October 15 – 18th 2007, Barcelona, Spain
  • MAX Japan: November 2007, Japan

This year MAX should certainly be the event to attend with Apollo coming up !

More details will appear soon on the Adobe website … I will post whenever registration for EMEA MAX will be available.

Website is available : http://www.adobemax2007.com/ 

Filed under: Flex, LiveCycle