List of usage examples for org.apache.wicket.ajax AjaxEventBehavior AjaxEventBehavior
public AjaxEventBehavior(String event)
From source file:org.apache.openmeetings.web.components.admin.labels.LangPanel.java
License:Apache License
@SuppressWarnings("unchecked") public LangPanel(String id) { super(id);/*from w w w . ja v a 2 s.c o m*/ FieldLanguageDao langDao = Application.getBean(FieldLanguageDao.class); language = langDao.getFieldLanguageById(1L); Fieldlanguagesvalues flv = new Fieldlanguagesvalues(); flv.setLanguage_id(language.getLanguage_id()); final LabelsForm form = new LabelsForm("form", this, flv); form.showNewRecord(); add(form); final SearchableDataView<Fieldvalues> dataView = new SearchableDataView<Fieldvalues>("langList", new SearchableDataProvider<Fieldvalues>(FieldValueDao.class) { private static final long serialVersionUID = -6822789354860988626L; @Override public long size() { return search == null ? Application.getBean(FieldValueDao.class).count() : Application.getBean(FieldValueDao.class).count(language.getLanguage_id(), search); } public Iterator<? extends Fieldvalues> iterator(long first, long count) { return (search == null && getSort() == null ? Application.getBean(FieldValueDao.class).get(language.getLanguage_id(), (int) first, (int) count) : Application.getBean(FieldValueDao.class).get(language.getLanguage_id(), search, (int) first, (int) count, getSortStr())).iterator(); } }) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(final Item<Fieldvalues> item) { final Fieldvalues fv = item.getModelObject(); item.add(new Label("lblId", "" + fv.getFieldvalues_id())); item.add(new Label("name", fv.getName())); item.add(new Label("value", fv.getFieldlanguagesvalue() != null ? fv.getFieldlanguagesvalue().getValue() : null)); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.setModelObject(fv.getFieldlanguagesvalue()); form.hideNewRecord(); target.add(form); target.appendJavaScript("labelsInit();"); } }); item.add(AttributeModifier.append("class", "clickable " + ((item.getIndex() % 2 == 1) ? "even" : "odd"))); } }; listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<Fieldvalues> container = new DataViewContainer<Fieldvalues>(listContainer, dataView); container.setLinks(new OrderByBorder<Fieldvalues>("orderById", "fieldvalues.fieldvalues_id", container), new OrderByBorder<Fieldvalues>("orderByName", "fieldvalues.name", container), new OrderByBorder<Fieldvalues>("orderByValue", "value", container)); add(container.orderLinks); add(new PagedEntityListPanel("navigator", dataView) { private static final long serialVersionUID = 5097048616003411362L; @Override protected void onEvent(AjaxRequestTarget target) { dataView.modelChanging(); target.add(listContainer); } }); langForm = new LangForm("langForm", listContainer, this); add(langForm); add(new AddLanguageForm("addLangForm", this)); }
From source file:org.apache.openmeetings.web.components.admin.ldaps.LdapsPanel.java
License:Apache License
@SuppressWarnings("unchecked") public LdapsPanel(String id) { super(id);/*w w w.j a va 2s . c o m*/ SearchableDataView<LdapConfig> dataView = new SearchableDataView<LdapConfig>("ldapList", new SearchableDataProvider<LdapConfig>(LdapConfigDao.class)) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(final Item<LdapConfig> item) { final LdapConfig ldapConfig = item.getModelObject(); item.add(new Label("ldapConfigId", "" + ldapConfig.getLdapConfigId())); item.add(new Label("name", "" + ldapConfig.getName())); item.add(new Label("configFileName", "" + ldapConfig.getConfigFileName())); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.setModelObject(ldapConfig); form.hideNewRecord(); target.add(form); target.appendJavaScript("omLdapPanelInit();"); } }); item.add(AttributeModifier.replace("class", (item.getIndex() % 2 == 1) ? "even" : "odd")); } }; final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<LdapConfig> container = new DataViewContainer<LdapConfig>(listContainer, dataView); container.setLinks(new OrderByBorder<LdapConfig>("orderById", "ldapConfigId", container), new OrderByBorder<LdapConfig>("orderByName", "name", container), new OrderByBorder<LdapConfig>("orderByFile", "configFileName", container)); add(container.orderLinks); add(new PagedEntityListPanel("navigator", dataView) { private static final long serialVersionUID = -1L; @Override protected void onEvent(AjaxRequestTarget target) { target.add(listContainer); } }); form = new LdapForm("form", listContainer, new LdapConfig()); form.showNewRecord(); add(form); }
From source file:org.apache.openmeetings.web.components.admin.rooms.RoomsPanel.java
License:Apache License
@SuppressWarnings("unchecked") public RoomsPanel(String id) { super(id);//from w w w. j a va 2s .c om SearchableDataView<Room> dataView = new SearchableDataView<Room>("roomList", new SearchableDataProvider<Room>(RoomDao.class)) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(final Item<Room> item) { final Room room = item.getModelObject(); item.add(new Label("rooms_id", "" + room.getRooms_id())); item.add(new Label("name", "" + room.getName())); item.add(new Label("ispublic", "" + room.getIspublic())); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.setModelObject(room); form.hideNewRecord(); target.add(form); target.appendJavaScript("omRoomPanelInit();"); } }); item.add(AttributeModifier.replace("class", (item.getIndex() % 2 == 1) ? "even" : "odd")); } }; final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<Room> container = new DataViewContainer<Room>(listContainer, dataView); container.setLinks(new OrderByBorder<Room>("orderById", "rooms_id", container), new OrderByBorder<Room>("orderByName", "name", container), new OrderByBorder<Room>("orderByPublic", "ispublic", container)); add(container.orderLinks); add(new PagedEntityListPanel("navigator", dataView) { private static final long serialVersionUID = -1L; @Override protected void onEvent(AjaxRequestTarget target) { target.add(listContainer); } }); form = new RoomForm("form", new Room()); form.showNewRecord(); add(form); }
From source file:org.apache.openmeetings.web.components.admin.servers.ServersPanel.java
License:Apache License
@SuppressWarnings("unchecked") public ServersPanel(String id) { super(id);/*from ww w .j a va 2 s .c o m*/ SearchableDataView<Server> dataView = new SearchableDataView<Server>("serverList", new SearchableDataProvider<Server>(ServerDao.class)) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(final Item<Server> item) { final Server Server = item.getModelObject(); item.add(new Label("id", "" + Server.getId())); item.add(new Label("name", "" + Server.getName())); item.add(new Label("address", "" + Server.getAddress())); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.setModelObject(Server); form.hideNewRecord(); target.add(form); target.appendJavaScript("omServerPanelInit();"); } }); item.add(AttributeModifier.replace("class", (item.getIndex() % 2 == 1) ? "even" : "odd")); } }; final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<Server> container = new DataViewContainer<Server>(listContainer, dataView); container.setLinks(new OrderByBorder<Server>("orderById", "id", container), new OrderByBorder<Server>("orderByName", "name", container), new OrderByBorder<Server>("orderByAddress", "address", 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 ServerForm("form", listContainer, new Server()); form.showNewRecord(); add(form); }
From source file:org.apache.openmeetings.web.components.admin.users.UsersPanel.java
License:Apache License
@SuppressWarnings("unchecked") public UsersPanel(String id) { super(id);/* w w w .ja v a2 s .c om*/ final SearchableDataView<User> dataView = new SearchableDataView<User>("userList", new SearchableDataProvider<User>(UsersDao.class)) { private static final long serialVersionUID = 8715559628755439596L; @Override protected void populateItem(Item<User> item) { final User u = item.getModelObject(); item.add(new Label("userId", "" + u.getUser_id())); item.add(new Label("login", u.getLogin())); item.add(new Label("firstName", u.getFirstname())); item.add(new Label("lastName", u.getLastname())); item.add(AttributeModifier.append("class", "clickable " + ((item.getIndex() % 2 == 1) ? "even" : "odd"))); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = -8069413566800571061L; protected void onEvent(AjaxRequestTarget target) { form.setModelObject(u); form.hideNewRecord(); target.add(form); //re-initialize height target.appendJavaScript("omUserPanelInit();"); } }); } }; final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); add(listContainer.add(dataView).setOutputMarkupId(true)); DataViewContainer<User> container = new DataViewContainer<User>(listContainer, dataView); container.setLinks(new OrderByBorder<User>("orderById", "user_id", container), new OrderByBorder<User>("orderByLogin", "login", container), new OrderByBorder<User>("orderByFirstName", "firstname", container), new OrderByBorder<User>("orderByLastName", "lastname", container)); add(container.orderLinks); add(new PagedEntityListPanel("navigator", dataView) { private static final long serialVersionUID = 5097048616003411362L; @Override protected void onEvent(AjaxRequestTarget target) { target.add(listContainer); } }); UsersDao usersDaoImpl = Application.getBean(UsersDao.class); form = new UserForm("form", listContainer, usersDaoImpl.getNewUserInstance(usersDaoImpl.get(WebSession.getUserId()))); form.showNewRecord(); add(form); }
From source file:org.apache.openmeetings.web.room.sidebar.RoomFilePanel.java
License:Apache License
@Override protected Component getUpload() { return super.getUpload().setVisible(true).add(new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override/*from www. j av a 2s. c o m*/ protected void onEvent(AjaxRequestTarget target) { room.getSidebar().showUpload(target); } }); }
From source file:org.apache.openmeetings.web.user.chat.ChatToolbar.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); BasePage page = (BasePage) getPage(); add(toolbar.add(new WebMarkupContainer("hyperlink").add( AttributeModifier.append("class", page.isRtl() ? "dropdown-menu-left" : "dropdown-menu-right")))); add(download);/*ww w . j ava2 s.c o m*/ delBtn = new ConfirmableAjaxBorder("delete", getString("80"), getString("832"), chatForm) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { final String scope = chatForm.getScope(); final boolean admin = hasAdminLevel(getRights()); chatForm.process(() -> { if (admin) { chatDao.deleteGlobal(); WebSocketHelper.sendAll(cleanMsg(ID_ALL).toString()); } return true; }, r -> { if (admin || isModerator(cm, getUserId(), r.getId())) { chatDao.deleteRoom(r.getId()); WebSocketHelper.sendRoom(r.getId(), cleanMsg(scope)); } return true; }, u -> { chatDao.deleteUser(u.getId()); WebSocketHelper.sendUser(u.getId(), cleanMsg(scope)); return true; }); } }; toolbar.add(delBtn.setVisible(hasAdminLevel(getRights())).setOutputMarkupId(true) .setOutputMarkupPlaceholderTag(true)); toolbar.add(save.setVisible(hasAdminLevel(getRights())).setOutputMarkupId(true) .setOutputMarkupPlaceholderTag(true).add(new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { download.initiate(target); } })); }
From source file:org.apache.openmeetings.web.user.dashboard.StartWidgetView.java
License:Apache License
public StartWidgetView(String id, Model<Widget> model) { super(id, model); add(new WebMarkupContainer("step1").add(new PublicRoomsEventBehavior())); add(new WebMarkupContainer("step2").add(new PublicRoomsEventBehavior())); add(new WebMarkupContainer("step3").add(new PublicRoomsEventBehavior())); add(new WebMarkupContainer("step4").add(new PublicRoomsEventBehavior())); add(new Label("123msg", Application.getString(804)).setEscapeModelStrings(false)); add(new Button("start").add(new PublicRoomsEventBehavior())); add(new Button("calendar").add(new AjaxEventBehavior("click") { private static final long serialVersionUID = 1L; @Override/*from w ww.ja va 2 s. c o m*/ protected void onEvent(AjaxRequestTarget target) { ((MainPage) getPage()).updateContents(CALENDAR, target); } })); }
From source file:org.apache.openmeetings.web.user.MessageDialog.java
License:Apache License
public MessageDialog(String id, CompoundPropertyModel<PrivateMessage> model) { super(id, Application.getString(1209), model); form = new Form<PrivateMessage>("form", getModel()); form.add(feedback.setOutputMarkupId(true)); form.add(new UserMultiChoice("to", modelTo).setRequired(true)); form.add(new TextField<String>("subject")); DefaultWysiwygToolbar toolbar = new DefaultWysiwygToolbar("toolbarContainer"); form.add(toolbar);/* ww w .j av a 2s . c o m*/ form.add(new WysiwygEditor("message", toolbar)); form.add(roomParamsBlock.setOutputMarkupId(true)); final CheckBox bookedRoom = new CheckBox("bookedRoom"); form.add(bookedRoom.setOutputMarkupId(true).add(new AjaxEventBehavior("click") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { PrivateMessage p = MessageDialog.this.getModelObject(); p.setBookedRoom(!p.isBookedRoom()); roomParams.setVisible(p.isBookedRoom()); target.add(bookedRoom, roomParamsBlock); } })); roomParamsBlock.add(roomParams); roomParams.add(new RoomTypeDropDown("room.type")); roomParams.add(start); roomParams.add(end); add(form.setOutputMarkupId(true)); }
From source file:org.apache.openmeetings.web.user.profile.EditProfileForm.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); add(passwd.setLabel(new ResourceModel("current.password")).setRequired(true).setVisible(checkPassword)); add(actions = new FormActionsPanel<User>("buttons", this) { private static final long serialVersionUID = 1L; private void refreshUser() { User u = getModelObject();//ww w . j a v a2 s. c o m if (u.getId() != null) { u = userDao.get(u.getId()); } else { u = new User(); } setModelObject(u); } @Override protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { try { userDao.update(getModelObject(), null, getUserId()); } catch (Exception e) { error(e.getMessage()); } refreshUser(); target.add(EditProfileForm.this); } @Override protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { refreshUser(); target.add(EditProfileForm.this); } @Override protected void onPurgeSubmit(AjaxRequestTarget target, Form<?> form) { userDao.purge(getModelObject(), getUserId()); WebSession.get().invalidateNow(); setResponsePage(Application.get().getSignInPageClass()); } }); add(new WebMarkupContainer("changePwd") .add(new ButtonBehavior("#changePwd"), new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { chPwdDlg.open(target); } }).setVisible(checkPassword)); add(userForm); add(new UploadableProfileImagePanel("img", getUserId())); add(new ComunityUserForm("comunity", getModel())); // attach an ajax validation behavior to all form component's keydown // event and throttle it down to once per second add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND)); add(new BookmarkablePageLink<>("link", PrivacyPage.class)); }