protected void internalEditItem(final M m) { this.model = m; if (m != null) { driver.edit(m); } }
protected void rejectAction() { if (model != null) { driver.edit(model); } bus.fire(config.getCrudEventType().createUpdateCompleteEvent(model)); }
@Test public void testEdit() { List<DataColumnDef> columnDefs = mock( List.class ); presenter.edit( dataSetDef, columnDefs ); assertEquals( editor, presenter.getEditor() ); verify( driver, times( 1 ) ).initialize( editor ); verify( editor, times( 1 ) ).setAcceptableValues( columnDefs ); verify( driver, times( 1 ) ).edit( dataSetDef ); verify( view, times( 2 ) ).clearView(); verify( view, times( 1 ) ).add( any( IsWidget.class ) ); verify( view, times( 0 ) ).init( presenter ); verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) ); verify( view, times( 0 ) ).clearButtons(); }
public DataSetEditWorkflow edit( final T definition, List<DataColumnDef> allColumns ) { clear(); this.dataSetDef = definition; checkDataSetDefNotNull(); this.driver = beanManager.lookupBean( getDriverClass() ).newInstance(); this.editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize( editor ); editor.setAcceptableValues( allColumns ); driver.edit( definition ); this.flushCommand = () -> flush(DataSetEditWorkflow.this.driver); this.stepValidator = () -> { final boolean isCacheEnabled = definition.isCacheEnabled(); final boolean isPushEnabled = definition.isPushEnabled(); final boolean isRefreshEnabled = definition.getRefreshTime() != null; Iterable<ConstraintViolation<?>> violations = validate( isCacheEnabled, isPushEnabled, isRefreshEnabled ); driver.setConstraintViolations( violations ); addViolations( violations ); }; // Show data set editor view. view.clearView(); view.add( getWidget() ); return this; }
editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize(editor); driver.edit(getDataSetDef());
public DataSetEditWorkflow edit( final T definition, List<DataColumnDef> allColumns ) { clear(); this.dataSetDef = definition; checkDataSetDefNotNull(); this.driver = beanManager.lookupBean( getDriverClass() ).newInstance(); this.editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize( editor ); editor.setAcceptableValues( allColumns ); driver.edit( definition ); this.flushCommand = () -> flush(DataSetEditWorkflow.this.driver); this.stepValidator = () -> { final boolean isCacheEnabled = definition.isCacheEnabled(); final boolean isPushEnabled = definition.isPushEnabled(); final boolean isRefreshEnabled = definition.getRefreshTime() != null; Iterable<ConstraintViolation<?>> violations = validate( isCacheEnabled, isPushEnabled, isRefreshEnabled ); driver.setConstraintViolations( violations ); addViolations( violations ); }; // Show data set editor view. view.clearView(); view.add( getWidget() ); return this; }
editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize(editor); driver.edit(getDataSetDef());