@SuppressWarnings({ "unchecked", "rawtypes" }) public ImportLayerForm(String id) { super(id); add(fileUpload = new FileUploadField("content", new Model())); add(new LambdaAjaxButton("import", this::actionImport)); }
public ContentPanel(String aId, IModel<KBConcept> newSubclassConceptModel) { super(aId); // add components for input form RequiredTextField<String> name = new RequiredTextField<>("name"); name.add(AttributeModifier.append("placeholder", new ResourceModel("subclassNamePlaceholder"))); LambdaAjaxButton<KBConcept> createButton = new LambdaAjaxButton<KBConcept>( "createSubclass", SubclassCreationDialog.this::actionCreateSubclass); createButton.add(new Label("createLabel", new ResourceModel("create"))); // initialize input form and add it to the content panel Form<KBConcept> form = new Form<KBConcept>("form", CompoundPropertyModel.of(newSubclassConceptModel)); form.add(name); form.add(createButton); form.setDefaultButton(createButton); add(form); } }
@SuppressWarnings("unchecked") @Override protected void onSubmit(AjaxRequestTarget aTarget) { try { action.accept(aTarget, (Form<T>) getForm()); } catch (Exception e) { if (exceptionHandler != null) { exceptionHandler.accept(aTarget, e); } else { LoggerFactory.getLogger(getPage().getClass()).error("Error: " + e.getMessage(), e); error("Error: " + e.getMessage()); aTarget.addChildren(getPage(), IFeedback.class); } } }
@Override protected void onError(AjaxRequestTarget aTarget) { super.onError(aTarget); aTarget.addChildren(getPage(), IFeedback.class); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) public ImportLayerForm(String id) { super(id); add(fileUpload = new FileUploadField("content", new Model())); add(new LambdaAjaxButton("import", this::actionImport)); }
public ContentPanel(String aId, IModel<KBConcept> newSubclassConceptModel) { super(aId); // add components for input form RequiredTextField<String> name = new RequiredTextField<>("name"); name.add(AttributeModifier.append("placeholder", new ResourceModel("subclassNamePlaceholder"))); LambdaAjaxButton<KBConcept> createButton = new LambdaAjaxButton<KBConcept>( "createSubclass", SubclassCreationDialog.this::actionCreateSubclass); createButton.add(new Label("createLabel", new ResourceModel("create"))); // initialize input form and add it to the content panel Form<KBConcept> form = new Form<KBConcept>("form", CompoundPropertyModel.of(newSubclassConceptModel)); form.add(name); form.add(createButton); form.setDefaultButton(createButton); add(form); } }
public ImportGuidelinesPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); form.add(fileUpload = new FileUploadField("guidelines")); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
add(new LambdaAjaxButton<>("delete", this::actionDelete).add( visibleWhen(() -> !isNull(getModelObject().getId()))));
public ImportGuidelinesPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); form.add(fileUpload = new FileUploadField("guidelines")); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
add(new LambdaAjaxButton<>("delete", this::actionDelete).add( visibleWhen(() -> !isNull(getModelObject().getId()))));
public ContentPanel(String aId, IModel<State> aModel) { super(aId, aModel); form = new Form<>("form", CompoundPropertyModel.of(aModel)); form.add(new Label("content").setEscapeModelStrings(false)); form.add(new Label("feedback")); form.add(new LambdaAjaxButton<>("confirm", ConfirmationDialog.this::onConfirmInternal)); form.add(new LambdaAjaxLink("cancel", ConfirmationDialog.this::onCancelInternal)); add(form); } }
public ContentPanel(String aId, IModel<State> aModel) { super(aId, aModel); form = new Form<>("form", aModel); form.add(new Label("challenge").setEscapeModelStrings(false)); form.add(new Label("feedback")); form.add(new TextField<>("response")); form.add(new LambdaAjaxButton<>("confirm", ChallengeResponseDialog.this::onConfirmInternal)); form.add(new LambdaAjaxLink("cancel", ChallengeResponseDialog.this::onCancelInternal)); add(form); } }
private Form<Void> clearSkippedRecommendationForm() { Form<Void> form = new Form<>(CID_LEARN_FROM_SKIPPED_RECOMMENDATION_FORM); form.add(LambdaBehavior.visibleWhen(() -> { ActiveLearningUserState alState = alStateModel.getObject(); return alState.isSessionActive() && !alState.getSuggestion().isPresent() && activeLearningService.hasSkippedSuggestions( getModelObject().getUser(), alState.getLayer()); })); form.setOutputMarkupPlaceholderTag(true); form.add(new Label(CID_ONLY_SKIPPED_RECOMMENDATION_LABEL, "There are only skipped suggestions. Do you want to learn these again?")); form.add(new LambdaAjaxButton<>(CID_LEARN_SKIPPED_ONES, this::actionClearSkippedRecommendations)); return form; }
private Form<Void> createRecommendationOperationForm() { recommendationForm = new Form<Void>(CID_RECOMMENDATION_FORM); recommendationForm.add(LambdaBehavior.visibleWhen(() -> { ActiveLearningUserState alState = alStateModel.getObject(); return alState.isSessionActive() && alState.getSuggestion().isPresent(); })); recommendationForm.setOutputMarkupPlaceholderTag(true); recommendationForm.add(createJumpToSuggestionLink()); recommendationForm.add(new Label(CID_RECOMMENDED_PREDITION, LoadableDetachableModel.of(() -> alStateModel.getObject() .getSuggestion().map(this::formatLabel).orElse(null)))); recommendationForm.add(new Label(CID_RECOMMENDED_CONFIDENCE, () -> alStateModel.getObject().getSuggestion() .map(AnnotationSuggestion::getConfidence).orElse(null))); recommendationForm.add(new Label(CID_RECOMMENDED_DIFFERENCE, () -> alStateModel.getObject().getCurrentDifference() .map(Delta::getDelta).orElse(null))); recommendationForm.add((alStateModel.getObject().getLayer() != null && alStateModel.getObject().getSuggestion().isPresent()) ? initializeFeatureEditor() : new Label(CID_EDITOR).setVisible(false)); recommendationForm.add(new LambdaAjaxButton<>(CID_ANNOTATE_BUTTON, this::actionAnnotate)); recommendationForm.add(new LambdaAjaxLink(CID_SKIP_BUTTON, this::actionSkip)); recommendationForm.add(new LambdaAjaxLink(CID_REJECT_BUTTON, this::actionReject)); return recommendationForm; }
form.add(new LambdaAjaxButton<>("save", this::actionSave)); form.add(new LambdaAjaxLink("cancel", this::actionCancel));
private Form<Void> clearSkippedRecommendationForm() { Form<Void> form = new Form<>(CID_LEARN_FROM_SKIPPED_RECOMMENDATION_FORM); form.add(LambdaBehavior.visibleWhen(() -> { ActiveLearningUserState alState = alStateModel.getObject(); return alState.isSessionActive() && !alState.getSuggestion().isPresent() && activeLearningService.hasSkippedSuggestions( getModelObject().getUser(), alState.getLayer()); })); form.setOutputMarkupPlaceholderTag(true); form.add(new Label(CID_ONLY_SKIPPED_RECOMMENDATION_LABEL, "There are only skipped suggestions. Do you want to learn these again?")); form.add(new LambdaAjaxButton<>(CID_LEARN_SKIPPED_ONES, this::actionClearSkippedRecommendations)); return form; }
private Form<Void> createRecommendationOperationForm() { recommendationForm = new Form<Void>(CID_RECOMMENDATION_FORM); recommendationForm.add(LambdaBehavior.visibleWhen(() -> { ActiveLearningUserState alState = alStateModel.getObject(); return alState.isSessionActive() && alState.getSuggestion().isPresent(); })); recommendationForm.setOutputMarkupPlaceholderTag(true); recommendationForm.add(createJumpToSuggestionLink()); recommendationForm.add(new Label(CID_RECOMMENDED_PREDITION, LoadableDetachableModel.of(() -> alStateModel.getObject() .getSuggestion().map(this::formatLabel).orElse(null)))); recommendationForm.add(new Label(CID_RECOMMENDED_CONFIDENCE, () -> alStateModel.getObject().getSuggestion() .map(AnnotationSuggestion::getConfidence).orElse(null))); recommendationForm.add(new Label(CID_RECOMMENDED_DIFFERENCE, () -> alStateModel.getObject().getCurrentDifference() .map(Delta::getDelta).orElse(null))); recommendationForm.add((alStateModel.getObject().getLayer() != null && alStateModel.getObject().getSuggestion().isPresent()) ? initializeFeatureEditor() : new Label(CID_EDITOR).setVisible(false)); recommendationForm.add(new LambdaAjaxButton<>(CID_ANNOTATE_BUTTON, this::actionAnnotate)); recommendationForm.add(new LambdaAjaxLink(CID_SKIP_BUTTON, this::actionSkip)); recommendationForm.add(new LambdaAjaxLink(CID_REJECT_BUTTON, this::actionReject)); return recommendationForm; }
public ImportDocumentsPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); format = Model.of(); List<String> readableFormats = listReadableFormats(); if (!readableFormats.isEmpty()) { if (readableFormats.contains("Plain text")) { format.setObject("Plain text"); } else { format.setObject(readableFormats.get(0)); } } form.add(fileUpload = new FileUploadField("documents")); DropDownChoice<String> formats = new BootstrapSelect<>("format"); formats.setModel(format); formats.setChoices(LambdaModel.of(this::listReadableFormats)); form.add(formats); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
public ImportDocumentsPanel(String aId, IModel<Project> aProject) { super(aId); projectModel = aProject; Form<Void> form = new Form<>("form"); add(form); format = Model.of(); List<String> readableFormats = listReadableFormats(); if (!readableFormats.isEmpty()) { if (readableFormats.contains("Plain text")) { format.setObject("Plain text"); } else { format.setObject(readableFormats.get(0)); } } form.add(fileUpload = new FileUploadField("documents")); DropDownChoice<String> formats = new BootstrapSelect<>("format"); formats.setModel(format); formats.setChoices(LambdaModel.of(this::listReadableFormats)); form.add(formats); form.add(new LambdaAjaxButton<>("import", this::actionImport)); }
form.add(new LambdaAjaxButton<>("save", this::actionSave)); form.add(new LambdaAjaxLink("cancel", this::actionCancel));