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

The following are top voted examples for showing how to use org.apache.wicket.markup.html.link.BookmarkablePageLink. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: geoserver-documentor   File: DocumentationIndexPage.java   View source code 6 votes vote down vote up
public DocumentationIndexPage() {
	Harvester harvester = new Harvester();
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	ListView listview = new ListView("listview", harvester.getWorkspaces()) {
	    /**
		 * 
		 */
		private static final long serialVersionUID = 2974513833506276491L;

		protected void populateItem(ListItem item) {
	    	WorkspaceDoc wi = (WorkspaceDoc) item.getModelObject();
			BookmarkablePageLink link = new BookmarkablePageLink("link", WorkspacePage.class);
			link.setParameter("workspaceName", wi.getName());
			link.add(new Label("workspaceName", wi.getName()));
	        item.add(link);
	    }
	};
	add(listview);

	ExtensionInfo info = new ExtensionInfo();
	add(new Label("documentorVersion", info.getVersion()));
	add(new Label("documentorGitVersion", info.getGitVersion()));
	add(new Label("readme", info.getReadme()));
}
 
Example 2
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
private void createHeader() {
    ExternalLink topLink = UrlUtil.getTopLink("top");
    add(topLink);
    Link<Void> reloadLink = new BookmarkablePageLink<Void>("refresh",
            LocationViewPage.class, LocationUtil.getParameters(current));
    add(reloadLink);

    Label categoryLabel = new Label("category", Model.of(LocationRenderer.getLocationType(current)));
    add(categoryLabel);

    String buildingCode = LocationRenderer.getBuildingCode(current);
    if (buildingCode != null) {
        buildingCode = "Building Code: " + buildingCode;
    }
    Label addressLabel = new Label("buildingCode", Model.of(buildingCode));
    add(addressLabel);

    String popName = LocationRenderer.getPopName(current);
    if (popName != null) {
        popName = "POP Name: " + popName;
    }
    Label popNameLabel = new Label("popName", Model.of(popName));
    add(popNameLabel);
}
 
Example 3
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
private void populateNode() throws ExternalServiceException, IOException, RemoteException {
    ListView<NodeDto> list = new ListView<NodeDto>("nodeList", this.model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<NodeDto> item) {
            NodeDto node = item.getModelObject();
            BookmarkablePageLink<Void> link = NodePageUtil.createNodeLink("nodeLink", node);
            item.add(link);
        }
    };
    add(list);
    WebMarkupContainer container = new WebMarkupContainer("nodeBlock");
    add(container);
    container.setVisible(this.model.isVisible());
}
 
Example 4
Project: openNaEF   File: NodePageUtil.java   View source code 6 votes vote down vote up
public static Link<Void> createNodeLink(final String id, final PortDto port) {
    final PageParameters param;
    final String nodeName;
    if (port != null) {
        param = NodeUtil.getParameters(port.getNode());
        nodeName = port.getNode().getName();
    } else {
        param = null;
        nodeName = null;
    }
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, param);
    link.setEnabled(port != null);
    Label label = new Label("nodeName", nodeName);
    link.add(label);
    return link;
}
 
Example 5
Project: MasterStats   File: BasePage.java   View source code 6 votes vote down vote up
/**
 * generates the navbar and mark the active page
 *
 * @param activePage page to be marked active (null for no active page)
 */
private void loadNavbar(final PageType activePage) {
    // add an entry for each page type
    add(new ListView<PageType>("navbar_left_elements", Arrays.asList(PageType.values())) {
        @Override
        protected void populateItem(final ListItem<PageType> item) {
            final PageType type = item.getModelObject();
            // create a link for the page type
            BookmarkablePageLink<String> link = new BookmarkablePageLink<>("navbar_left_element_link", type.getPageClass());
            link.add(new Label("navbar_left_element_text", type.getLinkText()));
            // if the type is same as active page, mark it as active
            if (type.equals(activePage)) link.add(new AttributeAppender("class", "active", " "));
            item.add(link);
        }
    });

    // create the summoner search region drop down menu
    // get all valid entries
    List<String> endpoints = Arrays.asList(RiotEndpoint.PLAYABLE_ENDPOINTS)
            .stream().map(RiotEndpoint::name).collect(Collectors.toList());
    // add the options to the drop down menu
    DropDownChoice<String> dropDownChoice = new DropDownChoice<>("navbar_form_regions_select",
            new PropertyModel<>(this, "selectedRegion"), endpoints, new StringChoiceRenderer());
    dropDownChoice.add(new AttributeModifier("name", "region"));
    add(dropDownChoice);
}
 
Example 6
Project: MBaaS   File: RoleBrowsePage.java   View source code 6 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    RoleProvider provider = new RoleProvider();
    provider.selectField("roleId", String.class);

    FilterForm<Map<String, String>> filterForm = new FilterForm<>("filter-form", provider);
    layout.add(filterForm);

    List<IColumn<Map<String, Object>, String>> columns = new ArrayList<>();
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("name"), "name", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("description"), "description", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("system"), "system", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

    DataTable<Map<String, Object>, String> dataTable = new DefaultDataTable<>("table", columns, provider, 20);
    dataTable.addTopToolbar(new FilterToolbar(dataTable, filterForm));
    filterForm.add(dataTable);

    BookmarkablePageLink<Void> refreshLink = new BookmarkablePageLink<>("refreshLink", RoleBrowsePage.class);
    layout.add(refreshLink);

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", RoleCreatePage.class);
    layout.add(createLink);
}
 
Example 7
Project: MBaaS   File: SectionBrowsePage.java   View source code 6 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    SectionProvider provider = new SectionProvider();
    provider.selectField("sectionId", String.class);

    FilterForm<Map<String, String>> filterForm = new FilterForm<>("filter-form", provider);
    layout.add(filterForm);

    List<IColumn<Map<String, Object>, String>> columns = new ArrayList<>();
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("title"), "title", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("system"), "system", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

    DataTable<Map<String, Object>, String> dataTable = new DefaultDataTable<>("table", columns, provider, 20);
    dataTable.addTopToolbar(new FilterToolbar(dataTable, filterForm));
    filterForm.add(dataTable);

    BookmarkablePageLink<Void> refreshLink = new BookmarkablePageLink<>("refreshLink", SectionBrowsePage.class);
    layout.add(refreshLink);

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", SectionCreatePage.class);
    layout.add(createLink);
}
 
Example 8
Project: MBaaS   File: FileBrowsePage.java   View source code 6 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    FileProvider provider = new FileProvider();

    FilterForm<Map<String, String>> filterForm = new FilterForm<>("filter-form", provider);
    layout.add(filterForm);

    List<IColumn<Map<String, Object>, String>> columns = new ArrayList<>();
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("fileId"), "fileId", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("name"), "name", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Integer, Model.of("length"), "length", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("mime"), "mime", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

    this.dataTable = new DefaultDataTable<>("table", columns, provider, 17);
    this.dataTable.addTopToolbar(new FilterToolbar(this.dataTable, filterForm));
    filterForm.add(this.dataTable);

    BookmarkablePageLink<Void> refreshLink = new BookmarkablePageLink<>("refreshLink", FileBrowsePage.class);
    layout.add(refreshLink);
}
 
Example 9
Project: MBaaS   File: CollectionCreatePage.java   View source code 6 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    this.form = new Form<>("form");
    layout.add(this.form);

    this.nameField = new TextField<>("nameField", new PropertyModel<>(this, "name"));
    this.nameField.add(new CollectionNameValidator());
    this.nameField.setRequired(true);
    this.form.add(this.nameField);

    this.nameFeedback = new TextFeedbackPanel("nameFeedback", this.nameField);
    this.form.add(this.nameFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", CollectionBrowsePage.class);
    this.form.add(this.closeButton);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);
}
 
Example 10
Project: vlo-curation   File: ErrorPage.java   View source code 6 votes vote down vote up
public ErrorPage(PageParameters parameters) {
    super(parameters);
    this.errorType = getErrorType(parameters.get(PAGE_PARAMETER_RESPONSE_CODE).toString());

    final PageParameters queryParams = new PageParameters(parameters).remove(PAGE_PARAMETER_RESPONSE_CODE);
    final boolean hasQuery = !queryParams.get(VloWebAppParameters.QUERY).isEmpty() || !queryParams.get(VloWebAppParameters.FILTER_QUERY).isEmpty();
    add(new BookmarkablePageLink("searchPage", FacetedSearchPage.class, queryParams)
            .add(new Label("label", hasQuery ? "Return to query" : "Go to the search page"))
    );

    final IModel<String> errorDescriptionModel = new LoadableDetachableModel<String>() {
        @Override
        protected String load() {
            return getDescriptionForError(errorType);
        }
    };
    add(new Label("description", errorDescriptionModel) {
        @Override
        protected void onConfigure() {
            setVisible(errorDescriptionModel.getObject() != null);
        }

    }.setEscapeModelStrings(false));
}
 
Example 11
Project: owsi-core-parent   File: AbstractWebPageTemplate.java   View source code 6 votes vote down vote up
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 12
Project: owsi-core-parent   File: LinkBreadCrumbElementPanel.java   View source code 6 votes vote down vote up
public LinkBreadCrumbElementPanel(String id, BreadCrumbElement breadCrumbElement, BreadCrumbMarkupTagRenderingBehavior renderingBehavior) {
	super(id, breadCrumbElement.getLabelModel());
	
	Link<Void> breadCrumbLink = new BookmarkablePageLink<Void>("breadCrumbElementLink", breadCrumbElement.getPageClass(),
			breadCrumbElement.getPageParameters()) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			
			setVisible(Session.get().getAuthorizationStrategy().isInstantiationAuthorized(getPageClass()));
		}
	};
	breadCrumbLink.setBody(getModel());
	breadCrumbLink.add(renderingBehavior);
	add(breadCrumbLink);
	
	add(
			Condition.componentVisible(breadCrumbLink).thenShowInternal()
	);
}
 
Example 13
Project: lumen   File: LinkPanel.java   View source code 6 votes vote down vote up
public LinkPanel(final String componentId,
				 final Class<? extends Page> pageClass, final PageParameters params,
				 final IModel<String> labelModel, @Nullable TagType tagType) {
	super(componentId);
	final BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("link", pageClass, params);
	if (tagType != null) {
		link.add(new TagLabel("label", labelModel, tagType));
	} else {
		link.add(new Label("label", labelModel));
	}
	add(link);
	add(new WebMarkupContainer("lock") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(!isEnabledInHierarchy());
		}
	});
}
 
Example 14
Project: lumen   File: PubLayout.java   View source code 6 votes vote down vote up
@Override
    protected void onInitialize() {
        super.onInitialize();
        //add(new GrowlBehavior());
        add(new HtmlTag("html", Locale.US));
        add(new Label("title", getTitleModel()));
        add(new MetaTag("metaDescription", new Model<>("description"), getMetaDescriptionModel()));
        add(new BookmarkablePageLink<>("skillManagementLink", SkillManagementPage.class, new PageParameters().set("skillId", "")));
//        add(new BookmarkablePageLink<>("roadsLink", RoadListPage.class,
//                new PageParameters().set(SeoBookmarkableMapper.LOCALE_PREF_ID_PARAMETER, localePrefId)));
//        add(new BookmarkablePageLink<>("camerasLink", CameraListPage.class,
//                new PageParameters().set(SeoBookmarkableMapper.LOCALE_PREF_ID_PARAMETER, localePrefId)));
//
//        add(new BookmarkablePageLink<>("tweetListLink", TweetListPage.class,
//                new PageParameters().set(SeoBookmarkableMapper.LOCALE_PREF_ID_PARAMETER, localePrefId)));
//        add(new BookmarkablePageLink<>("tweetMapLink", TweetMapPage.class,
//                new PageParameters().set(SeoBookmarkableMapper.LOCALE_PREF_ID_PARAMETER, localePrefId)));
        notificationPanel = new NotificationPanel("notificationPanel");
        notificationPanel.setOutputMarkupId(true);
        add(notificationPanel);
    }
 
Example 15
Project: relax-dms   File: User.java   View source code 6 votes vote down vote up
private void createDocumentList(String id, List<DocumentListData> docList) {
    ListView listview = new ListView(id, docList) {
        @Override
        protected void populateItem(ListItem item) {
            DocumentListData doc = (DocumentListData) item.getModelObject();
            
            PageParameters pp = new PageParameters();
            pp.add("id", doc.getId());
            
            BookmarkablePageLink<Void> docLink = new BookmarkablePageLink("docLink", DocumentTabs.class, pp);
            item.add(docLink.add(new Label("id", doc.getId())));
            item.add(new Label("title", doc.getTitle()));
        }
    };
    add(listview);
}
 
Example 16
Project: relax-dms   File: MenuDropdownItem.java   View source code 6 votes vote down vote up
public MenuDropdownItem(String id, MenuItemEnum currentMenuItem,
Collection<BookmarkablePageLink<?>> linksInMenuItem, boolean shouldBeActive) {
     super(id);

     WebMarkupContainer itemContainer = new WebMarkupContainer("itemContainer");
     if (shouldBeActive) {
         itemContainer.add(new AttributeAppender("class", " active "));
     }
     itemContainer.add(new Label("label", currentMenuItem.getLabel()));

     RepeatingView repeatingView = new RepeatingView("itemLinks");

     linksInMenuItem.stream().map((link) -> new MenuLinkItem(repeatingView.newChildId(), link, false)).forEach((menuLinkItem) -> {
         repeatingView.add(menuLinkItem);
     });

     itemContainer.add(repeatingView);
     add(itemContainer);
 }
 
Example 17
Project: relax-dms   File: DocumentList.java   View source code 6 votes vote down vote up
private void createDocumentList(List<DocumentListData> docList) {
    ListView listview = new ListView("listView", docList) {
        @Override
        protected void populateItem(ListItem item) {
            DocumentListData doc = (DocumentListData) item.getModelObject();
            
            PageParameters pp = new PageParameters();
            pp.add("id", doc.getId());
            
            BookmarkablePageLink<Void> docLink = new BookmarkablePageLink("docLink", DocumentTabs.class, pp);
            item.add(docLink.add(new Label("id", doc.getId())));
            item.add(new Label("title", doc.getTitle()));
            item.add(new Label("author", doc.getAuthor()));
        }
    };
    add(listview);
}
 
Example 18
Project: sakai   File: MenuItem.java   View source code 6 votes vote down vote up
public MenuItem(String id, IModel itemText, Class itemPageClass, PageParameters pageParameters, boolean first) {
	super(id);

	// link version
	menuItemLinkHolder = new WebMarkupContainer("menuItemLinkHolder");
	menuItemLink = new BookmarkablePageLink("menuItemLink", itemPageClass, pageParameters);
	menuLinkText = new Label("menuLinkText", itemText);
	menuLinkText.setRenderBodyOnly(true);
	menuItemLink.add(menuLinkText);
	menuItemLinkHolder.add(menuItemLink);
	add(menuItemLinkHolder);

	// span version
	menuItemLabel = new Label("menuItemLabel", itemText);
	menuItemLabel.setRenderBodyOnly(true);
	add(menuItemLabel);
	
	if(first) {
		add(new AttributeModifier("class", new Model("firstToolBarItem")));
	}
}
 
Example 19
Project: superfly   File: SpringSecurityAuthorizationStrategy.java   View source code 6 votes vote down vote up
public boolean isActionAuthorized(Component component, Action action) {
    boolean ret ;
    String path = component.getPage().getClass().getSimpleName()+"."+component.getId()+"."+action.getName();
    String superPath = component.getPage().getClass().getSuperclass().getSimpleName()+"."+component.getId()+"."+action.getName();

    Properties securityProperties = loadSecurityProperties();
    if(isInSecurityPath(path, securityProperties)) {
        ret = isComponentAllowed(path, securityProperties);
    } else if(isInSecurityPath(superPath, securityProperties)) {
        ret = isComponentAllowed(superPath, securityProperties);
    } else if (component.getClass().isAnnotationPresent(Secured.class)) {
        ret = SecurityUtils.isComponentVisible(component.getClass());
    } else if (component instanceof BookmarkablePageLink<?>) {
        BookmarkablePageLink<?> link = (BookmarkablePageLink<?>) component;
        ret = SecurityUtils.isComponentVisible(link.getPageClass());
    } else {
        ret = true;
    }
    return ret;
}
 
Example 20
Project: u-qasar.platform   File: LinkableUserBadge.java   View source code 6 votes vote down vote up
public LinkableUserBadge(String id, IModel<User> model) {
	super(id, model);
	Validate.notNull(model);
	Validate.notNull(model.getObject());
	user = model.getObject();

	BookmarkablePageLink<UserPage> container = new BookmarkablePageLink<>(
			"profile.link", UserPage.class, UserPage.forUser(user));
	container.add(userName = new Label("userName",
			new PropertyModel<String>(model, "userName")));

	WebMarkupContainer picture = new WebMarkupContainer("picture");
	picture.add(new UserProfilePictureBackgroundBehaviour(user, User.PictureDimensions.Badge));
	container.add(picture);
	container.add(new AttributeModifier("title", user.getFullName()));
	add(container);
}
 
Example 21
Project: superfly   File: SpringSecurityAuthorizationStrategy.java   View source code 6 votes vote down vote up
@Override
public boolean isActionAuthorized(Component component, Action action) {
    boolean ret ;
    String path = component.getPage().getClass().getSimpleName()+"."+component.getId()+"."+action.getName();
    String superPath = component.getPage().getClass().getSuperclass().getSimpleName()+"."+component.getId()+"."+action.getName();

    Properties securityProperties = loadSecurityProperties();
    if(isInSecurityPath(path, securityProperties)) {
        ret = isComponentAllowed(path, securityProperties);
    } else if(isInSecurityPath(superPath, securityProperties)) {
        ret = isComponentAllowed(superPath, securityProperties);
    } else if (component.getClass().isAnnotationPresent(Secured.class)) {
        ret = SecurityUtils.isComponentVisible(component.getClass());
    } else if (component instanceof BookmarkablePageLink<?>) {
        BookmarkablePageLink<?> link = (BookmarkablePageLink<?>) component;
        ret = SecurityUtils.isComponentVisible(link.getPageClass());
    } else {
        ret = true;
    }
    return ret;
}
 
Example 22
Project: superfly   File: EditRolePage.java   View source code 6 votes vote down vote up
public EditRolePage(PageParameters parameters) {
    super(ListRolesPage.class, parameters);
     long roleId = parameters.get("id").toLong(-1L);
     final UIRole role  = roleService.getRole(roleId);
     setDefaultModel(new CompoundPropertyModel<UIRole>(role));
     Form form = new Form("form"){

        @Override
        protected void onSubmit() {
        roleService.updateRole(role);
        setResponsePage(ListRolesPage.class);
        }

     };
     add(form);
     form.add(new LabelValueRow<String>("role-name", new Model<String>(role.getRoleName()), "role.create.name"));
     form.add(new LabelTextFieldRow<String>(role, "principalName", "role.create.principal-name", true));
     form.add(new Button("form-submit"));
     form.add(new BookmarkablePageLink<Page>("form-cancel", ListRolesPage.class));
}
 
Example 23
Project: superfly   File: CloneGroupPage.java   View source code 6 votes vote down vote up
@SuppressWarnings("serial")
public CloneGroupPage(PageParameters param) {
    super(ListGroupsPage.class, param);

    final Long sourceId = param.get("sid").toLong();

    final UIGroup sourceGroup = groupService.getGroupById(sourceId);
    GroupModel groupModel = new GroupModel();

    Form<GroupModel> form = new Form<GroupModel>("form", new Model<GroupModel>(groupModel)) {
        @Override
        protected void onSubmit() {
            UICloneGroupRequest request = new UICloneGroupRequest();
            request.setNewGroupName(getModelObject().getName());
            request.setSourceGroupId(sourceGroup.getId());
            groupService.cloneGroup(request);
            setResponsePage(ListGroupsPage.class);
        }

    };
    add(form);

    form.add(new LabelValueRow<String>("source", new Model(sourceGroup.getLabel()), "group.clone.source"));
    form.add(new LabelTextFieldRow<String>(groupModel, "name", "group.clone.name", true));
    form.add(new BookmarkablePageLink<Page>("cancel", ListGroupsPage.class));
}
 
Example 24
Project: superfly   File: BasePage.java   View source code 6 votes vote down vote up
private void init() {
    add(userContainer("user-container"));

    add(new BookmarkablePageLink<Void>("self-link", getApplication().getHomePage()));

    add(new Label("page-title", getTitle()));
    add(new Label("page-head-title", getHeadTitle()));

    add(new Label("superfly-version", settingsService.getSuperflyVersion()));

    feedbackPanel = new FeedbackPanel("feedback");
    feedbackPanel.setOutputMarkupId(true);
    add(feedbackPanel);

    addNavBarItem("subsystems", ListSubsystemsPage.class);
    addNavBarItem("actions", ListActionsPage.class);
    addNavBarItem("groups", ListGroupsPage.class);
    addNavBarItem("users", ListUsersPage.class);
    addNavBarItem("roles", ListRolesPage.class);
    addNavBarItem("sessions", ListSessionsPage.class);
    addNavBarItem("smtp", ListSmtpServersPage.class);


}
 
Example 25
Project: superfly   File: BasePage.java   View source code 6 votes vote down vote up
private void addNavBarItem(String id, Class<? extends Page> aPageClass) {
    WebMarkupContainer listItemContainer = new WebMarkupContainer("list-item-"+id);
    add(listItemContainer);
    BookmarkablePageLink<? extends Page> link = new BookmarkablePageLink<Page>(id, aPageClass);
    listItemContainer.add(link);
    if (pageClass != null) {
        if (pageClass.equals(aPageClass)) {
            listItemContainer.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    return "active";
                }

            }));
        }
    }
}
 
Example 26
Project: ontopia   File: VizigatorLinkFunctionBoxPanel.java   View source code 6 votes vote down vote up
@Override
protected Component getLink(String id) {
  PageParameters pageParameters = new PageParameters();
  pageParameters.put("topicMapId", getTopicMapId());
  pageParameters.put("topicId", getTopicId());
  
  return new BookmarkablePageLink<Page>(id, VizigatorPage.class, pageParameters) {
    @Override
    protected void onComponentTag(ComponentTag tag) {
      tag.setName("a");
      //tag.put("target", "_blank");
      super.onComponentTag(tag);
    }
    @Override
    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
      replaceComponentTagBody(markupStream, openTag, new ResourceModel("vizigator.text2").getObject().toString());
    }
  };
}
 
Example 27
Project: u-qasar.platform   File: UserEditPage.java   View source code 6 votes vote down vote up
private DataView<TeamMembership> getTeamListing() {
	return new DataView<TeamMembership>("teams", provider = new TeamProvider(user)) {
		@Override
		protected void populateItem(Item<TeamMembership> item) {
			final TeamMembership team = item.getModelObject();
			Check<TeamMembership> check = newDeleteCheck(item);
			List<Role> roles = new ArrayList<>(Arrays.asList(Role.teamAssignableRoles()));
			item.add(check);
			DropDownChoice<Role> roleSelector = new DropDownChoice<>("td.role",
					new PropertyModel<Role>(team, "role"), roles
			);
			roleSelector.setNullValid(false);
			item.add(roleSelector);
			BookmarkablePageLink<TeamEditPage> editTeamLink = new BookmarkablePageLink<>("link.edit.team", TeamEditPage.class, new PageParameters().add("id", team.getTeam().getId()));
			editTeamLink.add(new Label("td.teamname", new PropertyModel<>(team.getTeam(), "name")));
			item.add(editTeamLink);
			item.setOutputMarkupId(true);
		}
	};
}
 
Example 28
Project: u-qasar.platform   File: VisualProjectPanel.java   View source code 6 votes vote down vote up
/**
 * @param node
 * @return Returns a Link to the page element according to the type of the node
 */
   private BookmarkablePageLink<?> setLinkToNodePage(final TreeNode node) {
	BookmarkablePageLink<?> link = null;
	
	if (node instanceof Project) {
		link = new BookmarkablePageLink<ProjectViewPage>("link", ProjectViewPage.class, 
				BaseTreePage.forProject((Project) node));
	} else if (node instanceof QualityObjective) {
		link = new BookmarkablePageLink<ProjectViewPage>("link", QualityObjectiveViewPage.class,
				BaseTreePage.forQualityObjective((QualityObjective) node));
	} else if (node instanceof QualityIndicator) {
		link = new BookmarkablePageLink<ProjectViewPage>("link",QualityIndicatorViewPage.class,
				BaseTreePage.forQualityIndicator((QualityIndicator) node));
	} else if (node instanceof Metric) {
		link = new BookmarkablePageLink<ProjectViewPage>("link",MetricViewPage.class, BaseTreePage.forMetric((Metric) node));
	}
	
	link.add(new Label("name", new PropertyModel<String>(node, "name")));
	
	return link;
}
 
Example 29
Project: u-qasar.platform   File: SnapshotViewPanel.java   View source code 6 votes vote down vote up
/**
 * @param node
 * @return Returns a Link to the page element according to the type of the node
 */
   private BookmarkablePageLink<?> setLinkToNodePage(final TreeNode node) {
	BookmarkablePageLink<?> link = null;
	
	if (node instanceof Project) {
		link = new BookmarkablePageLink<ProjectViewPage>("link", ProjectViewPage.class, 
				BaseTreePage.forProject((Project) node));
	} else if (node instanceof QualityObjective) {
		link = new BookmarkablePageLink<ProjectViewPage>("link", QualityObjectiveViewPage.class,
				BaseTreePage.forQualityObjective((QualityObjective) node));
	} else if (node instanceof QualityIndicator) {
		link = new BookmarkablePageLink<ProjectViewPage>("link",QualityIndicatorViewPage.class,
				BaseTreePage.forQualityIndicator((QualityIndicator) node));
	} else if (node instanceof Metric) {
		link = new BookmarkablePageLink<ProjectViewPage>("link",MetricViewPage.class, BaseTreePage.forMetric((Metric) node));
	}
	
	link.add(new Label("name", new PropertyModel<String>(node, "name")));
	
	return link;
}
 
Example 30
Project: u-qasar.platform   File: QMQualityObjectiveSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QMQualityObjective> item) {
    final QMQualityObjective entity = item.getModelObject();
   BookmarkablePageLink<QMQualityObjectiveEditPage> link = new BookmarkablePageLink<>("link",
            QMQualityObjectiveEditPage.class, QMQualityObjectiveEditPage.forQualityObjective(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<QModelViewPage> QMlink = new BookmarkablePageLink<>("qmodel",
    		QModelViewPage.class, QModelViewPage.forQModel(entity.getQModel()));
    QMlink.add(new Label("qmKey", Model.of(entity.getQModel().getNodeKey())));
    item.add(QMlink);
    
    item.add(new Label("value", Model.of(entity.getTargetValue())));
}
 
Example 31
Project: u-qasar.platform   File: MetricSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<Metric> item) {
    final Metric entity = item.getModelObject();
    BookmarkablePageLink<MetricEditPage> link = new BookmarkablePageLink<>("link",
            MetricEditPage.class, MetricEditPage.forMetric(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<ProjectViewPage> projectLink = new BookmarkablePageLink<>("project",
            ProjectViewPage.class, ProjectViewPage.forProject(entity.getProject()));
    projectLink.add(new Label("projectKey", Model.of(entity.getProject().getNodeKey())));
    item.add(projectLink);
    
    item.add(new Label("source", Model.of(entity.getMetricSource())));
    item.add(new Label("value", Model.of(entity.getValue())));
}
 
Example 32
Project: u-qasar.platform   File: QualityObjectiveSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QualityObjective> item) {
    final QualityObjective entity = item.getModelObject();
   BookmarkablePageLink<QualityObjectiveEditPage> link = new BookmarkablePageLink<>("link",
            QualityObjectiveEditPage.class, QualityObjectiveEditPage.forQualityObjective(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<ProjectViewPage> projectLink = new BookmarkablePageLink<>("project",
            ProjectViewPage.class, ProjectViewPage.forProject(entity.getProject()));
    projectLink.add(new Label("projectKey", Model.of(entity.getProject().getNodeKey())));
    item.add(projectLink);
    
    item.add(new Label("purpose", Model.of(entity.getQualityPurpose())));
    item.add(new Label("value", Model.of(entity.getValue())));
}
 
Example 33
Project: u-qasar.platform   File: QMMetricSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QMMetric> item) {
    final QMMetric entity = item.getModelObject();
    BookmarkablePageLink<QMMetricEditPage> link = new BookmarkablePageLink<>("link",
            QMMetricEditPage.class, QMMetricEditPage.forMetric(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<QModelViewPage> QMlink = new BookmarkablePageLink<>("qmodel",
    		QModelViewPage.class, QModelViewPage.forQModel(entity.getQModel()));
    QMlink.add(new Label("qmKey", Model.of(entity.getQModel().getNodeKey())));
    item.add(QMlink);
    
    
    item.add(new Label("value", Model.of(entity.getTargetValue())));
}
 
Example 34
Project: u-qasar.platform   File: QMQualityIndicatorSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QMQualityIndicator> item) {
    final QMQualityIndicator entity = item.getModelObject();
    BookmarkablePageLink<QMQualityIndicatorEditPage> link = new BookmarkablePageLink<>("link",
            QMQualityIndicatorEditPage.class, QMQualityIndicatorEditPage.forQualityIndicator(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<QModelViewPage> QMlink = new BookmarkablePageLink<>("qmodel",
    		QModelViewPage.class, QModelViewPage.forQModel(entity.getQModel()));
    QMlink.add(new Label("qmKey", Model.of(entity.getQModel().getNodeKey())));
    item.add(QMlink);
    
    item.add(new Label("value", Model.of(entity.getTargetValue())));
}
 
Example 35
Project: u-qasar.platform   File: QualityIndicatorSearchResultsPanel.java   View source code 6 votes vote down vote up
@Override
protected void populateDataViewItem(Item<QualityIndicator> item) {
    final QualityIndicator entity = item.getModelObject();
    BookmarkablePageLink<QualityIndicatorEditPage> link = new BookmarkablePageLink<>("link",
            QualityIndicatorEditPage.class, QualityIndicatorEditPage.forQualityIndicator(entity));
    link.add(new Label("name", Model.of(entity.getName()
            + " (" + entity.getNodeKey() + ")")).setRenderBodyOnly(true));
    item.add(link);
    
    BookmarkablePageLink<ProjectViewPage> projectLink = new BookmarkablePageLink<>("project",
            ProjectViewPage.class, ProjectViewPage.forProject(entity.getProject()));
    projectLink.add(new Label("projectKey", Model.of(entity.getProject().getNodeKey())));
    item.add(projectLink);
    
    item.add(new Label("value", Model.of(entity.getValue())));
}
 
Example 36
Project: u-qasar.platform   File: ConfirmRegistrationPage.java   View source code 6 votes vote down vote up
public SuccessFragment(String id, String markupId, MarkupContainer markupProvider, User user) {
    super(id, markupId, markupProvider);
    this.user = user;
    this.provider = markupProvider;

    BookmarkablePageLink<LoginPage> loginLink = new BookmarkablePageLink<>("login", LoginPage.class);
    loginLink.
            add(new Label("loginlabel", new StringResourceModel("label.success.loginlink", provider, null, new Object[]{secondsToRedirect})));
    addOrReplace(loginLink);

    if (user.getSource() == LDAP) {
        addOrReplace(new Label("message", new StringResourceModel("label.success.ldap", provider, null, new Object[]{this.user.
            getFullName(), this.user.getUserName()})).
                setEscapeModelStrings(false));
    } else {
        addOrReplace(new Label("message", new StringResourceModel("label.success", provider, null, new Object[]{this.user.
            getFullName(), this.user.getMail()})).
                setEscapeModelStrings(false));
    }
}
 
Example 37
Project: u-qasar.platform   File: ErrorPage.java   View source code 6 votes vote down vote up
public ErrorPage(Throwable t) {
	super(new PageParameters());
	this.throwable = t;

	// add home page link
	add(new BookmarkablePageLink<Page>("homeLink", getApplication().getHomePage()));

	if (throwable == null) {
		// we are submitting a bug
		add(newLabel("header", "bug.report.header"));
		add(newLabel("message", "bug.report.message"));
	} else {
		// actual error page
		add(newLabel("header", "error.header"));
		add(newLabel("message", "error.message"));
	}

	// add bug report form
	add(newBugReportForm(throwable));
}
 
Example 38
Project: rotabuilder   File: CustomFooterPanel.java   View source code 5 votes vote down vote up
private void addAboutLink() {
    final BookmarkablePageLink<Void> aboutLink = new BookmarkablePageLink<>(ID_ABOUT_LINK, AboutPage.class);
    add(aboutLink);

    final Label aboutLabel = new Label(ID_ABOUT_MESSAGE, new ResourceModel("aboutLabel"));
    aboutLink.add(aboutLabel);
    addDevModeWarning(aboutLink);
}
 
Example 39
Project: openNaEF   File: LinkEditPage.java   View source code 5 votes vote down vote up
private Link<Void> createLink(String id, PortDto port) {
    PageParameters param = NodeUtil.getNodeParameters(port);
    Link<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, param);
    link.setEnabled(port != null);
    link.add(new Label("nodeName", new Model<String>(NodeUtil.getNodeName(port))));
    return link;
}
 
Example 40
Project: openNaEF   File: LocationUtil.java   View source code 5 votes vote down vote up
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;
}