title: Cannot discard changes made in fields in TableFieldFactory
body: <p>I have a simple Table where I present some data using an IndexedContainer as data source.
  I want my users to be able to edit some of this data, so I'm using a TableFieldFactory (DefaultFieldFactory) to generate these columns (properties) editable.</p>
  
  <p>Now, if a user is in editing mode (table.setEditable(true)) and have been changing some fields, he or she should be able to discard those changes - for this purpose, I have a "Cancel" button. This "Cancel" button is supposed to discard all changes made in the Table generated fields since the user entered editing mode and then setEditable(false) - now everything should be the way it was before setEditable(true) was called.</p>
  
  <p>This didn't sound very hard, until I tried implementing it.</p>
  
  <p>If I understand the functionality of the Table vs. Container vs. TableFieldFactory correctly, the following happens:</p>
  
  <ol>
  <li>Properties are added to the Container</li>
  <li>The Container is set as the Table data source</li>
  <li>The User clicks the "Edit Table" button (table.setEditable(true))</li>
  <li>The Table calls the TableFieldFactory's overridden createField() method</li>
  <li>The createField() method creates the editable fields</li>
  <li>The user edits the fields and at the same time the Container gets updated &lt;-- not 100% sure about this one</li>
  <li>The user clicks the "Cancel" button &lt;-- HERE is my problem</li>
  </ol>
  
  <p><strong>Question: When I press the "Cancel" button, what should I do discard() on?</strong> I can't do table.discard(), because the changes has already taken place. I can't do container.discard() becase, yeah, the Container interface doesn't inherit that method. I can't do field.discard(), because I cannot reach the fields from outside the createField() method. </p>
  
  <p>I have tried different variations of setBuffered, markAsDirty, refreshRowCache and setImmediate without success.</p>
  
  <p>Here's (hopefully all) relevant code:</p>
  
  <p><em>The table, container and the "Cancel" button (roughly):</em></p>
  
  <pre><code>table.setContainerDataSource(container);
  
  Button cancel = new Button("Cancel", new Button.ClickListener() {
      private static final long serialVersionUID = 1L;
  
      @Override
      public void buttonClick(ClickEvent event) {
          // table.setImmediate(false); //tried variations of this
          // table.refreshRowCache(); //tried variations of this
          // table.markAsDirty(); //tried variations of this
          // table.setBuffered(true); //tried variations of this
          // table.discard(); //tried this, but here it's too late
          table.setEditable(false);
      }
  });
  </code></pre>
  
  <p><em>The TableFieldFactory:</em></p>
  
  <pre><code>table.setTableFieldFactory(new DefaultFieldFactory() {
      private static final long serialVersionUID = 1L;
  
      @Override
      public Field&lt;?&gt; createField(Container container, Object itemId, Object propertyId, com.vaadin.ui.Component uiContext) {
  
          TextField tField = (TextField) DefaultFieldFactory.get().createField(container, itemId, propertyId, uiContext);
          tField.setImmediate(true);
  
          if (propertyId.equals("Foo")) {
              // field.setImmediate(true); //tried variations of this
              // field.setBuffered(false); //tried variations of this
              return tField;
          }
          else {
              tField.setReadOnly(true);
          }
          return tField;
      }
  });
  </code></pre>