16 Replies Latest reply: Sep 28, 2011 9:41 PM by Gang_Z RSS

    Custom check in dialog

    JoeriADAM Community Member

      Hi,

       

      we are currently implementing a custom check-in dialog for Bridge.

      The dialog contains a Combobox.

      The available items in the combobox are loaded from a web-service, called from Bridge. How is it possible to provide the Flex UI with data from Bridge?

       

      Thanks

        • 1. Re: Custom check in dialog
          JoeriADAM Community Member

          I think I'm on the right track but I'm not able to get it working.

           

          I'm using the IGetCustomCheckInUIContextInfoHandler from the Drive SDK, and have added following testcode:

           

          HashMap<String, Object> items = new HashMap<String, Object>();

          items.put("key1", "value1");

          items.put("key2", "value2");

          response.setContextInfo(items);

           

          In the Flex Mdule, I have implemented ICustomCheckInUI and using following code:

           

          public function setContextInfo(info:Object):void

          {

           

          var items:Array = info as Array;

           

          if(items != null) {

          workflowCombo.dataProvider = items;

          }

          }

           

          When running, I am able to see the ComboBox, but it is empty. Anyone an idea?

           

           

          • 2. Re: Custom check in dialog
            Gang_Z Community Member

            Hi,

             

            for the setContextInfo() function, you should write it like the below:

             

            public function setContextInfo(info:Object):void

            {

                 if(info == null

                      return

             

                 var items:Array = new Array();

             

                 if (info.hasOwnProperty("key1"))
                      items["key1"] = info["key1"];
               
                 if (info.hasOwnProperty("key2"))
                      items["key2"] = info["key2"];

             

               

                workflowCombo.dataProvider = items;

            }

             

             

            The context info object sent from your Java connector will be wrapped into a generic Flex Object class instance, all the keys will become its properties, all the values will become property values. you cannot cast it directly into an Array instance.

             

            Thanks

             

            Gang

            • 3. Re: Custom check in dialog
              JoeriADAM Community Member

              Thanks for your reply.

               

              But I think theres another problem we're facing.

               

              When I add the following line in setContextInfo(), my custom module is not visible in the check-in dialog, even if 'items' is a simple array.

               

              var items:Array = ["A", "B"];

              workflowCombo.dataProvider = items;

               

              If I remove the line

              workflowCombo.dataProvider = items;

               

              my module is available in the check in dialog (but is empty of course).

               

              Is there a way to have some logging?

              Could the problem be that binding the combobox at this time is too late?

              • 4. Re: Custom check in dialog
                Gang_Z Community Member

                Hi,

                 

                Sorry for late response.

                 

                There are two reasons causing your problems.

                 

                1) It's too early to bind Combobox in the SetContextInfo() function, SetContextInfo() function is called by AdobeDrive in the ModuleLoader.ready Module Event handler, during this time, the creation of Combobox is not finished, you should simply preserve the context info passed to you in SetContextInfo(), then bind Combobox with it in its creation complete event handler.

                 

                2) The dataprovider of ComboBox should be an ICollectionView instance, Array class doesn't meet this requirement

                 

                The sample code is as follows:

                 

                protected function module1_creationCompleteHandler(event:FlexEvent):void
                {
                    if (_contextInfo == null)
                     return;   
                      
                    var items:ArrayCollection = new ArrayCollection();   
                   
                    items.addItem("value1");   
                    items.addItem("value2");
                   
                    testCombo.dataProvider = items;

                }

                • 5. Re: Custom check in dialog
                  JoeriADAM Community Member

                  Hi,

                   

                  thanks a lot for your help. This is working now.

                   

                  One last issue however. Following code fragment (in the Flex code)

                   

                  public function getInteractionResults(): Object

                  {

                    return null;

                  };

                   

                  when I'm returning 'null' it works, meaning that I am able to cllick the OK button of the checkin dialog and checkin continues.

                  But when I'm trying to return something else, clicking the OK button does not do anything at all: the dialog stays open.

                   

                  I need to return the selected item of the comboBox. In the documentation I have read that the object you are returning must be an associative array.

                  When trying something like following line, again the OK button does not respond:

                   

                  var returnValue:Array = new Array();

                  returnValue["key"] = "value";

                  return returnValue;

                   

                  Again many thanks in advance.

                  • 6. Re: Custom check in dialog
                    Gang_Z Community Member

                    Hi,

                     

                    I tried to reproduce the issue with your code on my side, however everything was fine, the source code is attached below, please try it

                     

                    <?xml version="1.0" encoding="utf-8"?>
                    <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" 
                         height="100" implements="com.adobe.drive.customui.moduleinterface.ICustomCheckInUI" creationComplete="module1_creationCompleteHandler(event)">
                    <mx:Script>
                      <![CDATA[
                       import com.adobe.drive.customui.moduleinterface.ICustomCheckInUI;
                       
                       import mx.events.FlexEvent;
                       import mx.collections.ArrayCollection;
                       
                       private var _contextInfo:Object;
                       
                       public function setLocale(locale:String):void
                       {
                        return;
                       }
                       
                       
                       public function setContextInfo(info:Object):void
                       {
                        _contextInfo = info;    
                       }   
                       
                       public function getWidth():int
                       {
                        return 400; 
                       }
                       
                       
                       public function getHeight():int
                       {
                        return 100;
                       }
                       
                       
                       public function getInteractionResults():Object
                       {
                        var returnValue:Array = new Array();
                        
                        returnValue["key"] = "value";
                        
                        return returnValue;
                       }
                       
                       protected function module1_creationCompleteHandler(event:FlexEvent):void
                       {
                        if (_contextInfo == null)
                         return;    
                        
                        if (_contextInfo.hasOwnProperty("defaultValue"))
                         this.TestPropertyValue.text =  _contextInfo["defaultValue"];
                        
                        var items:ArrayCollection = new ArrayCollection();    
                        
                        items.addItem("value1");    
                        items.addItem("value2");
                        
                        testCombo.dataProvider = items;
                       }
                      ]]>
                    
                    
                    
                    </mx:Script>  
                    <mx:Canvas width="100%" height="100%" borderStyle="inset">
                      <mx:Label id="TestPropertyName" x="32" y="37" text="TestProperty:" width="100"/>
                      <mx:TextInput id="TestPropertyValue" x="195" y="35" width="164"/>
                      <mx:ComboBox id="testCombo" x="32" y="64"></mx:ComboBox>
                    </mx:Canvas>
                    
                       
                    </mx:Module>
                    
                    • 7. Re: Custom check in dialog
                      JoeriADAM Community Member

                      Ok,

                       

                      it seems that a few details in my code were causing the issue.

                       

                      Am I correct that the returnValue of getInteractionResults() can be used in the ICheckInHandler?

                      But, debugging the ICheckInHandler, my requestItem.getCustomParameters() returns null.

                       

                      Is this reproducable at your end?

                      • 8. Re: Custom check in dialog
                        Gang_Z Community Member

                        Hi,

                         

                        No, on my side, requestItem.getCustomParameters() returns the correct interaction result

                         

                        item CheckInRequest$Item  (id=212) 
                         content InputStreamReadableByteChannel  (id=214) 
                         contentSize 109753 
                         customParameters CustomParameters  (id=219) 
                          parameter HashMap<K,V>  (id=223) 
                           entrySet HashMap$EntrySet  (id=231) 
                           keySet null 
                           loadFactor 0.75 
                           modCount 1 
                           size 1 
                           table HashMap$Entry<K,V>[16]  (id=224) 
                            [0] null 
                            [1] null 
                            [2] null 
                            [3] null 
                            [4] null 
                            [5] null 
                            [6] null 
                            [7] null 
                            [8] null 
                            [9] null 
                            [10] null 
                            [11] null 
                            [12] null 
                            [13] null 
                            [14] null 
                            [15] HashMap$Entry<K,V>  (id=225) 
                             hash -922089969 
                             key "key" (id=143) 
                             next null 
                             value "value" (id=144) 
                           threshold 12 
                           values null 
                         identity RemoteAssetIdentity  (id=221) 
                         lockToken null 
                         mimeType null 
                         modificationDate 1307635200000 
                         replace false 
                         versionProperties null 
                         xmp null 
                        


                        Please do the following steps to re-test your connector

                         

                        1) unmount all the drives

                        2) kill CS5ServiceManager

                        3) make sure getInteractionResults() in the Flex part return the correct value

                        4) Compile you Flex module and replace the old one

                        5) re-connect your server

                        • 9. Re: Custom check in dialog
                          JoeriADAM Community Member

                          No result,

                           

                          can it be a result of using the Flex 3.6 Compiler? I have read that 3.0 must be used, but I can not find it for download...

                          • 10. Re: Custom check in dialog
                            Gang_Z Community Member

                            Hi,

                             

                            Please use Flex SDK 3.5 to compile your module swf, and give it another try

                             

                            thanks

                            • 11. Re: Custom check in dialog
                              JoeriADAM Community Member

                              Hi,

                               

                              still no luck with 3.5.

                               

                              Just to make sure: this is currently the hardcoded snippet in getInteractionResults()

                               

                              var returnValue:Array = new Array();

                              var key:String = "myKey";

                              var value:String = "myValue";

                              returnValue[key] = value;

                              return returnValue;

                              • 12. Re: Custom check in dialog
                                Gang_Z Community Member

                                This is what I got, , I still can not reproduce your issue

                                 

                                item CheckInRequest$Item  (id=593) 
                                 content InputStreamReadableByteChannel  (id=596) 
                                 contentSize 75579 
                                 customParameters CustomParameters  (id=597) 
                                  parameter HashMap<K,V>  (id=598) 
                                   entrySet HashMap$EntrySet  (id=666) 
                                   keySet null 
                                   loadFactor 0.75 
                                   modCount 1 
                                   size 1 
                                   table HashMap$Entry<K,V>[16]  (id=599) 
                                    [0] null 
                                    [1] null 
                                    [2] null 
                                    [3] null 
                                    [4] null 
                                    [5] null 
                                    [6] null 
                                    [7] null 
                                    [8] null 
                                    [9] null 
                                    [10] null 
                                    [11] null 
                                    [12] null 
                                    [13] HashMap$Entry<K,V>  (id=602) 
                                     hash -199977139 
                                     key "myKey" (id=584) 
                                     next null 
                                     value "myValue" (id=585) 
                                    [14] null 
                                    [15] null 
                                   threshold 12 
                                   values null 
                                 identity RemoteAssetIdentity  (id=594) 
                                 lockToken null 
                                 mimeType null 
                                 modificationDate 1307894400000 
                                 replace false 
                                 versionProperties null 
                                 xmp null 
                                


                                MXML file, could you totally use this file for your test and see what happens?

                                 

                                <?xml version="1.0" encoding="utf-8"?>
                                <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" 
                                     height="100" implements="com.adobe.drive.customui.moduleinterface.ICustomCheckInUI" creationComplete="module1_creationCompleteHandler(event)">
                                 <mx:Script>
                                  <![CDATA[
                                   import com.adobe.drive.customui.moduleinterface.ICustomCheckInUI;
                                   
                                   import mx.events.FlexEvent;
                                   import mx.collections.ArrayCollection;
                                   
                                   private var _contextInfo:Object;
                                   
                                   public function setLocale(locale:String):void
                                   {
                                    return;
                                   }
                                   
                                   
                                   public function setContextInfo(info:Object):void
                                   {
                                    _contextInfo = info;    
                                   }   
                                   
                                   public function getWidth():int
                                   {
                                    return 400; 
                                   }
                                   
                                   
                                   public function getHeight():int
                                   {
                                    return 100;
                                   }
                                   
                                   
                                   public function getInteractionResults():Object
                                   {
                                    var returnValue:Array = new Array();
                                    
                                    var key:String = "myKey";
                                    
                                    var value:String = "myValue";
                                    
                                    returnValue[key] = value;
                                    
                                    return returnValue;
                                   }
                                   
                                   protected function module1_creationCompleteHandler(event:FlexEvent):void
                                   {
                                    if (_contextInfo == null)
                                     return;    
                                    
                                    if (_contextInfo.hasOwnProperty("defaultValue"))
                                     this.TestPropertyValue.text =  _contextInfo["defaultValue"];
                                    
                                    var items:ArrayCollection = new ArrayCollection();    
                                    
                                    items.addItem("value1");    
                                    items.addItem("value2");
                                    
                                    testCombo.dataProvider = items;
                                   }
                                  ]]>
                                 </mx:Script>  
                                 <mx:Canvas width="100%" height="100%" borderStyle="inset">
                                  <mx:Label id="TestPropertyName" x="32" y="37" text="TestProperty:" width="100"/>
                                  <mx:TextInput id="TestPropertyValue" x="195" y="35" width="164"/>
                                  <mx:ComboBox id="testCombo" x="32" y="64"></mx:ComboBox>
                                 </mx:Canvas>
                                 
                                   
                                </mx:Module>
                                
                                • 13. Re: Custom check in dialog
                                  JoeriADAM Community Member

                                  Executing your code does not work also

                                  We have tried on two of our development machines, no luck on both...

                                   

                                  Currently I have no idea what to try. Maybe the issues isn't flex related, but Drive/Bridge?

                                  • 14. Re: Custom check in dialog
                                    Gang_Z Community Member

                                    It's really strange, if you don't mind, can you share you whole Flex project with me? you can zip it and send it to gzheng@adobe.com, I will compare your project setting with mine and test it with BR5.5

                                     

                                    Thanks

                                    • 15. Re: Custom check in dialog
                                      JoeriADAM Community Member

                                      Hi,

                                       

                                      I think we have found the issue now.

                                       

                                      Using Bridge:

                                       

                                      - do checkout - edit file -  checkin: getCustomParameters() is working correctly.

                                      - add a new file to bridge (which is automatically checked in) : the getCustomParameters() method returns null.

                                       

                                      Can you please verify that adding a new file using Bridge is really the issue here?

                                       

                                      Thanks

                                      • 16. Re: Custom check in dialog
                                        Gang_Z Community Member

                                        Hi,

                                         

                                        Yes, there is an issue here in adding a new file using Bridge, the main reason is, it's hard to extract the server information at that time, we will find out how to correct it in the future releases, a bug will be logged.

                                         

                                        please recommend your users to copy the file into AD file system using Explorer/Finder first, the file status is new, then use Bridge to check-in it.

                                         

                                        Thanks for reporting it.

                                         

                                        Gang