Prepare_dynamic_navigation to embed in another component

Hi,
I have two components A and B. A uses B as used component. Both A and B have  I  as used component. I is the interface component for visual components. Component VC implements interface component I.
My requirement is to put component VC in a view container in component B. But A should act as the controlling component and should take care of creating component VC and embed the created component VC into view container of B. Is it possible using prepare_dynamic_navigation method?
I am using the code as follows in component A:
try.
      l_view_controller_api->prepare_dynamic_navigation(
             source_window_name          = 'WI_MANAGECOURSE'
             source_vusage_name          = 'MAIN_USAGE_1'
             source_plug_name            = 'GOOUT'
             target_component_name       = 'B'
             target_component_usage      = 'MAIN_USAGE_1'
             target_view_name            = 'WI_GENERICRM'
             target_plug_name            = 'DEFAULT'
             target_embedding_position   = 'VI_MAIN/VIEWCONTAINER' ).
    catch cx_wd_runtime_repository.
      raise exception type cx_wdr_rt_exception.
  endtry.
Create the actual visual Component
  if wa_cmp_usage-component_usage->has_active_component( ) is not initial.
    wa_cmp_usage-component_usage->delete_component( ).
  endif.
  wa_cmp_usage-component_usage->create_component( 'VC' ).
This code gets executed fine but some where in the ABAP frame work class, I get the error:
"Component Usage VIEW_INTERFACE Has No Component. Application May Not Have Created an Instance "
VIEW_INTERFACE is the component use for interface I in both components A and B.
Regards,
Srini.

Hi,
The problem is resolved after I moved the embedding on to the same component. But I doubt whether it would be possible to use prepare_dynamic_navigation to embed in another component.
Regards,
Srini.

Similar Messages

  • Reading the data from one component view into another component view

    Hi All,
    I have requirement to read the data from one component into another component while creating the service order. Here are the details.
    Main View for Service order: BT116H_SRVO in that we have two assignment blocks like Organizational data(BTORGSET) and amount allocation(BTAMNTALL).This two blocks are two different component which are associated with main component(BT116H_SRVO).
    I need to read the sales org data from component/View(BTORGSET/Orgsetdata) into Component/View(BTAMNTALL(HdrBillPlanDet) method DO_VALIDATE_INPUT.
    I searched in SDN but all the posts are related to the data exchange between two views in same component. But My scenario is different as explained above.
    Refer the attachments for the component link..
    Please let me know how we can achieve this one..
    Thanks,
    Sapsar.

    Finally I was able to fix my code...My Mistakes were need to read the parent node above three levels and need to use the relation entity name while reading the data..
    Below is the correction code
    IF iv_index IS NOT INITIAL.
         lr_iterator ?= collection_wrapper->get_iterator( ).
         lr_current ?= lr_iterator->get_by_index( iv_index ).
         lr_entity ?= lr_iterator->get_by_index( iv_index ).
       ELSE.
         lr_current = collection_wrapper->get_current( ).
       ENDIF.
    *loop back to root entity
             WHILE lr_entity->get_name( ) NE 'BTAdminH'.
               lr_entity = lr_entity->get_parent( ).
             ENDWHILE.
    *Get the related entity
             IF lr_entity IS BOUND.
               lr_collection ?= lr_entity->get_related_entities( iv_relation_name = 'BTHeaderOrgmanSet' ) .
               IF lr_collection IS BOUND.
                 lr_orgset_m = lr_collection->get_current( ).
    *            lr_orgset = lr_orgset_m->get_related_entity( iv_relation_name = 'BTOrgSet' ).
                 lr_orgset = lr_orgset_m->get_property_as_string( 'SALES_ORG' ).
               ENDIF.
             ENDIF.
    Thanks,
    Sapsar.

  • Getting error while another component to the same project

    I am getting the following error while including another component (JSPDynPage) in the same project. Its scope is request. If there is some .jar file to export kindly tell its path also.
    Error:The project was not built since its classpath is incomplete. Cannot find the class file for javax.servlet.http.HttpServletRequest. Fix the classpath then try rebuilding this project.     TryProject

    Hello Shilpa,
    The required jar file is <b>servlet.jar</b>, this is present on your server under
    usrsap<ID><INST>j2eecluster<NODE> in/ext/servlet/servlet.jar
    So adding this to your classpath, should solve the problem.
    Check this to know, how to set classpath:
    Getting API:s for DevStudio
    Greetings,
    Praveen Gudapati
    p.s. Points are always welcome for helpful answers

  • Callinfg ALV from another component

    Hi all,
    We have a main component in which on press of a button we need to show alv which is in another component.
    I am trying to follow these steps but i need your inputs
    1. I have declared the component which calls alv in used components
    2. In the main view of my component i have placed a VCU
    3. In the window of the main component i have embedded that VCU and embedded the view of the component which calls the alv.
    Now how can i call alv on press of that button ?
    Please let me know your suggestions
    Regards
    Bhanu

    Hi,
    Aditya has the right idea in my opinion. I always do things this way (altering visibility) because 1. it's easiest and 2. you don't have initializing problems. Here's how you can do it:
    First of all, set your ViewContainer invisible in design time.
    1. Go to the Component controller of your main component (where your ViewContainer is in), go to attributes
    2. Add an attribute Z_GO_VIEW, Public, Type ref to, IF_WD_VIEW.
    3. Go to your View of the CC where the VC actually is in.
    4. Go to hook method WDDOMODIFYVIEW
    5. Add the following code:
    IF first_time = abap_true.
        wd_comp_controller->z_go_view = view.
    ENDIF.
    --> now you have the instance of your view interface.
    6. Make a button
    7. In the event handler method of the button, code something alike to this:
    DATA:
           lo_el_ui_root      TYPE REF TO cl_wd_uielement_container,
           lo_el_trans_cont1  TYPE REF TO cl_wd_uielement_container,
           lo_el_button1     TYPE REF TO cl_wd_button.
    DATA: lv_visibility TYPE WDUI_VISIBILITY.
    lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TC_ONE' ).
    lo_el_button1 ?= lo_el_trans_cont1->get_child( ID = 'I_AM_THE_MIGHTY_BUTTON' ).
    lv_visibility = '02'.
    lo_el_button1->set_visible( value = lv_visibility ).
    This isn't exactly what you'll need but you get the picture: Get the View Instance, Downcast the UI tree for the Element you want to dynamically alter, use the right method for alterations.
    This should solve your problem. If it doesn't, ask us again
    regards, Lukas

  • Read GUID of profile set in another component

    Hi,
    I am trying to read GUID of one component into another. Read it like this: This is marketing scenario where we create segments. Each segment has a GUID attached to it but component SEGED_SET which is meant for segments has no such attribute.
    How system is reading GUID for a segment:
      wa_object-object_id   = lo_entity->get_key( ).
      wa_object-object_name = lo_entity->get_name( ).
      CALL METHOD cl_crm_genil_container_tools=>get_key_from_object_id
        EXPORTING
          iv_object_name = wa_object-object_name
          iv_object_id   = wa_object-object_id
        IMPORTING
          es_key         = lv_guid.
    And it works.
    Now we have another component SEGED_NOTE which is used by SEGED_SET. I need to read GUID of segment in this component. I put following code:
      lo_entity ?= me->collection_wrapper->get_current( ).
      CHECK lo_entity IS BOUND.
      lo_parent ?= lo_entity->get_parent( ).
      CHECK lo_entity IS BOUND.
      wa_object-object_id   = lo_parent->get_key( ).
      wa_object-object_name = lo_parent->get_name( ).
      CALL METHOD cl_crm_genil_container_tools=>get_key_from_object_id
        EXPORTING
          iv_object_name = wa_object-object_name
          iv_object_id   = wa_object-object_id
        IMPORTING
          es_key         = lv_guid.
    But issue here is that lv_guid is not filled as this method reads data from buffer and currently buffer has data only for SEGED_NOTE and not for its parent entity. Please note that object name and object id were correctly retreived.
    Is there any other way to read this GUID?
    Regards,
    Shikha

    Hi Shikha,
    Declare an atrribute in Component Controller and use this to exchange the value from one component to another.
    Read the GUID in the GET Method of any displayed attribute using the +ifbol_property_access ( Class/ Interface ) using the GET_property Method.+_
    Regards,
    S John

  • Trying to use a popup window as a component  in another component

    Hi guys,
    I am unable to use a popup component in another component in
    Flex .
    Its not calling the popup compopnent.
    Could anyone plz hel me.
    This is my code.
    This is the parent component TitlWindow where i want to call
    my popup
    component.
    <mx:TitleWindow xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="100%" height="100%"
    xmlns:util="userinterfaces.util.*"
    creationComplete="showWindow();"
    title="CREATE PROFILE">
    This is my script where i am writing a function to call a
    component
    whose name is fielupload.mxml
    <mx:Script>
    private function showWindow():void
    pop =
    fileupload(PopUpManager.createPopUp(this,fileupload,true));//
    fileupload.mxml
    is called
    pop.title = "Please enter your login information.";
    pop.showCloseButton =true;
    PopUpManager.centerPopUp(pop);
    pop.addEventListener("close",removeMe);
    </mx:TitleWindow>
    This is the code for fileupload.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="100%" height="100%"
    xmlns:util="userinterfaces.util.*" title="File Upload">
    <mx:Script>
    <![CDATA[
    import mx.collections.XMLListCollection;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.ProgressEvent;
    import mx.controls.Alert;
    import flash.net.FileFilter;
    import flash.net.FileReference;
    import flash.events.SecurityErrorEvent;
    import mx.controls.Button;
    import mx.controls.TextInput;
    import mx.controls.ProgressBar;
    import mx.core.Application;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import mx.core.UIComponent;
    import mx.managers.PopUpManager;
    public var fileFilterImage:FileFilter = new
    FileFilter("Images","*.png;*.gif;*.jpg");
    public var fileFilterDocument:FileFilter = new
    FileFilter("Documents", "*.txt;*.doc;*.pdf;*.rtf");
    public var fileFilterArchives:FileFilter = new
    FileFilter("Archives", "*.zip;*.tar;*.hqx");
    public var fileFilterAll:FileFilter = new
    FileFilter("All", "*.*");
    public var fileRef:FileReference;
    public var selectedId:String;
    public function init():void {
    fileRef = new FileReference();
    fileRef.addEventListener(Event.CANCEL,
    traceEvent);
    fileRef.addEventListener(Event.COMPLETE,
    completeEvent);
    fileRef.addEventListener(Event.SELECT,
    selectEvent);
    fileRef.addEventListener(IOErrorEvent.IO_ERROR,
    traceEvent);
    fileRef.addEventListener(Event.OPEN, traceEvent);
    fileRef.addEventListener(ProgressEvent.PROGRESS,
    onFileProgress);
    fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    traceEvent);
    public function traceEvent(event:Event):void {
    var tmp:String =
    "================================\n";
    public function
    ioErrorEvent(event:IOErrorEvent):void{
    Alert.show("IOError:" + event.text);
    traceEvent(event);
    public function selectEvent(event:Event):void{
    //var selectedId:String =
    selectButton(event);
    //Alert.show("i am in id" +
    Application.application.winMyProfile.selectedId);
    btnUpload.enabled = true;
    iptFile.text = fileRef.name;
    public function
    selectButton(catchButton:Event):void{
    var newButton : Button = new Button;
    newButton = catchButton.currentTarget
    as Button
    selectedId = newButton.id;
    //Alert.show("i am in id" +
    selectedId);
    public function
    onFileProgress(event:ProgressEvent):void {
    prgBarUpload.label = "Loaded " +
    event.bytesLoaded + " of " +
    event.bytesTotal + " bytes";
    prgBarUpload.setProgress(event.bytesLoaded,
    event.bytesTotal);
    public function
    completeEvent(event:Event):void {
    Alert.show("File Uploaded
    Successfully");
    btnUpload.enabled = false;
    btnBrowse.enabled = true;
    public function uploadFile(url:String):void {
    url = url + "?
    folder="+Application.application.winLogin.userInfo.getUsername();
    var req:URLRequest = new
    URLRequest(url);
    req.method = URLRequestMethod.POST;
    var folder:String =
    Application.application.winLogin.userInfo.getUsername();
    fileRef.upload(req, folder,true);
    ]]>
    </mx:Script>
    <mx:VBox id="vbMain" width="100%" height="60">
    <mx:HBox width="100%" height="22">
    <mx:TextInput height="22" id="iptFile"
    width="100"/>
    <mx:Button id="btnBrowse" label="Browse"
    click="selectButton(event),fileRef.browse([fileFilterAll]);"
    />
    <mx:Button id="btnUpload" label="Upload"
    enabled="false"
    click="uploadFile('fileupload.do');" />
    <mx:Button id="btnCancel" label="Cancel"
    enabled="false"
    click="PopUpManager.removePopUp(this);"/>
    </mx:HBox>
    <mx:ProgressBar width="200"
    source="iptFileResume" height="5"
    id="prgBarUpload" mode="manual"/>
    </mx:VBox>
    </mx:TitleWindow>
    Its not even showing any error , i dont know whats the
    problem with
    it.
    Thanks for your help,
    Mario.

    If I understand, you want to display a popup Titlewindow from
    within another popup TitleWindow? This is possible.
    Simplify your code to get it working first.
    Tracy

  • How to create navigational links...and connect views of another component

    Hi...
    I am new to SAP CRM...
    I have a requirement where i need to navigate from the main window of a component to the view of a different component.
    Scenario:
    When i click on edit button after selecting a line item in the assignment block in the BT111H_OPPT/Details ,it should navigate to the details page of the line item which is the view of another component that has been created .say ZRP/PEL.
    How can i achieve this using the concept of inbound/outbound plugs and navigational links?
    I have got a vague idea on plugs from my search...that these are entry/exit points to views.
    But what is the procedure to follow to attain the functionality?
    How do we decide on which component needs which all plugs?
    Anyhelpful pointers would be rewarded.
    Also, an idea on what exactly does the inbound/outbound plugs do and how is the flow happening , how are navigational links working etc would be appreciated.
    Thanks..

    Steps to create navigational link:
    1.     Create an outbound plug in the component from where you want to navigate. Sometimes      
                    standard navigational links are already there.. you just need to identify it.
    2.     Create a Component usage in runtime repository for target component.
    3.     Add this component usage to the main window view in repository. 
    4.     Create navigation link between the transaction type and the target component view.
    5.     In the outbound plug, use the view manager to navigate to the target component. Ex: 
                    ME->FIRE_OUTBOUND_PLUG( IV_OUTBOUND_PLUG   = 'TO_OUTPLUG''
                              IV_DATA_COLLECTION = LR_COL ).
    6.     Pass the data through the data collection.

  • Problem in Navigation from one component to another component

    Hi,
    Here my requirement is:
    I have component - SRQM_INCIDENT_H/MainWindow. Now I have a buttopn in this window called "Create Task". When I clicke on this button, I need to navigate into another component carrying with some data. The other component is - BT125H_TASK/MainWindow.
    I have done the following steps:
    1. Added Task as component usage.
    2. Added Outbound plug in Service Request
    3. Now I am trying to create navigation link. Here, I am not able to see my component usage in Target views list.
    So, I am not able to create navigation link itself.
    Could you please help me out with some stepsfor this.
    Thanks,
    Sandeep

    1)Add the window to you component usage,the one whihc u want to navigate to .
    2) add this wuindow in the runtime repository to your main window.
    Only then u shud b able to c ur window in the "target" list for creating nav links.
    Suvidha

  • Error message: Acrobat 9 was installed as part of a suite. To enable Adobe Acrobat, please start another component of this suite (such as Adobe Photoshop).

    My harddrive crashed. New one installed. Restored data from Time Machine. When launching Acrobat 9 Pro, I get the following error message:
    "Acrobat was installed as part of a suite. To enable Adobe Acrobat, please start another component of this suite (such as Adobe Photoshop).
    I followed the prompt but still not launching. Any suggestions.
    Thanks.

    Hi baxterbabe,
    It is not recommended to use Time Machine to restore Adobe installations.
    As you can see that this has caused the corruption of the licensing file.
    Try launching Photoshop, go to 'Help' and select 'Deactivate' and then click 'Activate' from the same location.
    Now launch Acrobat and check if it works properly.
    You might also want to run the licensing repair tool from the link: Adobe - Adobe Licensing Repair Tool  and check if that works.
    If both these suggestions fail then you might want to uninstall the software completely and reinstall.
    Regards,
    Rave

  • Updating component within awt-event thread of another component

    Hi,
    I'm having trouble updating (repainting) a component inside the awt-event thread of another component. The component I want to update is a JFrame with a JLabel that lists the progress of the original component's action that triggered the event. I can get the frame to pop up but it's content is never fully painted and never refreshed.
    I've tried using invokeLater() (the frame ran after the original awt-event had finished) and invokeAndWait() (blocked the original awt-event) and running the computational intensive parts of the original component's action in SwingWorker threads (no difference) but all to no avail.
    What I want to do is similar to a progress bar so I think it should possible. Any suggestions? Thanks, Matt

    Are you calling yield() or sleep(...) on your Thread?

  • How to make a method global so that it can be used in another component.?

    Hi,
    Is it possible to make a method global so that it can be used in another component.?
    i.e I have one component C1 and methods declared in this component M1, M2, ...
    Now I have another component C2 and in this component i want to use method M1 of component C1.
    how to do so?
    Any inputs will be appreciated.
    Thanx.

    Hi,
    As Uday said, To make the method as global of component say C1, You have to make method as interface by clicking the check box.
    Now while using the method in other component say C2, you have to follow following steps:
    1. In used component of comp. C2, add component C1.
    2. Instantiate the component atleast once in any of the method of component using code wizard option:
    'Instantiate Used Componet'.
    3. Now you can call the method of component C1 using code wizard option 'Method call in used controller'

  • How to get a value of attribute/field From another Component/bol

    Hello
    I have to write some code in Component GS_CM/DocList.
    From 'GS_CM' I have to get a value of field attribute-STATUS_CURRENT
    From BT115QH_SLSQ/Details
    Context Node = BTSTATUSH
    Attributes = STATUS_CURRENT
    In order to check and enable some other functions.
    I know how to do it when I'm in the BT115QH_SLSQ/Details
    lr_status ?= typed_context->btstatush->collection_wrapper->get_current( ).
    lv_statush = lr_status->get_property_as_string( iv_attr_name = 'STATUS_CURRENT' ).
    But, in my Componenet GS_CM/DocList  the field  "BTSTATUSH->COLLECTION_WRAPPER->GET_CURRENT" is unknown. It is not contained in one of the specified tables nor is it defined .
    would be very grateful if you could help to solve this issue.
    Thanks In Advance
    Sima

    Hi Sima,
    then another short hint to the WD_USAGE_INITIALIZE.
    Go to the component workbench, open the component BT115QH_SLSQ. Go now to the component controller class, go to it's methods. You will see that in the coding of the Method WD_USAGE_INITIALIZE, on the class CL_BT115QH__BSPWDCOMPONEN_IMPL:
    WHEN 'CUGSCM' OR 'CUGSCM_DET'.
          CALL METHOD iv_usage->bind_context_node
            EXPORTING
              iv_controller_type  = cl_bsp_wd_controller=>co_type_custom
    "          iv_name             = 'ContentManagementCuCo'     "Custom Controller Name
              iv_name             = 'BT115QH_SLSQ/CUGSCMGenCuCo'     "Custom Controller Name
              iv_target_node_name = 'CMBO'      "Name of Node in this Custom Controller
              iv_node_2_bind      = 'CMBUSOBJ'. "Name of Node in used component GS_CM
          CALL METHOD iv_usage->bind_context_node
            EXPORTING
              iv_controller_type  = cl_bsp_wd_controller=>co_type_custom
              iv_name             = 'BT115QH_SLSQ/CUGSCMGenCuCo'"#EC NOTEXT
              iv_target_node_name = 'ATTRIBUTES'                "#EC NOTEXT
              iv_node_2_bind      = 'ATTRIBUTES'.               "#EC NOTEXT
    Now I checked the context on the component controller and it contains the statusH, the node which you want to use in the component GS_CM. So make sure to prepare the GS_CM component by adding the Status context, and afterwards just add the binding in the code I pointed out above.
    Best regards,
    Erika

  • HTML Viewer: Copying images+text to another component

    Hi folks,
    I'm working on a Java app for a research project where I'd like to be able to view a webpage in one panel (with some HTML viewer) and then be able to select pictures AND text from it (web browser-style), click a button, and have it copy the images and text (even the HTML code behind it would be sufficient) to some JTextArea or whatever.
    In other words, I'm trying to find an HTML viewer or browser which will be able to select both text and images and be able to copy the selection (as the real objects or even as HTML code, either way) so that it could be sent to some other component.
    I believe that JEditorPane supports viewing HTML, but you can only copy text from it. So, can anyone recommend an API class or even some 3rd party software (no funds since it's academic research, so free is preferable) that can do anything close to this? Alternatively, does anyone know of some other work around -- for example, selecting in IE or another browser, then dragging it onto some component into the Java app?
    Thanks a ton for any help!
    -Jon

    Try this..
    create a new flex project and add a folder called "src"
    create a new MXML component named "VideoComp.mxml" and copy/paste
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int = 300;
    [Bindable]
    public var videoHeight:int = 300;
    ]]>
    </mx:Script>
    <mx:Label text="Vidoe" />
    <mx:TextInput text="{videoWidth}" id="w" change="this.videoWidth = int(w.text);" />
    <mx:TextInput text="{videoHeight}" id="h" change="this.videoHeight = int(h.text);" />
    </mx:VBox>
    create a new MXML component named, "SharingComp.mxml" add copy/paste this..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int;
    [Bindable]
    public var videoHeight:int;
    ]]>
    </mx:Script>
    <mx:Label text="Sharing Comp." />
    <mx:Label text="{videoWidth}" />
    <mx:Label text="{videoHeight}" />
    </mx:VBox>
    and here is the main.mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:src="src.*">
        <mx:Script>
            <![CDATA[
                private function doSomething():void
                 sharingComp.videoHeight = videoComp.videoHeight;
                 sharingComp.videoWidth = videoComp.videoWidth;
            ]]>
        </mx:Script>
       <src:VideoComp id="videoComp" />
       <mx:Button click="doSomething()" label="copy" />
       <src:SharingComp id="sharingComp" />
    </mx:Application>
    Hope this helps,
    BaBo,

  • Simple Task - Syntax Question (how do you pass variables from one component to another component - databinding)?

    Hi all,
    I'm trying to pass some width/height/URLs from a Video Player component to a Social Bookmarking component's embed text input field. (for people to grab and share videos).
    I know this is a simple task, but it's the end of the day and I seem to be having a brain failure... What's the syntax to achieve this? Do I have to import the video player component? These widths/heights/URLs are all being dynamically generated from an XML... should I be pulling it from the XML or just reuse the variables that already exist in the Video Player component?
    Here's my code...
    Video Player:
    [Bindable]
    public var source:String = "";
    [Bindable]
    public var autoPlay:Boolean = false;
    [Bindable]
    public var fullScreenMode:Boolean = false;
    [Bindable]
    public var clipTag:String = "_movie";
    [Bindable]
    public var iag_code:String = "";
    [Bindable]
    public var officialURL:String = "http://www.movies.com/";
    [Bindable]
    public var referer:String = "unknown";
    [Bindable]
    public var gID:String;
    [Bindable]
    public var starterImageURL:String = 'http://www.movies.com/jazzmaster/images/default_starter_image.
    [Bindable]
    public var oldWidth:Number;
    [Bindable]
    public var oldHeight:Number;
    Sharing Component:
    <mx:HBox
      height="10%"
      horizontalCenter="-25"
      verticalCenter="0"
      paddingBottom="5">
      <mx:Text text="Embed Code:" paddingTop="1" color="#FFFFFF" fontSize="12"/>
      <mx:TextInput  text="{oldWidth}"/>
    </mx:HBox>
    The code above throws an error... "Attempted access of inaccessible property oldWidth through a reference with a static type com:SharingBookmarks."
    Thanks all!
    DK

    Try this..
    create a new flex project and add a folder called "src"
    create a new MXML component named "VideoComp.mxml" and copy/paste
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int = 300;
    [Bindable]
    public var videoHeight:int = 300;
    ]]>
    </mx:Script>
    <mx:Label text="Vidoe" />
    <mx:TextInput text="{videoWidth}" id="w" change="this.videoWidth = int(w.text);" />
    <mx:TextInput text="{videoHeight}" id="h" change="this.videoHeight = int(h.text);" />
    </mx:VBox>
    create a new MXML component named, "SharingComp.mxml" add copy/paste this..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int;
    [Bindable]
    public var videoHeight:int;
    ]]>
    </mx:Script>
    <mx:Label text="Sharing Comp." />
    <mx:Label text="{videoWidth}" />
    <mx:Label text="{videoHeight}" />
    </mx:VBox>
    and here is the main.mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:src="src.*">
        <mx:Script>
            <![CDATA[
                private function doSomething():void
                 sharingComp.videoHeight = videoComp.videoHeight;
                 sharingComp.videoWidth = videoComp.videoWidth;
            ]]>
        </mx:Script>
       <src:VideoComp id="videoComp" />
       <mx:Button click="doSomething()" label="copy" />
       <src:SharingComp id="sharingComp" />
    </mx:Application>
    Hope this helps,
    BaBo,

  • Having a JPanel 'float' semi-transparently over another component

    I am a programmer of a java project for our company.
    Managemnt decided that when a certain event happens, we need to 'semi-disable' a certain text area (in a JScrollPane), and have a floating message with a progress bar on top of this text area, but be semi-transparent, so you can still read the text under it.
    (Basically, they want it to look like a html page with a floating, semi-transparent DIV, because that is how another group mocked it up).
    I am trying to implement this, but am running into problems.
    Here is what I have, below I'll tell you what is wrong with it.
         * The purpose of this class is to have a scroll pane that can have it's contents partially covered by another panel
         * while still being able to read both the original panel and the new covering content, and still being able to scroll
         *the content under the covering panel.
        public class JOverlayScrollPane extends JScrollPane{
            private JPanel overlay = null;
            private Insets overlayInsets = null;
            private java.awt.AlphaComposite blend = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.50f);
            private ComponentAdapter cl = null;
            public void setOverlay(JPanel pan, Insets inset){
                overlay = pan;
                overlayInsets = inset;
                if(cl != null){
                    cl = new ComponentAdapter(){
                        public void componentResized(ComponentEvent e){
                            resizeOverlay();
                resizeOverlay();
                repaint();
            public void paint(Graphics g){
                super.paint(g);
                if(g instanceof Graphics2D && overlay !=null){
                    Graphics2D g2 = (Graphics2D)g;
    //                g2.setComposite(blend);
                    //overlay.paint(g2);
                    paintStuff(g,overlay);
            private void resizeOverlay(){
                if(overlay != null){
                    Dimension size = getSize();
                    int x = 0;
                    int y = 0;
                    if(overlayInsets !=null){
                        x = overlayInsets.left;
                        y = overlayInsets.top;
                        size.width = size.width - overlayInsets.left - overlayInsets.right;
                        size.height = size.height - overlayInsets.top - overlayInsets.bottom;
                    overlay.reshape(x,y, size.width, size.height);
                    overlay.doLayout();
                    overlay.validate();
            private void paintStuff(Graphics g,Component c){
                if(c != null){
                    c.paint(g);
                    if(c instanceof Container){
                        Container cont = (Container)c;
                        for(int i=0;i<cont.getComponentCount();i++){
                            Component cc = cont.getComponent(i);
                            paintStuff(g,cc);
        }//end of overlay scroll pane(I am having problems, so for now, the alpha blend is commented out).
    The first version didn't have the paintStuff() method (it just called paint). This just drew a big grey box, now of the sub-components of the passed in JPanel were drawing. I added the do layout and validate calls, without success.
    Then I added the paintStuff call, and all the subcomponents now, draw, but they all draw at 0,0.
    Questions
    1. Is the the correct approach to do this, or sould I be playing with the glass pane or some other approach?
    2. It seems that the overlay panel isn't being layed out / doens't paint it's children correctly. Is this because it isn't really part of the layout (i.e. it has no parent / is never added to a container) or am I just missing a step in 'faking' adding it to a layout?
    3. I'm sure I could just override paint and paint my own stuff (hand draw the text and a progress bar), but I would really like to put everything on one JPanel as what we want to display my be different in the future. I know that I manually ahve to call repaint on this scrollpane if one of the components on the overlay JPanel change in appearence (the progress bar especailly), and that they won't get events (I don't care about this as they are all non-interactive for now). Is this a viable approach, or is there a better way to do this?
    Thanks

    Wow, good answer.
    I never concidered using a root pane other than as it is used in JFrame.
    Very cool answer.
    Here is my origional code modifed with JN_'s idea, which cleaned up a repaint issue I was having.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TransparentPanel extends JFrame implements ActionListener
        ProgressPanel progressPanel;
        int progressCount;
        public TransparentPanel()
            super( "TransparentPanel Test");
            setDefaultCloseOperation( EXIT_ON_CLOSE );
            JPanel panel = new JPanel( new BorderLayout() );
            JTextArea area = new JTextArea( 20, 40 );
            JRootPane pane = new JRootPane();
            pane.setContentPane( new JScrollPane( area ) );
            panel.add( pane, BorderLayout.CENTER );
            //panel.add( new JScrollPane( area ), BorderLayout.CENTER );
            progressPanel = new ProgressPanel();
            pane.setGlassPane( progressPanel );
            JPanel buttonPanel = new JPanel( new FlowLayout());
            JButton button = new JButton( "Show" );
            button.setActionCommand("SHOW");
            button.addActionListener( this );
            buttonPanel.add( button );
            button = new JButton( "Hide" );
            button.setActionCommand("HIDE");
            button.addActionListener( this );
            buttonPanel.add( button );
            panel.add( buttonPanel, BorderLayout.SOUTH);
            setContentPane( panel );
            pack();
            setLocationRelativeTo( null );
            setVisible( true );
        public static void main( String[] args )
            try
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch( Exception e )
                e.printStackTrace();
            new TransparentPanel();
        public class ProgressPanel extends JPanel
            Color bg = new Color( 225, 221, 221, 100 );
            Color fg = new Color( 170, 234, 202, 100 );
            int progress;
                   setOpaque( false );
            public void setProgress( int n )
                 setVisible( n > 0 && n <= 100 );
                progress = n;
                repaint();
            public void paint( Graphics g )
                if( isVisible() )
                    Rectangle bounds = getBounds();
                    g.setColor( bg );
                    g.fillRect( bounds.x, bounds.y, bounds.width, bounds.height );
                    g.setColor(  fg );
                    int width = (int)(((double)progress/100)*bounds.width);
                    int height = (int) (((double)bounds.height)*.1);
                    int y = (int) (((double)bounds.height)*.4);
                    g.fillRect( bounds.x,y,width,height);
         * Invoked when an action occurs.
        public void actionPerformed(ActionEvent e)
            String cmd = e.getActionCommand();
            if(cmd.equals( "SHOW" ) )
                progressCount+= 10;
                if( progressCount > 100 )
                    progressCount = -1;
            else if( cmd.equals("HIDE" ) )
                progressCount = -1;
            progressPanel.setProgress( progressCount );
    }

Maybe you are looking for

  • Res. of photos in DVDSP

    I know that the photos you import to DVD SP should be 720x534 at 72dpi, but in Photoshop Elements, eveytime I try to get them to resize, I put in the 720, and the other demension autos to 485, it won't let me go to 720x534? Obviously am a little new

  • CS4 v10.0 Action Script window Text overlapped

    I just installed CS4 Production bundle, and have been entering in an Action Script to load a movie. When I type the word 'loadMovie', the automatic feature performs the word completion, but the cursor is not adjusted to the end of the text, and the r

  • Why this "!" char appears in my string?

    Hi, i've noticed a quite strange beahviour in my application. there's a form composing an email to send. in this form there's an hidden item called BODY and its source attribute is: You can access the document from the following link: <table bgcolor=

  • Misaligned camera fault??

    I noticed on my new Z2 that all the photos were slightly slanted.  This is esecially noticiable on landscape shots or when placing the phone on a flat suraface.       I updated the software but this did not fix it.    I sent it off for repair with Vo

  • Cannot connect to an encrypted Airport Extreme

    I bought an Airport Extreme router (big one) and an Airport base station (small; looks like a power adapter.) When i configured the base station for encryption under WEP it connected perfectly, when I placed these same settings to the Airport Extreme