EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  changing the css file dynamically in RUI handler

    Posted Thu September 22, 2011 05:43 PM
    Is it possible to change the cssfile in the RUI handler dynamically.

    for example , handler Test type RUIhandler{initialUI =[UI
    ], onConstructionFunction = start, cssFile = abc + "/css/test.css"}*

    where abc is configurable and will come as a input from session variable or some variable which has a value at application level.

    The problem is the cssfile expects a double quoted string and it doesnt accept a concatenated string .

    Similarly,
    library PropertiesLibrary type RUIPropertiesLibrary {
    propertiesFile= abc + "/resources"
    SystemAdmin


  • 2.  Re: changing the css file dynamically in RUI handler

    Posted Sun September 25, 2011 10:29 PM
    In RBD 8012, I believe the Dojo Sample contains an example of what you are looking for. To get the sample:

    Locate the sample in the help system using Help->Welcome->Samples->EGL Rich UI Dojo Widgets

    Import (in the following order):
    • Dojo Widgets
    • Rich UI Widgets
    • Local Dojo Toolkit
    • Sample

    Expand /com.ibm.egl.rui.dojo.samples_2.0.0/EGLSource/dojo.samples/

    Right click on Gallery.egl and select Open With -> EGL Rich UI Editor. When the editor opens, select the Preview tab. At the top of the page there is an option to select which theme is used to render the application.

    The theme is controlled by the ThemeLib library, which is backed by the DojoTheme external type. In the JavaScript code for the DojoTheme external type, which you can find in the WebContent folder of the sample, there is one function for dynamically loading CSS files at runtime (changeCSS), and there is another function for changing the class tag on the body of the document (setTheme).

    -Brian
    bsvihovec


  • 3.  Re: changing the css file dynamically in RUI handler

    Posted Mon September 26, 2011 04:15 PM
    Thanks for the solution. It works for the themes/css. But the problem comes when i try to load the RUIPropertieLibrary dynamically. The requirement is to load the labels,error messages depending on the user. There has to be multiple versions of the resource_en_us.properties which will be user specific.
    and to load every file in every RUI handler is not a good solution it seems.
    Is it possible to include the resources file in the generated html at runtime as per need instead of loading all the versions of resources files .
    SystemAdmin


  • 4.  Re: changing the css file dynamically in RUI handler

    Posted Thu September 29, 2011 05:10 PM
    I'm not sure if I have the answer to your question, but I wanted to provide some comments that might be relevant:

    1) You cannot change the content of a RUIPropertiesLibrary dynamically once the application content has been rendered. When a String is requested from a RUIPropertiesLibrary at run time, the value is accessed from the library and placed in the DOM Tree. Loading new content for a properties library will not result in the DOM Tree being updated for elements that have already been rendered. (I don't think this is what you are trying to do, but I wanted to make sure you were aware of this detail).

    2) The file containing the content for a RUIPropertiesLibrary is converted from a .properties file to a .js file during deployment, and the .js file is specified as a link in the HTML file. The .js file contains a 'map' that is placed into memory as soon as the .js file is loaded by the browser.

    As long as you loaded the content of the RUIPropertiesLibrary before the application content was rendered, I don't see why you couldn't replace a 'default' version that is linked in the HTML file with another one that is loaded dynamically. I believe this would require a separate RUIPropertiesLibrary, which is used only after you determine which user is working with the application.

    -Brian
    bsvihovec


  • 5.  Re: changing the css file dynamically in RUI handler

    Posted Wed January 18, 2017 02:16 AM

    Hi @SystemAdmin 3B5G092D666D698A8F5757DD0C7AC4000027​ @bsvihorec @Marcel-D 185ef4e2-58bb-459d-b414-d02f00ff390dCancelled mention of SystemAdmin, @bsvihorec @markevans 5c01ba43-4f0f-42d9-8c50-ff9ba92b68b7​, can I know if and how you solved the dynamic loading of the CSS file and the properties for RUI handlers?

    Matteo@MR


  • 6.  Re: changing the css file dynamically in RUI handler

    Posted Wed January 18, 2017 02:55 AM

    Hi,

    I don't think there is a built in function to change the css.

    In the Dojo widget samples there is only a function to change the dojo theme (claro,nihilo,tundra and soria).

     

    But I think you can change the css with external javascript.

    The function I mentioned above to change the dojo theme uses also external javascript.

     

    I dindn't tried it but maybe this could be usefull:

    http://stackoverflow.com/questions/574944/how-to-load-up-css-files-using-javascript

     

    If not you could also take a look at the Dojo set theme function:

     

     

    Kind Regards!

    Marcel-D