本文整理汇总了Java中org.apache.wicket.feedback.FeedbackMessage类的典型用法代码示例。如果您正苦于以下问题:Java FeedbackMessage类的具体用法?Java FeedbackMessage怎么用?Java FeedbackMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FeedbackMessage类属于org.apache.wicket.feedback包,在下文中一共展示了FeedbackMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (anyMessage(FeedbackMessage.ERROR) || anyMessage(FeedbackMessage.FATAL))
return " error";
else if (anyMessage(FeedbackMessage.WARNING))
return " warning";
else if (anyMessage(FeedbackMessage.SUCCESS))
return " success";
else
return " info";
}
}));
}
示例2: createMessageTooltip
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
static String createMessageTooltip(final IModel<FeedbackMessage> model) {
FeedbackMessage message = model.getObject();
switch (message.getLevel()) {
case FeedbackMessage.INFO:
return "info";
case FeedbackMessage.SUCCESS:
return "success";
case FeedbackMessage.ERROR:
return "partialError";
case FeedbackMessage.FATAL:
return "fatalError";
case FeedbackMessage.UNDEFINED:
return "undefined";
case FeedbackMessage.DEBUG:
return "debug";
case FeedbackMessage.WARNING:
default:
return "warn";
}
}
示例3: getQualifier
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
private String getQualifier(int level) {
switch (level) {
case FeedbackMessage.DEBUG:
return DEBUG_CSS_QUALIFIER;
case FeedbackMessage.INFO:
return INFO_CSS_QUALIFIER;
case FeedbackMessage.SUCCESS:
return SUCCESS_CSS_QUALIFIER;
case FeedbackMessage.WARNING:
return WARNING_CSS_QUALIFIER;
case FeedbackMessage.ERROR:
return ERROR_CSS_QUALIFIER;
case FeedbackMessage.FATAL:
return FATAL_CSS_QUALIFIER;
default:
return "";
}
}
示例4: onConfigure
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
@Override
protected void onConfigure() {
final Component component = element.getContext()
.getComponentRegistry()
.getComponent(element.getModelWicketId());
final FormComponent<?> formComponent = Components.asFormComponent(component);
if (formComponent != null) {
final StringBuilder sb = new StringBuilder();
if (showHelpText()) {
if (!formComponent.isValid()) {
boolean firstMessage = true;
for (final FeedbackMessage message : formComponent.getFeedbackMessages()) {
if (!firstMessage) {
sb.append("<br>");
}
firstMessage = false;
sb.append(message.getMessage());
}
}
help.setDefaultModelObject(sb);
}
help.setVisible(sb.length() > 0);
}
}
示例5: rememberAllFeedbackMessages
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
* This method is called on each page refresh to remember the previous state of feedback messages for rollback
*/
public static void rememberAllFeedbackMessages(final Component component) {
Assertions.assertThat(RequestCycle.get().getMetaData(KEY_PREVIOUS_MESSAGES)).isNull();
//CHECKSTYLE:OFF
final Map<String, List<FeedbackMessage>> markupId_previousMessages = new HashMap<String, List<FeedbackMessage>>();
//CHECKSTYLE:ON
component.getPage().visitChildren(new IVisitor<Component, Void>() {
@Override
public void component(final Component object, final IVisit<Void> visit) {
if (object.hasFeedbackMessage()) {
final List<FeedbackMessage> previousMessages = new ArrayList<FeedbackMessage>(
object.getFeedbackMessages().toList());
markupId_previousMessages.put(object.getMarkupId(), previousMessages);
}
}
});
RequestCycle.get().setMetaData(KEY_PREVIOUS_MESSAGES, markupId_previousMessages);
}
示例6: rollbackAllFeedbackMessages
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
public static void rollbackAllFeedbackMessages(final Component component) {
final Map<String, List<FeedbackMessage>> markupId_previousMessages = RequestCycle.get()
.getMetaData(KEY_PREVIOUS_MESSAGES);
Assertions.assertThat(markupId_previousMessages).isNotNull();
component.getPage().visitChildren(new IVisitor<Component, Void>() {
@Override
public void component(final Component object, final IVisit<Void> visit) {
if (object != component) {
object.getFeedbackMessages().clear();
final List<FeedbackMessage> previousMessages = markupId_previousMessages.get(object.getMarkupId());
if (previousMessages != null) {
for (final FeedbackMessage previousMessage : previousMessages) {
object.getFeedbackMessages().add(previousMessage);
}
}
}
}
});
RequestCycle.get().setMetaData(KEY_PREVIOUS_MESSAGES, null);
}
示例7: getCSSClass
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
@Override
protected String getCSSClass(FeedbackMessage message) {
String cssClass = "alert alert-dismissable";
switch (message.getLevel()) {
case FeedbackMessage.ERROR:
case FeedbackMessage.FATAL:
cssClass += " alert-danger";
break;
case FeedbackMessage.SUCCESS:
cssClass += " alert-success";
break;
case FeedbackMessage.WARNING:
cssClass += " alert-warning";
break;
case FeedbackMessage.INFO:
cssClass += " alert-info";
break;
default:
break;
}
return cssClass;
}
示例8: afterRender
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
@Override
public void afterRender(Component component) {
FormComponent fc = (FormComponent) component;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
FeedbackMessage first = fc.getFeedbackMessages().first();
first.markRendered();
error = first.getMessage().toString();
} else {
error = "Your input is invalid.";
}
fc.getResponse().write("*<span id=\"helpBlock2\" class=\"help-block\">"+error+"</span>");
super.afterRender(component);
}
}
示例9: afterRender
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
@Override
public void afterRender(Component component) {
FormComponent<?> fc = (FormComponent<?>) component;
Response r = component.getResponse();
r.write("</span>");
if (fc.hasFeedbackMessage()) {
r.write("<span class=\"feedbackPanelTextField\">");
IFeedbackMessageFilter filter = new ComponentFeedbackMessageFilter(component);
for (FeedbackMessage message : fc.getFeedbackMessages().messages(filter)) {
r.write("<span class=\"feedbackPanel");
r.write(message.getLevelAsString().toUpperCase());
r.write("\">");
r.write(Strings.escapeMarkup(message.getMessage().toString()));
}
r.write("</span>");
}
}
示例10: newCancelLink
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
*
* @return
*/
private Link<ProductManagementPage> newCancelLink() {
return new Link<ProductManagementPage>("cancel") {
private static final long serialVersionUID = -310533532532643267L;
@Override
public void onClick() {
setResponsePage(ProductManagementPage.class,
new PageParameters().set(
MESSAGE_PARAM,
new StringResourceModel("canceled.message", this, Model
.of(product)).getString()).set(LEVEL_PARAM,
FeedbackMessage.WARNING));
}
};
}
示例11: save
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
* Save product, show message to the user and redirect to the product
* list
* @param target
*/
private void save(AjaxRequestTarget target) {
// save product
saveProduct();
if (product.getId() == null) {
// redirect to product list page
setResponsePage(
ProductManagementPage.class,
new PageParameters().set(
MESSAGE_PARAM,
new StringResourceModel("add.confirmed", this, Model
.of(product)).getString()).set(LEVEL_PARAM,
FeedbackMessage.SUCCESS));
} else {
setResponsePage(ProductManagementPage.class,
new PageParameters().set(MESSAGE_PARAM,
new StringResourceModel("saved.message", this, Model
.of(product)).getString()).set(LEVEL_PARAM,
FeedbackMessage.SUCCESS));
}
}
示例12: save
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
* Save adapter settings, show message to the user and redirect to the adapter list
*
* @param target
*/
private void save(AjaxRequestTarget target) {
// Persist the adapter settings
saveSettings();
// success message has to be associated to session so that it is shown
// in the global feedback panel
Session.get().success(new StringResourceModel("saved.message", this, Model.of(platformSettings)).getString());
// redirect to adapter list page
setResponsePage(
PlatformSettingsPage.class,
new PageParameters().set(MESSAGE_PARAM,
new StringResourceModel("saved.message", this, Model.of(platformSettings)).getString()).set(LEVEL_PARAM,
FeedbackMessage.SUCCESS));
}
示例13: newCancelLink
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
*
* @return
*/
private Link<AdapterManagementPage> newCancelLink() {
return new Link<AdapterManagementPage>("cancel") {
/**
*
*/
private static final long serialVersionUID = 6433075921789830757L;
@Override
public void onClick() {
// redirect to adapter list page
setResponsePage(
AdapterManagementPage.class,
new PageParameters().set(
MESSAGE_PARAM,
new StringResourceModel("canceled.message", this, Model
.of(adapterSettings)).getString()).set(LEVEL_PARAM,
FeedbackMessage.WARNING));
}
};
}
示例14: save
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
* Save adapter settings, show message to the user and redirect to the
* adapter list
* @param target
*/
private void save(AjaxRequestTarget target) {
// Set the QA Project for the Adapter
adapterSettings.setProject(projectChoice.getModelObject());
// Persist the adapter settings
saveAdapterSettings();
// success message has to be associated to session so that it is shown
// in the global feedback panel
if (adapterSettings.getId() == null){
setResponsePage(AdapterManagementPage.class,
new PageParameters().set(MESSAGE_PARAM,
new StringResourceModel("add.confirmed", this, Model
.of(adapterSettings)).getString()).set(LEVEL_PARAM,
FeedbackMessage.SUCCESS));
} else {
setResponsePage(AdapterManagementPage.class,
new PageParameters().set(MESSAGE_PARAM,
new StringResourceModel("saved.message", this, Model
.of(adapterSettings)).getString()).set(LEVEL_PARAM,
FeedbackMessage.SUCCESS));
}
}
示例15: displayMessage
import org.apache.wicket.feedback.FeedbackMessage; //导入依赖的package包/类
/**
*
* @param parameters
*/
private void displayMessage(final PageParameters parameters) {
String message = parameters.get(MESSAGE_PARAM).toString(null);
int messageLevel = parameters.get(LEVEL_PARAM).toInt(-1);
if (message != null && messageLevel != -1) {
switch (messageLevel) {
case FeedbackMessage.SUCCESS:
success(message);
break;
case FeedbackMessage.INFO:
info(message);
break;
case FeedbackMessage.WARNING:
warn(message);
break;
case FeedbackMessage.ERROR:
error(message);
break;
}
}
}