List of usage examples for org.apache.wicket.ajax AjaxRequestTarget appendJavaScript
void appendJavaScript(CharSequence javascript);
If the javascript needs to do something asynchronously (i.e.
From source file:org.apache.openmeetings.web.admin.users.UserForm.java
License:Apache License
@Override protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { User u = getModelObject();//from w ww . j a v a 2 s . co m try { boolean isNew = (u.getId() == null); u = getBean(UserDao.class).update(u, generalForm.getPasswordField().getConvertedInput(), getUserId()); boolean sendEmailAtRegister = (1 == getBean(ConfigurationDao.class).getConfValue("sendEmailAtRegister", Integer.class, "0")); if (isNew && sendEmailAtRegister) { String link = getBean(ConfigurationDao.class).getBaseUrl(); String sendMail = getBean(EmailManager.class).sendMail(login.getValue(), generalForm.getPasswordField().getConvertedInput(), generalForm.getEmail(), link, false, null); if (!sendMail.equals("success")) { throw new Exception("Mail for new user is not sent"); } } } catch (Exception e) { // FIXME update feedback with the error details log.error("[onSaveSubmit]: ", e); } setModelObject(u); hideNewRecord(); target.add(this); target.add(listContainer); target.appendJavaScript("omUserPanelInit();"); if (u.getGroupUsers().isEmpty()) { warning.open(target); } }
From source file:org.apache.openmeetings.web.admin.users.UserForm.java
License:Apache License
public void update(AjaxRequestTarget target) { updateDomain(target);// w w w.j av a2 s . c o m if (target != null) { target.add(this, listContainer); target.appendJavaScript("omUserPanelInit();"); } }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigForm.java
License:Apache License
@Override protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { Application.getBean(ConfigurationDao.class).update(getModelObject(), WebSession.getUserId()); Configuration conf = Application.getBean(ConfigurationDao.class) .get(getModelObject().getConfiguration_id()); this.setModelObject(conf); hideNewRecord();/*from ww w .ja v a2 s. co m*/ target.add(this); target.add(listContainer); target.appendJavaScript("omConfigPanelInit();"); }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigForm.java
License:Apache License
@Override protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) { this.setModelObject(new Configuration()); target.add(this); target.appendJavaScript("omConfigPanelInit();"); }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigForm.java
License:Apache License
@Override protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { Configuration conf = this.getModelObject(); if (conf.getConfiguration_id() != null) { conf = Application.getBean(ConfigurationDao.class).get(conf.getConfiguration_id()); } else {/*from ww w .j ava 2s .c o m*/ conf = new Configuration(); } this.setModelObject(conf); target.add(this); target.appendJavaScript("omConfigPanelInit();"); }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigForm.java
License:Apache License
@Override protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) { Application.getBean(ConfigurationDao.class).delete(this.getModelObject(), WebSession.getUserId()); this.setModelObject(new Configuration()); target.add(listContainer);/* w w w.j a va2 s. co m*/ target.add(this); target.appendJavaScript("omConfigPanelInit();"); }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigsPanel.java
License:Apache License
@Override public void onMenuPanelLoad(AjaxRequestTarget target) { target.appendJavaScript("omConfigPanelInit();"); }
From source file:org.apache.openmeetings.web.components.admin.configurations.ConfigsPanel.java
License:Apache License
@SuppressWarnings("unchecked") public ConfigsPanel(String id) { super(id);/*w w w . j ava 2s . c o m*/ SearchableDataView<Configuration> dataView = new SearchableDataView<Configuration>("configList", new SearchableDataProvider<Configuration>(ConfigurationDao.class)) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(final Item<Configuration> item) { final Configuration configuration = item.getModelObject(); item.add(new Label("configuration_id", "" + configuration.getConfiguration_id())); item.add(new Label("conf_key", "" + configuration.getConf_key())); item.add(new Label("conf_value", "" + configuration.getConf_value())); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.hideNewRecord(); form.setModelObject(configuration); target.add(form); target.appendJavaScript("omConfigPanelInit();"); } }); item.add(AttributeModifier.replace("class", "clickable " + ((item.getIndex() % 2 == 1) ? "even" : "odd"))); } }; final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<Configuration> container = new DataViewContainer<Configuration>(listContainer, dataView); container.setLinks(new OrderByBorder<Configuration>("orderById", "configuration_id", container), new OrderByBorder<Configuration>("orderByKey", "conf_key", container), new OrderByBorder<Configuration>("orderByValue", "conf_value", container)); add(container.orderLinks); add(new PagedEntityListPanel("navigator", dataView) { private static final long serialVersionUID = 5097048616003411362L; @Override protected void onEvent(AjaxRequestTarget target) { target.add(listContainer); } }); form = new ConfigForm("form", listContainer, new Configuration()); form.showNewRecord(); add(form); }
From source file:org.apache.openmeetings.web.components.admin.groups.AddUsersForm.java
License:Apache License
public AddUsersForm(String id, final GroupForm groupForm) { super(id);// w ww . ja v a2 s .com IModel<List<User>> listUsersModel = new PropertyModel<List<User>>(AddUsersForm.this, "usersInList"); IModel<List<User>> selectedUsersModel = new PropertyModel<List<User>>(AddUsersForm.this, "usersToAdd"); final ListMultipleChoice<User> users = new ListMultipleChoice<User>("users", selectedUsersModel, listUsersModel, new IChoiceRenderer<User>() { private static final long serialVersionUID = 1L; public Object getDisplayValue(User object) { return getUser(object); } public String getIdValue(User object, int index) { return "" + object.getUser_id(); } }); add(new TextField<String>("searchText", new PropertyModel<String>(AddUsersForm.this, "userSearchText"))); add(new AjaxButton("search", Model.of(WebSession.getString(182L))) { private static final long serialVersionUID = -4752180617634945030L; protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { clear(); usersInList.addAll(Application.getBean(UsersDao.class).get(userSearchText)); target.add(users); } }); add(users.setOutputMarkupId(true)); add(new AjaxButton("add", Model.of(WebSession.getString(175L))) { private static final long serialVersionUID = 5553555064487161840L; protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { UsersDao userDao = Application.getBean(UsersDao.class); for (User u : usersToAdd) { List<Organisation_Users> orgUsers = u.getOrganisation_users(); boolean found = false; for (Organisation_Users ou : orgUsers) { if (ou.getOrganisation().getOrganisation_id().equals(organisation.getOrganisation_id())) { found = true; break; } } if (!found) { Organisation_Users orgUser = new Organisation_Users(organisation); orgUser.setDeleted(false); orgUsers.add(orgUser); userDao.update(u, WebSession.getUserId()); } } target.appendJavaScript("$('#addUsers').dialog('close');"); groupForm.updateView(target); } }); }
From source file:org.apache.openmeetings.web.components.admin.groups.GroupForm.java
License:Apache License
void updateView(AjaxRequestTarget target) { usersPanel.update(getOrgId()); target.add(this); target.appendJavaScript("groupsInit();"); }