16 Replies Latest reply on Apr 25, 2013 7:26 AM by Hitz_M

    One extension with multiple panels

    mmmmins

      Hello everybody,

       

      I am trying to find out if there is an option to have more than one panel per extension. The idea is to have a behaviour like different tabs, but instead of using the "tab" option within one panel, being able of displaying them as separate panels, so the user can see two (or more) of them at the same time.

       

      I found this, but this would install two extensions in one go that can work together, but what I would like to see is only one extension.

       

      Thanks a lot,

        • 1. Re: One extension with multiple panels
          FIGGAZZ

          import com.adobe.csxs.core.CSInterface;

          import com.adobe.csxs.types.CSXSWindowType;

          import spark.components.Window;

           

          private function createNewPanel():void

          {

               var nPnl:Window = new Window;

               nPnl.type =  CSXSWindowType.PANEL;

               // nPnl.x =

               //nPnl.y =

               //nPnl.width =

               //nPnl.height  =

               //nPnl.addElement()

               nPnl.open();

          }

          • 2. Re: One extension with multiple panels
            Harbs. Level 6

            No can do... Sorry.

            • 3. Re: One extension with multiple panels
              lomorgan Adobe Employee

              mmmmins wrote:

               

              I am trying to find out if there is an option to have more than one panel per extension. The idea is to have a behaviour like different tabs, but instead of using the "tab" option within one panel, being able of displaying them as separate panels, so the user can see two (or more) of them at the same time.

               

              It is possible to ship one "bundle" that contains multiple extensions. Typically people only create one extension per bundle, so there is some blurring of the terms - often when we talk about extensions we're really talking about bundles. When you create a new extension in Extension Builder what you're really doing is creating a new bundle with one extension in it. The article you linked to is an example of creating a bundle with two extenions in it. If you look at the CSXS manifest XML file you'll see the ExtensionList and DispatchInfoList elements - these can contain multiple Extension tags. This is supported by all the point products that support CSXS panels, indeed there are a number of Adobe bundles made up of multiple extensions.

               

              mmmmins wrote:

               

              I found this, but this would install two extensions in one go that can work together, but what I would like to see is only one extension.

               

              Thanks a lot,

               

              What do you mean by "only one extension"? Do you mean you only want the user to have to install one extension? Even if your bundle contained two extensions the user would only have to install one ZXP. If you mean that you only want one menu item to appear under Window > Extensions, then that would be possible by only having a menu item for one of the extensions. You could then open the other extension on creationComplete or some other start up event using CSXSInterface.getInstance().requestOpenExtension(<second extension's id goes here>);. You could send messages between the two panels using CSXS events.

               

              Hope that helps,

               

              Louis

              • 4. Re: One extension with multiple panels
                mmmmins Level 1

                lomorgan wrote:

                 

                mmmmins wrote:

                 

                I am trying to find out if there is an option to have more than one panel per extension. The idea is to have a behaviour like different tabs, but instead of using the "tab" option within one panel, being able of displaying them as separate panels, so the user can see two (or more) of them at the same time.

                 

                It is possible to ship one "bundle" that contains multiple extensions. Typically people only create one extension per bundle, so there is some blurring of the terms - often when we talk about extensions we're really talking about bundles. When you create a new extension in Extension Builder what you're really doing is creating a new bundle with one extension in it. The article you linked to is an example of creating a bundle with two extenions in it. If you look at the CSXS manifest XML file you'll see the ExtensionList and DispatchInfoList elements - these can contain multiple Extension tags. This is supported by all the point products that support CSXS panels, indeed there are a number of Adobe bundles made up of multiple extensions.

                 

                mmmmins wrote:

                 

                I found this, but this would install two extensions in one go that can work together, but what I would like to see is only one extension.

                 

                Thanks a lot,

                 

                What do you mean by "only one extension"? Do you mean you only want the user to have to install one extension? Even if your bundle contained two extensions the user would only have to install one ZXP. If you mean that you only want one menu item to appear under Window > Extensions, then that would be possible by only having a menu item for one of the extensions. You could then open the other extension on creationComplete or some other start up event using CSXSInterface.getInstance().requestOpenExtension(<second extension's id goes here>);. You could send messages between the two panels using CSXS events.

                 

                Hope that helps,

                 

                Louis

                 

                I was refering to not having two extensions in the menu, the option of creating a bundle with different extensions looks like the best option! Thank you for this great explanation!

                • 5. Re: One extension with multiple panels
                  mmmmins Level 1

                  FIGGAZZ wrote:

                   

                  import com.adobe.csxs.core.CSInterface;

                  import com.adobe.csxs.types.CSXSWindowType;

                  import spark.components.Window;

                   

                  private function createNewPanel():void

                  {

                       var nPnl:Window = new Window;

                       nPnl.type =  CSXSWindowType.PANEL;

                       // nPnl.x =

                       //nPnl.y =

                       //nPnl.width =

                       //nPnl.height  =

                       //nPnl.addElement()

                       nPnl.open();

                  }

                   

                  After having a look at the code and implemented in my extension, this could really make it. I still need to decide whether to go for a bundle of extensions with only one in the menu or this other option you suggest. Thanks a lot!

                  • 6. Re: One extension with multiple panels
                    Harbs. Level 6

                    Huh? Did you actually try this?

                    I don't think it will work...

                     

                    (referring to creating the panel on the fly...)

                    • 7. Re: One extension with multiple panels
                      mmmmins Level 1

                      I did try this (with some modifications for my extension) and did create a panel on the fly indeed... I myself didn't add any content to the panel, but the new panel was created and emerged in Photoshop.

                      Harbs. wrote:

                       

                      Huh? Did you actually try this?

                      I don't think it will work...

                       

                      (referring to creating the panel on the fly...)

                      • 8. Re: One extension with multiple panels
                        Harbs. Level 6

                        Interesting. Which version(s) did you try this in?

                         

                        IIRC, last time I tried to create a panel on the fly it created a regular window. I don't remember which apps/version I tested in.

                        • 9. Re: One extension with multiple panels
                          Harbs. Level 6

                          I just tested in InDesign CS6 and it creates a palette -- not a dockable panel. Are you sure PS is different?

                          • 10. Re: One extension with multiple panels
                            mmmmins Level 1

                            It does launch a new panel that can be docked around...

                             

                            import mx.core.Window;
                            import com.adobe.csxs.core.CSXSInterface;
                            import com.adobe.csxs.types.CSXSWindowType;
                            
                            public function appComplete():void{
                            var nPnl:Window = new Window;
                            nPnl.type =  CSXSWindowType.PANEL;
                            nPnl.open();
                            }
                            

                             

                             

                            I didn't really add content to it though!

                            • 11. Re: One extension with multiple panels
                              FIGGAZZ Level 1

                              I am sorry for my bad English...

                               

                               

                              I see that my code caused some interest, and for this reason, I will add some explanations:

                              This code was written on Flash Builder 4.6 with ExtBuilder 2.0 for Dreamweaver CS6 (Win). Result of execution of a code - is "native" floating panel created in real time.

                              The created panel allows to add \ delete the elements UI (before call open(), and after that) to work with events etc......  shortly, it is typical spark.panel or TitleWindow.

                              Created panel has the added internal Id (using in dreamweaver)

                              equal ExtensionId + sequence number of the created panel, for example: com.figgaz.dw.testExt0

                              Further, on this Id it is possible to address from ExtendScript script.

                               

                              By the way, in DW I couldn't catch an event of close and closing if the panel closed by button [x]. But яашёл an output through ExtendScript:

                               

                              var result:Boolean = CSInterface.instance.evalScript ('dw.getFloaterVisibility("com.figgaz.dw.testExt0")') as Boolean;

                              result = false if a panel is closed

                                                                 and

                              result = true if panel is open.

                               

                               

                              Harbs. wrote:

                               

                              I just tested in InDesign CS6 and it creates a palette -- not a dockable panel. Are you sure PS is different?

                              I didn't test this code in other applications of CS (while) also I can't know his behavior in them in any way.

                              But I remember that i slightly read about it in one of documentation.

                              • 12. Re: One extension with multiple panels
                                Harbs. Level 6

                                Here's the results of my testing:

                                1) Dreamweaver: Works.

                                2) Fireworks: Does not work.

                                3) Flash: Opens palette instead of panel.

                                4) Illustrator: Works

                                5) InDesign: Opens palette instead of panel

                                6) Photoshop: Works

                                 

                                I don't have video apps onstalled to try it on.

                                 

                                So, if you need it for DW, PS or AI, it's viable. Otherwise, no.

                                • 13. Re: One extension with multiple panels
                                  Hitz_M Level 1

                                  Hello,

                                   

                                  I have created new panel with your code, but I cant figure out how will that panel receive events from the Extension. Kidly help.

                                   

                                  Thanks.

                                  • 14. Re: One extension with multiple panels
                                    lomorgan Adobe Employee

                                    The strategy I have used in the past is to use CSXS events to communicate between the two panels. E.g. if your main panel is called "PanelA" and your secondary panel is "PanelB" then you might have something like this in the code for PanelB:

                                     

                                    private function onCreationComplete():void

                                    {

                                        CSInterface.instance.addEventListener("com.example.panelA_to_panelB_event", respondToCSXSEvent);

                                        // For CS5/5.5 you would use CSXSInterface.instance instead of CSInterface.

                                    }

                                     

                                    You can then contact it from PanelA by dispatching a CSXS event with type "com.example.panelA_to_panelB_event". You could have similar listeners in the PanelA code for two-way communication.

                                     

                                    Hope that helps,

                                     

                                    --Louis

                                    • 15. Re: One extension with multiple panels
                                      Hitz_M Level 1

                                      Thank you. Will try it out.

                                       

                                      Regards,

                                      Hitesh

                                      • 16. Re: One extension with multiple panels
                                        Hitz_M Level 1

                                        I am facing a problem while changing UI Theme in Illustrator.

                                        I have 2 panels, PanelA created by the extension and PanelB created using the code above through the extension.

                                        Both have mx:TabNavigator in them.

                                        In PanelA, the TabNavigator is added through mxml and in PanelB through ActionScript

                                        within the extension i've CSInterface.instance.autoThemeColorChange = true;

                                         

                                        while changing Illustrator theme from Dark to Light, the color of tabnavigotor for PanelA changes but not for PanelB

                                         

                                         

                                         

                                         

                                         

                                         

                                        Kindly help.

                                        Thanks