Search in sources :

Example 1 with EmptyPanel

use of org.apache.wicket.markup.html.panel.EmptyPanel in project wicket by apache.

the class MarkupContainerTest method linkedMapChildrenBecomesChild.

@Test
public void linkedMapChildrenBecomesChild() {
    WebMarkupContainer wmc = new WebMarkupContainer("id");
    addNChildren(wmc, NUMBER_OF_CHILDREN_FOR_A_MAP);
    wmc.add(new EmptyPanel("panel"));
    assertChildrenType(wmc, LinkedMap.class);
    Iterator<Component> iterator = wmc.iterator();
    removeNChildren(iterator, NUMBER_OF_CHILDREN_FOR_A_MAP);
    assertChildrenType(wmc, EmptyPanel.class);
}
Also used : EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) WebComponent(org.apache.wicket.markup.html.WebComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Test(org.junit.Test)

Example 2 with EmptyPanel

use of org.apache.wicket.markup.html.panel.EmptyPanel in project wicket by apache.

the class ComponentStringResourceLoaderTest method multiLevelEmbeddedComponentLoadFromComponent.

/**
 */
@Test
public void multiLevelEmbeddedComponentLoadFromComponent() {
    DummyPage p = new DummyPage();
    Panel panel = new EmptyPanel("panel");
    p.add(panel);
    DummyComponent c = new DummyComponent("hello", tester.getApplication());
    panel.add(c);
    IStringResourceLoader loader = new ComponentStringResourceLoader();
    assertEquals("Valid resourse string should be found", "Component string", loader.loadStringResource(c.getClass(), "component.string", Locale.getDefault(), null, null));
}
Also used : Panel(org.apache.wicket.markup.html.panel.Panel) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) ComponentStringResourceLoader(org.apache.wicket.resource.loader.ComponentStringResourceLoader) IStringResourceLoader(org.apache.wicket.resource.loader.IStringResourceLoader) Test(org.junit.Test)

Example 3 with EmptyPanel

use of org.apache.wicket.markup.html.panel.EmptyPanel 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 4 with EmptyPanel

use of org.apache.wicket.markup.html.panel.EmptyPanel in project wicket by apache.

the class ComponentMarkupIdTest method idGeneratedWhenPanelNotAddedToPage.

/**
 */
@Test
public void idGeneratedWhenPanelNotAddedToPage() {
    // In wicket 1.4 the following sequence would not cause an exception
    Panel panel = new EmptyPanel("bla");
    // however in 1.5 the following statement generated a WicketRuntimeException
    // that the markup type could not be determined
    String markupId = panel.getMarkupId();
    // instead 1.4 would just generate the missing markup identifier
    Assert.assertEquals("bla1", markupId);
}
Also used : Panel(org.apache.wicket.markup.html.panel.Panel) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) Test(org.junit.Test)

Example 5 with EmptyPanel

use of org.apache.wicket.markup.html.panel.EmptyPanel in project wicket by apache.

the class ComponentNotOnPage method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    add(new EmptyPanel("refresher"));
    add(new ListView<Integer>("listview", Arrays.asList(1, 2, 3, 4, 5)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<Integer> item) {
            item.setOutputMarkupId(true);
            item.add(new AjaxLink<Void>("link") {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    LastSelectedPanel lastSelected = new LastSelectedPanel("refresher", item);
                    ComponentNotOnPage.this.replace(lastSelected);
                    target.add(lastSelected);
                }
            });
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel)

Aggregations

EmptyPanel (org.apache.wicket.markup.html.panel.EmptyPanel)7 Test (org.junit.Test)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)2 IPartialPageRequestHandler (org.apache.wicket.core.request.handler.IPartialPageRequestHandler)2 WebComponent (org.apache.wicket.markup.html.WebComponent)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 Panel (org.apache.wicket.markup.html.panel.Panel)2 JQueryBehavior (com.googlecode.wicket.jquery.core.JQueryBehavior)1 MessageDialog (com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)1 FastDateFormat (org.apache.commons.lang3.time.FastDateFormat)1 IWsClient (org.apache.openmeetings.db.entity.basic.IWsClient)1 WsClient (org.apache.openmeetings.db.entity.basic.WsClient)1 Recording (org.apache.openmeetings.db.entity.record.Recording)1 Invitation (org.apache.openmeetings.db.entity.room.Invitation)1 Room (org.apache.openmeetings.db.entity.room.Room)1 PrivateMessage (org.apache.openmeetings.db.entity.user.PrivateMessage)1 WebSession (org.apache.openmeetings.web.app.WebSession)1 OmAjaxClientInfoBehavior (org.apache.openmeetings.web.common.OmAjaxClientInfoBehavior)1 OmWebSocketPanel (org.apache.openmeetings.web.common.OmWebSocketPanel)1