List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setWindowClosedCallback
public ModalWindow setWindowClosedCallback(final WindowClosedCallback callback)
@{link WindowClosedCallback
instance. From source file:nl.mpi.lamus.web.components.ButtonPanel.java
License:Open Source License
private ModalWindow createConfirmationModalWindow(WorkspaceSubmissionType submissionType) { String id;//w ww. java 2 s . c om String title; String cookieName; String confirmationInfoText = null; String confirmationText; if (WorkspaceSubmissionType.SUBMIT_WORKSPACE.equals(submissionType)) { id = "modalConfirmSubmit"; title = "Submit Workspace"; cookieName = "modal-confirm-submit"; confirmationInfoText = getLocalizer().getString("submit_workspace_info", this); confirmationText = getLocalizer().getString("submit_workspace_confirm", this); } else if (WorkspaceSubmissionType.DELETE_WORKSPACE.equals(submissionType)) { id = "modalConfirmDelete"; title = "Delete Workspace"; cookieName = "modal-confirm-delete"; confirmationText = getLocalizer().getString("delete_workspace_confirm", this); } else { throw new UnsupportedOperationException("Submission type not supported"); } final ConfirmationOptions options = new ConfirmationOptions(false, false, submissionType, confirmationInfoText, confirmationText); ModalWindow modalConfirm = new ModalWindow(id); modalConfirm.setContent(new ConfirmPanel(modalConfirm.getContentId(), modalConfirm, options)); modalConfirm.setTitle(title); modalConfirm.setCookieName(cookieName); modalConfirm.setWindowClosedCallback((new ModalWindow.WindowClosedCallback() { @Override public void onClose(AjaxRequestTarget art) { if (options.isConfirmed()) { if (WorkspaceSubmissionType.SUBMIT_WORKSPACE.equals(options.getWorkspaceSubmissionType())) { onSubmitConfirm(art, options.isKeepUnlinkedFiles()); } else if (WorkspaceSubmissionType.DELETE_WORKSPACE .equals(options.getWorkspaceSubmissionType())) { onDeleteConfirm(art, options.isKeepUnlinkedFiles()); } else { throw new UnsupportedOperationException("Confirmation type not supported"); } } else { onCancel(art); } } })); return modalConfirm; }
From source file:nl.mpi.lamus.web.pages.LamusPage.java
License:Open Source License
private ModalWindow createAboutModalWindow() { ModalWindow modalAbout = new ModalWindow("modalAbout"); modalAbout.setContent(new AboutPanel(modalAbout.getContentId())); modalAbout.setTitle("About LAMUS 2"); modalAbout.setCookieName("modal-about"); modalAbout.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { @Override/* w w w .j av a2 s. c om*/ public boolean onCloseButtonClicked(AjaxRequestTarget art) { return true; } }); modalAbout.setWindowClosedCallback((new ModalWindow.WindowClosedCallback() { @Override public void onClose(AjaxRequestTarget art) { } })); return modalAbout; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generateRevealTopLibraryCardLink(final String id, final String idModalWindow) { final ModalWindow window = new ModalWindow(idModalWindow); window.setWindowClosedCallback(new WindowClosedCallback() { private static final long serialVersionUID = 1L; @Override/*from www .j a v a 2s . c o m*/ public void onClose(final AjaxRequestTarget target) { if (HomePage.this.session.getTopCardIndex() > 0L) { HomePage.this.session .setTopCardIndex(Long.valueOf(HomePage.this.session.getTopCardIndex() - 1L)); } } }); window.setInitialWidth(500); window.setInitialHeight(510); final List<MagicCard> allCardsInLibrary = this.persistenceService.getAllCardsInLibraryForDeckAndPlayer( this.session.getGameId(), this.session.getPlayer().getId(), this.session.getPlayer().getDeck().getDeckId()); final MagicCard firstCard; if (allCardsInLibrary.isEmpty()) { firstCard = null; } else { firstCard = allCardsInLibrary.get(this.session.getTopCardIndex().intValue()); } window.setContent(new RevealTopLibraryCardModalWindow(window.getContentId(), window, firstCard)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setOutputMarkupId(true); this.revealTopLibraryCardWindow = window; this.add(this.revealTopLibraryCardWindow); final AjaxLink<Void> revealTopLibraryCardLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @SuppressWarnings("boxing") @SuppressFBWarnings({ "PATH_TRAVERSAL_IN", "PATH_TRAVERSAL_IN" }) @Override public void onClick(final AjaxRequestTarget target) { final List<MagicCard> _allCardsInLibrary = HomePage.this.persistenceService .getAllCardsInLibraryForDeckAndPlayer(HomePage.this.session.getGameId(), HomePage.this.session.getPlayer().getId(), HomePage.this.session.getPlayer().getDeck().getDeckId()); if (_allCardsInLibrary.isEmpty()) { return; } final MagicCard _firstCard = _allCardsInLibrary .get(HomePage.this.session.getTopCardIndex().intValue()); final String topCardName = _firstCard.getBigImageFilename(); final String cardPath = ResourceBundle.getBundle(HatchetHarryApplication.class.getCanonicalName()) .getString("SharedResourceFolder"); final String cardPathAndName = cardPath.replace("/cards", "") + topCardName; final File from = new File(cardPathAndName); final File to = new File(cardPath + "topLibraryCard.jpg"); try { Files.copy(from, to); } catch (final IOException e) { HomePage.LOGGER.error( "could not copy from: " + cardPathAndName + " to: " + cardPath + "topLibraryCard.jpg", e); } final Long _gameId = HomePage.this.persistenceService .getPlayer(HomePage.this.session.getPlayer().getId()).getGame().getId(); final RevealTopLibraryCardCometChannel chan = new RevealTopLibraryCardCometChannel( HomePage.this.session.getPlayer().getName(), _firstCard, HomePage.this.session.getTopCardIndex()); final ConsoleLogStrategy logger = AbstractConsoleLogStrategy.chooseStrategy( ConsoleLogType.REVEAL_TOP_CARD_OF_LIBRARY, null, null, null, _firstCard.getTitle(), HomePage.this.session.getPlayer().getName(), null, HomePage.this.session.getTopCardIndex() + 1L, null, Boolean.FALSE, _gameId); final List<BigInteger> allPlayersInGame = HomePage.this.persistenceService .giveAllPlayersFromGame(_gameId); EventBusPostService.post(allPlayersInGame, chan, new ConsoleLogCometChannel(logger)); } }; revealTopLibraryCardLink.setOutputMarkupId(true).setMarkupId(id); this.add(revealTopLibraryCardLink); }
From source file:org.apache.directory.fortress.web.panel.AuditAuthzListPanel.java
License:Apache License
private void addUserSearchModal() { final ModalWindow usersModalWindow; listForm.add(usersModalWindow = new ModalWindow("usersearchmodal")); final UserSearchModalPanel userSearchModalPanel = new UserSearchModalPanel(usersModalWindow.getContentId(), usersModalWindow);// w w w .j a v a 2 s.c om usersModalWindow.setContent(userSearchModalPanel); usersModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { User userSelection = userSearchModalPanel.getUserSelection(); if (userSelection != null) { LOG.debug("modal selected:" + userSelection.getUserId()); UserAudit userAudit = (UserAudit) listForm.getModelObject(); userAudit.setUserId(userSelection.getUserId()); target.add(userFld); } } }); listForm.add(new SecureIndicatingAjaxLink("userAssignLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_USERS) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); String msg = "clicked on users search"; msg += "userSelection: " + userAudit.getUserId(); userSearchModalPanel.setSearchVal(userAudit.getUserId()); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); usersModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); usersModalWindow.setTitle("User Search Modal"); usersModalWindow.setInitialWidth(1000); usersModalWindow.setInitialHeight(700); usersModalWindow.setCookieName("user-search-modal"); }
From source file:org.apache.directory.fortress.web.panel.AuditAuthzListPanel.java
License:Apache License
private void addPermSearchModal() { final ModalWindow permsModalWindow; UserAudit userAudit = (UserAudit) listForm.getModelObject(); listForm.add(permsModalWindow = new ModalWindow("permsearchmodal")); final PermSearchModalPanel permSearchModalPanel = new PermSearchModalPanel(permsModalWindow.getContentId(), permsModalWindow, userAudit.isAdmin()); permsModalWindow.setContent(permSearchModalPanel); permsModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override// ww w .j ava 2 s.c om public void onClose(AjaxRequestTarget target) { Permission permSelection = permSearchModalPanel.getSelection(); if (permSelection != null) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); LOG.debug("modal selected:" + permSelection.getAbstractName()); permission = permSelection; userAudit.setObjName(permSelection.getObjName()); userAudit.setOpName(permSelection.getOpName()); target.add(objFld); target.add(opFld); } } }); listForm.add(new SecureIndicatingAjaxLink("permLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_PERMISSIONS) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); String msg = "clicked on perms search"; msg += "permSelection: " + permission; permSearchModalPanel.setSearchVal(userAudit.getObjName()); permSearchModalPanel.setAdmin(userAudit.isAdmin()); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); permsModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); String title; if (userAudit.isAdmin()) title = "Admin Permission Search Modal"; else title = "Permission Search Modal"; permsModalWindow.setTitle(title); permsModalWindow.setInitialWidth(650); permsModalWindow.setInitialHeight(450); permsModalWindow.setCookieName("perm-search-modal"); }
From source file:org.apache.directory.fortress.web.panel.AuditModListPanel.java
License:Apache License
private void addUserSearchModal() { final ModalWindow usersModalWindow; listForm.add(usersModalWindow = new ModalWindow("usersearchmodal")); final UserSearchModalPanel userSearchModalPanel = new UserSearchModalPanel(usersModalWindow.getContentId(), usersModalWindow);/* w w w . ja va 2s.c o m*/ usersModalWindow.setContent(userSearchModalPanel); usersModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { User userSelection = userSearchModalPanel.getUserSelection(); if (userSelection != null) { LOG.debug("modal selected:" + userSelection.getUserId()); UserAudit userAudit = (UserAudit) listForm.getModelObject(); userAudit.setUserId(userSelection.getUserId()); userAudit.setInternalUserId(userSelection.getInternalId()); target.add(userFld); } } }); listForm.add(new SecureIndicatingAjaxLink("userAssignLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_USERS) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); String msg = "clicked on users search"; msg += "userSelection: " + userAudit.getUserId(); userSearchModalPanel.setSearchVal(userAudit.getUserId()); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); usersModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); usersModalWindow.setTitle("User Search Modal"); usersModalWindow.setInitialWidth(1000); usersModalWindow.setInitialHeight(700); usersModalWindow.setCookieName("user-search-modal"); }
From source file:org.apache.directory.fortress.web.panel.AuditModListPanel.java
License:Apache License
private void addPermSearchModal() { final ModalWindow permsModalWindow; listForm.add(permsModalWindow = new ModalWindow("permsearchmodal")); final PermSearchModalPanel permSearchModalPanel = new PermSearchModalPanel(permsModalWindow.getContentId(), permsModalWindow, true);// w w w . j av a 2 s. c o m permsModalWindow.setContent(permSearchModalPanel); permsModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { Permission permSelection = permSearchModalPanel.getSelection(); if (permSelection != null) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); LOG.debug("modal selected:" + permSelection.getAbstractName()); permission = permSelection; userAudit.setObjName(permSelection.getObjName()); userAudit.setOpName(permSelection.getOpName()); target.add(objFld); target.add(opFld); } } }); listForm.add(new SecureIndicatingAjaxLink("permLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_PERMISSIONS) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { UserAudit userAudit = (UserAudit) listForm.getModelObject(); String msg = "clicked on perms search"; msg += "permSelection: " + permission; permSearchModalPanel.setSearchVal(userAudit.getOpName()); permSearchModalPanel.setAdmin(true); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); permsModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); permsModalWindow.setTitle("Admin Permission Search Modal"); permsModalWindow.setInitialWidth(650); permsModalWindow.setInitialHeight(450); permsModalWindow.setCookieName("perm-search-modal"); }
From source file:org.apache.directory.fortress.web.panel.GroupListPanel.java
License:Apache License
private void addMemberSearchModal(Radio memberRb) { final ModalWindow memberModalWindow; listForm.add(memberModalWindow = new ModalWindow("membersearchmodal")); final UserSearchModalPanel userSearchModalPanel = new UserSearchModalPanel(memberModalWindow.getContentId(), memberModalWindow);//from w w w . j a va 2s .c o m memberModalWindow.setContent(userSearchModalPanel); memberModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { User user = userSearchModalPanel.getUserSelection(); if (user != null) { searchVal = user.getUserId(); selectedRadioButton = MEMBERS; target.add(radioGroup); } } }); memberRb.add(new SecureIndicatingAjaxLink("memberAssignLinkLbl", GlobalIds.REVIEW_MGR, "findUsers") { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { String msg = "clicked on ou search"; msg += "memberSelection: " + searchVal; userSearchModalPanel.setSearchVal(searchVal); log.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); memberModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); memberModalWindow.setTitle("Member Search Modal"); memberModalWindow.setInitialWidth(450); memberModalWindow.setInitialHeight(450); memberModalWindow.setCookieName("member-modal"); }
From source file:org.apache.directory.fortress.web.panel.ObjectListPanel.java
License:Apache License
private void addOUSearchModal(Radio ouRb) { final ModalWindow ousModalWindow; listForm.add(ousModalWindow = new ModalWindow("ousearchmodal")); final OUSearchModalPanel ouSearchModalPanel = new OUSearchModalPanel(ousModalWindow.getContentId(), ousModalWindow, false);/*from w w w . ja v a 2 s . c o m*/ ousModalWindow.setContent(ouSearchModalPanel); ousModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { OrgUnit ou = ouSearchModalPanel.getSelection(); if (ou != null) { searchVal = ou.getName(); selectedRadioButton = OUS; target.add(radioGroup); } } }); ouRb.add(new SecureIndicatingAjaxLink("ouAssignLinkLbl", GlobalIds.DEL_REVIEW_MGR, "searchOU") { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { String msg = "clicked on ou search"; msg += "ouSelection: " + searchVal; ouSearchModalPanel.setSearchVal(searchVal); log.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); ousModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); ousModalWindow.setTitle("Permission Object Organizational Unit Search Modal"); ousModalWindow.setInitialWidth(450); ousModalWindow.setInitialHeight(450); ousModalWindow.setCookieName("permou-modal"); }
From source file:org.apache.directory.fortress.web.panel.PermListPanel.java
License:Apache License
private void addObjectSearchModal() { final ModalWindow objectsModalWindow; listForm.add(objectsModalWindow = new ModalWindow("objectsearchmodal")); final ObjectSearchModalPanel objectSearchModalPanel = new ObjectSearchModalPanel( objectsModalWindow.getContentId(), objectsModalWindow, isAdmin); objectsModalWindow.setContent(objectSearchModalPanel); objectsModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override/*from w w w. j a va 2 s .c o m*/ public void onClose(AjaxRequestTarget target) { PermObj permObj = objectSearchModalPanel.getSelection(); if (permObj != null) { permObject = permObj.getObjName(); target.add(permObjectFld); } } }); listForm.add(new SecureIndicatingAjaxLink("objectAssignLinkLbl", GlobalIds.REVIEW_MGR, "findPermObjs") { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { String msg = "clicked on object search"; msg += "objectSelection: " + permObject; objectSearchModalPanel.setSearchVal(permObject); objectSearchModalPanel.setAdmin(isAdmin); log.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); objectsModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); String modalLabel; if (isAdmin) { modalLabel = "Admin Permission Object Search Modal"; } else { modalLabel = "RBAC Permission Object Search Modal"; } objectsModalWindow.setTitle(modalLabel); objectsModalWindow.setInitialWidth(700); objectsModalWindow.setInitialHeight(450); objectsModalWindow.setCookieName("objects-modal"); }