List of usage examples for org.apache.wicket MarkupContainer replace
public MarkupContainer replace(final Component child)
From source file:com.servoy.j2db.server.headlessclient.dataui.WebAccordionPanel.java
License:Open Source License
private void addCurrentFormComponent() { if (currentForm.isReady()) { int index = getTabIndex(); if (index >= 0) { MarkupContainer parent = (MarkupContainer) ((MarkupContainer) accordion.get(0)).get(index); if (parent != null) { if (parent.get(currentForm.getWebForm().getId()) != null) { // replace it parent.replace(currentForm.getWebForm()); } else { // else add it parent.add(currentForm.getWebForm()); }//w ww. j ava 2s .c o m } } } }
From source file:org.apache.openmeetings.web.components.MenuPanel.java
License:Apache License
public MenuPanel(String id, final MarkupContainer contents) { super(id);/*from w w w . ja va 2s . co m*/ setMarkupId(id); final NaviBuilder man = Application.getBean(NaviBuilder.class); add(new ListView<Naviglobal>("mainItem", man.getMainMenu(WebSession.getUserLevel(), WebSession.getUserId(), WebSession.getLanguage())) { private static final long serialVersionUID = 2173926553418745231L; @Override protected void populateItem(ListItem<Naviglobal> item) { Naviglobal gl = item.getModelObject(); item.add(new Label("label", gl.getLabel().getValue()).setRenderBodyOnly(true)); item.add(new ListView<Navimain>("childItem", gl.getMainnavi()) { private static final long serialVersionUID = 3609635268338379087L; @Override protected void populateItem(ListItem<Navimain> item) { Navimain m = item.getModelObject(); final String name = m.getLabel().getValue(); final String desc = m.getTooltip().getValue(); final MenuActions action = MenuActions.valueOf(m.getAction()); final MenuParams params = m.getParams() != null ? MenuParams.valueOf(m.getParams()) : MenuParams.publicTabButton; final String hash = getHash(action, params); item.add(new AjaxLink<Void>("link") { private static final long serialVersionUID = 5632618935550133709L; { add(new Label("name", name)); add(new Label("description", desc)); } public void onClick(AjaxRequestTarget target) { BasePanel basePanel = null; switch (action) { case dashboardModuleStartScreen: break; case dashboardModuleCalendar: basePanel = new CalendarPanel("child"); break; case recordModule: break; case conferenceModuleRoomList: basePanel = new UserRoomsPanel("child", params); break; case eventModuleRoomList: break; case moderatorModuleUser: break; case moderatorModuleRoom: break; case adminModuleUser: basePanel = new UsersPanel("child"); break; case adminModuleConnections: break; case adminModuleOrg: basePanel = new GroupsPanel("child"); break; case adminModuleRoom: basePanel = new RoomsPanel("child"); break; case adminModuleConfiguration: basePanel = new ConfigsPanel("child"); break; case adminModuleLanguages: basePanel = new LangPanel("child"); break; case adminModuleLDAP: basePanel = new LdapsPanel("child"); break; case adminModuleBackup: basePanel = new BackupPanel("child"); break; case adminModuleServers: basePanel = new ServersPanel("child"); break; } if (basePanel != null) { target.add(contents.replace(basePanel)); basePanel.onMenuPanelLoad(target); } target.appendJavaScript( "location.hash = '" + JavaScriptUtils.escapeQuotes(hash) + "';"); }; }.add(AttributeModifier.replace("href", hash))); } }.setReuseItems(true)); } }.setReuseItems(true)); add(new Behavior() { private static final long serialVersionUID = 9067610794087880297L; @Override public void renderHead(Component component, IHeaderResponse response) { String area = WebSession.get().getArea(); if (area != null) { //hash passed from signin response.render(OnDomReadyHeaderItem .forScript("$(\"a[href='" + JavaScriptUtils.escapeQuotes(area) + "']\").click();")); WebSession.get().setArea(null); } else { response.render( OnDomReadyHeaderItem.forScript("$(\"a[href='\" + location.hash + \"']\").click();")); } super.renderHead(component, response); } }); }