org.apache.wicket.markup.html.link.Link Java Examples

The following examples show how to use org.apache.wicket.markup.html.link.Link. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EingangsrechnungListPage.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
@Override
protected void init()
{
  dataTable = createDataTable(createColumns(this, true), "datum", SortOrder.DESCENDING);
  form.add(dataTable);
  addExcelExport(getString("fibu.common.creditor"), getString("fibu.eingangsrechnungen"));
  if (Configuration.getInstance().isCostConfigured() == true) {
    final ContentMenuEntryPanel exportExcelButton = new ContentMenuEntryPanel(getNewContentMenuChildId(), new Link<Object>("link") {
      @Override
      public void onClick()
      {
        exportExcelWithCostAssignments();
      };
    }, getString("fibu.rechnung.kostExcelExport")).setTooltip(getString("fibu.rechnung.kostExcelExport.tootlip"));
    addContentMenuEntry(exportExcelButton);
  }
}
 
Example #2
Source File: AdminPage.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
protected void addCachesMenu()
{
  // Caches
  final ContentMenuEntryPanel cachesMenu = new ContentMenuEntryPanel(getNewContentMenuChildId(),
      getString("system.admin.group.title.systemChecksAndFunctionality.caches"));
  addContentMenuEntry(cachesMenu);
  // Refresh caches.
  final Link<Void> refreshCachesLink = new Link<Void>(ContentMenuEntryPanel.LINK_ID) {
    @Override
    public void onClick()
    {
      refreshCaches();
    }
  };
  final ContentMenuEntryPanel refreshCachesLinkMenuItem = new ContentMenuEntryPanel(cachesMenu.newSubMenuChildId(), refreshCachesLink,
      getString("system.admin.button.refreshCaches")).setTooltip(getString("system.admin.button.refreshCaches.tooltip"));
  cachesMenu.addSubMenuEntry(refreshCachesLinkMenuItem);
}
 
Example #3
Source File: RechnungEditForm.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
@Override
protected void onRenderPosition(final WebMarkupContainer item, final RechnungsPositionDO position)
{
  // item.add(new AuftragsPositionFormComponent("orderPosition", new PropertyModel<AuftragsPositionDO>(position, "auftragsPosition"),
  // false));

  final Link<String> orderLink = new Link<String>("orderLink") {
    @Override
    public void onClick()
    {
      if (position.getAuftragsPosition() != null) {
        final PageParameters parameters = new PageParameters();
        parameters.add(AbstractEditPage.PARAMETER_KEY_ID, position.getAuftragsPosition().getAuftrag().getId());
        final AuftragEditPage auftragEditPage = new AuftragEditPage(parameters);
        auftragEditPage.setReturnToPage(getParentPage());
        setResponsePage(auftragEditPage);
      }
    }
  };
  item.add(orderLink);
  if (position.getAuftragsPosition() == null) {
    orderLink.setVisible(false);
  }
  orderLink.add(new PresizedImage("linkImage", WebConstants.IMAGE_FIND));
}
 
Example #4
Source File: WorkflowInstanceViewerPage.java    From oodt with Apache License 2.0 6 votes vote down vote up
public WorkflowInstanceViewerPage(PageParameters params){
  add(new Link("home_link"){
    /* (non-Javadoc)
    * @see org.apache.wicket.markup.html.link.Link#onClick()
    */
   @Override
   public void onClick() {
     setResponsePage(getApplication().getHomePage());
   }
});
  
  add(new WorkflowInstancesViewer("instance_viewer", ((WMMonitorApp)getApplication()).getWorkflowUrl(), 
      params.getString("status", "ALL"), params.getInt("pageNum", 1), ((WMMonitorApp)getApplication()).getStatuses(), 
      ((WMMonitorApp)getApplication()).getLifecycleFilePath(), ((WMMonitorApp)getApplication()).getInstMetFieldsFilePath(),
      WorkflowViewerPage.class, WorkflowTaskViewerPage.class, WorkflowInstanceViewerPage.class));
}
 
Example #5
Source File: TrainingEditPage.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
private void addTopMenuPanel()
{
  if (isNew() == false) {
    final Integer id = form.getData().getId();

    @SuppressWarnings("serial")
    final ContentMenuEntryPanel menu = new ContentMenuEntryPanel(getNewContentMenuChildId(), new Link<Void>(ContentMenuEntryPanel.LINK_ID) {
      @Override
      public void onClick()
      {
        final PageParameters params = new PageParameters();
        params.set(TrainingEditForm.PARAM_TRAINING_ID, id);
        final TrainingAttendeeListPage page = new TrainingAttendeeListPage(params);
        page.setReturnToPage(TrainingEditPage.this);
        setResponsePage(page);
      };
    }, getString("plugins.skillmatrix.skilltraining.attendee.menu"));
    addContentMenuEntry(menu);
  }
}
 
Example #6
Source File: NewPullRequestPage.java    From onedev with MIT License 6 votes vote down vote up
private Fragment newAcceptedFrag() {
	Fragment fragment = new Fragment("status", "mergedFrag", this);
	fragment.add(new BranchLink("sourceBranch", getPullRequest().getSource()));
	fragment.add(new BranchLink("targetBranch", getPullRequest().getTarget()));
	fragment.add(new Link<Void>("swapBranches") {

		@Override
		public void onClick() {
			setResponsePage(
					NewPullRequestPage.class, 
					paramsOf(getProject(), getPullRequest().getSource(), getPullRequest().getTarget()));
		}
		
	});
	return fragment;
}
 
Example #7
Source File: AddressEditLinkPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
public AddressEditLinkPanel(final String id, final WebPage returnToPage, final AddressDO address, final String addressText)
{
  super(id);
  add(new Link<Object>("link") {
    @Override
    public void onClick()
    {
      final PageParameters parameters = new PageParameters();
      parameters.add(AbstractEditPage.PARAMETER_KEY_ID, address.getId());
      final AddressEditPage editPage = new AddressEditPage(parameters);
      editPage.setReturnToPage(returnToPage);
      setResponsePage(editPage);
    }
  }.add(new Label("label", addressText).setRenderBodyOnly(true)));
}
 
Example #8
Source File: AuftragListPage.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
@Override
protected void init()
{
  dataTable = createDataTable(createColumns(this, true), "nummer", SortOrder.DESCENDING);
  form.add(dataTable);
  final ContentMenuEntryPanel exportExcelButton = new ContentMenuEntryPanel(getNewContentMenuChildId(), new Link<Object>("link") {
    @Override
    public void onClick()
    {
      final List<AuftragDO> list = getList();
      final byte[] xls = orderExport.export(list);
      if (xls == null || xls.length == 0) {
        form.addError("datatable.no-records-found");
        return;
      }
      final String filename = "ProjectForge-OrderExport_" + DateHelper.getDateAsFilenameSuffix(new Date()) + ".xls";
      DownloadUtils.setDownloadTarget(xls, filename);
    };
  }, getString("exportAsXls")).setTooltip(getString("tooltip.export.excel"));
  addContentMenuEntry(exportExcelButton);

}
 
Example #9
Source File: WidgetPopupMenuModel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private Link createDetachLink(final IModel<Widget> model) {
	Link<Void> link = new Link<Void>(MenuPanel.LINK_ID) {

		private static final long serialVersionUID = 1L;

		@Override
		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;
}
 
Example #10
Source File: WorkflowTaskViewerPage.java    From oodt with Apache License 2.0 6 votes vote down vote up
public WorkflowTaskViewerPage(PageParameters params) {
  add(new Link("home_link"){
    /* (non-Javadoc)
    * @see org.apache.wicket.markup.html.link.Link#onClick()
    */
   @Override
   public void onClick() {
     setResponsePage(getApplication().getHomePage());
   }
});    
  add(new Label("task_id", params.getString("id")));
  WorkflowTaskViewer viewerComponent = new WorkflowTaskViewer("task_viewer",
      ((WMMonitorAppBase) getApplication()).getWorkflowUrl(), params
          .getString("id"), WorkflowConditionViewerPage.class);
  add(viewerComponent);
}
 
Example #11
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newAddToCartLink(final String linkId,
                             final String supplier,
                             final String skuCode,
                             final String quantity,
                             final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_ADDTOCART, skuCode);
    params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    if (quantity != null) { // null quantity will pick min from product
        params.set(ShoppingCartCommand.CMD_P_QTY, quantity);
    }
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example #12
Source File: DefaultRestorePasswordPage.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
/**
 * Creates container which contains success message about restoring user password
 * @param id component id
 * @return restore success message
 */
protected WebMarkupContainer createRestoreSuccessMessage(String id) {
    return new WebMarkupContainer(id) {
        @Override
        protected void onConfigure() {
            super.onConfigure();
            setVisible(DBClosure.sudo(db -> getModelObject()) == null);
        }

        @Override
        protected void onInitialize() {
            super.onInitialize();
            add(new Link<Void>("loginPage") {
                @Override
                public void onClick() {
                    throw new RedirectToUrlException("/login");
                }
            });
            setOutputMarkupPlaceholderTag(true);
        }
    };
}
 
Example #13
Source File: WorkflowsViewerPage.java    From oodt with Apache License 2.0 6 votes vote down vote up
public WorkflowsViewerPage() {
  add(new Link("home_link") {
    /*
     * (non-Javadoc)
     * 
     * @see org.apache.wicket.markup.html.link.Link#onClick()
     */
    @Override
    public void onClick() {
      setResponsePage(getApplication().getHomePage());
    }
  });

  add(new WorkflowsViewer("workflows_viewer",
      ((WMMonitorApp) getApplication()).getWorkflowUrl(),
      WorkflowViewerPage.class));
}
 
Example #14
Source File: ProductItemPanel.java    From the-app with Apache License 2.0 6 votes vote down vote up
private Component productDetailImageLink() {
    Link<Void> detailPageLink = new Link<Void>("productDetailLink") {
        @Override
        public void onClick() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set("urlname", productUrlModel.getObject());
            setResponsePage(new ProductDetailPage(pageParameters));
        }
    };
    WebMarkupContainer image = new WebMarkupContainer("image");
    image.add(new AttributeModifier("src", new ImageLinkModel(productInfoModel, this)));
    image.add(new AttributeModifier("title", new PropertyModel<String>(productInfoModel, "description")));
    image.add(new AttributeModifier("alt", new PropertyModel<String>(productInfoModel, "name")));
    image.setOutputMarkupId(true);

    detailPageLink.add(image);
    return detailPageLink;
}
 
Example #15
Source File: ArtifactPortfolioPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
@Override
protected void addItemColumns(Item<Artifact> item, IModel<? extends Artifact> artifactModel) {
	item.add(new Label("groupId", BindingModel.of(artifactModel, Binding.artifact().group().groupId())));
	Link<Void> artifactLink = AdministrationArtifactDescriptionPage.linkDescriptor(ReadOnlyModel.of(artifactModel))
			.link("artifactLink");
	artifactLink.add(new Label("artifactId", BindingModel.of(artifactModel, Binding.artifact().artifactId())));
	item.add(artifactLink);
	item.add(new Label("nbVersions", BindingModel.of(artifactModel, Binding.artifact().versions().size())));
	
	final IModel<ArtifactDeprecationStatus> deprecatedModel = BindingModel.of(artifactModel, Binding.artifact().deprecationStatus());
	item.add(new BooleanIcon("deprecated", new LoadableDetachableModel<Boolean>() {
		private static final long serialVersionUID = 1L;

		@Override
		protected Boolean load() {
			return ArtifactDeprecationStatus.DEPRECATED.equals(deprecatedModel.getObject());
		}
	}));
}
 
Example #16
Source File: SakaiPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Add a menu entry with a custom link.
 *
 * @param link  Link to add to the menu bar
 * @param text  Link's text
 * @param title Title attribute for the link
 */
protected void addMenuLink(Link<Page> link, IModel<String> text, IModel<String> title) {
    WebMarkupContainer parent = new WebMarkupContainer(menu.newChildId());
    menu.add(parent);
    link.add(new Label("menuItemText", text).setRenderBodyOnly(true));
    if (title != null)
        link.add(new AttributeModifier("title", title));

    parent.add(link);
}
 
Example #17
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Link newProductSkuLink(final String linkId,
                              final String supplier,
                              final Object productRef) {

    return newBookmarkableLink(linkId, supplier, WebParametersKeys.SKU_ID, productRef);
}
 
Example #18
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Link newRemoveCouponLink(final String linkId,
                                final String coupon,
                                final Class<Page> target,
                                final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_REMOVECOUPON, coupon);
    return new BookmarkablePageLink(linkId, target, params);
}
 
Example #19
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newChangeLocaleLink(final String linkId,
                                final String language,
                                final Class<? extends Page> target,
                                final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_CHANGELOCALE, language);
    return new BookmarkablePageLink(
            linkId,
            target == null ? getHomePage() : target,
            params);
}
 
Example #20
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newChangeCurrencyLink(final String linkId,
                                  final String currency,
                                  final Class<? extends Page> target,
                                  final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_CHANGECURRENCY, currency);
    return new BookmarkablePageLink(
            linkId,
            target == null ? getHomePage() : target,
            params);
}
 
Example #21
Source File: ProjectPortfolioPanel.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
@Override
protected void addItemColumns(Item<Project> item, IModel<? extends Project> projectModel) {
	Link<Void> projectLink = ProjectDescriptionPage.linkDescriptor(ReadOnlyModel.of(projectModel)).link("projectLink");
	projectLink.add(new Label("name", BindingModel.of(projectModel, Binding.project().name())));
	item.add(projectLink);
	
	item.add(new Label("nbVersions", BindingModel.of(projectModel, Binding.project().versions().size())));
	
	item.add(new Label("nbArtifacts", BindingModel.of(projectModel, Binding.project().artifacts().size())));
}
 
Example #22
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Link newBookmarkableLink(final String linkId,
                                 final String supplier,
                                 final String uriContext,
                                 final Object uri) {

    final PageParameters params = new PageParameters();
    if (StringUtils.isNotBlank(supplier)) {
        params.add(WebParametersKeys.FULFILMENT_CENTRE_ID, supplier);
    }
    params.add(uriContext, uri);
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example #23
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Link newProductLink(final String linkId,
                           final String supplier,
                           final Object productRef) {

    return newBookmarkableLink(linkId, supplier, WebParametersKeys.PRODUCT_ID, productRef);
}
 
Example #24
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Link newCategoryLink(final String linkId,
                            final long categoryRef,
                            final PageParameters pageParameters) {

    return newBookmarkableLink(linkId, WebParametersKeys.CATEGORY_ID, categoryRef,
            getFilteredCurrentParameters(pageParameters));
}
 
Example #25
Source File: URLPagingNavigation.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
@Override
protected void populateItem(final LoopItem loopItem) {
    super.populateItem(loopItem);

    Link pageLink = (Link) loopItem.iterator().next();
    IModel model = pageLink.getModel();

    if (model instanceof Model && model.getObject() instanceof Boolean) {
        loopItem.add(new AttributeModifier("class", "active"));
    }

}
 
Example #26
Source File: PaginationSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean markSelectedPageLink(final Link link,
                                    final PageParameters pageParameters, final int pageIndex) {
    if (isPageSelected(pageParameters, pageIndex)) {
        link.add(new AttributeModifier("class", "nav-page-active nav-page active"));
        return true;
    } else {
        link.add(new AttributeModifier("class", "nav-page"));
        return false;
    }
}
 
Example #27
Source File: PaginationSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean markSelectedSortLink(final Link link,
                                    final PageParameters pageParameters, final String sortOrder, final String sortField) {
    if (isSortSelected(pageParameters, sortOrder, sortField)) {
        link.add(new AttributeModifier("class", "sort-order-active sort-order active"));
        return true;
    } else {
        link.add(new AttributeModifier("class", "sort-order"));
        return false;
    }
}
 
Example #28
Source File: MyPictures.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
protected void populateItem(ListItem<File> listItem) {
	final File file = (File) listItem.getModelObject();
	listItem.add(new Label("file", file.getName()));
	listItem.add(new Link("delete") {
		public void onClick() {
			Files.remove(file);
		}
	});
}
 
Example #29
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Link newBookmarkableLink(final String linkId,
                                 final String supplier,
                                 final String uriContext,
                                 final Object uri,
                                 final PageParameters carried) {
    
    final PageParameters params = new PageParameters(carried);
    if (StringUtils.isNotBlank(supplier)) {
        params.set(WebParametersKeys.FULFILMENT_CENTRE_ID, supplier);
    }
    params.set(uriContext, uri);
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example #30
Source File: MyPictures.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
protected void populateItem(ListItem<File> listItem) {
	final File file = (File) listItem.getModelObject();
	listItem.add(new Label("file", file.getName()));
	listItem.add(new Link("delete") {
		public void onClick() {
			Files.remove(file);
		}
	});
}