本文整理匯總了Java中com.gitblit.wicket.WicketUtils.setCssClass方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketUtils.setCssClass方法的具體用法?Java WicketUtils.setCssClass怎麽用?Java WicketUtils.setCssClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.gitblit.wicket.WicketUtils
的用法示例。
在下文中一共展示了WicketUtils.setCssClass方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LinkPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public LinkPanel(String wicketId, String bootstrapIcon, String linkCssClass, IModel<String> model,
Class<? extends WebPage> clazz, PageParameters parameters, boolean newWindow) {
super(wicketId);
this.labelModel = model;
Link<Void> link = null;
if (parameters == null) {
link = new BookmarkablePageLink<Void>("link", clazz);
} else {
link = new BookmarkablePageLink<Void>("link", clazz, parameters);
}
if (newWindow) {
link.add(new SimpleAttributeModifier("target", "_blank"));
}
if (linkCssClass != null) {
link.add(new SimpleAttributeModifier("class", linkCssClass));
}
Label icon = new Label("icon");
if (StringUtils.isEmpty(bootstrapIcon)) {
link.add(icon.setVisible(false));
} else {
WicketUtils.setCssClass(icon, bootstrapIcon);
link.add(icon);
}
link.add(new Label("label", labelModel).setRenderBodyOnly(true));
add(link);
}
示例2: GravatarImage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public GravatarImage(String id, PersonIdent person, int width, boolean linked) {
super(id);
String email = person.getEmailAddress() == null ? person.getName().toLowerCase() : person.getEmailAddress().toLowerCase();
String hash = StringUtils.getMD5(email);
Link<Void> link = new BookmarkablePageLink<Void>("link", GravatarProfilePage.class,
WicketUtils.newObjectParameter(hash));
link.add(new SimpleAttributeModifier("target", "_blank"));
String url = ActivityUtils.getGravatarThumbnailUrl(email, width);
ExternalImage image = new ExternalImage("image", url);
WicketUtils.setCssClass(image, "gravatar");
link.add(image);
if (linked) {
WicketUtils.setHtmlTooltip(link,
MessageFormat.format("View Gravatar profile for {0}", person.getName()));
} else {
WicketUtils.setHtmlTooltip(link, person.getName());
}
add(link.setEnabled(linked));
setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));
}
示例3: newSubmenu
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
/**
* Creates a submenu. This is not actually submenu because we're using an older Twitter Bootstrap which is pre-submenu.
*
* @param wicketId
* @param submenuTitle
* @param menuItems
* @return a submenu fragment
*/
private Fragment newSubmenu(String wicketId, String submenuTitle, List<MenuItem> menuItems) {
Fragment submenu = new Fragment(wicketId, "submenuFragment", this);
submenu.add(new Label("submenuTitle", submenuTitle).setRenderBodyOnly(true));
ListDataProvider<MenuItem> menuItemsDp = new ListDataProvider<MenuItem>(menuItems);
DataView<MenuItem> submenuItems = new DataView<MenuItem>("submenuItem", menuItemsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<MenuItem> menuItem) {
final MenuItem item = menuItem.getModelObject();
String name = item.toString();
try {
// try to lookup translation
name = getString(name);
} catch (Exception e) {
}
if (item instanceof PageLinkMenuItem) {
// link to another Wicket page
PageLinkMenuItem pageLink = (PageLinkMenuItem) item;
menuItem.add(new LinkPanel("submenuLink", null, null, name, pageLink.getPageClass(), pageLink.getPageParameters(), false)
.setRenderBodyOnly(true));
} else if (item instanceof ExternalLinkMenuItem) {
// link to a specified href
ExternalLinkMenuItem extLink = (ExternalLinkMenuItem) item;
menuItem.add(new LinkPanel("submenuLink", null, name, extLink.getHref(), extLink.openInNewWindow()).setRenderBodyOnly(true));
} else if (item instanceof MenuDivider) {
// divider
menuItem.add(new Label("submenuLink").setRenderBodyOnly(true));
WicketUtils.setCssClass(menuItem, "divider");
}
}
};
submenu.add(submenuItems);
submenu.setRenderBodyOnly(true);
return submenu;
}
示例4: addToolbarButton
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
protected void addToolbarButton(String wicketId, String iconClass, String label, String url) {
Fragment button = new Fragment(wicketId, "toolbarLinkFragment", this);
Label icon = new Label("icon");
WicketUtils.setCssClass(icon, iconClass);
button.add(icon);
button.add(new Label("label", label));
button.add(new SimpleAttributeModifier("href", url));
add(button);
}
示例5: onBeforeRender
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
@Override
protected void onBeforeRender()
{
String cssClass = "btn";
if (buttonState.equals(RegistrantPermissionsPanel.this.activeState)) {
cssClass = "btn btn-info active";
}
WicketUtils.setCssClass(this, cssClass);
super.onBeforeRender();
}
示例6: GravatarImage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public GravatarImage(String id, String username, String emailaddress, String cssClass, int width, boolean linked, boolean identicon) {
super(id);
String email = emailaddress == null ? username.toLowerCase() : emailaddress.toLowerCase();
String hash = StringUtils.getMD5(email);
Link<Void> link = new BookmarkablePageLink<Void>("link", GravatarProfilePage.class,
WicketUtils.newObjectParameter(hash));
link.add(new SimpleAttributeModifier("target", "_blank"));
String url;
if (identicon) {
url = ActivityUtils.getGravatarIdenticonUrl(email, width);
} else {
url = ActivityUtils.getGravatarThumbnailUrl(email, width);
}
ExternalImage image = new ExternalImage("image", url);
if (cssClass != null) {
WicketUtils.setCssClass(image, cssClass);
}
link.add(image);
if (linked) {
WicketUtils.setHtmlTooltip(link,
MessageFormat.format("View Gravatar profile for {0}", username));
} else {
WicketUtils.setHtmlTooltip(link, username);
}
add(link.setEnabled(linked));
setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));
}
示例7: DropDownMenu
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public DropDownMenu(String id, String label, final DropDownMenuRegistration menu) {
super(id);
add(new Label("label", label).setRenderBodyOnly(true));
ListDataProvider<DropDownMenuItem> items = new ListDataProvider<DropDownMenuItem>(
menu.menuItems);
DataView<DropDownMenuItem> view = new DataView<DropDownMenuItem>("menuItems", items) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<DropDownMenuItem> item) {
DropDownMenuItem entry = item.getModelObject();
if (entry.isDivider()) {
item.add(new Label("menuItem").setRenderBodyOnly(true));
WicketUtils.setCssClass(item, "divider");
} else {
String icon = null;
if (entry.isSelected()) {
icon = "icon-ok";
} else {
icon = "icon-ok-white";
}
item.add(new LinkPanel("menuItem", icon, null, entry.toString(), menu.pageClass,
entry.getPageParameters(), false).setRenderBodyOnly(true));
}
}
};
add(view);
setRenderBodyOnly(true);
}
示例8: PagerPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的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);
}