当前位置: 首页>>代码示例>>Java>>正文


Java BasePage类代码示例

本文整理汇总了Java中com.gitblit.wicket.pages.BasePage的典型用法代码示例。如果您正苦于以下问题:Java BasePage类的具体用法?Java BasePage怎么用?Java BasePage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasePage类属于com.gitblit.wicket.pages包,在下文中一共展示了BasePage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onUnauthorizedInstantiation

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(Component component) {
	
	if (component instanceof BasePage) {
		throw new RestartResponseException(GitBlitWebApp.HOME_PAGE_CLASS);
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:8,代码来源:AuthorizationStrategy.java

示例2: onUnauthorizedInstantiation

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(Component component) {
	
	if (component instanceof BasePage) {
		throw new RestartResponseException(RepositoriesPage.class);
	}
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:8,代码来源:AuthorizationStrategy.java

示例3: getAbsoluteUrl

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
protected String getAbsoluteUrl(Class<? extends BasePage> pageClass, PageParameters pageParameters) {
	String relativeUrl = urlFor(pageClass, pageParameters).toString();
	String absoluteUrl = RequestUtils.toAbsolutePath(relativeUrl);
	return absoluteUrl;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:6,代码来源:SessionlessForm.java

示例4: PagerPanel

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
public PagerPanel(String wicketId, final int currentPage, final int totalPages,
		final Class<? extends BasePage> pageClass, final PageParameters baseParams) {
	super(wicketId);
	List<PageObject> pages = new ArrayList<PageObject>();
	int[] deltas;
	if (currentPage == 1) {
		// [1], 2, 3, 4, 5
		deltas = new int[] { 0, 1, 2, 3, 4 };			
	} else if (currentPage == 2) {
		// 1, [2], 3, 4, 5
		deltas = new int[] { -1, 0, 1, 2, 3 };			
	} else {
		// 1, 2, [3], 4, 5
		deltas = new int[] { -2, -1, 0, 1, 2 };
	}

	if (totalPages > 0) {
		pages.add(new PageObject("\u2190", currentPage - 1));
	}
	for (int delta : deltas) {
		int page = currentPage + delta;
		if (page > 0 && page <= totalPages) {
			pages.add(new PageObject("" + page, page));
		}
	}
	if (totalPages > 0) {
		pages.add(new PageObject("\u2192", currentPage + 1));
	}

	ListDataProvider<PageObject> pagesProvider = new ListDataProvider<PageObject>(pages);
	final DataView<PageObject> pagesView = new DataView<PageObject>("page", pagesProvider) {
		private static final long serialVersionUID = 1L;

		public void populateItem(final Item<PageObject> item) {
			PageObject pageItem = item.getModelObject();
			PageParameters pageParams = new PageParameters(baseParams);
			pageParams.put("pg", pageItem.page);
			LinkPanel link = new LinkPanel("pageLink", null, pageItem.text, pageClass, pageParams);
			link.setRenderBodyOnly(true);
			item.add(link);
			if (pageItem.page == currentPage || pageItem.page < 1 || pageItem.page > totalPages) {
				WicketUtils.setCssClass(item, "disabled");
			}
		}
	};
	add(pagesView);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:48,代码来源:PagerPanel.java

示例5: isPageAuthorized

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
	if (GitBlitWebApp.HOME_PAGE_CLASS.equals(pageClass)) {
		// allow all requests to get to the HomePage with its inline
		// authentication form
		return true;
	}

	if (BasePage.class.isAssignableFrom(pageClass)) {
		boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
		boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
		boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);

		GitBlitWebSession session = GitBlitWebSession.get();
		if (authenticateView && !session.isLoggedIn()) {
			// authentication required
			session.cacheRequest(pageClass);
			return false;
		}

		UserModel user = session.getUser();
		if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
			// admin page
			if (allowAdmin) {
				if (authenticateAdmin) {
					// authenticate admin
					if (user != null) {
						return user.canAdmin();
					}
					return false;
				} else {
					// no admin authentication required
					return true;
				}
			} else {
				// admin prohibited
				return false;
			}
		}
	}
	return true;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:44,代码来源:AuthorizationStrategy.java

示例6: isPageAuthorized

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
	if (RepositoriesPage.class.equals(pageClass)) {
		// allow all requests to get to the RepositoriesPage with its inline
		// authentication form
		return true;
	}

	if (BasePage.class.isAssignableFrom(pageClass)) {
		boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
		boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
		boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);

		GitBlitWebSession session = GitBlitWebSession.get();
		if (authenticateView && !session.isLoggedIn()) {
			// authentication required
			session.cacheRequest(pageClass);
			return false;
		}

		UserModel user = session.getUser();
		if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
			// admin page
			if (allowAdmin) {
				if (authenticateAdmin) {
					// authenticate admin
					if (user != null) {
						return user.canAdmin();
					}
					return false;
				} else {
					// no admin authentication required
					return true;
				}
			} else {
				// admin prohibited
				return false;
			}
		}
	}
	return true;
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:44,代码来源:AuthorizationStrategy.java

示例7: SessionlessForm

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
/**
 * Sessionless forms must have a bookmarkable page class.  A bookmarkable
 * page is defined as a page that has only a default and/or a PageParameter
 * constructor.
 *
 * @param id
 * @param bookmarkablePageClass
 * @param pageParameters
 */
public SessionlessForm(String id, Class<? extends BasePage> bookmarkablePageClass,
		PageParameters pageParameters) {
	super(id);
	this.pageClass = bookmarkablePageClass;
	this.pageParameters = pageParameters;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:16,代码来源:SessionlessForm.java

示例8: SessionlessForm

import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
/**
 * Sessionless forms must have a bookmarkable page class.  A bookmarkable
 * page is defined as a page that has only a default and/or a PageParameter
 * constructor.
 * 
 * @param id
 * @param bookmarkablePageClass
 * @param pageParameters
 */
public SessionlessForm(String id, Class<? extends BasePage> bookmarkablePageClass,
		PageParameters pageParameters) {
	super(id);
	this.pageClass = bookmarkablePageClass;
	this.pageParameters = pageParameters;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:16,代码来源:SessionlessForm.java


注:本文中的com.gitblit.wicket.pages.BasePage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。