List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setPageCreator
public ModalWindow setPageCreator(final PageCreator creator)
PageCreator
instance. From source file:org.apache.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.ja v a2 s . c o m*/ final AbstractSearchResultPanel searchResult = new UserSearchResultPanel("searchResult", true, null, getPageReference(), restClient); add(searchResult); final AbstractSearchResultPanel listResult = new UserSearchResultPanel("listResult", false, null, getPageReference(), restClient); add(listResult); // create new user final AjaxLink<Void> createLink = new ClearIndicatingAjaxLink<Void>("createLink", getPageReference()) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(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.Builder("searchPanel").build(); searchForm.add(searchPanel); final ClearIndicatingAjaxButton searchButton = new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) { final String fiql = searchPanel.buildFIQL(); LOG.debug("FIQL: " + fiql); doSearch(target, fiql, searchResult); Session.get().getFeedbackMessages().clear(); searchPanel.getSearchFeedback().refresh(target); } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { searchPanel.getSearchFeedback().refresh(target); } }; searchForm.add(searchButton); searchForm.setDefaultButton(searchButton); }
From source file:org.apache.syncope.console.SyncopeApplication.java
License:Apache License
public void setupNavigationPanel(final WebPage page, final XMLRolesReader xmlRolesReader, final boolean notsel) { final ModalWindow infoModal = new ModalWindow("infoModal"); page.add(infoModal);/* ww w. j a v a 2s . c o m*/ infoModal.setInitialWidth(350); infoModal.setInitialHeight(300); infoModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); infoModal.setCookieName("infoModal"); infoModal.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new InfoModalPage(); } }); final AjaxLink<Page> infoLink = new AjaxLink<Page>("infoLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { infoModal.show(target); } }; page.add(infoLink); BookmarkablePageLink<Page> schemaLink = new BookmarkablePageLink<Page>("schema", Schema.class); MetaDataRoleAuthorizationStrategy.authorize(schemaLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Schema", "list")); page.add(schemaLink); schemaLink.add(new Image("schemaIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "schema" + Constants.PNG_EXT))); BookmarkablePageLink<Page> usersLink = new BookmarkablePageLink<Page>("users", Users.class); MetaDataRoleAuthorizationStrategy.authorize(usersLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "list")); page.add(usersLink); usersLink.add(new Image("usersIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "users" + Constants.PNG_EXT))); BookmarkablePageLink<Page> rolesLink = new BookmarkablePageLink<Page>("roles", Roles.class); MetaDataRoleAuthorizationStrategy.authorize(rolesLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "list")); page.add(rolesLink); rolesLink.add(new Image("rolesIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "roles" + Constants.PNG_EXT))); BookmarkablePageLink<Page> resourcesLink = new BookmarkablePageLink<Page>("resources", Resources.class); MetaDataRoleAuthorizationStrategy.authorize(resourcesLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Resources", "list")); page.add(resourcesLink); resourcesLink.add(new Image("resourcesIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "resources" + Constants.PNG_EXT))); BookmarkablePageLink<Page> todoLink = new BookmarkablePageLink<Page>("todo", Todo.class); MetaDataRoleAuthorizationStrategy.authorize(todoLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Approval", "list")); page.add(todoLink); todoLink.add(new Image("todoIcon", new ContextRelativeResource(IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "todo" + Constants.PNG_EXT))); BookmarkablePageLink<Page> reportLink = new BookmarkablePageLink<Page>("reports", Reports.class); MetaDataRoleAuthorizationStrategy.authorize(reportLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Reports", "list")); page.add(reportLink); reportLink.add(new Image("reportsIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "reports" + Constants.PNG_EXT))); BookmarkablePageLink<Page> configurationLink = new BookmarkablePageLink<Page>("configuration", Configuration.class); MetaDataRoleAuthorizationStrategy.authorize(configurationLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "list")); page.add(configurationLink); configurationLink.add(new Image("configurationIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "configuration" + Constants.PNG_EXT))); BookmarkablePageLink<Page> taskLink = new BookmarkablePageLink<Page>("tasks", Tasks.class); MetaDataRoleAuthorizationStrategy.authorize(taskLink, WebPage.ENABLE, xmlRolesReader.getAllAllowedRoles("Tasks", "list")); page.add(taskLink); taskLink.add(new Image("tasksIcon", new ContextRelativeResource( IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "tasks" + Constants.PNG_EXT))); page.add(new BookmarkablePageLink<Page>("logout", Logout.class)); }
From source file:org.apache.syncope.console.SyncopeApplication.java
License:Apache License
public void setupEditProfileModal(final WebPage page, final UserSelfRestClient userSelfRestClient) { // Modal window for editing user profile final ModalWindow editProfileModalWin = new ModalWindow("editProfileModal"); editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editProfileModalWin.setInitialHeight(EDIT_PROFILE_WIN_HEIGHT); editProfileModalWin.setInitialWidth(EDIT_PROFILE_WIN_WIDTH); editProfileModalWin.setCookieName("edit-profile-modal"); page.add(editProfileModalWin);/* w w w . j av a 2 s . co m*/ final AjaxLink<Page> editProfileLink = new AjaxLink<Page>("editProfileLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { final UserTO userTO = SyncopeSession.get().isAuthenticated() ? userSelfRestClient.read() : new UserTO(); editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new UserSelfModalPage(page.getPageReference(), editProfileModalWin, userTO); } }); editProfileModalWin.show(target); } }; editProfileLink.add(new Label("username", SyncopeSession.get().getUsername())); if ("admin".equals(SyncopeSession.get().getUsername())) { editProfileLink.setEnabled(false); } page.add(editProfileLink); }
From source file:org.dcm4chee.web.war.folder.StudyListPage.java
License:LGPL
private Link<Object> getFileDisplayLink(final ModalWindow modalWindow, final FileModel fileModel, TooltipBehaviour tooltip) {/*from ww w .j a v a 2 s . co m*/ int[] winSize = WebCfgDelegate.getInstance().getWindowSize("dcmFileDisplay"); final String fsID = fileModel.getFileObject().getFileSystem().getDirectoryPath(); final String fileID = fileModel.getFileObject().getFilePath(); ModalWindowLink displayLink = new ModalWindowLink("displayFile", modalWindow, winSize[0], winSize[1]) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { DicomInputStream dis = null; try { final File file = fsID.startsWith("tar:") ? TarRetrieveDelegate.getInstance().retrieveFileFromTar(fsID, fileID) : FileUtils.resolve(new File(fsID, fileID)); dis = new DicomInputStream(file); final DicomObject obj = dis.readDicomObject(); //modalWindow.setContent(new DicomObjectPanel("content", dis.readDicomObject(), true)); modalWindow.setPageCreator(new ModalWindow.PageCreator() { @Override public Page createPage() { return new DicomObjectPage(new DicomObjectPanel("content", obj, true)); } }); modalWindow.setTitle(new ResourceModel("folder.dcmfileview.title")); modalWindow.show(target); super.onClick(target); } catch (Exception e) { log.error("Error requesting dicom object from file: ", e); msgWin.show(target, getString("folder.message.dcmFileError")); } finally { if (dis != null) try { dis.close(); } catch (IOException ignore) { } } } }; Image image = new Image("displayFileImg", ImageManager.IMAGE_FOLDER_DICOM_FILE); image.add(new ImageSizeBehaviour("vertical-align: middle;")); if (tooltip != null) image.add(tooltip); displayLink.add(image); displayLink.setVisible(fsID.startsWith("tar:") || FileUtils.resolve(new File(fsID, fileID)).exists()); return displayLink; }
From source file:org.dcm4chee.web.war.folder.StudyListPage.java
License:LGPL
private Link<Object> getStudyPermissionLink(final ModalWindow modalWindow, final AbstractEditableDicomModel model, TooltipBehaviour tooltip) { int[] winSize = WebCfgDelegate.getInstance().getWindowSize("studyPerm"); ModalWindowLink studyPermissionLink = new ModalWindowLink("studyPermissions", modalWindow, winSize[0], winSize[1]) {/*from w ww . j av a 2 s.com*/ private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { if (checkExists(model, target)) { modalWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; @Override public Page createPage() { return new StudyPermissionsPage(model); } }); modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { updateStudyPermissions(); query(target); modalWindow.getPage().setOutputMarkupId(true); target.addComponent(modalWindow.getPage()); target.addComponent(header); } }); modalWindow.add(new ModalWindowLink.DisableDefaultConfirmBehavior()); modalWindow.setTitle(""); modalWindow.setCloseButtonCallback(null); modalWindow.show(target); } } @Override public boolean isVisible() { return studyPermissionHelper.isManageStudyPermissions() && model.getDataset() != null && !(model instanceof PatientModel && !((PatientModel) model).isExpandable()); } }; Image image = new Image("studyPermissionsImg", ImageManager.IMAGE_FOLDER_STUDY_PERMISSIONS); image.add(new ImageSizeBehaviour("vertical-align: middle;")); if (tooltip != null) image.add(tooltip); studyPermissionLink.add(image); return studyPermissionLink; }
From source file:org.dcm4chee.web.war.folder.webviewer.Webviewer.java
License:LGPL
private static AbstractLink getWebviewerSelectionPageLink(final AbstractDicomModel model, final WebviewerLinkProvider[] providers, final ModalWindow modalWindow, final WebviewerLinkClickedCallback callback) { log.debug("Use SelectionLINK for model:{}", model); if (modalWindow == null) { Link<Object> link = new Link<Object>(WEBVIEW_ID) { private static final long serialVersionUID = 1L; @Override/*w w w .j a v a 2s . c o m*/ public void onClick() { setResponsePage(new WebviewerSelectionPage(model, providers, null, callback)); } }; link.setPopupSettings(new PopupSettings(PageMap.forName("webviewPage"), PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)); return link; } else { int[] winSize = WebCfgDelegate.getInstance().getWindowSize("webviewer"); return new ModalWindowLink(WEBVIEW_ID, modalWindow, winSize[0], winSize[1]) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { modalWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; @Override public Page createPage() { return new WebviewerSelectionPage(model, providers, modalWindow, callback); } }); modalWindow.setTitle(""); modalWindow.show(target); } }; } }
From source file:org.dcm4chee.web.war.tc.TCResultPanel.java
License:LGPL
@SuppressWarnings("serial") public TCResultPanel(final String id, final TCListModel model, final IModel<Boolean> trainingModeModel) { super(id, model != null ? model : new TCListModel()); setOutputMarkupId(true);//w ww . j av a 2s . c om stPermHelper = StudyPermissionHelper.get(); initWebviewerLinkProvider(); add(msgWin); final ModalWindow modalWindow = new ModalWindow("modal-window"); add(modalWindow); final ModalWindow forumWindow = new ModalWindow("forum-window"); add(forumWindow); final TCStudyListPage studyPage = new TCStudyListPage(); final ModalWindow studyWindow = new ModalWindow("study-window"); studyWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; public Page createPage() { return studyPage; } }); add(studyWindow); tclistProvider = new SortableTCListProvider((TCListModel) getDefaultModel()); final TCAttributeVisibilityStrategy attrVisibilityStrategy = new TCAttributeVisibilityStrategy( trainingModeModel); final DataView<TCModel> dataView = new DataView<TCModel>("row", tclistProvider) { private final StudyListLocal dao = (StudyListLocal) JNDIUtils.lookup(StudyListLocal.JNDI_NAME); private final Map<String, List<String>> studyActions = new HashMap<String, List<String>>(); @Override protected void populateItem(final Item<TCModel> item) { final TCModel tc = item.getModelObject(); final StringBuilder jsStopEventPropagationInline = new StringBuilder( "var event=arguments[0] || window.event; if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble=True;};"); item.setOutputMarkupId(true); item.add(new TCMultiLineLabel("title", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.Title)) { return TCUtilities.getLocalizedString("tc.case.text") + " " + tc.getId(); } return tc.getTitle(); } }, new AutoClampSettings(40))); item.add(new TCMultiLineLabel("abstract", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.Abstract)) { return TCUtilities.getLocalizedString("tc.obfuscation.text"); } return tc.getAbstract(); } }, new AutoClampSettings(40))); item.add(new TCMultiLineLabel("author", new AbstractReadOnlyModel<String>() { public String getObject() { if (!attrVisibilityStrategy.isAttributeVisible(TCAttribute.AuthorName)) { return TCUtilities.getLocalizedString("tc.obfuscation.text"); } return tc.getAuthor(); } }, new AutoClampSettings(40))); item.add(new Label("date", new Model<Date>(tc.getCreationDate())) { private static final long serialVersionUID = 1L; @Override public IConverter getConverter(Class<?> type) { return new DateConverter() { private static final long serialVersionUID = 1L; @Override public DateFormat getDateFormat(Locale locale) { if (locale == null) { locale = Locale.getDefault(); } return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); } }; } }); final String stuid = tc.getStudyInstanceUID(); if (dao != null && !studyActions.containsKey(stuid)) { studyActions.put(stuid, dao.findStudyPermissionActions(stuid, stPermHelper.getDicomRoles())); } item.add(Webviewer.getLink(tc, webviewerLinkProviders, stPermHelper, new TooltipBehaviour("tc.result.table.", "webviewer"), modalWindow, new WebviewerLinkClickedCallback() { public void linkClicked(AjaxRequestTarget target) { TCAuditLog.logTFImagesViewed(tc); } }).add(new SecurityBehavior(TCPanel.getModuleName() + ":webviewerInstanceLink"))); final Component viewLink = new IndicatingAjaxLink<String>("tc-view") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); openTC(tc, false, target); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcViewImg", ImageManager.IMAGE_COMMON_DICOM_DETAILS) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "view")).setOutputMarkupId(true); final Component editLink = new IndicatingAjaxLink<String>("tc-edit") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); openTC(tc, true, target); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcEditImg", ImageManager.IMAGE_COMMON_DICOM_EDIT) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "edit")) .add(new SecurityBehavior(TCPanel.getModuleName() + ":editTC")).setOutputMarkupId(true); final Component studyLink = new IndicatingAjaxLink<String>("tc-study") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { selectTC(item, tc, target); try { TCObject tcObject = TCObject.create(tc); List<TCReferencedStudy> refStudies = tcObject.getReferencedStudies(); if (refStudies != null && !refStudies.isEmpty()) { if (refStudies.size() == 1) { studyPage.setStudyInstanceUID(refStudies.get(0).getStudyUID()); } else { studyPage.setPatientIdAndIssuer(tc.getPatientId(), tc.getIssuerOfPatientId()); } } if (studyPage.getStudyInstanceUID() != null || studyPage.getPatientId() != null) { studyPage.getStudyViewPort().clear(); studyWindow .setTitle(new StringResourceModel("tc.result.studywindow.title", this, null, new Object[] { maskNull(cutAtISOControl(tc.getTitle(), 40), "?"), maskNull(cutAtISOControl(tc.getAbstract(), 25), "?"), maskNull(cutAtISOControl(tc.getAuthor(), 20), "?"), maskNull(tc.getCreationDate(), tc.getCreatedTime()) })); studyWindow.setInitialWidth(1200); studyWindow.setInitialHeight(600); studyWindow.setMinimalWidth(800); studyWindow.setMinimalHeight(400); if (studyWindow.isShown()) { log.warn("###### StudyView is already shown ???!!!"); try { Field showField = ModalWindow.class.getDeclaredField("shown"); showField.setAccessible(true); showField.set(studyWindow, false); } catch (Exception e) { log.error("Failed to reset shown Field from ModalWindow!"); } log.info("###### studyWindow.isShown():" + studyWindow.isShown()); } studyWindow.show(target); } else { log.warn("Showing TC referenced studies discarded: No referened study found!"); msgWin.setInfoMessage(getString("tc.result.studywindow.noStudies")); msgWin.show(target); } } catch (Exception e) { msgWin.setErrorMessage(getString("tc.result.studywindow.failed")); msgWin.show(target); log.error("Unable to show TC referenced studies!", e); } } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcStudyImg", ImageManager.IMAGE_COMMON_SEARCH) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "showStudy")) .add(new SecurityBehavior(TCPanel.getModuleName() + ":showTCStudy")) .setOutputMarkupId(true); final Component forumLink = new IndicatingAjaxLink<String>("tc-forum") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { try { TCForumPostsPanel content = new TCForumPostsPanel(forumWindow.getContentId(), new Model<String>(TCForumIntegration .get(WebCfgDelegate.getInstance().getTCForumIntegrationType()) .getPostsPageURL(tc))); forumWindow.setInitialHeight(820); forumWindow.setInitialWidth(1024); forumWindow.setContent(content); forumWindow.show(target); } catch (Exception e) { log.error("Unable to open case forum page!", e); } } @Override public boolean isVisible() { return TCForumIntegration .get(WebCfgDelegate.getInstance().getTCForumIntegrationType()) != null; } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("ondblclick", jsStopEventPropagationInline); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return TCPanel.getMaskingBehaviour().getAjaxCallDecorator(); } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }.add(new Image("tcForumImg", ImageManager.IMAGE_TC_FORUM) .add(new ImageSizeBehaviour("vertical-align: middle;"))) .add(new TooltipBehaviour("tc.result.table.", "showForum")).setOutputMarkupId(true); item.add(viewLink); item.add(editLink); item.add(studyLink); item.add(forumLink); item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { if (selected != null && selected.equals(tc)) { return "mouse-out-selected"; } else { return item.getIndex() % 2 == 1 ? "even-mouse-out" : "odd-mouse-out"; } } })); item.add(new AttributeModifier("selected", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { if (selected != null && selected.equals(tc)) { return "selected"; } else { return null; } } })); item.add(new AttributeModifier("onmouseover", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { StringBuffer sbuf = new StringBuffer(); sbuf.append("if ($(this).attr('selected')==null) {"); sbuf.append(" $(this).removeClass();"); sbuf.append(" if (").append(item.getIndex()) .append("%2==1) $(this).addClass('even-mouse-over');"); sbuf.append(" else $(this).addClass('odd-mouse-over');"); sbuf.append("}"); return sbuf.toString(); } })); item.add(new AttributeModifier("onmouseout", true, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { StringBuffer sbuf = new StringBuffer(); sbuf.append("if ($(this).attr('selected')==null) {"); sbuf.append(" $(this).removeClass();"); sbuf.append(" if (").append(item.getIndex()) .append("%2==1) $(this).addClass('even-mouse-out');"); sbuf.append(" else $(this).addClass('odd-mouse-out');"); sbuf.append("}"); return sbuf.toString(); } })); item.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { selectTC(item, tc, target); } }); item.add(new AjaxEventBehavior("ondblclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { boolean edit = WebCfgDelegate.getInstance().getTCEditOnDoubleClick(); if (edit) { edit = SecureComponentHelper.isActionAuthorized(editLink, "render"); } openTC(selected, edit, target); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { try { return new IAjaxCallDecorator() { private static final long serialVersionUID = 1L; public final CharSequence decorateScript(CharSequence script) { return "if(typeof showMask == 'function') { showMask(); $('body').css('cursor','wait'); };" + script; } public final CharSequence decorateOnSuccessScript(CharSequence script) { return "hideMask();$('body').css('cursor','');" + script; } public final CharSequence decorateOnFailureScript(CharSequence script) { return "hideMask();$('body').css('cursor','');" + script; } }; } catch (Exception e) { log.error("Failed to get IAjaxCallDecorator: ", e); } return null; } }); } }; dataView.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); dataView.setItemsPerPage(WebCfgDelegate.getInstance().getDefaultFolderPagesize()); dataView.setOutputMarkupId(true); SortLinkGroup sortGroup = new SortLinkGroup(dataView); add(new SortLink("sortTitle", sortGroup, TCModel.Sorter.Title)); add(new SortLink("sortAbstract", sortGroup, TCModel.Sorter.Abstract)); add(new SortLink("sortDate", sortGroup, TCModel.Sorter.Date)); add(new SortLink("sortAuthor", sortGroup, TCModel.Sorter.Author)); add(dataView); add(new Label("numberOfMatchingInstances", new StringResourceModel("tc.list.numberOfMatchingInstances", this, null, new Object[] { new Model<Integer>() { private static final long serialVersionUID = 1L; @Override public Integer getObject() { return ((TCListModel) TCResultPanel.this.getDefaultModel()).getObject().size(); } } }))); add(new PagingNavigator("navigator", dataView)); }
From source file:org.devgateway.eudevfin.projects.module.components.panels.ReportsTableListPanel.java
private ModalWindow AddModalWindow(PageParameters parameters) { if (parameters == null) { parameters = new PageParameters(); }/*ww w .j av a2 s .c om*/ final ModalWindow modal = new ModalWindow("modal"); modal.setCookieName("modal-1"); modal.setPageCreator(new ModalWindow.PageCreator() { @Override public org.apache.wicket.Page createPage() { return new ReportsTableModal(getParameters(), ReportsTableListPanel.this.getPage().getPageReference(), modal); } }); modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { ReportsTableListPanel newComp = new ReportsTableListPanel(WICKETID_LIST_PANEL, new ProjectReportsListGenerator(NewProjectPage.project.getProjectReports())); getParent().replace(newComp); target.add(newComp); } }); modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { public boolean onCloseButtonClicked(AjaxRequestTarget target) { return true; } }); return modal; }
From source file:org.devgateway.eudevfin.projects.module.components.panels.ResultsTableListPanel.java
private ModalWindow AddModalWindow(PageParameters parameters) { if (parameters == null) { parameters = new PageParameters(); }// w w w .j a v a 2 s. c om final ModalWindow modal = new ModalWindow("modal"); modal.setCookieName("modal-1"); modal.setPageCreator(new ModalWindow.PageCreator() { @Override public org.apache.wicket.Page createPage() { return new ResultsTableModal(getParameters(), ResultsTableListPanel.this.getPage().getPageReference(), modal); } }); modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { ResultsTableListPanel newComp = new ResultsTableListPanel(WICKETID_LIST_PANEL, new ProjectResultsListGenerator(NewProjectPage.project.getProjectResults())); getParent().replace(newComp); target.add(newComp); } }); modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { public boolean onCloseButtonClicked(AjaxRequestTarget target) { // Change the passValue variable when modal window is closed. //setPassValue("Modal window is closed by user."); return true; } }); return modal; }
From source file:org.devgateway.eudevfin.projects.module.components.panels.TransactionTableListPanel.java
private ModalWindow AddModalWindow(PageParameters parameters) { if (parameters == null) { parameters = new PageParameters(); }//w w w . ja v a2 s . c o m final ModalWindow modal = new ModalWindow("modal"); modal.setCookieName("modal-1"); modal.setPageCreator(new ModalWindow.PageCreator() { @Override public org.apache.wicket.Page createPage() { return new TransactionsTableModal(getParameters(), TransactionTableListPanel.this.getPage().getPageReference(), modal); } }); modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { TransactionTableListPanel newComp = new TransactionTableListPanel(WICKETID_LIST_PANEL, new ProjectTransactionsListGenerator(NewProjectPage.project.getProjectTransactions())); newComp.add(new AttributeAppender("class", "budget-table")); getParent().replace(newComp); target.add(newComp); } }); modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { public boolean onCloseButtonClicked(AjaxRequestTarget target) { return true; } }); return modal; }