Skip to Content
avatar image
Former Member

Labels in Web Dynpro's

Has anybody had any trouble getting labels to display in a view at runtime - I have concluded that this is perhaps a bug, but would like to confirm. I have checked and rechecked the properties of labels with no luck.

Secondly, I am having a little trouble getting my mind round the API. How would one get a handle on a label or input at runtime to set it's properties?

Many thanks,

Rowan

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 12, 2004 at 12:10 PM

    Hi Rowan,

    The label can be used like all other UI elements. The ID of the UI element gives you a handle. By using a Cast on the right type you can access and set all properties of this UI element.

    Maybe the abstract of the documentation is helpful as well:

    Dynamic Modification of a View

    Web Dynpro provides the wdDoModifyView Hook method in the controller implementation of the view. The Hook method enables you to overwrite source code at runtime. It allows the application programmer to insert source code, which is used for customizing a Web application, for example. The wdDoModifyView method is called for every view before it is displayed on the screen. All modifications of UI elements that cannot be made using declarative data binding at design time are covered by the Hook method. For example, the Hook method is used if a UI element is to be rendered only at runtime.

    /**

    • Hook method called to modify view before rendering. Access to UI elements

    • is via the given view API only!

    */

    public void wdDoModifyView(IWDView view)

    {

    //@@begin wdDoModifyView

    //@@end

    }

    Note that the implementation of the wdDoModifyView method must always be defined between the comment lines //@@begin and //@@end, which is the user coding area. Otherwise, a runtime error occurs.

    The interfaces IWDView and IWDViewElement provide the methods required for modifying the UI elements.

    · IWDView provides a method for rendering the new UI elements:

    IWDButton submitButton = (IWDButton) view.createElement(IWDButton.class, ?submitButton?);

    · IWDView provides a method for accessing existing UI elements using the ID:

    IWDButton submitButton = (IWDButton) view.getElement(?submitButton?);

    By default, a view contains a TransparentContainer UI element, whose ID is RootUIElementContainer. This element is the top UI element in the hierarchy of the UI elements of a view. This condition cannot be changed, modifications can only be defined for the UI element children of this container.

    Note that exactly one view is assigned to a UI element. Therefore, it is not possible to separate UI elements from multiple views or transfer them from one view to another.

    Add comment
    10|10000 characters needed characters exceeded