org.apache.wicket.model.CompoundPropertyModel Java Examples

The following examples show how to use org.apache.wicket.model.CompoundPropertyModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SakaiPagingNavigator.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
protected void onBeforeRender()
{
	if (get("rowNumberSelector") == null)
	{
		setDefaultModel(new CompoundPropertyModel(this));
		
		// Get the row number selector
		add(newRowNumberSelector(getPageable()));

		// Add additional page links
		replace(newPagingNavigationLink("first", getPageable(), 0));
		replace(newPagingNavigationIncrementLink("prev", getPageable(), -1));
		replace(newPagingNavigationIncrementLink("next", getPageable(), 1));
		replace(newPagingNavigationLink("last", getPageable(), -1));
	}
	super.onBeforeRender();
}
 
Example #2
Source File: TagEditorPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
public TagEditorPanel(String aId, IModel<TagSet> aTagSet, IModel<Tag> aTag)
{
    super(aId, aTag);
    
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    
    selectedTagSet = aTagSet;
    selectedTag = aTag;
    
    Form<Tag> form = new Form<>("form", CompoundPropertyModel.of(aTag));
    add(form);
    
    form.add(new TextField<String>("name")
            .add(new TagExistsValidator())
            .setRequired(true));
    form.add(new TextArea<String>("description"));
    
    form.add(new LambdaAjaxButton<>("save", this::actionSave));
    form.add(new LambdaAjaxLink("delete", this::actionDelete)
            .onConfigure(_this -> _this.setVisible(form.getModelObject().getId() != null)));
    form.add(new LambdaAjaxLink("cancel", this::actionCancel));
}
 
Example #3
Source File: QualifierEditor.java    From inception with Apache License 2.0 6 votes vote down vote up
public ViewMode(String aId, IModel<KBQualifier> aQualifier)
{
    super(aId, "viewMode", QualifierEditor.this, aQualifier);
    CompoundPropertyModel<KBQualifier> compoundModel = new CompoundPropertyModel<>(
        aQualifier);
    add(new Label("property", aQualifier.getObject().getProperty().getUiLabel()));
    add(new Label("language", compoundModel.bind("language")).add(
            LambdaBehavior.onConfigure(_this -> 
                    _this.setVisible(isNotEmpty(aQualifier.getObject().getLanguage())))));
    add(new Label("value",
            LoadableDetachableModel.of(() -> getLabel(compoundModel.getObject()))));

    LambdaAjaxLink editLink = new LambdaAjaxLink("edit", QualifierEditor.this::actionEdit);
    editLink.add(visibleWhen(() -> kbModel.map(kb -> !kb.isReadOnly())
            .orElse(false).getObject()));
    add(editLink);
}
 
Example #4
Source File: StatementGroupPanel.java    From inception with Apache License 2.0 6 votes vote down vote up
public StatementGroupPanel(String aId, CompoundPropertyModel<StatementGroupBean> aGroupModel)
{
    super(aId, aGroupModel);
    groupModel = aGroupModel;
    setOutputMarkupId(true);
    
    if (groupModel.getObject().isNew()) {
        NewStatementGroupFragment newStatement = new NewStatementGroupFragment(
                CONTENT_MARKUP_ID);

        // obtain AjaxRequestTarget and set the focus
        RequestCycle.get()
                .find(AjaxRequestTarget.class)
                .ifPresent(target -> target.focusComponent(newStatement.getFocusComponent()));

        content = newStatement;
    } else {
        content = new ExistingStatementGroupFragment(CONTENT_MARKUP_ID);
    }
    add(content);
}
 
Example #5
Source File: StringLiteralValuePresenter.java    From inception with Apache License 2.0 6 votes vote down vote up
public StringLiteralValuePresenter(String aId, IModel<KBStatement> aModel)
{
    super(aId, CompoundPropertyModel.of(aModel));

    add(new Label("value"));
    add(new Label("language")
    {
        private static final long serialVersionUID = 3436068825093393740L;

        @Override
        protected void onConfigure()
        {
            super.onConfigure();
            
            String language = (String) this.getDefaultModelObject();
            setVisible(StringUtils.isNotEmpty(language));
        }
    });
}
 
Example #6
Source File: BooleanLiteralValueEditor.java    From inception with Apache License 2.0 6 votes vote down vote up
public BooleanLiteralValueEditor(String aId, IModel<KBStatement> aModel)
{
    super(aId, CompoundPropertyModel.of(aModel));
    
    BootstrapCheckBoxPickerConfig config = new BootstrapCheckBoxPickerConfig();
    config.withReverse(true);
    value = new BootstrapCheckBoxPicker("value", config) {
        private static final long serialVersionUID = -3413189824637877732L;

        @Override
        protected void onComponentTag(ComponentTag aTag)
        {
            super.onComponentTag(aTag);
            
            aTag.put("data-group-cls", "btn-group-justified");
        }
    };
    value.setOutputMarkupId(true);
    value.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(getParent())));
    add(value);
}
 
Example #7
Source File: RecommenderViewPanel.java    From inception with Apache License 2.0 6 votes vote down vote up
public RecommenderViewPanel(String aId, IModel<Recommender> aRecommender)
{
    super(aId, aRecommender);

    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);

    recommenderModel = aRecommender; 
    
    Form<Recommender> form = new Form<>(MID_FORM, CompoundPropertyModel.of(aRecommender));
    add(form);
    
    nameField = new TextField<>(MID_NAME, String.class);
    form.add(nameField);
    
    tool = new TextField<>(MID_TOOL,String.class);
    form.add(tool);
    
    feature = new TextField<AnnotationFeature>(MID_FEATURE );
    form.add(feature);

    layer = new TextField<AnnotationLayer>(MID_LAYER);
    form.add(layer);
}
 
Example #8
Source File: ColoringRulesConfigurationPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
public ColoringRulesConfigurationPanel(String aId, IModel<AnnotationLayer> aModel,
        IModel<List<ColoringRule>> aColoringRules)
{
    super(aId, aModel);
    
    coloringRules = aColoringRules;
    
    Form<ColoringRule> coloringRulesForm = new Form<>("coloringRulesForm",
            CompoundPropertyModel.of(new ColoringRule()));
    add(coloringRulesForm);

    coloringRulesContainer = new WebMarkupContainer("coloringRulesContainer");
    coloringRulesContainer.setOutputMarkupPlaceholderTag(true);
    coloringRulesForm.add(coloringRulesContainer);

    coloringRulesContainer.add(new TextField<String>("pattern"));
    // We cannot make the color field a required one here because then we'd get a message
    // about color not being set when saving the entire feature details form!
    coloringRulesContainer.add(new ColorPickerTextField("color")
            .add(new PatternValidator("#[0-9a-fA-F]{6}")));
    coloringRulesContainer
            .add(new LambdaAjaxSubmitLink<>("addColoringRule", this::addColoringRule));
            
    coloringRulesContainer.add(createKeyBindingsList("coloringRules", coloringRules));
}
 
Example #9
Source File: ImageFeatureEditor.java    From inception with Apache License 2.0 6 votes vote down vote up
public ImageFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel)
{
    super(aId, aItem, new CompoundPropertyModel<>(aModel));
    
    IModel<String> urlModel = getModel().bind("value");
    
    ExternalImage preview = new ExternalImage("preview");
    // Need to manually set the markup ID of the preview because the feature editor usually
    // resides in a list view causing the markup ID to change on every refresh - and this
    // causes the AJAX behaviors to stop working because they may still refer to an outdated
    // ID
    preview.setMarkupId(aItem.getMarkupId() + "-preview-" + aModel.getObject().feature.getId());
    preview.setDefaultModel(urlModel);
    preview.add(visibleWhen(() -> urlValidator().isValid(urlModel.getObject())));
    preview.setOutputMarkupId(true);
    add(preview);

    field = new TextField<String>("value");
    field.add(urlValidator());
    field.add(OnChangeAjaxBehavior.onChange(_target -> _target.add(preview)));
    add(field);
}
 
Example #10
Source File: SearchPage.java    From inception with Apache License 2.0 6 votes vote down vote up
public SearchForm(String id)
{
    super(id);
    
    setModel(CompoundPropertyModel.of(new SearchFormModel()));
    
    DropDownChoice<DocumentRepository> repositoryCombo = 
            new BootstrapSelect<DocumentRepository>("repository");
    repositoryCombo.setChoices(LoadableDetachableModel
            .of(() -> externalSearchService.listDocumentRepositories(project)));
    repositoryCombo.setChoiceRenderer(new ChoiceRenderer<DocumentRepository>("name"));
    repositoryCombo.setNullValid(false);
    add(repositoryCombo);
    
    if (!repositoryCombo.getChoices().isEmpty()) {
        repositoryCombo.setModelObject(repositoryCombo.getChoices().get(0));
    }
    
    add(new TextField<>("query", String.class));
    
    LambdaAjaxSubmitLink searchLink = new LambdaAjaxSubmitLink("submitSearch",
            this::actionSearch);
    add(searchLink);
    setDefaultButton(searchLink);
}
 
Example #11
Source File: PubAnnotationProviderTraitsEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public PubAnnotationProviderTraitsEditor(String aId,
        IModel<DocumentRepository> aDocumentRepository)
{
    super(aId, aDocumentRepository);
    documentRepository = aDocumentRepository.getObject();
    properties = externalSearchProviderFactory.readTraits(documentRepository);

    Form<PubAnnotationProviderTraits> form = new Form<PubAnnotationProviderTraits>(
            MID_FORM, CompoundPropertyModel.of(Model.of(properties)))
    {
        private static final long serialVersionUID = -3109239608742291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();
            externalSearchProviderFactory.writeTraits(documentRepository, properties);
        }
    };

    TextField<String> remoteUrl = new TextField<>("url");
    remoteUrl.setRequired(true);
    remoteUrl.add(new UrlValidator());
    form.add(remoteUrl);

    add(form);
}
 
Example #12
Source File: LappsGridRecommenderTraitsEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public LappsGridRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender)
{
    super(aId, aRecommender);

    traits = toolFactory.readTraits(aRecommender.getObject());
    traitsModel = CompoundPropertyModel.of(traits);
    Form<LappsGridRecommenderTraits> form =
            new Form<LappsGridRecommenderTraits>(MID_FORM, traitsModel)
    {
        private static final long serialVersionUID = -3109239605742291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();
            toolFactory.writeTraits(aRecommender.getObject(), traits);
        }
    };

    urlField = new TextField<>(MID_URL);
    urlField.setRequired(true);
    urlField.add(new UrlValidator());
    urlField.setOutputMarkupId(true);
    form.add(urlField);

    servicesDropDown = new BootstrapSelect<>(MID_SERVICES);
    servicesDropDown.setModel(Model.of());
    servicesDropDown.setChoices(LoadableDetachableModel.of(this::getPredefinedServicesList));
    servicesDropDown.setChoiceRenderer(new ChoiceRenderer<>("description"));
    servicesDropDown.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> {
        LappsGridService selection = servicesDropDown.getModelObject();
        if (selection != null) {
            traits.setUrl(selection.getUrl());
        }
        t.add(urlField);
    }));
    form.add(servicesDropDown);

    add(form);
}
 
Example #13
Source File: LdapForm.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
public LdapForm(String id, WebMarkupContainer listContainer, final LdapConfig ldapConfig) {
	super(id, new CompoundPropertyModel<>(ldapConfig));
	setOutputMarkupId(true);
	this.listContainer = listContainer;

	add(new CheckBox("active"));
	add(new DateLabel("inserted"));
	add(new Label("insertedby.login"));
	add(new DateLabel("updated"));
	add(new Label("updatedby.login"));
	add(new CheckBox("addDomainToUserName"));
	add(new TextField<String>("domain"));
	add(new TextArea<String>("comment"));
}
 
Example #14
Source File: LayerSelectionPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public LayerSelectionPanel(String aId, IModel<AnnotatorState> aModel,
        AnnotationDetailEditorPanel aOwner)
{
    super(aId, new CompoundPropertyModel<>(aModel));
    
    setOutputMarkupId(true);
    
    owner = aOwner;
    
    add(relationHint = createRelationHint());
    add(layerSelector = createDefaultAnnotationLayerSelector());
    // Visible if there is more than one selectable layer and if either "remember layer" is off
    // (meaning that the dropdown indicates the currently selected layer) or "remember layer"
    // is on and the document is editable (meaning we need to be able to change the layer)
    add(visibleWhen(() -> layerSelector.getChoicesModel()
            .map(layerChoices -> layerChoices.size() > 1).orElse(false).getObject()
            && (!getModelObject().getPreferences().isRememberLayer()
                    || getEditorPage().isEditable())));
    
    // Trying to re-render the forwardAnnotationCheckBox as part of an AJAX request when it is
    // not visible causes an error in the JS console saying that the component could not be
    // found. Placing it in this WebMarkupContainer and controlling the visibility via the
    // container resolves this issue. Mind, using a "wicket:enclosure" instead of the
    // WebMarkupGroup also did not work.
    forwardAnnotationGroup = new WebMarkupContainer("forwardAnnotationGroup");
    forwardAnnotationGroup.add(createForwardAnnotationCheckBox());
    forwardAnnotationGroup.setOutputMarkupPlaceholderTag(true);
    forwardAnnotationGroup.add(visibleWhen(this::isForwardable));
    add(forwardAnnotationGroup);

}
 
Example #15
Source File: AjaxLazyLoadImage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private void init() {
	setOutputMarkupId(true);	
	
	// render chart by ajax, uppon request
	chartRenderAjaxBehavior = new AbstractDefaultAjaxBehavior() {
		private static final long	serialVersionUID	= 1L;

		@Override
		protected void respond(AjaxRequestTarget target) {
			//log.debug("chartRenderAjaxBehavior.Responding for "+ getId());
			renderImage(target, true);
		}
		
		@Override
		public boolean isEnabled(Component component) {
			return state < 2;
		}
		
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
		{
			super.updateAjaxAttributes(attributes);
			
			attributes.setChannel(new AjaxChannel(getId()));
		}
	};
	add(chartRenderAjaxBehavior);
	
	// fields for maximized chart size
	setDefaultModel(new CompoundPropertyModel(this));
	form = new Form("chartForm");
	form.add(new HiddenField("maxWidth"));
	form.add(new HiddenField("maxHeight"));
	add(form);

}
 
Example #16
Source File: AgreementPage.java    From webanno with Apache License 2.0 5 votes vote down vote up
public ProjectSelectionForm(String id)
{
    super(id, new CompoundPropertyModel<>(new ProjectSelectionModel()));

    ListChoice<Project> projectList = new OverviewListChoice<>("project");
    projectList.setChoiceRenderer(new ChoiceRenderer<>("name"));
    projectList.setChoices(LoadableDetachableModel.of(this::listAllowedProjects));
    projectList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::onSelectionChanged));
    add(projectList);
}
 
Example #17
Source File: ActiveLearningSidebar.java    From inception with Apache License 2.0 5 votes vote down vote up
public ActiveLearningSidebar(String aId, IModel<AnnotatorState> aModel,
        AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
        AnnotationPage aAnnotationPage)
{
    super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage);

    annotationPage = aAnnotationPage;

    // Instead of maintaining the AL state in the sidebar, we maintain it in the page because
    // that way we persists even if we switch to another sidebar tab
    alStateModel = new CompoundPropertyModel<>(LambdaModelAdapter.of(
        () -> aAnnotationPage.getMetaData(CURRENT_AL_USER_STATE),
        alState -> aAnnotationPage.setMetaData(CURRENT_AL_USER_STATE, alState)));

    // Set up the AL state in the page if it is not already there or if for some reason the
    // suggestions have completely disappeared (e.g. after a system restart)
    AnnotatorState state = getModelObject();
    Predictions predictions = state.getProject() != null
            ? recommendationService.getPredictions(state.getUser(), state.getProject())
            : null;
    if (aAnnotationPage.getMetaData(CURRENT_AL_USER_STATE) == null || predictions == null) {
        ActiveLearningUserState alState = new ActiveLearningUserState();
        alState.setStrategy(new UncertaintySamplingStrategy());
        alStateModel.setObject(alState);;
    }
    
    mainContainer = new WebMarkupContainer(CID_MAIN_CONTAINER);
    mainContainer.setOutputMarkupId(true);
    mainContainer.add(createNoRecommendersMessage());
    mainContainer.add(createSessionControlForm());
    mainContainer.add(createNoRecommendationLabel());
    mainContainer.add(clearSkippedRecommendationForm());
    mainContainer.add(createRecommendationOperationForm());
    mainContainer.add(createLearningHistory());
    add(mainContainer);
    
    confirmationDialog = new ConfirmationDialog(CID_CONFIRMATION_DIALOG);
    confirmationDialog.setAutoSize(true);
    add(confirmationDialog);
}
 
Example #18
Source File: TagSetImportPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public TagSetImportPanel(String aId, IModel<Project> aModel)
{
    super(aId);
    
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    
    preferences = Model.of(new Preferences());
    selectedProject = aModel;
    
    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));

    BootstrapSelect<String> format = new BootstrapSelect<>("format",
            asList(JSON_FORMAT, TAB_FORMAT));
    form.add(format);
    format.setModelObject(JSON_FORMAT); // Set after adding to form to have access to for model
    format.setRequired(true);
    
    form.add(new CheckBox("overwrite"));
    
    form.add(fileUpload = new BootstrapFileInputField("content", new ListModel<>()));
    fileUpload.getConfig().showPreview(false);
    fileUpload.getConfig().showUpload(false);
    fileUpload.getConfig().showRemove(false);
    fileUpload.setRequired(true);
    
    form.add(new LambdaAjaxButton<>("import", this::actionImport));
    
    add(form);
}
 
Example #19
Source File: SignInPage.java    From ontopia with Apache License 2.0 5 votes vote down vote up
public SignInForm(String id) { 
  super(id); 
  setDefaultModel(new CompoundPropertyModel<SignInForm>(this)); 
  
  add(new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(this)));
  
  add(new TextField<String>("username")); 
  add(new PasswordTextField("password"));   
}
 
Example #20
Source File: IRIValueEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public IRIValueEditor(String aId, IModel<KBStatement> aModel, IModel<KBProperty> aProperty,
        IModel<KnowledgeBase> aKB)
{   
    super(aId, CompoundPropertyModel.of(aModel));
    statement = aModel;
    property = aProperty;
    kb = aKB;
    
    ITextRenderer<KBHandle> renderer = new TextRenderer<KBHandle>("uiLabel")
    {
        private static final long serialVersionUID = 6523122841966543569L;

        @Override
        public String getText(KBHandle aObject)
        {
            // For the feature value editor, we do *not* want IRIs to be abbreviated to a human
            // readable name.
            if (aObject != null && StringUtils.isBlank(aObject.getName())) {
                return aObject.getIdentifier();
            }
            
            return super.getText(aObject);
        }
    };
    
    value = new KnowledgeBaseItemAutoCompleteField("value", this::listChoices, renderer);
    // Explicitly constructing this as a LambdaModelAdapter<Object> is necessary to avoid
    // a ClassCastException when the AutoCompleteField sends a String value which it (for
    // whatever reason sometimes) fails to map to a KBHandle.
    value.setDefaultModel(
            new LambdaModelAdapter<Object>(this::getKBHandleModel, this::setKBHandleModel));
    value.setOutputMarkupId(true);
    // Statement values cannot be null/empty - well, in theory they could be the empty string,
    // but we treat the empty string as null
    value.setRequired(true);
    add(value);
}
 
Example #21
Source File: AccessSpecificSettingsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public AccessSpecificSettingsPanel(String id,
    CompoundPropertyModel<KnowledgeBaseWrapper> aModel,
    Map<String, KnowledgeBaseProfile> aKnowledgeBaseProfiles)
{
    super(id);
    setOutputMarkupId(true);

    kbModel = aModel;
    knowledgeBaseProfiles = aKnowledgeBaseProfiles;
    downloadedProfiles = new HashMap<>();
    uploadedFiles = new HashMap<>();
    kbModel.getObject().clearFiles();
    kbInfoModel = CompoundPropertyModel.of(Model.of());

    boolean isHandlingLocalRepository =
        kbModel.getObject().getKb().getType() == RepositoryType.LOCAL;

    // container for form components related to local KBs
    WebMarkupContainer local = new WebMarkupContainer("localSpecificSettings");
    add(local);
    local.setVisibilityAllowed(isHandlingLocalRepository);
    setUpLocalSpecificSettings(local);

    // container for form components related to remote KBs
    WebMarkupContainer remote = new WebMarkupContainer("remoteSpecificSettings");
    add(remote);
    remote.setVisibilityAllowed(!isHandlingLocalRepository);
    setUpRemoteSpecificSettings(remote);
}
 
Example #22
Source File: RootConceptsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public RootConceptsPanel(String id,
    CompoundPropertyModel<KnowledgeBaseWrapper> aModel)
{
    super(id);

    kbModel = aModel;
    concepts = kbModel.getObject().getKb().getRootConcepts();
    setOutputMarkupId(true);

    ListView<IRI> conceptsListView = new ListView<IRI>("rootConcepts",
        kbModel.bind("kb.rootConcepts"))
    {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<IRI> item)
        {
            Form<Void> conceptForm = new Form<Void>("conceptForm");
            conceptForm.add(buildTextField("textField", item.getModel()));
            conceptForm.add(new LambdaAjaxLink("removeConcept", t -> 
                RootConceptsPanel.this.actionRemoveConcept(t, item.getModelObject())
            ));
            item.add(conceptForm);
        }

    };
    conceptsListView.setOutputMarkupId(true);
    add(conceptsListView);

    TextField<String> newRootConcept = new TextField<>("newConceptField",
        newConceptIRIString);
    newRootConcept.add(new LambdaAjaxFormComponentUpdatingBehavior("change"));
    add(newRootConcept);

    LambdaAjaxLink specifyConcept = new LambdaAjaxLink("newExplicitConcept",
        RootConceptsPanel.this::actionNewRootConcept);
    add(specifyConcept);
}
 
Example #23
Source File: OpenNlpPosRecommenderTraitsEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public OpenNlpPosRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender)
{
    super(aId, aRecommender);
    
    traits = toolFactory.readTraits(aRecommender.getObject());

    Form<OpenNlpPosRecommenderTraits> form = new Form<OpenNlpPosRecommenderTraits>(
            MID_FORM, new CompoundPropertyModel<>(traits))
    {
        private static final long serialVersionUID = -3109239605742291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();
            toolFactory.writeTraits(aRecommender.getObject(), traits);
        }
    };

    NumberTextField<Double> iterations = new NumberTextField<>("taggedTokensThreshold",
            Double.class);
    iterations.setMinimum(1.0);
    iterations.setMaximum(100.0);
    form.add(iterations);

    add(form);
}
 
Example #24
Source File: PropertyListPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public PropertyListPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<KBProperty> aModel)
{
    super(aId, aModel);

    setOutputMarkupId(true);

    selectedProperty = aModel;
    kbModel = aKbModel;
    preferences = Model.of(new Preferences());

    OverviewListChoice<KBProperty> overviewList = new OverviewListChoice<>("properties");
    overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    overviewList.setModel(selectedProperty);
    overviewList.setChoices(LambdaModel.of(this::getProperties));
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::actionSelectionChanged));
    
    add(overviewList);

    add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size())));

    LambdaAjaxLink addLink = new LambdaAjaxLink("add",
        target -> send(getPage(), Broadcast.BREADTH, new AjaxNewPropertyEvent(target)));
    addLink.add(new Label("label", new ResourceModel("property.list.add")));
    addLink.add(new WriteProtectionBehavior(kbModel));
    add(addLink);

    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
    form.add(new CheckBox("showAllProperties").add(
            new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged)));
    add(form);
}
 
Example #25
Source File: LoginPage.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
public LoginForm(String id) {
	super(id);
	setModel(new CompoundPropertyModel<>(this));
	add(new FeedbackPanel("feedback"));
	add(new RequiredTextField<String>("username"));
	add(new PasswordTextField("password"));
}
 
Example #26
Source File: DefaultDataProvider.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
@Override
public IModel<MODEL> model(MODEL object) {
	ID id = object.getId();
	return new CompoundPropertyModel<>(new LoadableDetachableModel<MODEL>(object) {

		@Override
		protected MODEL load() {
			return getFilterService().findById(id);
		}
	});
}
 
Example #27
Source File: ConceptListPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public ConceptListPanel(String aId, IModel<KnowledgeBase> aKbModel,
        IModel<KBHandle> selectedConceptModel) {
    super(aId, selectedConceptModel);

    setOutputMarkupId(true);

    selectedConcept = selectedConceptModel;
    kbModel = aKbModel;
    preferences = Model.of(new Preferences());

    OverviewListChoice<KBHandle> overviewList = new OverviewListChoice<>("concepts");
    overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    overviewList.setModel(selectedConceptModel);
    overviewList.setChoices(LambdaModel.of(this::getConcepts));
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::actionSelectionChanged));
    overviewList.setMaxRows(LIST_MAX_ROWS);
    add(overviewList);

    add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size())));

    LambdaAjaxLink addLink = new LambdaAjaxLink("add", target -> send(getPage(),
            Broadcast.BREADTH, new AjaxNewConceptEvent(target)));
    addLink.add(new Label("label", new ResourceModel("concept.list.add")));
    addLink.add(new WriteProtectionBehavior(kbModel));
    add(addLink);

    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
    form.add(new CheckBox("showAllConcepts").add(
            new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged)));
    add(form);
}
 
Example #28
Source File: StringLiteralValueEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public StringLiteralValueEditor(String aId, IModel<KBStatement> aModel)
{
    super(aId, CompoundPropertyModel.of(aModel));

    value = new TextArea<>("value");
    value.setOutputMarkupId(true);
    // Statement values cannot be null/empty - well, in theory they could be the empty string,
    // but we treat the empty string as null
    value.setRequired(true);
    add(value);

    add(new TextField<>("language"));
}
 
Example #29
Source File: KnowledgeBaseCreationWizard.java    From inception with Apache License 2.0 5 votes vote down vote up
public SchemaConfigurationStep(IDynamicWizardStep previousStep,
        CompoundPropertyModel<KnowledgeBaseWrapper> aModel)
{
    super(previousStep, "", "", aModel);
    model = aModel;

    add(new KnowledgeBaseIriPanel("iriPanel", model));
}
 
Example #30
Source File: ExternalRecommenderTraitsEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public ExternalRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender)
{
    super(aId, aRecommender);
    
    traits = toolFactory.readTraits(aRecommender.getObject());

    Form<ExternalRecommenderTraits> form = new Form<ExternalRecommenderTraits>(MID_FORM,
            CompoundPropertyModel.of(Model.of(traits)))
    {
        private static final long serialVersionUID = -3109239605742291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();
            toolFactory.writeTraits(aRecommender.getObject(), traits);
        }
    };

    TextField<String> remoteUrl = new TextField<>("remoteUrl");
    remoteUrl.setRequired(true);
    remoteUrl.add(new UrlValidator());
    form.add(remoteUrl);

    CheckBox trainable = new CheckBox("trainable");
    trainable.setOutputMarkupId(true);
    trainable.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> 
            _target.add(getTrainingStatesChoice())));
    form.add(trainable);
    
    getTrainingStatesChoice().add(visibleWhen(() -> trainable.getModelObject() == true));
    
    add(form);
}