List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow show
public void show(final IPartialPageRequestHandler target)
From source file:org.syncope.console.pages.Users.java
License:Apache License
public Users(final PageParameters parameters) { super(parameters); // Modal window for editing user attributes final ModalWindow editModalWin = new ModalWindow("editModal"); editModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editModalWin.setInitialHeight(EDIT_MODAL_WIN_HEIGHT); editModalWin.setInitialWidth(EDIT_MODAL_WIN_WIDTH); editModalWin.setCookieName("edit-modal"); add(editModalWin);// w w w . j a va 2 s .c o m final ResultSetPanel searchResult = new ResultSetPanel("searchResult", true, null, getPageReference()); add(searchResult); final ResultSetPanel listResult = new ResultSetPanel("listResult", false, null, getPageReference()); add(listResult); // create new user final AjaxLink createLink = new IndicatingAjaxLink("createLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { editModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new EditUserModalPage(Users.this.getPageReference(), editModalWin, new UserTO()); } }); editModalWin.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "create")); add(createLink); setWindowClosedReloadCallback(editModalWin); final Form searchForm = new Form("searchForm"); add(searchForm); final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel"); searchForm.add(searchPanel); searchForm.add(new IndicatingAjaxButton("search", new ResourceModel("search")) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { final NodeCond searchCond = searchPanel.buildSearchCond(); LOG.debug("Node condition " + searchCond); doSearch(target, searchCond, searchResult); Session.get().getFeedbackMessages().clear(); target.add(searchPanel.getSearchFeedback()); } @Override protected void onError(final AjaxRequestTarget target, final Form form) { target.add(searchPanel.getSearchFeedback()); } }); }
From source file:org.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel.java
License:Apache License
public TreeActionLinkPanel(final String id, final long idRole, final IModel inputModel, final ModalWindow window, final PageReference callerPageRef) { super(id);/*from ww w. jav a 2 s .co m*/ fragment = new Fragment("menuPanel", idRole == 0 ? "fakerootFrag" : "roleFrag", this); AjaxLink createRoleLink = new IndicatingAjaxLink("createRoleLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { RoleTO roleTO = new RoleTO(); roleTO.setParent(idRole); RoleModalPage form = new RoleModalPage(callerPageRef, window, roleTO); return form; } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "create")); fragment.add(createRoleLink); if (idRole != 0) { AjaxLink updateRoleLink = new IndicatingAjaxLink("updateRoleLink") { @Override public void onClick(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { RoleTO roleTO = restClient.readRole(idRole); RoleModalPage form = new RoleModalPage(callerPageRef, window, roleTO); return form; } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "read")); fragment.add(updateRoleLink); AjaxLink dropRoleLink = new IndicatingDeleteOnConfirmAjaxLink("dropRoleLink") { @Override public void onClick(final AjaxRequestTarget target) { try { restClient.deleteRole(idRole); getSession().info(getString("operation_succeded")); } catch (SyncopeClientCompositeErrorException e) { LOG.error("While deleting role " + idRole, e); getSession().error(getString("operation_error")); } setResponsePage(new Roles(null)); } }; MetaDataRoleAuthorizationStrategy.authorize(dropRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "delete")); fragment.add(dropRoleLink); } add(fragment); }
From source file:org.webical.web.pages.ErrorPage.java
License:Open Source License
public void setupNonAccessibleComponents() { //ModelDialog for the detailmessage final ModalWindow modalWindow = new ModalWindow(DETAILED_ERROR_PANEL_ID); //The detailed message final String detailedMessage = getDetailedMessage(); //Link to show the details IndicatingAjaxLink showDetailsLink = new IndicatingAjaxLink(SHOW_DETAILS_LINK_MARKUP_ID) { private static final long serialVersionUID = 1L; @Override/*w ww . j av a 2 s. c o m*/ public void onClick(AjaxRequestTarget ajaxRequestTarget) { modalWindow.setContent(new DetailPanel(modalWindow.getContentId(), new Model(detailedMessage))); modalWindow.setVisible(true); modalWindow.show(ajaxRequestTarget); } }; if (detailedMessage == null) { showDetailsLink.setEnabled(false); } else { modalWindow.setInitialWidth(700); modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget ajaxRequestTarget) { modalWindow.setContent(new Label(modalWindow.getContentId(), new Model(""))); modalWindow.setVisible(false); ajaxRequestTarget.addComponent(modalWindow); getSession().createAutoPageMap(); } }); } //Add components addOrReplace(modalWindow); addOrReplace(showDetailsLink); }
From source file:org.wicketTutorial.modalwindow.HomePage.java
License:Apache License
public HomePage(final PageParameters parameters) { super(parameters); final ModalWindow modalWindow = new ModalWindow("modalWindow"); Label label = new Label(modalWindow.getContentId(), "I'm a modal window!"); modalWindow.setContent(label);//ww w . j av a2 s . c o m modalWindow.setTitle("Modal window"); add(modalWindow); add(new AjaxLink("openWindow") { @Override public void onClick(AjaxRequestTarget target) { modalWindow.show(target); } }); }
From source file:org.xaloon.wicket.component.classifier.panel.ClassifierItemListPanel.java
License:Apache License
protected void addCreateNewClassifierItem(final ClassifierItemOptions classifierItemOptions, final ClassifierDropDownChoice classifierDropDownChoice) { final ModalWindow modal2 = new CustomModalWindow("modal2") { private static final long serialVersionUID = 1L; @Override//from w ww .ja v a2s . c om protected void addComponentsToRefresh(java.util.List<Component> components) { components.add(ClassifierItemListPanel.this); }; }; PageParameters params = new PageParameters(); params.set(ClassifiersPanel.PARAM_CLASSIFIER_TYPE, classifierItemOptions.getClassifierType()); params.set(ClassifierConstants.PARENT_ITEM, parentClassifierItem); modal2.setContent(new NewClassifierItemPanel<ClassifierItem, Classifier>(modal2, params)); modal2.setVisible(securityFacade.hasAny(SecurityAuthorities.CLASSIFIER_EDIT)); add(modal2); add(new AjaxLink<Void>("add-new-item") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { modal2.show(target); } }.setVisible(securityFacade.hasAny(SecurityAuthorities.CLASSIFIER_EDIT))); }
From source file:org.xaloon.wicket.component.classifier.panel.ClassifiersItemPanel.java
License:Apache License
@Override protected void onInitialize(EmptyPlugin plugin, AbstractPluginBean pluginBean) { PageParameters params = getPageRequestParameters(); if (params.isEmpty()) { setVisible(false);//from w w w. j av a2 s. com setResponsePage(ClassifiersPage.class); return; } final String classifierType = params.get(ClassifiersPanel.PARAM_CLASSIFIER_TYPE).toString(); String parentClassifierItem = null; if (params.get(ClassifierConstants.PARENT_ITEM) != null) { parentClassifierItem = params.get(ClassifierConstants.PARENT_ITEM).toString(); } // Add data container final DecoratedPagingNavigatorContainer<ClassifierItem> dataContainer = new DecoratedPagingNavigatorContainer<ClassifierItem>( "container", getCurrentRedirectLink()); add(dataContainer); // Add data view final DataView<ClassifierItem> classifierDataView = new DataView<ClassifierItem>("item-list", new ClassifierDataProvider(classifierType, parentClassifierItem)) { private static final long serialVersionUID = 1L; @Override protected void populateItem(Item<ClassifierItem> item) { ClassifierItem classifierItem = item.getModelObject(); // Add link PageParameters pageParameters = new PageParameters(); pageParameters.set(ClassifiersPanel.PARAM_CLASSIFIER_TYPE, classifierType); pageParameters.add(ClassifierConstants.PARENT_ITEM, classifierItem.getCode()); BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("link-item", ClassifiersItemPage.class, pageParameters); item.add(link); link.add(new Label("code", new Model<String>(classifierItem.getCode()))); // Add name item.add(new Label("name", new Model<String>(classifierItem.getName()))); } }; dataContainer.addAbstractPageableView(classifierDataView); dataContainer.setVisible(true); classifierDataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); // Create modal window to create new classifier final ModalWindow addNewClassifierModalWindow = new CustomModalWindow("modal-new-item", "title") { private static final long serialVersionUID = 1L; @Override protected void addComponentsToRefresh(java.util.List<Component> components) { components.add(dataContainer); }; }; addNewClassifierModalWindow.setContent( new NewClassifierItemPanel<ClassifierItem, Classifier>(addNewClassifierModalWindow, params)); add(addNewClassifierModalWindow); // add create new classifier link add(new AjaxLink<Void>("link-add-new-item") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { addNewClassifierModalWindow.show(target); } }); }
From source file:org.xaloon.wicket.component.classifier.panel.ClassifiersPanel.java
License:Apache License
@Override protected void onInitialize(EmptyPlugin plugin, AbstractPluginBean pluginBean) { // Add data container final DecoratedPagingNavigatorContainer<Classifier> dataContainer = new DecoratedPagingNavigatorContainer<Classifier>( "container", getCurrentRedirectLink()); add(dataContainer);//w w w. j a va 2 s . co m // Add data view final DataView<Classifier> classifierDataView = new DataView<Classifier>("item-list", new ClassifierDataProvider()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(Item<Classifier> item) { Classifier classifier = item.getModelObject(); // Add link PageParameters pageParameters = new PageParameters(); pageParameters.set(PARAM_CLASSIFIER_TYPE, classifier.getType()); BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("link-item", ClassifiersItemPage.class, pageParameters); item.add(link); link.add(new Label("type", new Model<String>(classifier.getType()))); // Add name item.add(new Label("name", new Model<String>(classifier.getName()))); } }; dataContainer.addAbstractPageableView(classifierDataView); classifierDataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance()); dataContainer.setVisible(true); // Create modal window to create new classifier final ModalWindow addNewClassifierModalWindow = new CustomModalWindow("modal-new-item", "title") { private static final long serialVersionUID = 1L; @Override protected void addComponentsToRefresh(java.util.List<Component> components) { components.add(dataContainer); }; }; addNewClassifierModalWindow.setContent( new NewClassifierPanel<Classifier>(addNewClassifierModalWindow, getPageRequestParameters())); add(addNewClassifierModalWindow); // add create new classifier link add(new AjaxLink<Void>("link-add-new-item") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { addNewClassifierModalWindow.show(target); } }); }
From source file:org.xaloon.wicket.plugin.admin.PluginAdministrationPanel.java
License:Apache License
private void init() { List<List<GenericTreeNode<MenuItem>>> menuItems = new ArrayList<List<GenericTreeNode<MenuItem>>>(); menuItems.add(getCategoryMenuPlugin().getTree().getChildren()); FlatDynamicMenuPanel hierarchyMenu = new FlatDynamicMenuPanel("hierarchy-menu", menuItems); hierarchyMenu.setMenuItemPageClass(PluginAdministrationPage.class); add(hierarchyMenu);/*from ww w . j ava 2s . c om*/ String filter = pageParameters.get(CategoryConstants.PAGE_NAMED_PARAMETER_PARENT_CATEGORY).toString(); List<GenericTreeNode<Plugin>> pluginCollection; if (StringUtils.isEmpty(filter)) { pluginCollection = getCategoryGroupPlugin().getTree().getChildren(); } else { pluginCollection = getCategoryGroupPlugin().getTreeNodesByContext().get("/" + filter).getChildren(); } add(new ListView<GenericTreeNode<Plugin>>("plugin-view", pluginCollection) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<GenericTreeNode<Plugin>> item) { item.setOutputMarkupId(true); final ValueMap properties = new ValueMap(); final Plugin plugin = item.getModelObject().getData(); if (plugin == null || plugin.getAdministratorFormClass() == null) { item.setVisible(false); return; } boolean pluginEnabled = getPluginRegistry().isEnabled(plugin); properties.put(PLUGIN_PROPERTY_CONTAINER, pluginEnabled); item.add(new Label("plugin-name", new Model<String>(plugin.getName()))); item.add(new Label("plugin-version", new Model<String>(plugin.getVersion()))); item.add(new Label("plugin-description", new Model<String>(plugin.getDescription())) .setVisible(!StringUtils.isEmpty(plugin.getDescription()))); final ModalWindow pluginConfigurationModalWindow = new CustomModalWindow("plugin-config", "title"); item.add(pluginConfigurationModalWindow); pluginConfigurationModalWindow.setContent( new PluginConfigurationPanel(pluginConfigurationModalWindow, new Model<Plugin>(plugin))); // add link to open configuration window final AjaxLink<Void> openConfigWindow = new AjaxLink<Void>("link-plugin-config") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { pluginConfigurationModalWindow.show(target); } }; item.add(openConfigWindow); openConfigWindow.setVisible(pluginEnabled); // } catch (CreateClassInstanceException e) { // setVisible(false);// TODO double check // if (logger.isWarnEnabled()) { // logger.warn("Could not create instance for administration class: " + plugin.getAdministratorFormClass()); // } // } AjaxCheckBox pluginEnabledCheckbox = new AjaxCheckBox(PLUGIN_PROPERTY_CONTAINER, new PropertyModel<Boolean>(properties, PLUGIN_PROPERTY_CONTAINER)) { /** * */ private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { Boolean pluginEnabled = getModelObject(); getPluginRegistry().setEnabled(plugin, pluginEnabled); openConfigWindow.setVisible(pluginEnabled); target.add(item); } }; item.add(pluginEnabledCheckbox); pluginEnabledCheckbox .setEnabled(!DefaultPluginCategories.ADMINISTRATION.equals(plugin.getCategory())); } }); }
From source file:org.xaloon.wicket.plugin.image.panel.ImagePanel.java
License:Apache License
@Override protected void onBeforeRender() { super.onBeforeRender(); removeAll();/*from w ww . j av a2 s .c o m*/ final ImageComposition image = getModelObject(); // Add show temporary image FileDescriptor temporaryFiledeDescriptor = image.getImage().getThumbnail(); if (temporaryFiledeDescriptor == null) { temporaryFiledeDescriptor = image.getImage(); } if (temporaryFiledeDescriptor != null && temporaryFiledeDescriptor.getImageInputStreamContainer() == null) { if (temporaryFiledeDescriptor.isExternal()) { temporaryFiledeDescriptor.setImageInputStreamContainer( new UrlInputStreamContainer(temporaryFiledeDescriptor.getPath())); } else { temporaryFiledeDescriptor.setImageInputStreamContainer(new ByteArrayAsInputStreamContainer( fileRepositoryFacade.getFileByPath(temporaryFiledeDescriptor.getPath()))); } } TemporaryResource temporaryResource = new TemporaryResource(temporaryFiledeDescriptor); Image temporaryImage = new NonCachingImage("temporary-image", temporaryResource); temporaryImage.add(AttributeModifier.replace(HtmlElementEnum.WIDTH.value(), String.valueOf(imageWidth))); temporaryImage.add(AttributeModifier.replace(HtmlElementEnum.HEIGHT.value(), String.valueOf(imageHeight))); temporaryImage.setVisible(!temporaryResource.isEmpty()); add(temporaryImage); // Add delete image link add(new ConfirmationAjaxLink<Void>("delete-image-link") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { deleteFileDescriptor(image); Component componentToRefresh = getOnCloseRefreshComponent(); if (componentToRefresh != null) { target.add(componentToRefresh); } } }.setVisible(securityFacade.hasAny(GallerySecurityAuthorities.IMAGE_DELETE))); // Add the modal window to edit image information final ModalWindow imageInformationModalWindow = new CustomModalWindow("modal-image-information", "Image information") { private static final long serialVersionUID = 1L; @Override protected void addComponentsToRefresh(java.util.List<Component> components) { components.add(ImagePanel.this); }; }; imageInformationModalWindow.setContent(new ImageDescriptionPanel(imageInformationModalWindow.getContentId(), new Model<org.xaloon.core.api.image.model.Image>(image.getImage())) { private static final long serialVersionUID = 1L; @Override protected void onImageUpdate(AjaxRequestTarget target, org.xaloon.core.api.image.model.Image entity) { // Usually parent of this panel should be responsible to save // new entity, so we just update existing one here if (entity.getId() != null) { albumFacade.save(entity); } imageInformationModalWindow.close(target); } }); add(imageInformationModalWindow); // Add edit image metadata modal window add(new AjaxLink<Void>("edit-information") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { imageInformationModalWindow.show(target); } }.setVisible(securityFacade.hasAny(GallerySecurityAuthorities.IMAGE_EDIT))); }
From source file:org.xaloon.wicket.plugin.user.admin.panel.CheckboxMultipleChoiceManagement.java
License:Apache License
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override/*w w w .jav a2 s. c o m*/ protected void onBeforeRender() { super.onBeforeRender(); removeAll(); // Add the modal window final ModalWindow addGroupModalWindow = new CustomModalWindow("modal-assign-entities", "Assign something") { private static final long serialVersionUID = 1L; @Override protected void addComponentsToRefresh(List<Component> components) { CheckboxMultipleChoiceManagement.this.addComponentsToRefresh(components); } }; add(addGroupModalWindow); // Create and set form container panel FormContainerPanel formContainerPanel = new FormContainerPanel(addGroupModalWindow.getContentId()); addGroupModalWindow.setContent(formContainerPanel); // Create and add form Form form = new Form("form"); formContainerPanel.setForm(form); // Create and add selection choices to form CheckBoxMultipleChoice choices = new CheckBoxMultipleChoice("choices", Model.of(selectedEntities), availableEntitiesToSelect, choiceRenderer); form.add(choices); // Add submit button to form form.add(new AjaxButton("submit") { /** * */ private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { onFormSubmit(target); addGroupModalWindow.close(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { } }); // Add assign entities link add(new AjaxLink<Void>("link-assign-entities") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { addGroupModalWindow.show(target); } }); }