List of usage examples for org.apache.wicket.markup ComponentTag setModified
public final void setModified(final boolean modified)
From source file:com.userweave.application.UserWeaveApplication.java
License:Open Source License
@Override public void init() { super.init(); getComponentInstantiationListeners().add(new SpringComponentInjector(this)); setupAuthorization();/*w w w . ja v a 2 s .c o m*/ mountPages(); mountResources(); getMarkupSettings().setStripWicketTags(true); setupErrorHandling(); setupProductionSettings(); setDefaultResourceLocale(LocalizationUtils.getDefaultLocale()); getMarkupSettings().setMarkupFactory(new MarkupFactory() { @Override public MarkupParser newMarkupParser(MarkupResourceStream resource) { MarkupParser markupParser = new MarkupParser(resource); markupParser.add(new AbstractMarkupFilter() { // @Override // public MarkupElement nextTag() throws ParseException { // // // Get the next tag. If null, no more tags are available // final ComponentTag tag = (ComponentTag)getParent().nextTag(); // if ( null == tag || null != tag.getId() ) // return tag; // // // Process open <html> tags // if( null != tag.getName() && tag.getName().equals( "html" ) && tag.isOpen()) // { // String language = UserWeaveSession.get().getLocale().getLanguage(); // tag.getAttributes().put("lang", language); // tag.getAttributes().put("xml:lang", language); // tag.setModified( true ); // } // // return tag; // } @Override protected MarkupElement onComponentTag(ComponentTag tag) throws ParseException { if (null == tag || null != tag.getId()) { return tag; } // Process open <html> tags if (null != tag.getName() && tag.getName().equals("html") && tag.isOpen()) { String language = UserWeaveSession.get().getLocale().getLanguage(); tag.getAttributes().put("lang", language); tag.getAttributes().put("xml:lang", language); tag.setModified(true); } return tag; } }); return markupParser; } }); /* * @see: migration guide to wicket 1.5 Request cycle * * Instead of overrride newRequestCycle, we have to create a factory, * that builds our custom RequestCycle. */ setRequestCycleProvider(new IRequestCycleProvider() { @Override public RequestCycle get(RequestCycleContext context) { return new UserWeaveWebRequestCycle(context); } }); /* * @see: https://cwiki.apache.org/WICKET/request-mapping.html * * newRequestCycleProcessor is obsolete, so we replace the * CryptedUrlWebRequestCodingStrategy with a CryptoMapper, */ // if(ENCRYPTION) // { // setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this)); // } // add custom listener for runtime exceptions. getRequestCycleListeners().add(new AbstractRequestCycleListener() { @Override public IRequestHandler onException(RequestCycle cycle, Exception ex) { if (ex instanceof RuntimeException) { ((UserWeaveWebRequestCycle) cycle).handleRuntimeException((RuntimeException) ex); } return null; } }); // disable caching strategy getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE); }
From source file:fiftyfive.wicket.feedback.FeedbackStyle.java
License:Apache License
public void onComponentTag(Component c, ComponentTag tag) { List<FeedbackMessage> msgs = newFeedbackMessagesModel(c).getObject(); if (msgs.size() > 0) { StringBuffer newClassValue = new StringBuffer(tag.getAttributes().getString("class", "")); Set<String> classes = new HashSet<String>(); for (FeedbackMessage m : msgs) { String cssClass = getCssClass(m); if (classes.add(cssClass)) { if (newClassValue.length() > 0) { newClassValue.append(" "); }// w ww . ja va2 s. com newClassValue.append(cssClass); } } tag.put("class", newClassValue.toString()); tag.setModified(true); } }
From source file:net.jawr.web.wicket.JawrWicketLinkTagHandler.java
License:Apache License
@Override protected MarkupElement onComponentTag(ComponentTag tag) throws ParseException { if (tag == null) { return tag; }// www. j a v a2 s .c om // Only xml tags not already identified as Wicket components will be // considered for autolinking. This is because it is assumed that Wicket // components like images or all other kind of Wicket Links will handle // it themselves. // Subclass analyzeAutolinkCondition() to implement you own // implementation and register the new tag handler with the markup // parser through Application.newMarkupParser(). if (analyzeAutolinkCondition(tag) == true) { // Just a dummy name. The ComponentTag will not be forwarded. tag.setId(AUTOLINK_ID); tag.setAutoComponentTag(true); tag.setModified(true); return tag; } return tag; }
From source file:org.apache.openmeetings.web.app.MessageTagHandler.java
License:Apache License
@Override protected final MarkupElement onComponentTag(ComponentTag tag) throws ParseException { if (tag.isClose()) { return tag; }/*w w w .ja v a 2s. c om*/ final String wicketMessageAttribute = tag.getAttributes().getString(getWicketMessageAttrName()); if (Strings.isEmpty(wicketMessageAttribute) == false) { // check if this tag is raw markup if (tag.getId() == null) { // if this is a raw tag we need to set the id to something so // that wicket will not merge this as raw markup and instead // pass it on to a resolver tag.setId(getWicketMessageIdPrefix()); tag.setAutoComponentTag(true); tag.setModified(true); } tag.addBehavior(new AttributeLocalizer(getWicketMessageAttrName())); } return tag; }