use of org.apache.wicket.Page in project ocvn by devgateway.
the class BasePage method newLanguageMenu.
public NavbarDropDownButton newLanguageMenu() {
final NavbarDropDownButton languageDropDown = new NavbarDropDownButton(new StringResourceModel("navbar.lang", this, null)) {
private static final long serialVersionUID = 319842753824102674L;
@Override
protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
final List<AbstractLink> list = new ArrayList<>();
for (final Locale l : WebConstants.AVAILABLE_LOCALES) {
final PageParameters params = new PageParameters(BasePage.this.getPageParameters());
params.set(WebConstants.LANGUAGE_PARAM, l.getLanguage());
list.add(new MenuBookmarkablePageLink<Page>(BasePage.this.getPageClass(), params, Model.of(l.getDisplayName())));
}
return list;
}
};
languageDropDown.setIconType(GlyphIconType.flag);
return languageDropDown;
}
use of org.apache.wicket.Page in project wicket by apache.
the class ConversationPropagator method onRequestHandlerResolved.
@Override
public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler) {
String cid = cycle.getRequest().getRequestParameters().getParameterValue(CID).toString();
Page page = getPage(handler);
if (cid == null && page != null) {
cid = page.getMetaData(CID_KEY);
}
Conversation current = getConversation(cycle);
if (current != null && !Objects.isEqual(current.getId(), cid)) {
logger.info("Conversation {} has expired for {}", cid, page);
throw new ConversationExpiredException(null, cid, page, handler);
}
activateConversationIfNeeded(cycle, handler, cid);
}
use of org.apache.wicket.Page in project wicket by apache.
the class ConversationPropagator method onRequestHandlerExecuted.
@Override
public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler) {
Conversation conversation = getConversation(cycle);
if (conversation == null) {
return;
}
Page page = getPage(handler);
if (page == null) {
return;
}
// apply auto semantics
autoEndIfNecessary(page, handler, conversation);
autoBeginIfNecessary(page, handler, conversation);
if (propagation.propagatesViaPage(page, handler)) {
// propagate a conversation across non-bookmarkable page instances
setConversationOnPage(conversation, page);
}
}
use of org.apache.wicket.Page in project wicket by apache.
the class Form method getRootFormRelativeId.
/**
* Utility method to assemble an id to distinct form components from different nesting levels.
* Useful to generate input names attributes.
*
* @param component
* @return form relative identification string
*/
public static String getRootFormRelativeId(Component component) {
String id = component.getId();
final PrependingStringBuffer inputName = new PrependingStringBuffer(id.length());
Component c = component;
while (true) {
inputName.prepend(id);
c = c.getParent();
if (c == null || (c instanceof Form<?> && ((Form<?>) c).isRootForm()) || c instanceof Page) {
break;
}
inputName.prepend(Component.PATH_SEPARATOR);
id = c.getId();
}
/*
* Certain input names causes problems with JavaScript. If the input name would cause a
* problem, we create a replacement unique name by prefixing the name with a path that would
* otherwise never be used (blank id in path).
*
* Input names must start with [A-Za-z] according to HTML 4.01 spec. HTML 5 allows almost
* anything.
*/
if (JavaScriptReservedNames.isNameReserved(inputName.toString())) {
inputName.prepend(Component.PATH_SEPARATOR);
inputName.prepend(Component.PATH_SEPARATOR);
inputName.prepend("p");
}
return inputName.toString();
}
use of org.apache.wicket.Page in project wicket by apache.
the class CheckBoxMultipleChoice method setSuffix.
/**
* @param suffix
* Separator to use between radio options
* @return this
*/
public final CheckBoxMultipleChoice<T> setSuffix(final String suffix) {
// Tell the page that this component's suffix was changed
final Page page = findPage();
if (page != null) {
addStateChange();
}
this.suffix = suffix;
return this;
}
Aggregations