Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Want to access constant values from properties file

    Hi Admin,

    I want to access the constant values from properties file. My purpose to avoid hard coded values like height, width, name etc
    Got to use properties file only because i don't want to recompile over change in the constant value.
    I do not mean Internationalization by this.

    For Example:
    =============
    dynamicForm.setCellBorder(2);
    dynamicForm.setWidth(300);
    dynamicForm.setHeight(300);

    I want some thing like:
    ======================
    dynamicForm.setCellBorder(BORDER);
    dynamicForm.setWidth(FORM.WIDTH);
    dynamicForm.setHeight(FORM.HEIGHT);


    Thanks in Advance
    Last edited by Pushpa; 16 May 2012, 08:18.

    #2
    Note: We are assuming we're talking about SmartGWT here, not SmartClient.

    This would seem to be a general GWT question rather than a SmartGWT question per se - however, presumably you can use the standard GWT i18n interfaces to read constants from a .properties file for this usage:
    http://google-web-toolkit.googlecode...Constants.html.

    Alternatively you could avoid using a .properties file entirely by writing a small .js file containing your constants written into the page's global scope, load this into your bootstrap, and then having a small JSNI function to read these values and make them available to your Java code. Then you'd only need to modify the .js file to pick up the changes - no need for recompiling your GWT source and redeploying.

    Comment


      #3
      Originally posted by Isomorphic
      Note: We are assuming we're talking about SmartGWT here, not SmartClient.

      This would seem to be a general GWT question rather than a SmartGWT question per se - however, presumably you can use the standard GWT i18n interfaces to read constants from a .properties file for this usage:
      http://google-web-toolkit.googlecode...Constants.html.

      Alternatively you could avoid using a .properties file entirely by writing a small .js file containing your constants written into the page's global scope, load this into your bootstrap, and then having a small JSNI function to read these values and make them available to your Java code. Then you'd only need to modify the .js file to pick up the changes - no need for recompiling your GWT source and redeploying.

      Thanks a lot, the top fix works...:)

      Comment

      Working...
      X