public SentenceLink(String aId, IModel<SourceListView> aModel) { super(aId, aModel); setBody(Model.of(aModel.getObject().getSentenceNumber().toString())); }
final SourceListView curationViewItem = getModelObject();
final SourceListView curationViewItem = getModelObject();
@Override public void onClick(AjaxRequestTarget aTarget) { final SourceListView curationViewItem = getModelObject(); curationView = curationViewItem; fSn = 0; try { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); updateCurationView(CurationPanel.this.getModelObject(), curationViewItem, aTarget, jCas); updatePanel(aTarget, CurationPanel.this.getModelObject()); state.setFocusUnitIndex(curationViewItem.getSentenceNumber()); } catch (UIMAException e) { error("Error: " + ExceptionUtils.getRootCauseMessage(e)); } catch (ClassNotFoundException | AnnotationException | IOException e) { error("Error: " + e.getMessage()); } } }
@Override public void onClick(AjaxRequestTarget aTarget) { final SourceListView curationViewItem = getModelObject(); curationView = curationViewItem; fSn = 0; try { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); updateCurationView(CurationPanel.this.getModelObject(), curationViewItem, aTarget, jCas); updatePanel(aTarget, CurationPanel.this.getModelObject()); state.setFocusUnitIndex(curationViewItem.getSentenceNumber()); } catch (UIMAException e) { error("Error: " + ExceptionUtils.getRootCauseMessage(e)); } catch (ClassNotFoundException | AnnotationException | IOException e) { error("Error: " + e.getMessage()); } } }
@Override protected void onAfterRender() { super.onAfterRender(); // The sentence list is refreshed using AJAX. Unfortunately, the renderHead() method // of the AjaxEventBehavior created by AjaxLink does not seem to be called by Wicket // during an AJAX rendering, causing the sentence links to loose their functionality. // Here, we ensure that the callback scripts are attached to the sentence links even // during AJAX updates. if (isEnabledInHierarchy()) { RequestCycle.get().find(AjaxRequestTarget.class).ifPresent(_target -> { for (AjaxEventBehavior b : getBehaviors(AjaxEventBehavior.class)) { _target.appendJavaScript(b.getCallbackScript()); } }); } }
@Override protected void onAfterRender() { super.onAfterRender(); // The sentence list is refreshed using AJAX. Unfortunately, the renderHead() method // of the AjaxEventBehavior created by AjaxLink does not seem to be called by Wicket // during an AJAX rendering, causing the sentence links to loose their functionality. // Here, we ensure that the callback scripts are attached to the sentence links even // during AJAX updates. if (isEnabledInHierarchy()) { RequestCycle.get().find(AjaxRequestTarget.class).ifPresent(_target -> { for (AjaxEventBehavior b : getBehaviors(AjaxEventBehavior.class)) { _target.appendJavaScript(b.getCallbackScript()); } }); } }
@Override protected void populateItem(ListItem<SourceListView> item) { item.add(new SentenceLink("sentenceNumber", item.getModel())); } });
@Override protected void populateItem(ListItem<SourceListView> item) { item.add(new SentenceLink("sentenceNumber", item.getModel())); } });
public SentenceLink(String aId, IModel<SourceListView> aModel) { super(aId, aModel); setBody(Model.of(aModel.getObject().getSentenceNumber().toString())); }