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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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;
}
 
Example 41
Project: openNaEF   File: NodePageUtil.java   Source Code and License 5 votes vote down vote up
public static BookmarkablePageLink<Void> createSimpleNodeLink(final String id, final NodeDto node, final String captionId) {
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, NodeUtil.getParameters(node));
    link.setEnabled(node != null);
    String nodeName = (node == null ? "" : node.getName());
    if (captionId != null) {
        Label label = new Label(captionId, nodeName);
        link.add(label);
    }
    return link;
}
 
Example 42
Project: openNaEF   File: NodePageUtil.java   Source Code and License 5 votes vote down vote up
public static Link<Void> createPortLink(String id, PortDto port) {
    Label caption = new Label("ifName",
            new org.apache.wicket.model.Model<String>(
                    NameUtil.getNodeIfName(port)));
    final PageParameters params = NodeUtil.getNodeParameters(port);
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, params);
    link.setEnabled(port != null);
    link.add(caption);
    return link;
}
 
Example 43
Project: openNaEF   File: NodePageUtil.java   Source Code and License 5 votes vote down vote up
public static Link<Void> createPortLink(String id, IModel<PortDto> model) {
    PortDto port = model.getObject();
    Label caption = new Label("ifName",
            new org.apache.wicket.model.Model<String>(
                    NameUtil.getCaption(port)));
    final PageParameters params = NodeUtil.getNodeParameters(port);
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, params);
    link.setEnabled(port != null);
    link.add(caption);
    return link;
}
 
Example 44
Project: MasterStats   File: SingleSummonerPage.java   Source Code and License 5 votes vote down vote up
@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 45
Project: MasterStats   File: ChampionsPage.java   Source Code and License 5 votes vote down vote up
public ChampionsPage(PageParameters parameters) {
    super(parameters, "Champions", PageType.CHAMPIONS);

    // get a list of all champions, order them alphabetically and create their entry on the page
    add(new ListView<Map.Entry<String, ChampionStatisticItem>>("champions_list_view", PageDataProvider.championStatisticMap
            .entrySet().stream().sorted((e1, e2) -> e1.getKey().compareToIgnoreCase(e2.getKey()))
            .collect(Collectors.toList())) {
        @Override
        protected void populateItem(ListItem<Map.Entry<String, ChampionStatisticItem>> item) {
            // get data from item
            Map.Entry<String, ChampionStatisticItem> championEntry = item.getModelObject();
            ChampionStatisticItem championStatisticItem = championEntry.getValue();

            // create div
            WebMarkupContainer div = new WebMarkupContainer("champion_entry");

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

            // set champion portrait and name
            link.add(new ExternalImage("champion_portrait", championStatisticItem.getPortraitUrl()));
            link.add(new Label("champion_name", championStatisticItem.getChampionName()));

            item.add(div);
        }
    });
}
 
Example 46
Project: GeoCrawler   File: DashboardPage.java   Source Code and License 5 votes vote down vote up
public DashboardPage() {
  panel = new WebMarkupContainer("panel");
  panel.setOutputMarkupId(true);
  panel.add(new AjaxSelfUpdatingTimerBehavior(Duration.ONE_SECOND));
  panel.add(new Label("jobsRunning", new JobsModel()));
  add(panel);
  add(new BookmarkablePageLink<Void>("viewInstances", InstancesPage.class));
}
 
Example 47
Project: GeoCrawler   File: SeedListsPage.java   Source Code and License 5 votes vote down vote up
public SeedListsPage() {

    RefreshingView<SeedList> seedLists = new RefreshingView<SeedList>(
        "seedLists") {

      @Override
      protected Iterator<IModel<SeedList>> getItemModels() {
        return new CpmIteratorAdapter<SeedList>(seedListService.findAll());
      }

      @Override
      protected void populateItem(final Item<SeedList> item) {
        PageParameters params = new PageParameters();
        params.add("id", item.getModelObject().getId());

        Link<Void> edit = new BookmarkablePageLink<Void>("edit",
            SeedPage.class, params);
        edit.add(new Label("name"));
        item.add(edit);

        item.add(new Label("seedUrlsCount"));

        item.add(new Link<SeedList>("delete", item.getModel()) {
          @Override
          public void onClick() {
            seedListService.delete(item.getModelObject().getId());
          }
        });
      }
    };

    add(seedLists);
    add(new BookmarkablePageLink<Void>("newSeedList", SeedPage.class));
  }
 
Example 48
Project: coling2016-marketing-blunders   File: ApplicationPageBase.java   Source Code and License 5 votes vote down vote up
private void commonInit() {
	getSession().setLocale(Locale.ENGLISH);

	feedbackPanel = new FeedbackPanel("feedbackPanel");
	feedbackPanel.setOutputMarkupId(true);
	feedbackPanel.add(new AttributeModifier("class", "error"));
	feedbackPanel.setFilter(new IFeedbackMessageFilter(){
		@Override
		public boolean accept(FeedbackMessage aMessage) {
			String username = "anonymous";
			if (aMessage.isFatal())
				LOG.fatal(username + ": " + aMessage.getMessage());
			else
			if (aMessage.isError())
				LOG.error(username + ": " + aMessage.getMessage());
			else
			if (aMessage.isWarning())
				LOG.warn(username + ": " + aMessage.getMessage());
			else
			if (aMessage.isInfo())
				LOG.info(username + ": " + aMessage.getMessage());
			else
			if (aMessage.isDebug())
				LOG.debug(username + ": " + aMessage.getMessage());
			return true;
		}
	});

	Properties props = getVersionProperties();
	String versionString = props.getProperty("version");
	versionLabel = new Label("version", versionString);

	add(feedbackPanel);
	add(versionLabel);

	add(new BookmarkablePageLink<Void>("homeButton", HomePage.class));
	add(new BookmarkablePageLink<Void>("footerHomeLink", HomePage.class));
}
 
Example 49
Project: semat   File: CustomFooterPanel.java   Source Code and License 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 50
Project: MBaaS   File: RoleCreatePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

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

    this.pageField = new Select2MultipleChoice<>("pageField", new PropertyModel<>(this, "cmsPage"), new PagesChoiceProvider());
    this.form.add(this.pageField);
    this.pageFeedback = new TextFeedbackPanel("pageFeedback", this.pageField);
    this.form.add(this.pageFeedback);

    this.restField = new Select2MultipleChoice<>("restField", new PropertyModel<>(this, "rest"), new RestsChoiceProvider());
    this.form.add(this.restField);
    this.restFeedback = new TextFeedbackPanel("restFeedback", this.restField);
    this.form.add(this.restFeedback);

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

    this.descriptionField = new TextField<>("descriptionField", new PropertyModel<>(this, "description"));
    this.descriptionField.setRequired(true);
    this.form.add(this.descriptionField);
    this.descriptionFeedback = new TextFeedbackPanel("descriptionFeedback", this.descriptionField);
    this.form.add(this.descriptionFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.closeButton = new BookmarkablePageLink<>("closeButton", RoleBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 51
Project: MBaaS   File: SectionCreatePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

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

    this.titleField = new TextField<>("titleField", new PropertyModel<>(this, "title"));
    this.titleField.setRequired(true);
    this.titleField.add(new SectionTitleValidator());
    this.form.add(this.titleField);
    this.titleFeedback = new TextFeedbackPanel("titleFeedback", this.titleField);
    this.form.add(this.titleFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.orderField = new TextField<>("orderField", new PropertyModel<>(this, "order"));
    this.orderField.setRequired(true);
    this.form.add(this.orderField);
    this.orderFeedback = new TextFeedbackPanel("orderFeedback", this.orderField);
    this.form.add(this.orderFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", SectionBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 52
Project: MBaaS   File: SectionModifyPage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    DSLContext context = Spring.getBean(DSLContext.class);
    SectionTable sectionTable = Tables.SECTION.as("sectionTable");

    PageParameters parameters = getPageParameters();
    this.sectionId = parameters.get("sectionId").toString("");
    SectionPojo section = context.select(sectionTable.fields()).from(sectionTable).where(sectionTable.SECTION_ID.eq(this.sectionId)).fetchOneInto(SectionPojo.class);
    this.order = section.getOrder();
    this.title = section.getTitle();

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

    this.titleField = new TextField<>("titleField", new PropertyModel<>(this, "title"));
    this.titleField.setRequired(true);
    this.titleField.add(new SectionTitleValidator(this.sectionId));
    this.form.add(this.titleField);
    this.titleFeedback = new TextFeedbackPanel("titleFeedback", this.titleField);
    this.form.add(this.titleFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.orderField = new TextField<>("orderField", new PropertyModel<>(this, "order"));
    this.orderField.setRequired(true);
    this.form.add(this.orderField);
    this.orderFeedback = new TextFeedbackPanel("orderFeedback", this.orderField);
    this.form.add(this.orderFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", SectionBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 53
Project: MBaaS   File: RestBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    RestProvider provider = new RestProvider();
    provider.selectField("restId", String.class);
    provider.selectField("system", Boolean.class);
    provider.selectField("dateModified", Date.class);
    provider.setSort("dateModified", SortOrder.DESCENDING);

    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("method"), "method", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("path"), "path", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

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

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", RestCreatePage.class);
    layout.add(createLink);

    BookmarkablePageLink<Void> refreshLink = new BookmarkablePageLink<>("refreshLink", RestBrowsePage.class);
    layout.add(refreshLink);
}
 
Example 54
Project: MBaaS   File: FileCreatePage.java   Source Code and License 5 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.setRequired(true);
    this.nameField.setLabel(Model.of("name"));
    this.form.add(nameField);
    this.nameFeedback = new TextFeedbackPanel("nameFeedback", this.nameField);
    this.form.add(nameFeedback);

    this.fileField = new FileUploadField("fileField", new PropertyModel<>(this, "file"));
    this.fileField.setRequired(true);
    this.form.add(this.fileField);
    this.fileFeedback = new TextFeedbackPanel("fileFeedback", this.fileField);
    this.form.add(fileFeedback);

    this.saveButton = new AjaxButton("saveButton");
    this.saveButton.setOnError(this::saveButtonOnError);
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(saveButton);

    this.closeButton = new BookmarkablePageLink<>("closeButton", FileBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 55
Project: MBaaS   File: CollectionBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);
    CollectionProvider provider = new CollectionProvider();
    provider.setSort("name", SortOrder.ASCENDING);
    provider.selectField("collectionId", 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.Boolean, Model.of("system"), "system", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("locked"), "locked", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("mutable"), "mutable", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

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

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

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", CollectionCreatePage.class);
    layout.add(createLink);
}
 
Example 56
Project: MBaaS   File: MenuBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    MenuProvider provider = new MenuProvider();
    provider.selectField("menuId", 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.String, Model.of("icon"), "icon", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("parent"), "parent", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("section"), "section", 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", MenuBrowsePage.class);
    layout.add(refreshLink);

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", MenuCreatePage.class);
    layout.add(createLink);
}
 
Example 57
Project: MBaaS   File: MenuItemBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    MenuItemProvider provider = new MenuItemProvider();
    provider.selectField("menuItemId", 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.String, Model.of("icon"), "icon", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("page"), "page", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("menu"), "menu", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("section"), "section", 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 = new DefaultDataTable<>("table", columns, provider, 20);
    dataTable.addTopToolbar(new FilterToolbar(dataTable, filterForm));
    filterForm.add(dataTable);

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

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", MenuItemCreatePage.class);
    layout.add(createLink);
}
 
Example 58
Project: MBaaS   File: PageBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    PageProvider provider = new PageProvider();
    provider.setSort("title", SortOrder.ASCENDING);
    provider.selectField("pageId", String.class);
    provider.selectField("cmsPage", Boolean.class);
    provider.selectField("dateModified", Date.class);
    provider.setSort("dateModified", SortOrder.DESCENDING);

    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.String, Model.of("description"), "description", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.String, Model.of("layout"), "layout", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("system"), "system", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("cms"), "cmsPage", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

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

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

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", PageCreatePage.class);
    layout.add(createLink);
}
 
Example 59
Project: MBaaS   File: DocumentBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    DSLContext context = Spring.getBean(DSLContext.class);
    CollectionTable collectionTable = Tables.COLLECTION.as("collectionTable");
    AttributeTable attributeTable = Tables.ATTRIBUTE.as("attributeTable");

    String collectionId = getPageParameters().get("collectionId").toString();
    this.collection = context.select(collectionTable.fields()).from(collectionTable).where(collectionTable.COLLECTION_ID.eq(collectionId)).fetchOneInto(CollectionPojo.class);
    List<AttributePojo> attributes = context.select(attributeTable.fields()).from(attributeTable).where(attributeTable.COLLECTION_ID.eq(collectionId)).fetchInto(AttributePojo.class);

    this.provider = new DocumentProvider(collectionId);

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

    List<IColumn<Map<String, Object>, String>> columns = new ArrayList<>();
    for (AttributePojo attribute : attributes) {
        TypeEnum type = TypeEnum.valueOf(attribute.getType());
        ProviderUtils.addColumn(this.provider, columns, attribute, type);
    }

    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", DocumentBrowsePage.class, getPageParameters());
    layout.add(refreshLink);

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", DocumentCreatePage.class, getPageParameters());
    layout.add(createLink);

    BookmarkablePageLink<Void> collectionBrowseLink = new BookmarkablePageLink<>("collectionBrowseLink", CollectionBrowsePage.class);
    layout.add(collectionBrowseLink);
}
 
Example 60
Project: MBaaS   File: LayoutBrowsePage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    LayoutProvider provider = new LayoutProvider();
    provider.selectField("layoutId", String.class);
    provider.selectField("cmsLayout", Boolean.class);
    provider.selectField("dateModified", Date.class);
    provider.setSort("dateModified", SortOrder.DESCENDING);

    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.String, Model.of("description"), "description", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("system"), "system", this::modelValue));
    columns.add(new TextFilterColumn(provider, ItemClass.Boolean, Model.of("cms"), "cmsLayout", this::modelValue));
    columns.add(new ActionFilterColumn(Model.of("action"), this::actions, this::clickable, this::itemCss, this::itemClick));

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

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

    BookmarkablePageLink<Void> createLink = new BookmarkablePageLink<>("createLink", LayoutCreatePage.class);
    layout.add(createLink);
}