本文整理汇总了Java中org.apache.wicket.feedback.FeedbackMessage.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java FeedbackMessage.getMessage方法的具体用法?Java FeedbackMessage.getMessage怎么用?Java FeedbackMessage.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.feedback.FeedbackMessage
的用法示例。
在下文中一共展示了FeedbackMessage.getMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transform
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public CharSequence transform(Component component, CharSequence cs) {
CharSequence res = cs;
FormComponent<?> fc = (FormComponent<?>) component;
String span = "";
if (!fc.isValid()) {
for (FeedbackMessage message : fc.getFeedbackMessages()) {
message.markRendered();
String id = getWicketIdForErrorSpan(component);
span = "<span id=\"" + id + "\" class=\"error-icon\">" + "<i class=\"" +
ValidationTooltipStyleGroupBehavior.VALIDATION_ERROR_ICON_CLASS +
"\" title = \""
+ message.getMessage() + "\"></i></span>";
}
}
res = cs + span;
return res;
}
示例2: getObject
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public Object getObject() {
StringBuffer initScript = new StringBuffer();
// init
String defaultFeedbackId = defaultFeedbackPanel == null
? "" : defaultFeedbackPanel.getMarkupId();
initScript
.append("(function(fd) {\n")
.append("fd.init('")
.append(defaultFeedbackId)
.append("');\n");
// add messages
for (FeedbackMessage feedbackMessage : getCurrentMessages()) {
feedbackMessage.markRendered();
Serializable message = feedbackMessage.getMessage();
String messageString = (message instanceof UnescapedFeedbackMessage) ?
message.toString() : Strings.escapeMarkup(message.toString(), false, false).toString();
initScript
.append("fd.addMessage('")
.append(getMarkupIdFor(feedbackMessage.getReporter()))
.append("', '")
.append(feedbackMessage.getLevelAsString())
.append("', ")
.append(asJsStringParam(messageString))
.append(");\n");
}
initScript.append("fd.showMessages();\n");
initScript.append("})(FeedbackDistributer);\n");
return initScript;
}
示例3: accept
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public boolean accept(FeedbackMessage message) {
Serializable value = message.getMessage();
if (value instanceof AbstractFieldInstanceMessage<?>) {
return matchesThisField((AbstractFieldInstanceMessage<?>)value);
}
return false;
}
示例4: transform
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public CharSequence transform(Component component, CharSequence cs) {
CharSequence res = cs;
FormComponent<?> fc = (FormComponent<?>) component;
if (!fc.isValid() && showInlineError) {
for (FeedbackMessage message : fc.getFeedbackMessages()) {
message.markRendered();
String id = getWicketIdForErrorSpan(component);
res = cs + "<p id=\"" + id + "\" class=\"error\">" + message.getMessage() + "</p>";
}
}
return res;
}
示例5: newMessageDisplayComponent
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
Serializable serializable = message.getMessage();
Label label = new Label(id, (serializable == null) ? "" : serializable.toString() + "<br/>");
label.setEscapeModelStrings(false);
return label;
}
示例6: renderFeedback
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
private String renderFeedback() {
// this.getComponent().getFeedbackMessage();
FeedbackMessages fm = Session.get().getFeedbackMessages();
Iterator<FeedbackMessage> iter = fm.iterator();
StringBuilder sb = new StringBuilder();
while (iter.hasNext()) {
FeedbackMessage message = iter.next();
if ((message.getReporter() != null) || message.isRendered()) {
// if a component-level message, don't show it
continue;
}
// if we are info stick set to info else set to message level
String cssClassSuffix = "";
switch (message.getLevel()) {
case INFO_STICKY:
case INFO_FADE:
cssClassSuffix = "INFO";
break;
case ERROR_STICKY:
cssClassSuffix = "ERROR";
break;
default:
cssClassSuffix = message.getLevelAsString();
break;
}
Serializable serializable = message.getMessage();
// grab the message, if it's null use an empty string
String msg = (serializable == null) ? StringUtils.EMPTY : serializable.toString();
sb.append("$.jGrowl(\"").append(escape(msg)).append('\"');
sb.append(", {");
// set the css style, i.e. the theme
sb.append("theme: \'jgrowl-").append(cssClassSuffix).append("\'");
// set afterOpen
String afterOpen = getAfterOpenJavaScript();
if (StringUtils.isNotEmpty(afterOpen)) {
sb.append(", afterOpen: " + getAfterOpenJavaScript());
}
// set sticky
if (message.getLevel() > FeedbackMessage.INFO) {
sb.append(", sticky: true");
} else {
// default is 3000 (3sec)
sb.append(", life: 5000");
}
sb.append("});");
message.markRendered();
}
return sb.toString();
}
示例7: newMessageDisplayComponent
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
/**
* Generates a component that is used to display the message inside the
* feedback panel. This component must handle being attached to
* <code>span</code> tags.
*
* By default a {@link Label} is used.
*
* Note that the created component is expected to respect feedback panel's
* {@link #getEscapeModelStrings()} value
*
* @param id
* parent id
* @param message
* feedback message
* @return component used to display the message
*/
private Component newMessageDisplayComponent(String id,
FeedbackMessage message) {
Serializable serializable = message.getMessage();
Label label = new Label(id, (serializable == null) ? ""
: serializable.toString());
label.setEscapeModelStrings(StyledFeedbackPanel.this
.getEscapeModelStrings());
return label;
}
示例8: newMessageDisplayComponent
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
/**
* Generates a component that is used to display the message inside the feedback panel. This component must handle being attached to
* <code>span</code> tags.
*
* By default a {@link Label} is used.
*
* Note that the created component is expected to respect feedback panel's {@link #getEscapeModelStrings()} value
*
* @param id
* parent id
* @param message
* feedback message
* @return component used to display the message
*/
protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
Serializable serializable = message.getMessage();
Label label = new Label(id, (serializable == null) ? "" : serializable.toString());
label.setEscapeModelStrings(BootstrapFeedbackPanel.this.getEscapeModelStrings());
return label;
}