Announcement

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

    getBackgroundColor () after setBackgroundColor (null) does not work

    Using:
    GWT 2.5.0
    SmartGWT 3.1p-2012-11-23
    SmartClient Version: v8.3p_2012-11-23/LGPL Development Only (built 2012-11-23)
    FF 19, IE 9, Chrome 26

    Problem:
    Call layout.setBackgroundColor ("red"); // turns background color to red as expected
    Call layout.getBackgroundColor (); // returns "red" as expected

    Call layout.setBackgroundColor (null); // turns background color to white as expected
    Call layout.getBackgroundColor (); // returns "red", but should return null

    In this sample, click Red then click Null, and I see:
    Code:
    00:02:24.207 [INFO] setBackgroundColor (). color: red, layoutBackgroundColorBefore: null, layoutBackgroundColorAfter: red
    00:02:27.072 [INFO] setBackgroundColor (). color: null, layoutBackgroundColorBefore: red, 
    layoutBackgroundColorAfter: red
    Sample code:
    Code:
    public class SetBackgroundColor implements EntryPoint {
    
      // my attributes
      private final VLayout layout = new VLayout ();
    
      /**
       * The EntryPoint interface
       * http://forums.smartclient.com/showthread.php?p=94385
       */
      public void onModuleLoad() {
    
        // add a button that makes the background red
        final IButton buttonRed = new IButton ();
        buttonRed.setTitle ("Red");
        buttonRed.addClickHandler (new ClickHandler () {
          public void onClick (final ClickEvent clickEvent) {
            setBackgroundColor ("red");
          }
        });
    
        // add a button that shows a dialog with a canvas with no opaticy set
        final IButton buttonNull = new IButton ();
        buttonNull.setTitle ("Null");
        buttonNull.addClickHandler (new ClickHandler () {
          public void onClick (final ClickEvent clickEvent) {
            setBackgroundColor (null);
          }
        });
    
        // add
        layout.addMember (buttonRed);
        layout.addMember (buttonNull);
        layout.draw ();
      }
    
      /**
       * Uniformly sets the background color and logs debug data
       * @param color
       */
      private void setBackgroundColor (final String color) {
    
        final String layoutBackgroundColorBefore = layout.getBackgroundColor ();
        layout.setBackgroundColor (color);
        final String layoutBackgroundColorAfter = layout.getBackgroundColor ();
        GWT.log (
          "setBackgroundColor (). color: " + color + ", " +
          "layoutBackgroundColorBefore: " + layoutBackgroundColorBefore + ", " +
          "layoutBackgroundColorAfter: " + layoutBackgroundColorAfter);
      }
    }

    #2
    Thanks for the report - we've fixed this for 3.1 and 4.0 - please retest with a nightly build dated May 19 or later

    Comment


      #3
      Just tested - seems fixed with this:
      SmartClient Version: v8.3p_2013-05-23/LGPL Development Only (built 2013-05-23)

      Now the output is as expected:
      Code:
      00:00:17.663 [INFO] setBackgroundColor (). color: red, layoutBackgroundColorBefore: null, layoutBackgroundColorAfter: red
      00:00:19.321 [INFO] setBackgroundColor (). color: null, layoutBackgroundColorBefore: red, layoutBackgroundColorAfter: null
      Thanks!

      Comment

      Working...
      X