List of usage examples for org.apache.wicket.markup.html.link Link setPopupSettings
public final Link<T> setPopupSettings(final PopupSettings popupSettings)
From source file:com.norconex.jefmon.instance.action.ActionsCell.java
License:Apache License
@SuppressWarnings("nls") public ActionsCell(final String id, final JobStatusTreeNode job, final List<IJobAction> actions) { super(id);/*from w ww .ja va 2s . c o m*/ add(new ListView<IJobAction>("actions", actions) { private static final long serialVersionUID = 3635147316426384496L; @Override protected void populateItem(ListItem<IJobAction> item) { final IJobAction action = item.getModelObject(); if (action.isVisible(job)) { String icon = action.getFontIcon(); final String pageName = action.getName().getObject() + " - " + job.getJobId(); Link<String> link = new Link<String>("actionLink") { private static final long serialVersionUID = 3488334322744811811L; @Override public void onClick() { Component comp = action.execute(job, ActionPage.COMPONENT_ID); if (comp != null) { setResponsePage(new ActionPage(comp, Model.of(pageName))); } } }; PopupSettings popup = new PopupSettings(pageName, PopupSettings.RESIZABLE); popup.setWidth(800); link.setPopupSettings(popup); link.add(new Label("actionIcon").add(new CssClass(icon))); link.add(new BootstrapTooltip(action.getName())); item.add(link); } else { WebMarkupContainer empty = new WebMarkupContainer("actionLink"); empty.add(new Label("actionIcon")); empty.setVisible(false); item.add(empty); } } }); }
From source file:jdave.webdriver.testapplication.WebDriverTestPage.java
License:Apache License
public WebDriverTestPage() { final Label label = new Label("testLabel", new Model<String>("test label")); label.setOutputMarkupId(true);/* w ww. j a v a2 s . c o m*/ add(label); add(new AjaxFallbackLink<Void>("testLink") { @Override public void onClick(AjaxRequestTarget target) { label.setDefaultModelObject("link clicked"); target.addComponent(label); } }); add(new AjaxFallbackLink<Void>("testLink2") { @Override public void onClick(AjaxRequestTarget target) { } }); TextField<String> textField = new TextField<String>("testTextField", new Model<String>()); add(textField); textField.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { label.setDefaultModelObject(getDefaultModelObject()); target.addComponent(label); } }); add(new AjaxCheckBox("testCheckBox", new Model<Boolean>(false)) { @Override protected void onUpdate(AjaxRequestTarget target) { label.setDefaultModelObject("checkbox clicked"); target.addComponent(label); } }); add(TestDropDownChoice.getDropDownChoice()); Link<Void> openLink = new Link<Void>("openChildPageLink") { @Override public void onClick() { setResponsePage(new ChildPage()); } }; final PopupSettings popupSettings = new PopupSettings(PopupSettings.SCROLLBARS).setWidth(1045) .setHeight(900).setWindowName("childPage"); openLink.setPopupSettings(popupSettings); add(openLink); }
From source file:org.apache.oodt.cas.webcomponents.filemgr.browser.types.TypeBrowser.java
License:Apache License
public TypeBrowser(String componentId, String fmUrlStr, String productTypeName, int pageNum, final Class<? extends WebPage> typeBrowserPage, final Class<? extends WebPage> produdctBrowser, final Class<? extends WebPage> prodRefsBrowser, final Class<? extends WebPage> prodMetBrowser) { super(componentId); this.fm = new FileManagerConn(fmUrlStr); this.type = fm.safeGetProductTypeByName(productTypeName); this.pageNum = pageNum; this.criteria = ((FMBrowserSession) getSession()).getCriteria(); this.refreshProductPage(); this.computeStartEndIdx(); add(new ExistingCriteriaForm("existing_criteria_form")); add(new AddCriteriaForm("new_criteria_form")); add(new Label("ptype_name", type.getName())); add(new Label("start_idx", String.valueOf(this.startIdx))); add(new Label("end_idx", String.valueOf(this.endIdx))); add(new Label("num_products", String.valueOf(this.totalProducts))); add(new ListView<Product>("product_list", this.productPage.getPageProducts()) { /*//from w w w. j a v a 2 s . c om * (non-Javadoc) * * @see * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache * .wicket.markup.html.list.ListItem) */ @Override protected void populateItem(ListItem<Product> prodItem) { Link prodPageLink = new Link<Product>("product_page_link", new ProductModel(prodItem.getModelObject())) { /* * (non-Javadoc) * * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { PageParameters params = new PageParameters(); params.add("id", this.getModelObject().getProductId()); setResponsePage(produdctBrowser, params); } }; prodPageLink.add(new Label("product_name", prodItem.getModelObject().getProductName())); prodItem.add(prodPageLink); prodItem.add(new Label("product_transfer_status", prodItem.getModelObject().getTransferStatus())); try { prodItem.add(new Label("product_pct_transferred", NumberFormat.getPercentInstance() .format(fm.getFm().getProductPctTransferred(prodItem.getModelObject())))); } catch (DataTransferException e) { LOG.log(Level.WARNING, "Unable to obtain transfer percentage for product: [" + prodItem.getModelObject().getProductName() + "]: Reason: " + e.getMessage()); } String prodReceivedTime = fm.getProdReceivedTime(prodItem.getModelObject()); prodItem.add(new Label("product_received_time", prodReceivedTime)); PopupSettings refSettings = new PopupSettings(); refSettings.setWidth(525).setHeight(450).setWindowName("_refWin"); Link<String> refLink = new Link<String>("ref_page_link", new Model<String>(prodItem.getModelObject().getProductId())) { /* * (non-Javadoc) * * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { PageParameters params = new PageParameters(); params.add("id", getModelObject()); setResponsePage(prodRefsBrowser, params); } }; refLink.setPopupSettings(refSettings); prodItem.add(refLink); Link<String> metLink = new Link<String>("met_page_link", new Model(prodItem.getModelObject().getProductId())) { /* * (non-Javadoc) * * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { PageParameters params = new PageParameters(); params.add("id", getModelObject()); setResponsePage(prodMetBrowser, params); } }; PopupSettings metSettings = new PopupSettings(); metSettings.setWidth(525).setHeight(450).setWindowName("_metWin"); metLink.setPopupSettings(metSettings); prodItem.add(metLink); } }); add(new ProductPaginator("paginator", this.productPage, this.type.getName(), typeBrowserPage)); }
From source file:org.cast.isi.page.TeacherToc.java
License:Open Source License
public void addChapterTables(ISIXmlSection currentRootSection) { RepeatingView chapterRepeater = new RepeatingView("chapterRepeater"); add(chapterRepeater);//from ww w.ja va 2s .c o m for (XmlDocument doc : ISIApplication.get().getStudentContent()) { // For each XML Document for (XmlSection rs : doc.getTocSection().getChildren()) { // For each chapter in the document; tends to be only one. final ISIXmlSection rootSection = (ISIXmlSection) rs; WebMarkupContainer rootSectionContainer = new WebMarkupContainer(chapterRepeater.newChildId()); chapterRepeater.add(rootSectionContainer); rootSectionContainer.add(new Label("title", rs.getTitle())); rootSectionContainer.add(new Label("subtitle", rootSection.getSubTitle())); if (rootSection.equals(currentRootSection)) rootSectionContainer.add(new ClassAttributeModifier("open")); WebMarkupContainer table = new WebMarkupContainer("periodTable"); rootSectionContainer.add(table); table.add(new Label("periodName", new PropertyModel<String>(ISISession.get().getCurrentPeriodModel(), "name"))); // Add non-section children as Super Section Labels // TODO: Lame hack for differences between IQWST/FS // TODO: Have TeacherToc create a custom repeater that can be extended by subclasses? RepeatingView superSectionRepeater = new RepeatingView("superSectionRepeater"); for (XmlSection rc : rootSection.getChildren()) { ISIXmlSection rootChild = (ISIXmlSection) rc; WebMarkupContainer superSectionContainer = new WebMarkupContainer( superSectionRepeater.newChildId()); superSectionRepeater.add(superSectionContainer); if (rootChild.isSuperSection()) { superSectionContainer.add(new Label("superSectionTitle", rootChild.getTitle())); if (rootChild.getChildren().size() > 1) { superSectionContainer.add(new AttributeModifier("colspan", String.valueOf(rootChild.getChildren().size()))); } } else { superSectionContainer.add(new EmptyPanel("superSectionTitle")); } } table.add(superSectionRepeater); // List Sections across the top of the table. table.add(new ListView<ISIXmlSection>("sectionList", rootSection.getSectionChildren()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<ISIXmlSection> item) { ISIXmlSection sec = item.getModelObject(); BookmarkablePageLink<ISIStandardPage> link = new SectionLinkFactory() .linkToPage("sectionLink", sec); item.add(link); link.add(ISIApplication.get().iconFor(sec)); } }); // List students and their appropriate status messages // get the list of students in this period UserCriteriaBuilder c = new UserCriteriaBuilder(); c.setRole(Role.STUDENT); c.setPeriod(ISISession.get().getCurrentPeriodModel()); // add the students to the table table.add(new ListView<User>("student", new UserListModel(c)) { private static final long serialVersionUID = 1L; // for each student add the following fields @Override protected void populateItem(ListItem<User> userItem) { final User student = userItem.getModelObject(); userItem.add(new StudentFlagPanel("flagPanel", student, mFlagMap.getObject())); userItem.add(new Label("studentName", student.getSortName())); // The cells in the table are status indications userItem.add(new ListView<ISIXmlSection>("statusCell", rootSection.getSectionChildren()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<ISIXmlSection> sectionItem) { final ISIXmlSection sec = sectionItem.getModelObject(); Link<ISIXmlSection> link = new Link<ISIXmlSection>("link") { private static final long serialVersionUID = 1L; @Override public void onClick() { SectionStatus stat = getUserSectionStatus(student, sec); ISIXmlSection targetSection = new SectionLinkFactory().sectionLinkDest(sec); Class<? extends ISIStandardPage> pageType = ISIApplication.get() .getReadingPageClass(); ISISession.get().setStudentModel(new HibernateObjectModel<User>(student)); PageParameters param = new PageParameters(); // TODO: This first statement is a hack. For some reason, getUnreadStudentMessages() // is able to be out of sync with FeedbackMessage.isUnread() flag and is displaying // the wrong icon on the page. See ISIApplication.statusIconFor() as well. String s = null; if (stat != null && stat.getUnreadStudentMessages() > 0 && (s = responseService.locationOfFirstUnreadMessage(student, sec)) != null) { param.set("loc", s); } else if (stat != null && stat.getCompleted() && !stat.getReviewed()) { ISIXmlSection section = targetSection.getSectionAncestor() .firstPageWithResponseGroup(); if (section != null) param.set("loc", (new ContentLoc(section).getLocation())); else throw new IllegalStateException( "Section without response areas marked Ready For Review - should automatically be reviewed."); } else { param.set("loc", (new ContentLoc(targetSection)).getLocation()); } setResponsePage(pageType, param); } }; link.add(ISIApplication.get().teacherStatusIconFor(sec, getUserSectionStatus(student, sec))); sectionItem.add(link); } }); Link<Object> teacherNotesLink = new Link<Object>("teacherNotesLink") { private static final long serialVersionUID = 1L; @Override public void onClick() { ISISession.get().setStudentModel(new HibernateObjectModel<User>(student)); setResponsePage(ISIApplication.get().getTeacherNotesPageClass()); } }; userItem.add(teacherNotesLink); teacherNotesLink.setPopupSettings(ISIApplication.teacherNotesPopupSettings); teacherNotesLink.setVisible(mStudentWithNotes.getObject().contains(student)); } }); } } }
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 2 s. co 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.openengsb.ui.common.editor.fields.OAuthField.java
License:Apache License
@Override protected ModelFacade<String> createFormComponent(AttributeDefinition attribute, final IModel<String> model) { PopupSettings popupSettings = new PopupSettings("popuppagemap").setHeight(300).setWidth(600).setLeft(50) .setTop(50);// w ww .j a v a 2s . com Link<OAuthData> pageLink = new Link<OAuthData>("popupLink", new OAuthPageModel(new Model<OAuthData>(attribute.getOAuthConfiguration()))) { @Override public void onClick() { OAuthData oauth = getModelObject(); String redirectURL = buildRedirectURL(getRequest()); oauth.setRedirectURL(redirectURL); String link = oauth.generateFirstCallLink(); OAuthPageFactory.putOAuthObject(getSession().getId(), oauth); getRequestCycle().scheduleRequestHandlerAfterCurrent(new RedirectRequestHandler(link)); } }; pageLink.setPopupSettings(popupSettings); final TextField<String> tokenResult = new TextField<String>("field", model); tokenResult.setRequired(true); tokenResult.setOutputMarkupId(true); List<Component> list = new ArrayList<Component>(); list.add(pageLink); ModelFacade<String> container = new ModelFacade<String>(); container.setHelpComponents(list); container.setMainComponent(tokenResult); return container; }
From source file:org.sakaiproject.scorm.ui.console.pages.DisplayDesignatedPackage.java
License:Educational Community License
/** * @param pkg/*from ww w. j ava2 s . c o m*/ */ @SuppressWarnings("deprecation") protected void addActionLinksForPackage(final ContentPackage pkg) { PlayerPage playerPage = new PlayerPage(getParametersForPackage(pkg)); Link lnkGo = new PageLink("lnk_go", playerPage); // Link lnkGo = new BookmarkablePageLink("lnk_go", PlayerPage.class, getParametersForPackage(pkg) ); if (StringUtils.isNotBlank(pkg.getTitle())) { String title = pkg.getTitle(); PopupSettings popupSettings = new PopupSettings(PageMap.forName(title), PopupSettings.RESIZABLE); popupSettings.setWidth(1020); popupSettings.setHeight(740); popupSettings.setWindowName(title); lnkGo.setPopupSettings(popupSettings); } lnkGo.setEnabled(true); lnkGo.setVisible(true); final PageParameters params = getParametersForPackage(pkg); params.add("no-toolbar", "true"); String context = lms.currentContext(); final boolean canConfigure = lms.canConfigure(context); final boolean canViewResults = lms.canViewResults(context); final boolean canGrade = lms.canGrade(context); Link<?> lnkConfigure = new Link("lnk_configure") { @Override public void onClick() { setResponsePage(new PackageConfigurationPage(params)); } }; lnkConfigure.setVisible(canConfigure); // the following link points to the results page for the designated package /* * if (canViewResults) { actionColumn.addAction(new Action(new StringResourceModel("column.action.grade.label", this, null), LearnerResultsPage.class, paramPropertyExpressions)); } */ Link<?> lnkResults = new Link("lnk_results") { @Override public void onClick() { Page resultsPage = new LearnerResultsPage(getParametersForPersonalResults(pkg)); if (canGrade) { resultsPage = new ResultsListPage(getParametersForResultsList(pkg)); } setResponsePage(resultsPage); } }; lnkResults.setVisible(canViewResults || canGrade); // add links to page add(lnkGo); add(lnkConfigure); add(lnkResults); }
From source file:org.sakaiproject.scorm.ui.console.pages.PackageListPage.java
License:Educational Community License
public PackageListPage(PageParameters params) { List<ContentPackage> contentPackages = contentService.getContentPackages(); final String context = lms.currentContext(); final boolean canConfigure = lms.canConfigure(context); final boolean canGrade = lms.canGrade(context); final boolean canViewResults = lms.canViewResults(context); final boolean canDelete = lms.canDelete(context); List<IColumn<ContentPackage>> columns = new LinkedList<IColumn<ContentPackage>>(); ActionColumn actionColumn = new ActionColumn( new StringResourceModel("column.header.content.package.name", this, null), "title", "title"); String[] paramPropertyExpressions = { "contentPackageId", "resourceId", "title" }; Action launchAction = new Action("title", PlayerPage.class, paramPropertyExpressions) { private static final long serialVersionUID = 1L; @Override/* ww w. j a v a2 s . c om*/ public Component newLink(String id, Object bean) { IModel<String> labelModel; if (displayModel != null) { labelModel = displayModel; } else { String labelValue = String.valueOf(PropertyResolver.getValue(labelPropertyExpression, bean)); labelModel = new Model<String>(labelValue); } PageParameters params = buildPageParameters(paramPropertyExpressions, bean); Link link = new BookmarkablePageLabeledLink(id, labelModel, pageClass, params); if (popupWindowName != null) { PopupSettings popupSettings = new PopupSettings(PageMap.forName(popupWindowName), PopupSettings.RESIZABLE); popupSettings.setWidth(1020); popupSettings.setHeight(740); popupSettings.setWindowName(popupWindowName); link.setPopupSettings(popupSettings); } link.setEnabled(isEnabled(bean) && lms.canLaunch((ContentPackage) bean)); link.setVisible(isVisible(bean)); return link; } }; actionColumn.addAction(launchAction); if (lms.canLaunchNewWindow()) { launchAction.setPopupWindowName("ScormPlayer"); } if (canConfigure) { actionColumn.addAction(new Action(new ResourceModel("column.action.edit.label"), PackageConfigurationPage.class, paramPropertyExpressions)); } if (canGrade) { actionColumn.addAction(new Action(new StringResourceModel("column.action.grade.label", this, null), ResultsListPage.class, paramPropertyExpressions)); } else if (canViewResults) { actionColumn.addAction(new Action(new StringResourceModel("column.action.grade.label", this, null), LearnerResultsPage.class, paramPropertyExpressions)); } columns.add(actionColumn); columns.add(new StatusColumn(new StringResourceModel("column.header.status", this, null), "status")); columns.add(new DecoratedDatePropertyColumn(new StringResourceModel("column.header.releaseOn", this, null), "releaseOn", "releaseOn")); columns.add(new DecoratedDatePropertyColumn(new StringResourceModel("column.header.dueOn", this, null), "dueOn", "dueOn")); if (canDelete) { columns.add(new ImageLinkColumn(new Model("Remove"), PackageRemovePage.class, paramPropertyExpressions, DELETE_ICON, "delete")); } BasicDataTable table = new BasicDataTable("cpTable", columns, contentPackages); add(table); }
From source file:org.sakaiproject.wicket.markup.html.repeater.data.table.Action.java
License:Educational Community License
public Component newLink(String id, Object bean) { IModel labelModel = null;/*from w w w . j a v a 2s .co m*/ if (displayModel != null) { labelModel = displayModel; } else { String labelValue = String.valueOf(PropertyResolver.getValue(labelPropertyExpression, bean)); labelModel = new Model(labelValue); } PageParameters params = buildPageParameters(paramPropertyExpressions, bean); Link link = new BookmarkablePageLabeledLink(id, labelModel, pageClass, params); if (popupWindowName != null) { PopupSettings popupSettings = new PopupSettings(PageMap.forName(popupWindowName), PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS); popupSettings.setWindowName(popupWindowName); link.setPopupSettings(popupSettings); } link.setEnabled(isEnabled(bean)); link.setVisible(isVisible(bean)); return link; }
From source file:ro.nextreports.server.web.dashboard.WidgetPopupMenuModel.java
License:Apache License
private Link createDetachLink(final IModel<Widget> model) { Link<Void> link = new Link<Void>(MenuPanel.LINK_ID) { private static final long serialVersionUID = 1L; @Override// w w w . j ava 2 s .c o m public void onClick() { setResponsePage(new WidgetZoomPage(model.getObject().getId())); } }; // see busy-indicator.js // we do not want a busy indicator in this situation link.add(new AttributeAppender("class", new Model<String>("noBusyIndicator"), " ")); PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS); popupSettings.setWidth(POPUP_WIDTH).setHeight(POPUP_HEIGHT); link.setPopupSettings(popupSettings); return link; }