com.google.gwt.uibinder.rebind.messages
Class MessagesWriter

java.lang.Object
  extended by com.google.gwt.uibinder.rebind.messages.MessagesWriter

public class MessagesWriter
extends java.lang.Object

TemplateWriter for messages.


Field Summary
static java.lang.String ATTRIBUTE
           
 
Constructor Summary
MessagesWriter(java.lang.String nameSpaceUri, MortalLogger mortalLogger, java.lang.String generatedFrom, java.lang.String packageName, java.lang.String uiBinderImplClassName)
           
 
Method Summary
 void consumeAndStoreMessageAttributesFor(XMLElement elem)
          Call consumeAttributeMessages(com.google.gwt.uibinder.rebind.XMLElement), but instead of returning the results store them for retrieval by a later call to retrieveMessageAttributesFor(com.google.gwt.uibinder.rebind.XMLElement).
 java.util.Collection<AttributeMessage> consumeAttributeMessages(XMLElement elem)
          Examine the children of the given element.
 java.lang.String consumeMessageAttribute(java.lang.String attName, XMLElement elem)
          Consume an m:blah attribute on a non-message element, e.g.
 java.lang.String declareMessage(MessageWriter newMessage)
          Declares a message created by a previous call to newMessage(com.google.gwt.uibinder.rebind.XMLElement), and returns its invocation expression to be stitched into an innerHTML block.
 void findMessagesConfig(XMLElement elem)
          Expected to be called with the root element, to allow configuration from various messages related attributes.
 java.lang.String getDeclaration()
           
 java.lang.String getMessagesClassName()
           
 java.lang.String getMessagesPrefix()
           
 boolean hasMessageAttribute(java.lang.String attName, XMLElement elem)
          Confirm existence of an m:blah attribute on a non-message element, e.g.
 boolean hasMessages()
           
 boolean isMessage(XMLElement elem)
           
 MessageWriter newMessage(XMLElement elem)
          Creates a new MessageWriter instance with description, key and meaning values consumed from the given XMLElement.
 java.util.Collection<AttributeMessage> retrieveMessageAttributesFor(XMLElement elem)
           
 void write(java.io.PrintWriter printWriter)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE

public static final java.lang.String ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

MessagesWriter

public MessagesWriter(java.lang.String nameSpaceUri,
                      MortalLogger mortalLogger,
                      java.lang.String generatedFrom,
                      java.lang.String packageName,
                      java.lang.String uiBinderImplClassName)
Method Detail

consumeAndStoreMessageAttributesFor

public void consumeAndStoreMessageAttributesFor(XMLElement elem)
                                         throws UnableToCompleteException
Call consumeAttributeMessages(com.google.gwt.uibinder.rebind.XMLElement), but instead of returning the results store them for retrieval by a later call to retrieveMessageAttributesFor(com.google.gwt.uibinder.rebind.XMLElement).

Throws:
UnableToCompleteException - on error

consumeAttributeMessages

public java.util.Collection<AttributeMessage> consumeAttributeMessages(XMLElement elem)
                                                                throws UnableToCompleteException
Examine the children of the given element. Consume those tagged m:attribute and return a set of AttributeMessage instances. E.g.:

 <img src="blueSky.jpg" alt="A blue sky">
   <ui:attribute name="alt" description="blue sky image alt text"/>
 </img>
 

Throws:
UnableToCompleteException

consumeMessageAttribute

public java.lang.String consumeMessageAttribute(java.lang.String attName,
                                                XMLElement elem)
Consume an m:blah attribute on a non-message element, e.g. <span m:ph="fnord"/>


declareMessage

public java.lang.String declareMessage(MessageWriter newMessage)
Declares a message created by a previous call to newMessage(com.google.gwt.uibinder.rebind.XMLElement), and returns its invocation expression to be stitched into an innerHTML block.


findMessagesConfig

public void findMessagesConfig(XMLElement elem)
Expected to be called with the root element, to allow configuration from various messages related attributes.


getDeclaration

public java.lang.String getDeclaration()
Returns:
the expression that will instantiate the Messages interface

getMessagesClassName

public java.lang.String getMessagesClassName()

getMessagesPrefix

public java.lang.String getMessagesPrefix()
Returns:
The namespace prefix (not including :) declared by the template for message elements and attributes

hasMessageAttribute

public boolean hasMessageAttribute(java.lang.String attName,
                                   XMLElement elem)
Confirm existence of an m:blah attribute on a non-message element, e.g. <span ui:ph="fnord"/>


hasMessages

public boolean hasMessages()
Returns:
true iff any messages have been declared

isMessage

public boolean isMessage(XMLElement elem)

newMessage

public MessageWriter newMessage(XMLElement elem)
Creates a new MessageWriter instance with description, key and meaning values consumed from the given XMLElement. Note that this message will not be written in the generated code unless it is later declared via declareMessage(MessageWriter)


retrieveMessageAttributesFor

public java.util.Collection<AttributeMessage> retrieveMessageAttributesFor(XMLElement elem)
Returns:
The set of AttributeMessages that were found in elem and stored by a previous call to consumeAndStoreMessageAttributesFor(com.google.gwt.uibinder.rebind.XMLElement)

write

public void write(java.io.PrintWriter printWriter)