@Override public void reset(OCRResultPanel component) { component.reset(); }
@Override protected Pair<JComponent, ComponentHandler<?>> handle0( Field field, Object instance, final FieldUpdateListener updateListener, JPAReflectionFormBuilder reflectionFormBuilder) throws IllegalArgumentException, IllegalAccessException, FieldHandlingException, InvocationTargetException, NoSuchMethodException, InstantiationException { if (field == null) { throw new IllegalArgumentException("field mustn't be null"); } if (field.getAnnotation(OCRResult.class) != null) { String fieldValue = (String) field.get(instance); OCRResultPanel retValue = new OCRResultPanel(oCRResultPanelFetcher, fieldValue, getMessageHandler()); retValue.addUpdateListener( new OCRResultPanelUpdateListener() { @Override public void onUpdate(OCRResultPanelUpdateEvent event) { updateListener.onUpdate(new FieldUpdateEvent<>(event.getNewValue())); } }); if (this.documentScannerConf.isAutoSaveOCRData() && fieldValue == null) { // if fieldValue != null there's no need to start OCR (i.e. if // an invalid value has been persisted it's up to the user to // (re)start OCR manually retValue.startOCR(); } return new ImmutablePair<JComponent, ComponentHandler<?>>( retValue, OCR_RESULT_PANEL_COMPONENT_RESETTABLE); } if (field.getAnnotation(ScanResult.class) != null) { byte[] fieldValue = (byte[]) field.get(instance); ScanResultPanel retValue = new ScanResultPanel(scanResultPanelFetcher, fieldValue); retValue.addUpdateListerner( new ScanResultPanelUpdateListener() { @Override public void onUpdate(ScanResultPanelUpdateEvent event) { updateListener.onUpdate(new FieldUpdateEvent<>(event.getNewValue())); } }); if (documentScannerConf.isAutoSaveImageData() && fieldValue == null) { // if fieldValue != null there's no need to save the image data retValue.save( true // async ); } return new ImmutablePair<JComponent, ComponentHandler<?>>( retValue, SCAN_RESULT_PANEL_COMPONENT_RESETTABLE); } if (field.getAnnotation(CommunicationTree.class) != null) { List<WorkflowItem> fieldValue = (List<WorkflowItem>) field.get(instance); WorkflowItemTreePanel retValue = new WorkflowItemTreePanel( storage, fieldValue, getMessageHandler(), confirmMessageHandler, reflectionFormBuilder, entityClasses, primaryClassSelection, mainPanel, getIdApplier(), warningHandlers, fieldInitializer); retValue.addUpdateListener( new WorkflowItemTreePanelUpdateListener() { @Override public void onUpdate(WorkflowItemTreePanelUpdateEvent event) { updateListener.onUpdate( new MappedFieldUpdateEvent<>( event.getNewValue(), event.getMappedField() // mappedField )); } }); return new ImmutablePair<JComponent, ComponentHandler<?>>( retValue, COMMUNICATION_TREE_PANEL_COMPONENT_HANDLER); } if (field.getAnnotation(Tags.class) != null) { Set<String> fieldValue = (Set<String>) field.get(instance); TagComponent retValue = new TagComponent(tagStorage, fieldValue); retValue.addUpdateListener( new TagComponentUpdateListener() { @Override public void onUpdate(TagComponentUpdateEvent updateEvent) { updateListener.onUpdate(new FieldUpdateEvent(updateEvent.getNewValue())); } }); return new ImmutablePair<JComponent, ComponentHandler<?>>(retValue, TAG_COMPONENT_HANDLER); } return super.handle0(field, instance, updateListener, reflectionFormBuilder); }