本文整理汇总了Java中org.apache.wicket.feedback.FeedbackMessage.markRendered方法的典型用法代码示例。如果您正苦于以下问题:Java FeedbackMessage.markRendered方法的具体用法?Java FeedbackMessage.markRendered怎么用?Java FeedbackMessage.markRendered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.feedback.FeedbackMessage
的用法示例。
在下文中一共展示了FeedbackMessage.markRendered方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: onConfigure
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
protected void onConfigure() {
super.onConfigure();
FeedbackMessages feedbackMessages = Session.get().getFeedbackMessages();
if(feedbackMessages.hasMessage(getFeedbackMessageFilter())){
messageHolder.setVisible(true);
List<FeedbackMessage> messages = feedbackMessages.messages(getFeedbackMessageFilter());
FeedbackMessage message = messages.get(0);
onDisplayError(message);
message.markRendered();
} else {
messageHolder.setVisible(false);
}
}
示例3: renderHead
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
List<FeedbackMessage> msgs = model.getObject();
if(msgs.size()>0){
for(Component component: messages.keySet()){
StringBuffer sb = new StringBuffer();
for(FeedbackMessage msg : messages.get(component)){
sb.append(msg.getMessage()+"\n");
msg.markRendered();
}
String script = "$(\"#"+component.getMarkupId()+"\")"
+ ".popover({ 'trigger': 'focus', "
+ "'placement': 'top', "
+ "'content': \""+StringEscapeUtils.escapeEcmaScript(sb.toString())+"\", "
+ "'template': '<div class=\"popover feedback-popover\"><div class=\"arrow\"></div><div class=\"popover-inner\"><h3 class=\"popover-title\"></h3><div class=\"popover-content\"><p></p></div></div></div>'"
+ "});";
script += "$(\"#"+component.getMarkupId()+"\").keypress(function(){ $(\"#"+this.getMarkupId()+"\").removeClass('has-error'); $(this).popover('destroy'); });";
response.render(OnDomReadyHeaderItem.forScript(script));
}
}
}
示例4: refresh
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
public final void refresh(final IPartialPageRequestHandler handler) {
for (FeedbackMessage message : this.getModelObject()) {
if (message.isError()) {
this.notification.error(handler, message.getMessage());
} else if (message.isWarning()) {
// this is necessary before check for success and info in order to show warnings: isSuccess and isInfo
// return true also in case of warnings ...
this.notification.warn(handler, message.getMessage());
} else if (message.isSuccess() || message.isInfo()) {
this.notification.success(handler, message.getMessage());
} else {
this.notification.warn(handler, message.getMessage());
}
message.markRendered();
}
}
示例5: 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;
}
示例6: getFormChildsFeedbackMessages
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
public String getFormChildsFeedbackMessages(final boolean markAsRendered)
{
if (hasFormChildsFeedbackMessage() == false) {
return null;
}
final StringBuffer buf = new StringBuffer();
boolean first = true;
for (final FormComponent< ? > formComponent : allFormComponents) {
if (formComponent.hasFeedbackMessage() == true) {
final FeedbackMessage feedbackMessage = formComponent.getFeedbackMessages().first();
if (markAsRendered == true) {
feedbackMessage.markRendered();
}
first = StringHelper.append(buf, first, feedbackMessage.getMessage().toString(), "\n");
}
}
return buf.toString();
}
示例7: 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;
}
示例8: populateItem
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
protected void populateItem(final ListItem<FeedbackMessage> listItem) {
final FeedbackMessage message = listItem.getModelObject();
message.markRendered();
final Component label = newMessageDisplayComponent("message",
message);
listItem.add(label);
}
示例9: onBeforeRender
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
protected void onBeforeRender() {
super.onBeforeRender();
List<FeedbackMessage> msgs = model.getObject();
messages = new HashMap<Component, List<FeedbackMessage>>();
for(FeedbackMessage msg : msgs){
if(!messages.containsKey(msg.getReporter())) messages.put(msg.getReporter(), new ArrayList<FeedbackMessage>());
messages.get(msg.getReporter()).add(msg);
msg.markRendered();
}
}
示例10: transform
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public CharSequence transform(Component component, CharSequence cs) {
boolean added = false;
StringBuffer messageBuffer = new StringBuffer(BEFORE_MESSAGE);
boolean isRadio = false;
ComponentHierarchyIterator it = ((ComponentGroup) component).visitChildren(FormComponent.class);
for (Component n : it) {
FormComponent<?> fc = (FormComponent<?>) n;
if (!fc.isValid()) {
if (fc instanceof DMDRadioChoice<?>) {
isRadio = true;
}
for (FeedbackMessage message : fc.getFeedbackMessages()) {
message.markRendered();
if (added) {
messageBuffer.append(BR);
}
messageBuffer.append(message.getMessage());
added = true;
}
}
}
if (!added) {
return cs;
}
messageBuffer.append(AFTER_MESSAGE);
StringBuffer b;
if (isRadio) {
b = buildOutputForRadio(cs, messageBuffer, component);
} else {
b = buildOutput(cs, messageBuffer);
}
return b.toString();
}
示例11: 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;
}
示例12: transform
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
public CharSequence transform(Component component, CharSequence cs) {
boolean added = false;
StringBuffer messageBuffer = new StringBuffer(BEFORE_MESSAGE);
boolean isRadioOrCheckbox = false;
ComponentHierarchyIterator it = ((ComponentGroup) component).visitChildren(FormComponent.class);
for (Component n : it) {
FormComponent<?> fc = (FormComponent<?>) n;
if (!fc.isValid()) {
if (fc instanceof DMDRadioChoice<?>) {
isRadioOrCheckbox = true;
}
for (FeedbackMessage message : fc.getFeedbackMessages()) {
message.markRendered();
if (added) {
messageBuffer.append(BR);
}
messageBuffer.append(message.getMessage());
added = true;
}
}
}
if (!added) {
return cs;
}
messageBuffer.append(AFTER_MESSAGE);
StringBuffer b;
if (isRadioOrCheckbox) {
b = buildOutputForRadioOrCheckbox(cs, messageBuffer);
} else {
b = buildOutput(cs, messageBuffer);
}
return b.toString();
}
示例13: populateItem
import org.apache.wicket.feedback.FeedbackMessage; //导入方法依赖的package包/类
@Override
protected void populateItem(ListItem<FeedbackMessage> listItem) {
final FeedbackMessage message = listItem.getModelObject();
message.markRendered();
final Component label = newMessageDisplayComponent("message", message);
final AttributeModifier levelModifier = AttributeModifier.append("class", getCSSClass(message));
label.add(levelModifier);
listItem.add(label);
}
示例14: 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();
}