1 29 30 package nextapp.echo2.webrender.servermessage; 31 32 import org.w3c.dom.Document ; 33 import org.w3c.dom.Element ; 34 35 import nextapp.echo2.webrender.ClientConfiguration; 36 import nextapp.echo2.webrender.ServerMessage; 37 38 42 public class ClientConfigurationUpdate { 43 44 51 public static void renderUpdateDirective(ServerMessage serverMessage, ClientConfiguration clientConfiguration) { 52 if (clientConfiguration == null) { 53 return; 54 } 55 Document document = serverMessage.getDocument(); 56 Element messagePartElement = serverMessage.addPart(ServerMessage.GROUP_ID_INIT, "EchoClientConfiguration.MessageProcessor"); 57 Element storeElement = document.createElement("store"); 58 messagePartElement.appendChild(storeElement); 59 60 String [] propertyNames = clientConfiguration.getPropertyNames(); 61 for (int i = 0; i < propertyNames.length; ++i) { 62 Element propertyElement = document.createElement("property"); 63 storeElement.appendChild(propertyElement); 64 propertyElement.setAttribute("name", propertyNames[i]); 65 propertyElement.setAttribute("value", clientConfiguration.getProperty(propertyNames[i])); 66 } 67 } 68 69 70 private ClientConfigurationUpdate() { } 71 } 72 | Popular Tags |