@Test public void testLoadAnnotation( ) { listItem.loadAnnotation( annotation, annotationSource ); verify( view, times( 1 ) ).setHeadingTitle( ANNOTATION_CLASS_NAME ); verify( itemInstance, times( valuePairs.size( ) ) ).get( ); for ( int i = 0; i < valuePairItems.size( ); i++ ) { verify( valuePairItems.get( i ), times( 1 ) ).loadValuePair( annotation, valuePairs.get( i ), annotationSource ); verify( valuePairItems.get( i ), times( 1 ) ).setClearValuePairHandler( any( AdvancedAnnotationListEditorView.ClearValuePairHandler.class ) ); verify( valuePairItems.get( i ), times( 1 ) ).setEditValuePairHandler( any( AdvancedAnnotationListEditorView.EditValuePairHandler.class ) ); verify( view, times( 1 ) ).addItem( valuePairItems.get( i ) ); } }
public void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ) { this.annotation = annotation; view.setHeadingTitle( annotation.getClassName( ) ); if ( annotation.getAnnotationDefinition( ) != null && annotation.getAnnotationDefinition( ).getValuePairs( ) != null ) { for ( AnnotationValuePairDefinition valuePairDefinition : annotation.getAnnotationDefinition( ).getValuePairs( ) ) { AnnotationValuePairListItem valuePairListItem = createListItem(); valuePairListItem.loadValuePair( annotation, valuePairDefinition, annotationSource ); valuePairListItem.setClearValuePairHandler( new AdvancedAnnotationListEditorView.ClearValuePairHandler( ) { @Override public void onClearValuePair( Annotation annotation, String valuePair ) { if ( clearValuePairHandler != null ) { clearValuePairHandler.onClearValuePair( annotation, valuePair ); } } } ); valuePairListItem.setEditValuePairHandler( new AdvancedAnnotationListEditorView.EditValuePairHandler( ) { @Override public void onEditValuePair( Annotation annotation, String valuePair ) { if ( editValuePairHandler != null ) { editValuePairHandler.onEditValuePair( annotation, valuePair ); } } } ); view.addItem( valuePairListItem ); items.add( valuePairListItem ); } } }
AnnotationListItem implements AnnotationListItemView.Presenter, IsWidget { public void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ) { this.annotation = annotation; view.setHeadingTitle( annotation.getClassName( ) ); if ( annotation.getAnnotationDefinition( ) != null && annotation.getAnnotationDefinition( ).getValuePairs( ) != null ) { for ( AnnotationValuePairDefinition valuePairDefinition : annotation.getAnnotationDefinition( ).getValuePairs( ) ) { AnnotationValuePairListItem valuePairListItem = createListItem(); valuePairListItem.loadValuePair( annotation, valuePairDefinition, annotationSource ); valuePairListItem.setClearValuePairHandler( new AdvancedAnnotationListEditorView.ClearValuePairHandler( ) { @Override public void onClearValuePair( Annotation annotation, String valuePair ) { if ( clearValuePairHandler != null ) { clearValuePairHandler.onClearValuePair( annotation, valuePair ); } } } ); valuePairListItem.setEditValuePairHandler( new AdvancedAnnotationListEditorView.EditValuePairHandler( ) { @Override public void onEditValuePair( Annotation annotation, String valuePair ) { if ( editValuePairHandler != null ) { editValuePairHandler.onEditValuePair( annotation, valuePair ); } } } ); view.addItem( valuePairListItem ); items.add( valuePairListItem ); } } } }
AnnotationListItem implements AnnotationListItemView.Presenter, IsWidget { public void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ) { this.annotation = annotation; view.setHeadingTitle( annotation.getClassName( ) ); if ( annotation.getAnnotationDefinition( ) != null && annotation.getAnnotationDefinition( ).getValuePairs( ) != null ) { for ( AnnotationValuePairDefinition valuePairDefinition : annotation.getAnnotationDefinition( ).getValuePairs( ) ) { AnnotationValuePairListItem valuePairListItem = createListItem(); valuePairListItem.loadValuePair( annotation, valuePairDefinition, annotationSource ); valuePairListItem.setClearValuePairHandler( new AdvancedAnnotationListEditorView.ClearValuePairHandler( ) { @Override public void onClearValuePair( Annotation annotation, String valuePair ) { if ( clearValuePairHandler != null ) { clearValuePairHandler.onClearValuePair( annotation, valuePair ); } } } ); valuePairListItem.setEditValuePairHandler( new AdvancedAnnotationListEditorView.EditValuePairHandler( ) { @Override public void onEditValuePair( Annotation annotation, String valuePair ) { if ( editValuePairHandler != null ) { editValuePairHandler.onEditValuePair( annotation, valuePair ); } } } ); view.addItem( valuePairListItem ); items.add( valuePairListItem ); } } } AnnotationListItem( ); @Inject  AnnotationListItem( AnnotationListItemView view, Instance<AnnotationValuePairListItem> itemInstance ); }
AnnotationListItem implements AnnotationListItemView.Presenter, IsWidget { public void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ) { this.annotation = annotation; view.setHeadingTitle( annotation.getClassName( ) ); if ( annotation.getAnnotationDefinition( ) != null && annotation.getAnnotationDefinition( ).getValuePairs( ) != null ) { for ( AnnotationValuePairDefinition valuePairDefinition : annotation.getAnnotationDefinition( ).getValuePairs( ) ) { AnnotationValuePairListItem valuePairListItem = createListItem(); valuePairListItem.loadValuePair( annotation, valuePairDefinition, annotationSource ); valuePairListItem.setClearValuePairHandler( new AdvancedAnnotationListEditorView.ClearValuePairHandler( ) { @Override public void onClearValuePair( Annotation annotation, String valuePair ) { if ( clearValuePairHandler != null ) { clearValuePairHandler.onClearValuePair( annotation, valuePair ); } } } ); valuePairListItem.setEditValuePairHandler( new AdvancedAnnotationListEditorView.EditValuePairHandler( ) { @Override public void onEditValuePair( Annotation annotation, String valuePair ) { if ( editValuePairHandler != null ) { editValuePairHandler.onEditValuePair( annotation, valuePair ); } } } ); view.addItem( valuePairListItem ); items.add( valuePairListItem ); } } } AnnotationListItem( ); @Inject  AnnotationListItem( AnnotationListItemView view, Instance<AnnotationValuePairListItem> itemInstance ); @Override Widget asWidget( ); void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ); void setDeleteAnnotationHandler( AdvancedAnnotationListEditorView.DeleteAnnotationHandler deleteAnnotationHandler ); void setClearValuePairHandler( AdvancedAnnotationListEditorView.ClearValuePairHandler clearValuePairHandler ); void setEditValuePairHandler( AdvancedAnnotationListEditorView.EditValuePairHandler editValuePairHandler ); void setCollapseChangeHandler( AdvancedAnnotationListEditorView.CollapseChangeHandler collapseChangeHandler ); boolean isCollapsed( ); void setCollapsed( boolean collapsed ); void setReadonly( boolean readonly ); @Override void onDelete( ); @Override void onCollapseChange( ); }
AnnotationListItem implements AnnotationListItemView.Presenter, IsWidget { public void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ) { this.annotation = annotation; view.setHeadingTitle( annotation.getClassName( ) ); if ( annotation.getAnnotationDefinition( ) != null && annotation.getAnnotationDefinition( ).getValuePairs( ) != null ) { for ( AnnotationValuePairDefinition valuePairDefinition : annotation.getAnnotationDefinition( ).getValuePairs( ) ) { AnnotationValuePairListItem valuePairListItem = createListItem(); valuePairListItem.loadValuePair( annotation, valuePairDefinition, annotationSource ); valuePairListItem.setClearValuePairHandler( new AdvancedAnnotationListEditorView.ClearValuePairHandler( ) { @Override public void onClearValuePair( Annotation annotation, String valuePair ) { if ( clearValuePairHandler != null ) { clearValuePairHandler.onClearValuePair( annotation, valuePair ); } } } ); valuePairListItem.setEditValuePairHandler( new AdvancedAnnotationListEditorView.EditValuePairHandler( ) { @Override public void onEditValuePair( Annotation annotation, String valuePair ) { if ( editValuePairHandler != null ) { editValuePairHandler.onEditValuePair( annotation, valuePair ); } } } ); view.addItem( valuePairListItem ); items.add( valuePairListItem ); } } } AnnotationListItem( ); @Inject  AnnotationListItem( AnnotationListItemView view, Instance<AnnotationValuePairListItem> itemInstance ); @Override Widget asWidget( ); void loadAnnotation( Annotation annotation, AnnotationSource annotationSource ); void setDeleteAnnotationHandler( AdvancedAnnotationListEditorView.DeleteAnnotationHandler deleteAnnotationHandler ); void setClearValuePairHandler( AdvancedAnnotationListEditorView.ClearValuePairHandler clearValuePairHandler ); void setEditValuePairHandler( AdvancedAnnotationListEditorView.EditValuePairHandler editValuePairHandler ); void setCollapseChangeHandler( AdvancedAnnotationListEditorView.CollapseChangeHandler collapseChangeHandler ); boolean isCollapsed( ); void setCollapsed( boolean collapsed ); void setReadonly( boolean readonly ); @Override void onDelete( ); @Override void onCollapseChange( );  }