Results 1 to 2 of 2

Thread: @eval and ensureInjected with Themebuilder

  1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default @eval and ensureInjected with Themebuilder

    I'd like to set dynamic values in my theme, for example a backgroundcolor depending on a logged-in user preference. Is it possible to use at runtime:
    Code:
    @eval userBackground com.module.UserPreferences.getUserBackground();
    and then
    Code:
    CssResource.ensureInjected()
    with the new themebuilder?

  2. #2
    Sencha - GXT Dev Team jhickman's Avatar
    Join Date
    Feb 2011
    Location
    Missouri
    Posts
    24
    Vote Rating
    3
      0  

    Default

    Currently, the theme builder doesn't support custom background images other than gradients set in the configuration file. Recent work has been done on being able to provide a mechanism for custom icons.


    If the background image is a "one off," where it's only used for a panel or two, then you may want to consider just using a CSS style when constructing the widget
    Code:
    widget.getElement().getStyle().setBackground(someBackground);
    If all instances of a single widget need a background image, then I can think of a couple of methods that could be considered.
    • Subclass the generated Appearance, add the background image, create a <replace-with> to override the Appearance to use new sub class.
    • When generating the theme, use the -gen flag to generate the code to a specified directory and update the code directly before jarring up.
    I just tried another option, which is fairly straight forward. By creating a CustomStyle CssResource, you can import the appearance style interface and modify. For example:



    Code:
      public interface CustomResources extends ClientBundle {
        @Import(Css3FramedPanelStyle.class)
        @Source("custom.css")
        CustomStyles style();
      }
    
    
      public interface CustomStyles extends CssResource {
    
    
      }
    Then, in your "custom.css" file, you can change the background (I used a color in this case):

    Code:
    .Css3FramedPanelStyle-body {
      background-color: green !important;
    }
    You can then add any custom backgrounds you want.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •