Java Code Examples for org.apache.wicket.markup.html.WebMarkupContainer#setOutputMarkupPlaceholderTag()

The following examples show how to use org.apache.wicket.markup.html.WebMarkupContainer#setOutputMarkupPlaceholderTag() . 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: FilterPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
public FilterPanel(String id, IModel<String> name, final Form form, List<AbstractFilterPanel<?, ?>> filterPanels) {
    super(id);
    final WebMarkupContainer container = new WebMarkupContainer("container");
    this.containerId = container.getMarkupId();
    initFilterPanels(filterPanels);
    List<FilterTab> tabs = createPanelSwitches("switch", filterPanels);
    currentTab = tabs.get(0);
    addFilterPanels(container, filterPanels, tabs);
    addFilterSwitches(container, tabs);
    container.setOutputMarkupPlaceholderTag(true);
    container.setVisible(false);
    container.add(newOkButton("okButton", container, form));
    container.add(newClearButton("clearButton", container, form, filterPanels));
    container.add(newOnEnterPressBehavior(container));
    add(newShowFilterButton("showFilters", container));
    container.add(new Label("panelTitle", name).setOutputMarkupPlaceholderTag(true));
    add(container);
    setOutputMarkupPlaceholderTag(true);
}
 
Example 2
Source File: PageExpiredErrorPage.java    From ontopia with Apache License 2.0 6 votes vote down vote up
public PageExpiredErrorPage(final Class<? extends Page> previousPage, PageParameters parameters) {	
  super(parameters);
  
  createTitle();
  
  add(new OntopolyBookmarkablePageLink("startPage", StartPage.class, new ResourceModel("topic.map.index.page").getObject().toString()));
  
  // The bookmarkablePageLink class demands that the page argument is not equal to null, so
  // it has to be set to a concrete page if previousPage is null.
  Class<? extends Page> page = StartPage.class;
  if(previousPage != null) {
    page = previousPage;
  }
  
  WebMarkupContainer previousPageLinkContainer = new WebMarkupContainer("previousPageLinkContainer") {
    @Override
    public boolean isVisible() {
      return previousPage != null ? true : false;
    }  
  };
  previousPageLinkContainer.setOutputMarkupPlaceholderTag(true);
  add(previousPageLinkContainer);
  
  String label = "previous page";
  previousPageLinkContainer.add(new OntopolyBookmarkablePageLink("previousPage", page, parameters, label));
}
 
Example 3
Source File: AbstractGroups.java    From syncope with Apache License 2.0 6 votes vote down vote up
public <T extends AnyTO> AbstractGroups(final AnyWrapper<T> modelObject) {
    super();
    this.anyTO = modelObject.getInnerObject();

    setOutputMarkupId(true);

    groupsContainer = new WebMarkupContainer("groupsContainer");
    groupsContainer.setOutputMarkupId(true);
    groupsContainer.setOutputMarkupPlaceholderTag(true);
    add(groupsContainer);

    // ------------------
    // insert changed label if needed
    // ------------------
    if (modelObject instanceof UserWrapper
            && UserWrapper.class.cast(modelObject).getPreviousUserTO() != null
            && !ListUtils.isEqualList(
                    UserWrapper.class.cast(modelObject).getInnerObject().getMemberships(),
                    UserWrapper.class.cast(modelObject).getPreviousUserTO().getMemberships())) {
        groupsContainer.add(new LabelInfo("changed", StringUtils.EMPTY));
    } else {
        groupsContainer.add(new Label("changed", StringUtils.EMPTY));
    }
    // ------------------
}
 
Example 4
Source File: AnnotationPage.java    From webanno with Apache License 2.0 6 votes vote down vote up
private void createChildComponents()
{
    add(createUrlFragmentBehavior());      
    
    centerArea = new WebMarkupContainer("centerArea");
    centerArea.add(visibleWhen(() -> getModelObject().getDocument() != null));
    centerArea.setOutputMarkupPlaceholderTag(true);
    centerArea.add(createDocumentInfoLabel());
    add(centerArea);
    
    actionBar = new ActionBar("actionBar");
    centerArea.add(actionBar);

    add(createRightSidebar());

    createAnnotationEditor(null);

    leftSidebar = createLeftSidebar();
    add(leftSidebar);
}
 
Example 5
Source File: FeatureEditorListPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
public FeatureEditorListPanel(String aId, IModel<AnnotatorState> aModel,
        AnnotationDetailEditorPanel aOwner)
{
    super(aId, aModel);
    
    setOutputMarkupPlaceholderTag(true);
    
    owner = aOwner;

    featureEditorContainer = new WebMarkupContainer("featureEditorContainer");
    featureEditorContainer.setOutputMarkupPlaceholderTag(true);
    featureEditorContainer.add(featureEditorPanelContent = new FeatureEditorPanelContent("featureEditors"));
    featureEditorContainer.add(createFocusResetHelper());
    featureEditorContainer.add(visibleWhen(() -> !hasFeatures()));
    add(featureEditorContainer);
    
    noFeaturesWarning = new WebMarkupContainer("noFeaturesWarning");
    noFeaturesWarning.setOutputMarkupPlaceholderTag(true);
    noFeaturesWarning.add(visibleWhen(() -> hasFeatures()));
    add(noFeaturesWarning);
}
 
Example 6
Source File: TopologyTogglePanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public TopologyTogglePanel(final String id, final PageReference pageRef) {
    super(id, "topologyTogglePanel", pageRef);

    modal.size(Modal.Size.Large);
    setFooterVisibility(false);

    propTaskModal = new BaseModal<>(Constants.OUTER);
    propTaskModal.size(Modal.Size.Large);
    addOuterObject(propTaskModal);

    schedTaskModal = new BaseModal<Serializable>(Constants.OUTER) {

        private static final long serialVersionUID = 389935548143327858L;

        @Override
        protected void onConfigure() {
            super.onConfigure();
            setFooterVisible(false);
        }
    };
    schedTaskModal.size(Modal.Size.Large);
    addOuterObject(schedTaskModal);

    provisionModal = new BaseModal<>(Constants.OUTER);
    provisionModal.size(Modal.Size.Large);
    provisionModal.addSubmitButton();
    addOuterObject(provisionModal);

    historyModal = new BaseModal<>(Constants.OUTER);
    historyModal.size(Modal.Size.Large);
    addOuterObject(historyModal);

    container = new WebMarkupContainer("container");
    container.setOutputMarkupPlaceholderTag(true);
    addInnerObject(container);

    container.add(getEmptyFragment());
}
 
Example 7
Source File: ActionLinksTogglePanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public ActionLinksTogglePanel(final String id, final PageReference pageRef) {
    super(id, UUID.randomUUID().toString(), pageRef);

    modal.size(Modal.Size.Large);
    setFooterVisibility(false);

    container = new WebMarkupContainer("container");
    container.setOutputMarkupPlaceholderTag(true);
    addInnerObject(container);

    container.add(getEmptyFragment());
}
 
Example 8
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 9
Source File: Roles.java    From syncope with Apache License 2.0 5 votes vote down vote up
public <T extends AnyTO> Roles(final UserWrapper modelObject) {
    if (modelObject.getPreviousUserTO() != null
            && !modelObject.getInnerObject().getRoles().equals(modelObject.getPreviousUserTO().getRoles())) {

        add(new LabelInfo("changed", StringUtils.EMPTY));
    } else {
        add(new Label("changed", StringUtils.EMPTY));
    }

    userTO = modelObject.getInnerObject();

    // -----------------------------------------------------------------
    // Pre-Authorizations
    // -----------------------------------------------------------------
    ActionPermissions permissions = new ActionPermissions();
    setMetaData(MetaDataRoleAuthorizationStrategy.ACTION_PERMISSIONS, permissions);
    permissions.authorize(RENDER,
            new org.apache.wicket.authroles.authorization.strategies.role.Roles(IdRepoEntitlement.ROLE_LIST));
    // -----------------------------------------------------------------

    this.setOutputMarkupId(true);

    allRoles = getManagedRoles();

    add(buildRolesSelector(modelObject));

    dynrolesContainer = new WebMarkupContainer("dynrolesContainer");
    dynrolesContainer.setOutputMarkupId(true);
    dynrolesContainer.setOutputMarkupPlaceholderTag(true);
    add(dynrolesContainer);

    dynrolesContainer.add(new AjaxPalettePanel.Builder<String>().build("dynroles",
            new PropertyModel<>(userTO, "dynRoles"),
            new ListModel<>(allRoles)).hideLabel().setEnabled(false).setOutputMarkupId(true));
}
 
Example 10
Source File: KeyBindingsConfigurationPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public KeyBindingsConfigurationPanel(String aId, IModel<AnnotationFeature> aModel,
        IModel<List<KeyBinding>> aKeyBindings)
{
    super(aId, aModel);
    
    keyBindings = aKeyBindings;
    
    Form<KeyBinding> keyBindingForm = new Form<>("keyBindingForm",
            CompoundPropertyModel.of(new KeyBinding()));
    add(keyBindingForm);

    keyBindingsContainer = new WebMarkupContainer("keyBindingsContainer");
    keyBindingsContainer.setOutputMarkupPlaceholderTag(true);
    keyBindingForm.add(keyBindingsContainer);

    // We cannot make the key-combo field a required one here because then we'd get a message
    // about keyCombo not being set when saving the entire feature details form!
    keyBindingsContainer.add(new TextField<String>("keyCombo")
            .add(new KeyComboValidator()));
    keyBindingsContainer.add(new LambdaAjaxSubmitLink<>("addKeyBinding", this::addKeyBinding));
    
    AnnotationFeature feature = aModel.getObject();
    FeatureSupport<?> fs = featureSupportRegistry.getFeatureSupport(feature);
    featureState = Model.of(new FeatureState(VID.NONE_ID, feature, null));
    if (feature.getTagset() != null) {
        featureState.getObject().tagset = schemaService.listTags(feature.getTagset());
    }
    // We are adding only the focus component here because we do not want to display the label
    // which usually goes along with the feature editor. This assumes that there is a sensible
    // focus component... might not be the case for some multi-component editors.
    editor = fs.createEditor("value", this, null, null, featureState);
    editor.addFeatureUpdateBehavior();
    editor.getLabelComponent().setVisible(false);
    keyBindingsContainer.add(editor);
    
    keyBindingsContainer.add(createKeyBindingsList("keyBindings", keyBindings));
}
 
Example 11
Source File: AccessSpecificSettingsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
private void setUpLocalSpecificSettings(WebMarkupContainer wmc)
{
    wmc.add(uploadForm("uploadForm", "uploadField"));

    // add link for clearing the knowledge base contents, enabled only, if there is
    // something to clear
    AjaxLink<Void> clearLink = clearLink("clear");
    wmc.add(clearLink);

    wmc.add(fileExtensionsExportList("exportButtons"));

    List<KnowledgeBaseProfile> localKBs = knowledgeBaseProfiles.values().stream()
        .filter(kb -> RepositoryType.LOCAL.equals(kb.getType()))
        .collect(Collectors.toList());

    listViewContainer = new WebMarkupContainer("listViewContainer");
    ListView<KnowledgeBaseProfile> suggestions = localSuggestionsList("localKBs", localKBs);
    listViewContainer.add(suggestions);
    listViewContainer.setOutputMarkupPlaceholderTag(true);

    LambdaAjaxLink addKbButton = new LambdaAjaxLink("addKbButton",
        this::actionDownloadKbAndSetIRIs);
    addKbButton.add(new Label("addKbLabel", new ResourceModel("kb.wizard.steps.local.addKb")));
    listViewContainer.add(addKbButton);

    infoContainerLocal = createKbInfoContainer("infoContainer");
    infoContainerLocal.setOutputMarkupId(true);
    wmc.add(infoContainerLocal);

    wmc.add(listViewContainer);
}
 
Example 12
Source File: SkillSelectPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public SkillSelectPanel(final FieldsetPanel fieldsetPanel, final IModel<SkillDO> model, final ISelectCallerPage caller,
    final String selectProperty)
{
  super(fieldsetPanel.newChildId(), model, caller, selectProperty);
  this.fieldsetPanel = fieldsetPanel;
  fieldsetPanel.getFieldset().setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);
  SkillDO skill = model.getObject();
  if (Hibernate.isInitialized(skill) == false) {
    skill = getSkillTree().getSkillById(skill.getId());
    model.setObject(skill);
  }
  divContainer = new WebMarkupContainer("div") {
    private static final long serialVersionUID = -8150112323444983335L;

    /**
     * @see org.apache.wicket.Component#isVisible()
     */
    @Override
    public boolean isVisible()
    {
      // display only, if we are not in ajax skill select mode
      return ajaxSkillSelectMode == false;
    }
  };
  divContainer.setOutputMarkupId(true);
  divContainer.setOutputMarkupPlaceholderTag(true);
  add(divContainer);
  ajaxSkillSelectMode = false;
}
 
Example 13
Source File: Groups.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
protected void addDynamicGroupsContainer() {
    dyngroupsContainer = new WebMarkupContainer("dyngroupsContainer");
    dyngroupsContainer.setOutputMarkupId(true);
    dyngroupsContainer.setOutputMarkupPlaceholderTag(true);
    add(dyngroupsContainer);
}
 
Example 14
Source File: ProjectPage.java    From webanno with Apache License 2.0 4 votes vote down vote up
private void commonInit()
{
    selectedProject = Model.of();

    sidebar = new WebMarkupContainer("sidebar");
    sidebar.setOutputMarkupId(true);
    add(sidebar);

    tabContainer = new WebMarkupContainer("tabContainer");
    tabContainer.setOutputMarkupPlaceholderTag(true);
    tabContainer.add(visibleWhen(() -> selectedProject.getObject() != null));
    add(tabContainer);
    
    tabContainer.add(new Label("projectName", PropertyModel.of(selectedProject, "name")));
    
    tabContainer.add(new LambdaAjaxLink("cancel", this::actionCancel));
    
    tabContainer.add(new LambdaAjaxLink("delete", this::actionDelete)
            .onConfigure((_this) -> _this.setEnabled(selectedProject.getObject() != null
                    && selectedProject.getObject().getId() != null)));
    
    tabPanel = new BootstrapAjaxTabbedPanel<ITab>("tabPanel", makeTabs()) {
        private static final long serialVersionUID = -7356420977522213071L;

        @Override
        protected void onConfigure()
        {
            super.onConfigure();
            
            setVisible(selectedProject.getObject() != null);
        }
    };
    tabPanel.setOutputMarkupPlaceholderTag(true);
    tabContainer.add(tabPanel);
    
    projects = new ProjectSelectionPanel("projects", selectedProject);
    projects.setCreateAction(target -> {
        selectedProject.setObject(new Project());
        // Make sure that default values are loaded
        tabPanel.visitChildren(new ModelChangedVisitor(selectedProject));
    });
    projects.setChangeAction(target -> { 
        target.add(tabContainer);
        // Make sure that any invalid forms are cleared now that we load the new project.
        // If we do not do this, then e.g. input fields may just continue showing the values
        // they had when they were marked invalid.
        tabPanel.visitChildren(new ModelChangedVisitor(selectedProject));
    });
    sidebar.add(projects);

    IModel<String> projectNameModel = PropertyModel.of(selectedProject, "name");
    add(deleteProjectDialog = new ChallengeResponseDialog("deleteProjectDialog",
            new StringResourceModel("DeleteProjectDialog.title", this),
            new StringResourceModel("DeleteProjectDialog.text", this)
                    .setModel(selectedProject).setParameters(projectNameModel),
            projectNameModel));
    deleteProjectDialog.setConfirmAction((target) -> {
        try {
            projectService.removeProject(selectedProject.getObject());
            if (preSelectedModelMode) {
                setResponsePage(getApplication().getHomePage());
            }
            else {
                selectedProject.setObject(null);
                target.add(getPage());
            }
        }
        catch (IOException e) {
            LOG.error("Unable to remove project :" + ExceptionUtils.getRootCauseMessage(e));
            error("Unable to remove project " + ":" + ExceptionUtils.getRootCauseMessage(e));
            target.addChildren(getPage(), IFeedback.class);
        }
    });
}
 
Example 15
Source File: GalleryImageEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public GalleryImageEdit(String id,
		final String userId, final GalleryImage image,
		final long galleryPageIndex) {

	super(id);

	log.debug("GalleryImageEdit()");

	// feedback label for user alert in event remove/set actions fail
	final Label formFeedback = new Label("formFeedback");
	formFeedback.setOutputMarkupPlaceholderTag(true);
	add(formFeedback);

	Form imageEditForm = new Form("galleryImageEditForm");

	imageEditForm.setOutputMarkupId(true);
	add(imageEditForm);

	imageOptionsContainer = new WebMarkupContainer("galleryImageOptionsContainer");
	imageOptionsContainer.setOutputMarkupId(true);
	imageOptionsContainer.setOutputMarkupPlaceholderTag(true);

	imageOptionsContainer.add(new Label("removePictureLabel",
			new ResourceModel("pictures.removepicture")));

	AjaxFallbackButton removePictureButton = createRemovePictureButton(imageEditForm);
	imageOptionsContainer.add(removePictureButton);

	Label setProfileImageLabel = new Label("setProfileImageLabel",
			new ResourceModel("pictures.setprofileimage"));
	imageOptionsContainer.add(setProfileImageLabel);

	AjaxFallbackButton setProfileImageButton = createSetProfileImageButton(imageEditForm);

	if ((true == sakaiProxy.isOfficialImageEnabledGlobally() && 
			false == sakaiProxy.isUsingOfficialImageButAlternateSelectionEnabled())
			|| preferencesLogic.getPreferencesRecordForUser(userId).isUseOfficialImage()) {
		
		setProfileImageLabel.setVisible(false);
		setProfileImageButton.setVisible(false);
	}
	
	imageOptionsContainer.add(setProfileImageButton);

	imageEditForm.add(imageOptionsContainer);

	removeConfirmContainer = new WebMarkupContainer("galleryRemoveImageConfirmContainer");
	removeConfirmContainer.setOutputMarkupId(true);
	removeConfirmContainer.setOutputMarkupPlaceholderTag(true);

	Label removeConfirmLabel = new Label("removePictureConfirmLabel",
			new ResourceModel("pictures.removepicture.confirm"));
	removeConfirmContainer.add(removeConfirmLabel);

	AjaxFallbackButton removeConfirmButton = createRemoveConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	//removeConfirmButton.add(new FocusOnLoadBehaviour());
	removeConfirmContainer.add(removeConfirmButton);

	AjaxFallbackButton removeCancelButton = createRemoveCancelButton(imageEditForm);
	removeConfirmContainer.add(removeCancelButton);

	removeConfirmContainer.setVisible(false);
	imageEditForm.add(removeConfirmContainer);
	
	setProfileImageConfirmContainer = new WebMarkupContainer("gallerySetProfileImageConfirmContainer");
	setProfileImageConfirmContainer.setOutputMarkupId(true);
	setProfileImageConfirmContainer.setOutputMarkupPlaceholderTag(true);
	
	Label setProfileImageConfirmLabel = new Label("setProfileImageConfirmLabel",
			new ResourceModel("pictures.setprofileimage.confirm"));
	setProfileImageConfirmContainer.add(setProfileImageConfirmLabel);

	
	AjaxFallbackButton setProfileImageConfirmButton = createSetProfileImageConfirmButton(
			userId, image, (int) galleryPageIndex, formFeedback,
			imageEditForm);
	
	//setProfileImageConfirmButton.add(new FocusOnLoadBehaviour());
	setProfileImageConfirmContainer.add(setProfileImageConfirmButton);
	
	AjaxFallbackButton setProfileImageCancelButton = createSetProfileImageCancelButton(imageEditForm);
	setProfileImageConfirmContainer.add(setProfileImageCancelButton);

	setProfileImageConfirmContainer.setVisible(false);
	imageEditForm.add(setProfileImageConfirmContainer);
	
	add(new GalleryImageRenderer("galleryImageMainRenderer", image
			.getMainResource()));
}
 
Example 16
Source File: CorrectionPage.java    From webanno with Apache License 2.0 4 votes vote down vote up
private void commonInit()
{
    setVersioned(false);
    
    setModel(Model.of(new AnnotatorStateImpl(Mode.CORRECTION)));
    
    WebMarkupContainer rightSidebar = new WebMarkupContainer("rightSidebar");
    // Override sidebar width from preferences
    rightSidebar.add(new AttributeModifier("style", LambdaModel.of(() -> String
            .format("flex-basis: %d%%;", getModelObject().getPreferences().getSidebarSize()))));
    rightSidebar.setOutputMarkupId(true);
    add(rightSidebar);
    
    rightSidebar.add(detailEditor = createDetailEditor());

    centerArea = new WebMarkupContainer("centerArea");
    centerArea.add(visibleWhen(() -> getModelObject().getDocument() != null));
    centerArea.setOutputMarkupPlaceholderTag(true);
    centerArea.add(createDocumentInfoLabel());
    
    actionBar = new ActionBar("actionBar");
    centerArea.add(actionBar);
    
    annotationEditor = new BratAnnotationEditor("mergeView", getModel(), detailEditor,
            this::getEditorCas);
    centerArea.add(annotationEditor);
    add(centerArea);

    getModelObject().setPagingStrategy(new SentenceOrientedPagingStrategy());
    centerArea.add(getModelObject().getPagingStrategy()
            .createPositionLabel(MID_NUMBER_OF_PAGES, getModel())
            .add(visibleWhen(() -> getModelObject().getDocument() != null))
            .add(LambdaBehavior.onEvent(RenderAnnotationsEvent.class,
                (c, e) -> e.getRequestHandler().add(c))));
    
    List<UserAnnotationSegment> segments = new LinkedList<>();
    UserAnnotationSegment userAnnotationSegment = new UserAnnotationSegment();
    if (getModelObject().getDocument() != null) {
        userAnnotationSegment
                .setSelectionByUsernameAndAddress(annotationSelectionByUsernameAndAddress);
        userAnnotationSegment.setAnnotatorState(getModelObject());
        segments.add(userAnnotationSegment);
    }
    
    suggestionView = new SuggestionViewPanel("correctionView", new ListModel<>(segments))
    {
        private static final long serialVersionUID = 2583509126979792202L;

        @Override
        public void onChange(AjaxRequestTarget aTarget)
        {
            AnnotatorState state = CorrectionPage.this.getModelObject();
            
            aTarget.addChildren(getPage(), IFeedback.class);
            try {
                // update begin/end of the curation segment based on bratAnnotatorModel changes
                // (like sentence change in auto-scroll mode,....
                curationContainer.setState(state);
                CAS editorCas = getEditorCas();
                setCurationSegmentBeginEnd(editorCas);

                suggestionView.updatePanel(aTarget, curationContainer,
                        annotationSelectionByUsernameAndAddress, curationSegment);
                
                annotationEditor.requestRender(aTarget);
                update(aTarget);
            }
            catch (UIMAException e) {
                LOG.error("Error: " + e.getMessage(), e);
                error("Error: " + ExceptionUtils.getRootCauseMessage(e));
            }
            catch (Exception e) {
                LOG.error("Error: " + e.getMessage(), e);
                error("Error: " + e.getMessage());
            }
        }
    };
    centerArea.add(suggestionView);

    curationContainer = new CurationContainer();
    curationContainer.setState(getModelObject());
}
 
Example 17
Source File: ProjectsOverviewPage.java    From inception with Apache License 2.0 4 votes vote down vote up
private WebMarkupContainer createProjectList()
{
    ListView<Project> listview = new ListView<Project>(MID_PROJECT,
            LoadableDetachableModel.of(this::listProjects))
    {
        private static final long serialVersionUID = -755155675319764642L;

        @Override
        protected void populateItem(ListItem<Project> aItem)
        {
            PageParameters pageParameters = new PageParameters().add(
                    ProjectDashboardPage.PAGE_PARAM_PROJECT_ID, aItem.getModelObject().getId());
            BookmarkablePageLink<Void> projectLink = new BookmarkablePageLink<>(
                    MID_PROJECT_LINK, ProjectDashboardPage.class, pageParameters);
            projectLink.add(new Label(MID_NAME, aItem.getModelObject().getName()));
            DateLabel createdLabel = DateLabel.forDatePattern(MID_CREATED,
                () -> aItem.getModelObject().getCreated(), "yyyy-MM-dd");
            addActionsDropdown(aItem);
            aItem.add(projectLink);
            createdLabel.add(visibleWhen(() -> createdLabel.getModelObject() != null));
            aItem.add(createdLabel);
            aItem.add(createRoleBadges(aItem.getModelObject()));
        }

        @Override
        protected void onConfigure()
        {
            super.onConfigure();

            if (getModelObject().isEmpty()) {
                warn("There are no projects accessible to you matching the filter criteria.");
                emptyListLabel.setVisible(true);
            }
            else {
                emptyListLabel.setVisible(false);
            }
        }
    };
    
    WebMarkupContainer projectList = new WebMarkupContainer(MID_PROJECTS);
    projectList.setOutputMarkupPlaceholderTag(true);
    projectList.add(listview);
    
    return projectList;
}
 
Example 18
Source File: OIDCProviderWizardBuilder.java    From syncope with Apache License 2.0 4 votes vote down vote up
public OPContinue(final OIDCProviderTO opTO) {
    final WebMarkupContainer content = new WebMarkupContainer("content");
    this.setOutputMarkupId(true);
    content.setOutputMarkupId(true);
    add(content);

    UrlValidator urlValidator = new UrlValidator();
    final AjaxTextFieldPanel issuer = new AjaxTextFieldPanel(
            "issuer", "issuer", new PropertyModel<>(opTO, "issuer"));
    issuer.addValidator(urlValidator);
    issuer.addRequiredLabel();
    content.add(issuer);

    final AjaxCheckBoxPanel hasDiscovery = new AjaxCheckBoxPanel(
            "hasDiscovery", "hasDiscovery", new PropertyModel<>(opTO, "hasDiscovery"));
    content.add(hasDiscovery);

    final AjaxTextFieldPanel authorizationEndpoint = new AjaxTextFieldPanel("authorizationEndpoint",
            "authorizationEndpoint", new PropertyModel<>(opTO, "authorizationEndpoint"));
    authorizationEndpoint.addRequiredLabel();
    authorizationEndpoint.addValidator(urlValidator);
    content.add(authorizationEndpoint);

    final AjaxTextFieldPanel userinfoEndpoint = new AjaxTextFieldPanel("userinfoEndpoint",
            "userinfoEndpoint", new PropertyModel<>(opTO, "userinfoEndpoint"));
    userinfoEndpoint.addValidator(urlValidator);
    content.add(userinfoEndpoint);

    final AjaxTextFieldPanel tokenEndpoint = new AjaxTextFieldPanel("tokenEndpoint",
            "tokenEndpoint", new PropertyModel<>(opTO, "tokenEndpoint"));
    tokenEndpoint.addRequiredLabel();
    tokenEndpoint.addValidator(urlValidator);
    content.add(tokenEndpoint);

    final AjaxTextFieldPanel jwksUri = new AjaxTextFieldPanel("jwksUri",
            "jwksUri", new PropertyModel<>(opTO, "jwksUri"));
    jwksUri.addRequiredLabel();
    jwksUri.addValidator(urlValidator);
    content.add(jwksUri);

    final AjaxTextFieldPanel endSessionEndpoint = new AjaxTextFieldPanel("endSessionEndpoint",
            "endSessionEndpoint", new PropertyModel<>(opTO, "endSessionEndpoint"));
    endSessionEndpoint.addValidator(urlValidator);
    content.add(endSessionEndpoint);

    final WebMarkupContainer visibleParam = new WebMarkupContainer("visibleParams");
    visibleParam.setOutputMarkupPlaceholderTag(true);
    visibleParam.add(authorizationEndpoint);
    visibleParam.add(userinfoEndpoint);
    visibleParam.add(tokenEndpoint);
    visibleParam.add(jwksUri);
    visibleParam.add(endSessionEndpoint);
    content.add(visibleParam);

    showHide(hasDiscovery, visibleParam);

    hasDiscovery.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            showHide(hasDiscovery, visibleParam);
            target.add(visibleParam);
        }
    });
}
 
Example 19
Source File: RecommenderInfoPanel.java    From inception with Apache License 2.0 4 votes vote down vote up
public RecommenderInfoPanel(String aId, IModel<AnnotatorState> aModel)
{
    super(aId, aModel);
    
    setOutputMarkupId(true);
    
    WebMarkupContainer recommenderContainer = new WebMarkupContainer("recommenderContainer");
    add(recommenderContainer);
    
    ListView<Recommender> searchResultGroups = new ListView<Recommender>("recommender")
    {
        private static final long serialVersionUID = -631500052426449048L;

        @Override
        protected void populateItem(ListItem<Recommender> item)
        {
            User user = userService.getCurrentUser();
            Recommender recommender = item.getModelObject();
            List<EvaluatedRecommender> activeRecommenders = recommendationService
                    .getActiveRecommenders(user, recommender.getLayer());
            Optional<EvaluationResult> evalResult = activeRecommenders.stream()
                    .filter(r -> r.getRecommender().equals(recommender))
                    .map(EvaluatedRecommender::getEvaluationResult)
                    .findAny();
            item.add(new Label("name", recommender.getName()));
            item.add(new Label("state", evalResult.isPresent() ? "active" : "off"));

            item.add(new LambdaAjaxLink("acceptAll", _target -> 
                    actionAcceptAll(_target, recommender)));
            
            WebMarkupContainer resultsContainer = new WebMarkupContainer("resultsContainer");
            // Show results only if the evaluation was not skipped (and of course only if the
            // result is actually present).
            resultsContainer.setVisible(evalResult.map(r -> !r.isEvaluationSkipped())
                    .orElse(evalResult.isPresent()));
            resultsContainer.add(new Label("f1Score",
                    evalResult.map(EvaluationResult::computeF1Score).orElse(0.0d)));
            resultsContainer.add(new Label("accuracy",
                    evalResult.map(EvaluationResult::computeAccuracyScore).orElse(0.0d)));
            resultsContainer.add(new Label("precision",
                    evalResult.map(EvaluationResult::computePrecisionScore).orElse(0.0d)));
            resultsContainer.add(new Label("recall",
                    evalResult.map(EvaluationResult::computeRecallScore).orElse(0.0d)));
            item.add(resultsContainer);
        }
    };
    IModel<List<Recommender>> recommenders = LoadableDetachableModel.of(() -> 
            recommendationService.listEnabledRecommenders(aModel.getObject().getProject()));
    searchResultGroups.setModel(recommenders);
    
    recommenderContainer.add(visibleWhen(() -> !recommenders.getObject().isEmpty()));
    recommenderContainer.add(searchResultGroups);

    WebMarkupContainer noRecommendersWarning = new WebMarkupContainer("noRecommendersWarning");
    noRecommendersWarning.setOutputMarkupPlaceholderTag(true);
    noRecommendersWarning.add(visibleWhen(() -> recommenders.getObject().isEmpty()));
    add(noRecommendersWarning);
}
 
Example 20
Source File: RecommendationSidebar.java    From inception with Apache License 2.0 4 votes vote down vote up
public RecommendationSidebar(String aId, IModel<AnnotatorState> aModel,
        AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
        AnnotationPage aAnnotationPage)
{
    super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage);
    
    IModel<Preferences> modelPreferences = LambdaModelAdapter.of(
        () -> recommendationService.getPreferences(aModel.getObject().getUser(),
                aModel.getObject().getProject()),
        (v) -> recommendationService.setPreferences(aModel.getObject().getUser(),
                aModel.getObject().getProject(), v));

    warning = new WebMarkupContainer("warning");
    warning.setOutputMarkupPlaceholderTag(true);
    add(warning);
    tipModel = new StringResourceModel("mismatch", this);
    TooltipBehavior tip = new TooltipBehavior(tipModel);
    tip.setOption("width", Options.asString("300px"));
    warning.add(tip);
    
    add(new LambdaAjaxLink("showLog", this::actionShowLog));
    
    add(new LambdaAjaxLink("retrain", this::actionRetrain));
    
    form = new Form<>("form", CompoundPropertyModel.of(modelPreferences));

    form.add(new NumberTextField<Integer>("maxPredictions", Integer.class)
            .setMinimum(1)
            .setMaximum(10)
            .setStep(1));

    form.add(new CheckBox("showAllPredictions").setOutputMarkupId(true));

    form.add(new LambdaAjaxButton<>("save", (_target, _form) -> 
            aAnnotationPage.actionRefreshDocument(_target)));
    
    add(form);

    add(new LearningCurveChartPanel(LEARNING_CURVE, aModel));
    
    recommenderInfos = new RecommenderInfoPanel("recommenders", aModel);
    add(recommenderInfos);
    
    logDialog = new LogDialog("logDialog", Model.of("Recommender Log"));
    add(logDialog);
}