Search in sources :

Example 1 with IPartialPageRequestHandler

use of org.apache.wicket.core.request.handler.IPartialPageRequestHandler in project openmeetings by apache.

the class PollResultsDialog method onInitialize.

@Override
protected void onInitialize() {
    getTitle().setObject(getString("37"));
    cancel = new DialogButton("cancel", getString("lbl.cancel"));
    close = new DialogButton("close", getString("1418"));
    delete = new DialogButton("delete", getString("1420"));
    add(closeConfirm = new MessageDialog("closeConfirm", getString("1418"), getString("1419"), DialogButtons.YES_NO, DialogIcon.WARN) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            if (button != null && button.match(YES)) {
                Long id = dispForm.getModelObject().getId();
                pollDao.close(roomId);
                selForm.updateModel(handler);
                RoomPoll p = pollDao.get(id);
                selForm.select.setModelObject(p);
                dispForm.updateModel(p, true, handler);
                sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
            }
        }
    });
    add(deleteConfirm = new MessageDialog("deleteConfirm", getString("1420"), getString("1421"), DialogButtons.YES_NO, DialogIcon.WARN) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            if (button != null && button.match(YES)) {
                pollDao.delete(dispForm.getModelObject());
                selForm.updateModel(handler);
                dispForm.updateModel(selForm.select.getModelObject(), true, handler);
                sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
            }
        }
    });
    super.onInitialize();
}
Also used : DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) MainPanel(org.apache.openmeetings.web.common.MainPanel) RoomMessage(org.apache.openmeetings.db.util.ws.RoomMessage) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) MessageDialog(com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll)

Example 2 with IPartialPageRequestHandler

use of org.apache.wicket.core.request.handler.IPartialPageRequestHandler in project openmeetings by apache.

the class UsersPanel method onInitialize.

@Override
protected void onInitialize() {
    final MessageDialog warning = new MessageDialog("warning", getString("797"), getString("warn.nogroup"), DialogButtons.OK, DialogIcon.WARN) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
        // no-op
        }
    };
    form = new UserForm("form", listContainer, userDao.getNewUserInstance(userDao.get(getUserId())), warning);
    form.showNewRecord();
    add(form, warning);
    super.onInitialize();
}
Also used : DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) MessageDialog(com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)

Example 3 with IPartialPageRequestHandler

use of org.apache.wicket.core.request.handler.IPartialPageRequestHandler in project openmeetings by apache.

the class GeneralUserForm method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    add(email);
    email.setLabel(Model.of(getString("119")));
    email.add(RfcCompliantEmailAddressValidator.getInstance());
    add(new DropDownChoice<>("salutation", Arrays.asList(Salutation.values()), new ChoiceRenderer<Salutation>() {

        private static final long serialVersionUID = 1L;

        @Override
        public Object getDisplayValue(Salutation object) {
            return getString("user.salutation." + object.name());
        }

        @Override
        public String getIdValue(Salutation object, int index) {
            return object.name();
        }
    }));
    add(new TextField<String>("firstname"));
    add(new TextField<String>("lastname"));
    add(new DropDownChoice<>("timeZoneId", AVAILABLE_TIMEZONES));
    add(new LanguageDropDown("languageId"));
    add(new TextField<String>("address.phone"));
    add(new CheckBox("sendSMS"));
    add(new AjaxDatePicker("age", new PropertyModel<LocalDate>(this, "age"), WebSession.get().getLocale()) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onValueChanged(IPartialPageRequestHandler target) {
            User u = GeneralUserForm.this.getModelObject();
            u.setAge(CalendarHelper.getDate(age, u.getTimeZoneId()));
        }
    });
    add(new TextField<String>("address.street"));
    add(new TextField<String>("address.additionalname"));
    add(new TextField<String>("address.zip"));
    add(new TextField<String>("address.town"));
    add(new CountryDropDown("address.country"));
    add(new TextArea<String>("address.comment"));
    add(new Select2MultiChoice<>("groupUsers", null, new RestrictiveChoiceProvider<GroupUser>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getDisplayValue(GroupUser choice) {
            return choice.getGroup().getName();
        }

        @Override
        public String toId(GroupUser choice) {
            Long id = choice.getGroup().getId();
            return id == null ? null : "" + id;
        }

        @Override
        public void query(String term, int page, Response<GroupUser> response) {
            for (GroupUser ou : grpUsers) {
                if (Strings.isEmpty(term) || ou.getGroup().getName().contains(term)) {
                    response.add(ou);
                }
            }
        }

        @Override
        public GroupUser fromId(String _id) {
            Long id = Long.parseLong(_id);
            User u = GeneralUserForm.this.getModelObject();
            Group g = groupDao.get(id);
            GroupUser gu = new GroupUser(g, u);
            int idx = grpUsers.indexOf(gu);
            return idx < 0 ? gu : grpUsers.get(idx);
        }
    }).setLabel(Model.of(getString("161"))).setRequired(isAdminForm && hasGroupAdminLevel(getRights())).setEnabled(isAdminForm));
}
Also used : AjaxDatePicker(com.googlecode.wicket.kendo.ui.form.datetime.local.AjaxDatePicker) CountryDropDown(org.apache.openmeetings.web.util.CountryDropDown) Group(org.apache.openmeetings.db.entity.user.Group) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) PropertyModel(org.apache.wicket.model.PropertyModel) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) Salutation(org.apache.openmeetings.db.entity.user.User.Salutation) CheckBox(org.apache.wicket.markup.html.form.CheckBox) Select2MultiChoice(org.wicketstuff.select2.Select2MultiChoice) ChoiceRenderer(org.apache.wicket.markup.html.form.ChoiceRenderer)

Example 4 with IPartialPageRequestHandler

use of org.apache.wicket.core.request.handler.IPartialPageRequestHandler in project openmeetings by apache.

the class HashPage method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    StringValue secure = p.get(HASH);
    StringValue invitation = p.get(INVITATION_HASH);
    WebSession ws = WebSession.get();
    ws.checkHashes(secure, invitation);
    String errorMsg = getString("invalid.hash");
    recContainer.setVisible(false);
    add(new EmptyPanel(PANEL_MAIN).setVisible(false));
    if (!invitation.isEmpty()) {
        Invitation i = ws.getInvitation();
        if (i == null) {
            errorMsg = getString("error.hash.invalid");
        } else if (!i.isAllowEntry()) {
            FastDateFormat sdf = FormatHelper.getDateTimeFormat(i.getInvitee());
            errorMsg = Valid.OneTime == i.getValid() ? getString("error.hash.used") : String.format("%s %s - %s, %s", getString("error.hash.period"), sdf.format(i.getValidFrom()), sdf.format(i.getValidTo()), i.getInvitee().getTimeZoneId());
        } else {
            Recording rec = i.getRecording();
            if (rec != null) {
                vi.setVisible(!i.isPasswordProtected());
                vp.setVisible(!i.isPasswordProtected());
                if (!i.isPasswordProtected()) {
                    vi.update(null, rec);
                    vp.update(null, rec);
                }
                recContainer.setVisible(true);
                error = false;
            }
            Room r = i.getRoom();
            if (r != null && !r.isDeleted()) {
                createRoom(r.getId());
                if (i.isPasswordProtected() && rp != null) {
                    mp.getChat().setVisible(false);
                    rp.setOutputMarkupPlaceholderTag(true).setVisible(false);
                }
            }
        }
    } else if (!secure.isEmpty()) {
        Long recId = getRecordingId(), roomId = ws.getRoomId();
        if (recId == null && roomId == null) {
            errorMsg = getString("1599");
        } else if (recId != null) {
            recContainer.setVisible(true);
            Recording rec = recDao.get(recId);
            vi.update(null, rec);
            vp.update(null, rec);
            error = false;
        } else {
            createRoom(roomId);
        }
    }
    StringValue swf = p.get(SWF);
    StringValue app = swf.isEmpty() ? p.get(APP) : swf;
    if (!app.isEmpty()) {
        if (APP_TYPE_NETWORK.equals(app.toString())) {
            replace(new NetTestPanel(PANEL_MAIN).add(AttributeModifier.append("class", "app")));
            error = false;
        }
        if (APP_TYPE_SETTINGS.equals(app.toString())) {
            replace(new VideoSettings(PANEL_MAIN).replace(new OmWebSocketPanel("ws-panel") {

                private static final long serialVersionUID = 1L;

                private WsClient c = null;

                @Override
                protected void onConnect(ConnectedMessage message) {
                    c = new WsClient(message.getSessionId(), message.getKey().hashCode());
                }

                @Override
                protected IWsClient getWsClient() {
                    return c;
                }
            }).add(new OmAjaxClientInfoBehavior() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onClientInfo(AjaxRequestTarget target, WebClientInfo info) {
                    super.onClientInfo(target, info);
                    target.appendJavaScript(String.format("VideoSettings.init(%s);VideoSettings.open();", VideoSettings.getInitJson("noclient")));
                }
            }));
            error = false;
        }
    }
    add(recContainer.add(vi.setShowShare(false).setOutputMarkupPlaceholderTag(true), vp.setOutputMarkupPlaceholderTag(true)), new InvitationPasswordDialog("i-pass", this));
    remove(urlParametersReceivingBehavior);
    add(new MessageDialog("access-denied", getString("invalid.hash"), errorMsg, DialogButtons.OK, DialogIcon.ERROR) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onConfigure(JQueryBehavior behavior) {
            super.onConfigure(behavior);
            behavior.setOption("autoOpen", error);
            behavior.setOption("resizable", false);
        }

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
        // no-op
        }
    });
}
Also used : WebClientInfo(org.apache.wicket.protocol.http.request.WebClientInfo) DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) OmWebSocketPanel(org.apache.openmeetings.web.common.OmWebSocketPanel) WsClient(org.apache.openmeetings.db.entity.basic.WsClient) IWsClient(org.apache.openmeetings.db.entity.basic.IWsClient) ConnectedMessage(org.apache.wicket.protocol.ws.api.message.ConnectedMessage) MessageDialog(com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog) StringValue(org.apache.wicket.util.string.StringValue) Room(org.apache.openmeetings.db.entity.room.Room) IWsClient(org.apache.openmeetings.db.entity.basic.IWsClient) JQueryBehavior(com.googlecode.wicket.jquery.core.JQueryBehavior) VideoSettings(org.apache.openmeetings.web.room.VideoSettings) Invitation(org.apache.openmeetings.db.entity.room.Invitation) OmAjaxClientInfoBehavior(org.apache.openmeetings.web.common.OmAjaxClientInfoBehavior) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) FastDateFormat(org.apache.commons.lang3.time.FastDateFormat) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WebSession(org.apache.openmeetings.web.app.WebSession) NetTestPanel(org.apache.openmeetings.web.room.NetTestPanel) Recording(org.apache.openmeetings.db.entity.record.Recording)

Example 5 with IPartialPageRequestHandler

use of org.apache.wicket.core.request.handler.IPartialPageRequestHandler in project openmeetings by apache.

the class RegisterDialog method onInitialize.

@Override
protected void onInitialize() {
    getTitle().setObject(getString("113"));
    cancelBtn = new DialogButton("cancel", getString("lbl.cancel"));
    registerBtn = new DialogButton("register", getString("121")) {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isIndicating() {
            return true;
        }
    };
    confirmRegistration = new NonClosableMessageDialog("confirmRegistration", getString("235"), getString("warn.notverified")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            s.open(handler);
        }
    };
    add(confirmRegistration);
    reset(null);
    super.onInitialize();
}
Also used : DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) NonClosableMessageDialog(org.apache.openmeetings.web.util.NonClosableMessageDialog) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler)

Aggregations

IPartialPageRequestHandler (org.apache.wicket.core.request.handler.IPartialPageRequestHandler)12 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)10 MessageDialog (com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)6 NonClosableMessageDialog (org.apache.openmeetings.web.util.NonClosableMessageDialog)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 JSONObject (com.github.openjson.JSONObject)2 JQueryBehavior (com.googlecode.wicket.jquery.core.JQueryBehavior)2 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)2 User (org.apache.openmeetings.db.entity.user.User)2 RoomMessage (org.apache.openmeetings.db.util.ws.RoomMessage)2 Component (org.apache.wicket.Component)2 EmptyPanel (org.apache.wicket.markup.html.panel.EmptyPanel)2 Droppable (com.googlecode.wicket.jquery.ui.interaction.droppable.Droppable)1 AjaxDatePicker (com.googlecode.wicket.kendo.ui.form.datetime.local.AjaxDatePicker)1 Calendar (java.util.Calendar)1 FastDateFormat (org.apache.commons.lang3.time.FastDateFormat)1 Client (org.apache.openmeetings.db.entity.basic.Client)1 IWsClient (org.apache.openmeetings.db.entity.basic.IWsClient)1 WsClient (org.apache.openmeetings.db.entity.basic.WsClient)1 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)1