Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default [FNR] Grid.setEnabled(false)

    [FNR] Grid.setEnabled(false)


    Just found a bug while trying to disable a grid. Here a simple example:

    Code:
    private static final StockProperties props = GWT.create(StockProperties.class);
    
        public void onModuleLoad()
        {
            ColumnConfig<Stock, String> nameCol =
                    new ColumnConfig<Stock, String>(props.name(), 200, "Name");
    
            ListStore<Stock> store = new ListStore<Stock>(props.key());
            store.add(new Stock("myKey", "myName"));
    
            ContentPanel cp = new ContentPanel();
            cp.setPixelSize(600, 300);
    
            List<ColumnConfig<Stock, ?>> l = new ArrayList<ColumnConfig<Stock, ?>>();
            l.add(nameCol);
            ColumnModel<Stock> cm = new ColumnModel<Stock>(l);
    
            final Grid<Stock> grid = new Grid<Stock>(store, cm);
            grid.getView().setAutoExpandColumn(nameCol);
            grid.setBorders(false);
            grid.setStripeRows(true);
            grid.setColumnLines(true);
    
            VerticalLayoutContainer con = new VerticalLayoutContainer();
            cp.setWidget(con);
    
            con.add(grid, new VerticalLayoutData(1, 1));
    
            grid.setEnabled(false); // NULLPOINTEREXCEPTION
            RootLayoutPanel.get().add(cp);
        }
    
        interface StockProperties extends PropertyAccess<Stock>
        {
            ModelKeyProvider<Stock> key();
            ValueProvider<Stock, String> name();
        }
    
        class Stock
        {
            public Stock(String key, String name)
            {
                this.key = key;
                this.name = name;
            }
    
            String key = "";
            String name = "";
    
            public String getKey()
            {
                return key;
            }
    
            public void setKey(String key)
            {
                this.key = key;
            }
    
            public String getName()
            {
                return name;
            }
    
            public void setName(String name)
            {
                this.name = name;
            }
        }
    And the error message (my package = nope.client):
    java.lang.NullPointerException: null
    at com.google.gwt.user.client.ui.UIObject.setStyleName(UIObject.java:296)
    at com.google.gwt.user.client.ui.UIObject.setStyleName(UIObject.java:688)
    at com.google.gwt.user.client.ui.UIObject.addStyleName(UIObject.java:469)
    at com.sencha.gxt.widget.core.client.Component.onDisable(Component.java:1298)
    at com.sencha.gxt.widget.core.client.grid.Grid.onDisable(Grid.java:842)
    at com.sencha.gxt.widget.core.client.Component.disable(Component.java:259)
    at com.sencha.gxt.widget.core.client.Component.setEnabled(Component.java:699)
    at nope.client.GXT_3_0.onModuleLoad(GXT_3_0.java:54)

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Fixed in SVN

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default


    The exception is gone, but the grid doesn't (always) get disabled. In my main application, the default "gray disabled" style is applied only sometimes. I couldn't find the exact test case when it works, so here a code where it doesn't work. It seems, like the "enabled" variable gets updated (since grid.isEnabled() returns false), but the style doesn't get changed and I can still select and change everything (cell and header):

    Code:
      public void onModuleLoad()
        {
            ColumnConfig<Stock, String> nameCol = new ColumnConfig<Stock, String>(props.name(), 200, "Name");
    
            ListStore<Stock> store = new ListStore<Stock>(props.key());
            store.add(new Stock("myKey", "myName", 1));
    
            ContentPanel cp = new ContentPanel();
            cp.setPixelSize(600, 300);
    
            List<ColumnConfig<Stock, ?>> l = new ArrayList<ColumnConfig<Stock, ?>>();
            l.add(nameCol);
            ColumnModel<Stock> cm = new ColumnModel<Stock>(l);
    
            final Grid<Stock> grid = new Grid<Stock>(store, cm);
            grid.getView().setAutoExpandColumn(nameCol);
            grid.setBorders(false);
            grid.setStripeRows(true);
            grid.setColumnLines(true);
    
            GridInlineEditing<Stock> editing = new GridInlineEditing<Stock>(grid);
            editing.addEditor(nameCol, new TextField());
    
            VerticalLayoutContainer con = new VerticalLayoutContainer();
            cp.setWidget(con);
    
            TextButton button = new TextButton("disable");
            button.addSelectHandler(new SelectHandler()
            {
    
                @Override
                public void onSelect(SelectEvent event)
                {
                    grid.setEnabled(false); // does nothing!
                    System.out.println(grid.isEnabled()); // = "false"
                }
            });
    
            con.add(grid, new VerticalLayoutData(1, 0.9));
            con.add(button, new VerticalLayoutData(1, 0.1));
    
            grid.setEnabled(false); // does nothing!
            System.out.println(grid.isEnabled()); // = "false"
            RootLayoutPanel.get().add(cp);
        }
    (utility classes are the same as in my first post)

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar