Java Code Examples for org.apache.wicket.markup.html.link.BookmarkablePageLink.setVisible()

The following are Jave code examples for showing how to use setVisible() of the org.apache.wicket.markup.html.link.BookmarkablePageLink class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: owsi-core-parent   File: AbstractWebPageTemplate.java   Source Code and License Vote up 6 votes
protected void addMenuElement(MarkupContainer menuContainer,
		Class<? extends Page> selectedPageClass,
		String name,
		Class<? extends Page> pageClass,
		PageParameters parameters,
		boolean isVisible) {
	BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(name + "MenuLink", pageClass, parameters);
	link.setVisible(isVisible && isPageAccessible(pageClass));
	
	MarkupContainer container = new WebMarkupContainer(name + "MenuLinkContainer");
	if (pageClass.equals(selectedPageClass)) {
		container.add(new ClassAttributeAppender("active"));
	}
	container.add(link);
	
	menuContainer.add(container);
}
 
Example 2
Project: openNaEF   File: LocationUtil.java   Source Code and License Vote up 5 votes
public static BookmarkablePageLink<Void> getLocationLink(String id, LocationDto dto) {
    PageParameters parameters = getParameters(dto);
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, LocationViewPage.class, parameters);
    link.setEnabled(dto != null);
    link.setVisible(dto != null);
    return link;
}
 
Example 3
Project: MasterStats   File: SingleSummonerPage.java   Source Code and License Vote up 5 votes
@Override
protected void populateItem(ListItem<ChampionMasteryItem> item) {
    ChampionMasteryItem mastery = item.getModelObject();
    ChampionStatisticItem championStatistic = null;
    // create boolean to storing whether or not element should be shown
    // set to false if mastery or championStatistic is null
    boolean visible = true;
    // check if mastery is null

    if (mastery != null) {
        championStatistic = PageDataProvider.getChampionStatisticById(mastery.getChampionId());
    } else {
        // if mastery is null create a new one and fill it with default data
        mastery = new ChampionMasteryItem();
        mastery.setChampionPoints(42);
        mastery.setChampionLevel(1);
        visible = false;
    }
    if (championStatistic == null) {
        // if champion statistic is null use default champion for statistic
        championStatistic = PageDataProvider.championStatisticMap.get("bard");
        visible = false;
    }

    // create link to champion page
    PageParameters linkParameters = new PageParameters();
    linkParameters.set(0, championStatistic.getKeyName());
    BookmarkablePageLink<String> link = new BookmarkablePageLink<>("champion_link",
            SingleChampionPage.class, linkParameters);
    item.add(link);

    // add champion portrait, name and mastery score as well as champion level
    link.add(new ExternalImage("champion_portrait", championStatistic.getPortraitUrl()));
    link.add(new Label("champion_name", championStatistic.getChampionName()));
    link.add(new Label("champion_stats", String.format("%s - Level %d", NumberFormatter.formatLong(
            mastery.getChampionPoints()), mastery.getChampionLevel())));

    // hide link if necessary
    link.setVisible(visible);
}
 
Example 4
Project: singular-server   File: BoxContent.java   Source Code and License Vote up 5 votes
private MarkupContainer createHistoryLink(String id, IModel<BoxItemDataMap> boxItemModel) {
    BoxItemDataMap boxItem        = boxItemModel.getObject();
    PageParameters pageParameters = new PageParameters();
    if (boxItem.getFlowInstanceId() != null) {
        pageParameters.add(REQUIREMENT_ID, boxItem.getCod());
        pageParameters.add(INSTANCE_ID, boxItem.getFlowInstanceId());
        pageParameters.add(MODULE_PARAM_NAME, getModule().getCod());
        pageParameters.add(MENU_PARAM_NAME, getMenu());
    }
    BookmarkablePageLink<?> historiLink = new BookmarkablePageLink<>(id, getHistoricoPage(), pageParameters);
    historiLink.setVisible(boxItem.getProcessBeginDate() != null);
    return historiLink;
}
 
Example 5
Project: elpaaso-core   File: DesignerArchitectureSummaryPanel.java   Source Code and License Vote up 5 votes
private void initComponents() {

            Label summaryResultLabel = new Label("summaryResultLabel",new StringResourceModel("portal.design.service.summary_result.title", null));
            add(summaryResultLabel);

            String key = "";
            logger.debug("looking for key");

            if (!canCreateEnvironment) {
                key = "portal.design.service.summary.read.only";
            } else if (isLocked) {
                key = "portal.design.service.summary.locked";
            } else if (isLogicalDeploymentConsistent) {
                key = "portal.design.service.summary.validated";
            } else {
                key = "portal.design.service.summary.errors";
            }
            
            statusLabel = new Label("archiValidatedLabel", new StringResourceModel(key, null));
            add(statusLabel);
            PageParameters newEnvPageParameters = new PageParameters(params);
            newEnvPageParameters.set("new", "1");

            BookmarkablePageLink<Page> newEnv = new BookmarkablePageLink<Page>("newEnvLink", SelectedReleasePage.class, newEnvPageParameters);
            newEnv.setVisible(isLogicalDeploymentConsistent && canCreateEnvironment);
            add(newEnv);

    }