Search in sources :

Example 1 with MenuPanel

use of org.apache.openmeetings.web.common.menu.MenuPanel in project openmeetings by apache.

the class RoomMenuPanel method onInitialize.

@Override
protected void onInitialize() {
    exitMenuItem = new RoomMenuItem(getString("308"), getString("309"), "room menu exit") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            exit(target);
        }
    };
    filesMenu = new RoomMenuItem(getString("245"), null, false);
    actionsSubMenu.init();
    pollsSubMenu.init();
    add((menuPanel = new MenuPanel("menu", getMenu())).setVisible(isVisible()));
    add(askBtn.add(AttributeModifier.replace(ATTR_TITLE, getString("84"))));
    Label demo = new Label("demo", Model.of(""));
    Room r = room.getRoom();
    add(demo.setVisible(r.isDemoRoom() && r.getDemoTime() != null && room.getRoom().getDemoTime().intValue() > 0));
    if (demo.isVisible()) {
        demo.add(new OmRedirectTimerBehavior(room.getRoom().getDemoTime().intValue(), "637") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onTimer(int remain) {
                getComponent().add(AttributeModifier.replace(ATTR_TITLE, getText("639", remain)));
            }

            @Override
            protected void onFinish(AjaxRequestTarget target) {
                exit(target);
            }
        });
    }
    super.onInitialize();
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MenuPanel(org.apache.openmeetings.web.common.menu.MenuPanel) OmRedirectTimerBehavior(org.apache.openmeetings.web.room.OmRedirectTimerBehavior) Label(org.apache.wicket.markup.html.basic.Label) RoomMenuItem(org.apache.openmeetings.web.common.menu.RoomMenuItem) Room(org.apache.openmeetings.db.entity.room.Room)

Example 2 with MenuPanel

use of org.apache.openmeetings.web.common.menu.MenuPanel in project openmeetings by apache.

the class MainPanel method onInitialize.

@Override
protected void onInitialize() {
    menu = new MenuPanel("menu", getMainMenu());
    add(topControls.setOutputMarkupPlaceholderTag(true).setMarkupId("topControls"));
    add(contents.add(getClient() == null || panel == null ? EMPTY : panel).setOutputMarkupId(true).setMarkupId("contents"));
    topControls.add(menu.setVisible(false), topLinks.setVisible(false).setOutputMarkupPlaceholderTag(true).setMarkupId("topLinks"));
    topLinks.add(new AjaxLink<Void>("messages") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            updateContents(PROFILE_MESSAGES, target);
        }
    });
    topLinks.add(new AjaxLink<Void>("profile") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            updateContents(PROFILE_EDIT, target);
        }
    });
    final AboutDialog about = new AboutDialog("aboutDialog");
    topLinks.add(new AjaxLink<Void>("about") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            about.open(target);
        }
    });
    if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
        add(new DebugBar("dev").setOutputMarkupId(true));
    } else {
        add(new EmptyPanel("dev").setVisible(false));
    }
    add(new OmAjaxClientInfoBehavior());
    add(about, chat = new ChatPanel("chatPanel"));
    add(newMessage = new MessageDialog("newMessageDialog", new CompoundPropertyModel<>(new PrivateMessage())) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            BasePanel bp = getCurrentPanel();
            if (send.equals(button) && bp != null) {
                bp.onNewMessageClose(handler);
            }
        }
    });
    add(userInfo = new UserInfoDialog("userInfoDialog", newMessage));
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            userInfo.open(target, getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("showUserInfo", this, explicit(PARAM_USER_ID))));
        }
    });
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            ContactsHelper.addUserToContactList(getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("addContact", this, explicit(PARAM_USER_ID))));
        }
    });
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            newMessage.reset(true).open(target, getParam(getComponent(), PARAM_USER_ID).toOptionalLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("privateMessage", this, explicit(PARAM_USER_ID))));
        }
    });
    add(inviteUser = new InviteUserToRoomDialog("invite-to-room"));
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            inviteUser.open(target, getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("inviteUser", this, explicit(PARAM_USER_ID))));
        }
    });
    topLinks.add(new ConfirmableAjaxBorder("logout", getString("310"), getString("634")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            getSession().invalidate();
            setResponsePage(Application.get().getSignInPageClass());
        }
    });
    super.onInitialize();
}
Also used : DebugBar(org.apache.wicket.devutils.debugbar.DebugBar) DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) AboutDialog(org.apache.openmeetings.web.user.AboutDialog) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) ChatPanel(org.apache.openmeetings.web.user.chat.ChatPanel) InviteUserToRoomDialog(org.apache.openmeetings.web.user.InviteUserToRoomDialog) MenuPanel(org.apache.openmeetings.web.common.menu.MenuPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserInfoDialog(org.apache.openmeetings.web.user.UserInfoDialog) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) AbstractDefaultAjaxBehavior(org.apache.wicket.ajax.AbstractDefaultAjaxBehavior) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) MessageDialog(org.apache.openmeetings.web.user.MessageDialog) PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage) Component(org.apache.wicket.Component)

Aggregations

MenuPanel (org.apache.openmeetings.web.common.menu.MenuPanel)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)1 Room (org.apache.openmeetings.db.entity.room.Room)1 PrivateMessage (org.apache.openmeetings.db.entity.user.PrivateMessage)1 RoomMenuItem (org.apache.openmeetings.web.common.menu.RoomMenuItem)1 OmRedirectTimerBehavior (org.apache.openmeetings.web.room.OmRedirectTimerBehavior)1 AboutDialog (org.apache.openmeetings.web.user.AboutDialog)1 InviteUserToRoomDialog (org.apache.openmeetings.web.user.InviteUserToRoomDialog)1 MessageDialog (org.apache.openmeetings.web.user.MessageDialog)1 UserInfoDialog (org.apache.openmeetings.web.user.UserInfoDialog)1 ChatPanel (org.apache.openmeetings.web.user.chat.ChatPanel)1 Component (org.apache.wicket.Component)1 AbstractDefaultAjaxBehavior (org.apache.wicket.ajax.AbstractDefaultAjaxBehavior)1 IPartialPageRequestHandler (org.apache.wicket.core.request.handler.IPartialPageRequestHandler)1 DebugBar (org.apache.wicket.devutils.debugbar.DebugBar)1 IHeaderResponse (org.apache.wicket.markup.head.IHeaderResponse)1 PriorityHeaderItem (org.apache.wicket.markup.head.PriorityHeaderItem)1 Label (org.apache.wicket.markup.html.basic.Label)1 EmptyPanel (org.apache.wicket.markup.html.panel.EmptyPanel)1