Java Code Examples for org.apache.wicket.ajax.AjaxRequestTarget#add()

The following examples show how to use org.apache.wicket.ajax.AjaxRequestTarget#add() . 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: GalleryImageEdit.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private AjaxFallbackButton createSetProfileImageCancelButton(Form imageEditForm) {
	AjaxFallbackButton removeCancelButton = new AjaxFallbackButton(
			"gallerySetProfileImageCancelButton", new ResourceModel(
					"button.cancel"), imageEditForm) {

		@Override
		protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
			target.appendJavaScript("$('#"
					+ setProfileImageConfirmContainer.getMarkupId() + "').hide();");

			imageOptionsContainer.setVisible(true);
			target.add(imageOptionsContainer);

			target.appendJavaScript("setMainFrameHeight(window.name);");
		}

	};
	return removeCancelButton;
}
 
Example 2
Source File: LinkToSocialNetworkPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private void onSocialImageClick(AjaxRequestTarget target, IModel<OAuth2Service> model) {
    OAuth2Service service = model.getObject();
    OAuth2ServiceContext ctx = createOAuth2ServiceContext(service);
    ctx.setSocialNetworkLink(true);
    DBClosure.sudoConsumer(db -> ctx.save());
    String url = ctx.getAuthorizationUrl();
    target.appendJavaScript(String.format("window.open('%s', '_blank', 'height=570,width=520')", url));


    Map<String, Object> macros = new HashMap<>();
    macros.put("network", new ResourceModel(service.getProvider().getLabel()).getObject());

    feedbackLabel.setDefaultModel(new StringResourceModel("info.social.network.added", new MapModel<>(macros)));
    feedbackLabel.setVisible(true);
    target.add(feedbackLabel);
}
 
Example 3
Source File: FormPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
protected void onCancel(AjaxRequestTarget target) {
	setVisible(false);
	target.add(this);

	form.clearInput();
	target.add(form);

	contentPanel.onCancel(target);
}
 
Example 4
Source File: OAuthForm.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
	oauthDao.update(getModelObject(), getUserId());
	OAuthServer oauthServer = oauthDao.get(getModelObject().getId());
	this.setModelObject(oauthServer);
	setNewVisible(false);
	target.add(this);
	target.add(listContainer);
}
 
Example 5
Source File: RootConceptsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
private void actionNewRootConcept(AjaxRequestTarget aTarget) {
    ValueFactory vf = SimpleValueFactory.getInstance();
    IRI concept = vf.createIRI(newConceptIRIString.getObject());
    if (isConceptValid(kbModel.getObject().getKb(), concept, true)) {
        concepts.add(concept);
        newConceptIRIString.setObject(null);
    }
    else {
        error("Concept [" + newConceptIRIString.getObject()
                + "] does not exist or has already been specified");
        aTarget.addChildren(getPage(), IFeedback.class);
    }
    aTarget.add(this);
}
 
Example 6
Source File: AccessSpecificSettingsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
private void actionClear(AjaxRequestTarget aTarget)
{
    try {
        kbService.clear(kbModel.getObject().getKb());
        info(getString("kb.details.local.contents.clear.feedback", kbModel.bind("kb")));
        aTarget.add(this);
        aTarget.addChildren(getPage(), IFeedback.class);
    }
    catch (RepositoryException e) {
        error("Error clearing KB: " + e.getMessage());
        log.error("Error clearing KB", e);
        aTarget.addChildren(getPage(), IFeedback.class);
    }
}
 
Example 7
Source File: CurationPage.java    From webanno with Apache License 2.0 5 votes vote down vote up
public void updatePanel(AjaxRequestTarget aTarget, CurationContainer aCC)
    throws UIMAException, ClassNotFoundException, IOException, AnnotationException
{
    commonUpdate();
    
    // Render the main annotation editor (upper part)
    annotationEditor.requestRender(aTarget);
    
    // Render the user annotation segments (lower part)
    suggestionViewPanel.updatePanel(aTarget, aCC, annotationSelectionByUsernameAndAddress,
            curationView);
    
    // Render the sentence list sidebar
    aTarget.add(sentencesListView);
}
 
Example 8
Source File: TagSetEditorPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
private void actionSave(AjaxRequestTarget aTarget, Form<Tag> aForm) {
    if (isNull(selectedTagSet.getObject().getId())) {
        if (annotationSchemaService.existsTagSet(selectedTagSet.getObject()
                .getName(), selectedProject.getObject())) {
            error("Only one tagset per project is allowed!");
        }
    }
    
    selectedTagSet.getObject().setProject(selectedProject.getObject());
    annotationSchemaService.createTagSet(selectedTagSet.getObject());
    
    // Reload whole page because master panel also needs to be reloaded.
    aTarget.add(getPage());
}
 
Example 9
Source File: HeaderPanel.java    From JPPF with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
public HeaderPanel() {
  super("jppf.header");
  final String user = JPPFWebSession.getSignedInUser();
  final Locale locale = Session.get().getLocale();
  final String s = (user != null)
    ? LocalizationUtils.getLocalized(getClass().getName(), "jppf.header.user.label", locale) + " " + user
    : LocalizationUtils.getLocalized(getClass().getName(), "jppf.header.not.signed_in.label", locale);
  add(new Label("jppf.header.user", Model.of(s)));
  final Form<String> form = new Form<>("login.signout.form");
  final AjaxButton link = new AjaxButton("login.signout.link", Model.of("Sign out")) {
    @Override
    protected void onSubmit(final AjaxRequestTarget target) {
      AuthenticatedWebSession.get().signOut();
      AuthenticatedWebSession.get().invalidate();
      target.add(getForm());
      setResponsePage(getApplication().getHomePage());
    }
  };

  form.add(link);
  showIPCheckBox = new AjaxCheckBox("jppf.header.show.ip", Model.of(JPPFWebSession.get().isShowIP())) {
    @Override
    protected void onUpdate(final AjaxRequestTarget target) {
      final Boolean newSelection = this.getModelObject();
      JPPFWebSession.get().setShowIP((newSelection != null) && newSelection);
    }
  };
  form.add(showIPCheckBox);
  form.setVisible(user != null);
  link.setVisible(user != null);
  add(form);
}
 
Example 10
Source File: LabelsForm.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
	try {
		LabelDao.update(panel.language.getValue(), getModelObject());
	} catch (Exception e) {
		error("Unexpected error while saving label:" + e.getMessage());
	}
	setNewVisible(false);
	target.add(panel.listContainer);
}
 
Example 11
Source File: ComponentVisualErrorBehaviour.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Changes the CSS class of the linked {@link FormComponent} via AJAX.
 *
 * @param ajaxRequestTarget of type AjaxRequestTarget
 * @param valid Was the validation succesful?
 * @param cssClass The CSS class that must be set on the linked {@link FormComponent}
 */
private void changeCssClass(AjaxRequestTarget ajaxRequestTarget, boolean valid, String cssClass) {
    FormComponent formComponent = getFormComponent();

    if(formComponent.isValid() == valid){
        formComponent.add(new AttributeModifier("class", true, new Model("formInputField " + cssClass)));
        ajaxRequestTarget.add(formComponent);
    }

    if(updateComponent!=null){
        ajaxRequestTarget.add(updateComponent);
    }
}
 
Example 12
Source File: AbstractSettingsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public void onChange(Form<?> form, AjaxRequestTarget target) {
	try {                  
		beforeChange(form, target);
    	storageService.modifyEntity((Settings)form.getModelObject());
    	afterChange(form, target);
    	add(new AlertBehavior(getString("Settings.save")));
    } catch (Exception e) {
        e.printStackTrace();
        add(new AlertBehavior(e.getMessage()));            
    }  
    target.add(this);
}
 
Example 13
Source File: LdapForm.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
	LdapConfig ldapConfig = this.getModelObject();
	if (ldapConfig.getId() != null) {
		ldapConfig = ldapDao.get(ldapConfig.getId());
	} else {
		ldapConfig = new LdapConfig();
	}
	this.setModelObject(ldapConfig);
	target.add(this);
}
 
Example 14
Source File: CreatePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private void resetEdit(AjaxRequestTarget target) {
	addTextModel.setObject(getString("add"));
	editIndex = -1;
	oldColumnIndex = -1;
	oldFilterIndex = -1;
	oldSortIndex = -1;
	oldGroupIndex = -1;
	target.add(label);
}
 
Example 15
Source File: GroupPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private void resetEdit(AjaxRequestTarget target) {
	addTextModel.setObject(getString("add")); 					
	editIndex = -1;
	target.add(label);
}
 
Example 16
Source File: LoginPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
private void onFailedLogin(AjaxRequestTarget target) {
    error(getLocalizer().getString("login.panel.error", this));
    target.add(LoginPanel.this);
}
 
Example 17
Source File: DashboardPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void refreshGlobalSettings(AjaxRequestTarget target) {
	target.add(globalSettingsLink);
}
 
Example 18
Source File: AdvancedSearchPanel.java    From onedev with MIT License 4 votes vote down vote up
private void onSelectTab(AjaxRequestTarget target) {
	WebSession.get().setMetaData(ACTIVE_TAB, option.getClass());
	SearchOptionEditor editor = newSearchOptionEditor(option);
	form.replace(editor);
	target.add(editor);
}
 
Example 19
Source File: WidgetPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void refresh(AjaxRequestTarget target) {
	addWidgetView(((Widget)this.getModel().getObject()).isCollapsed());
	target.add(this);
}
 
Example 20
Source File: ArtifactFollowActionsPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
protected void refresh(AjaxRequestTarget target) {
	target.add(getPage());
}