public PersistentFieldChange buildChange(String name, Object value) {
    touch();
    String[] chunks = name.split(":");

    // Will be empty string for the root component
    String componentId = chunks[2];
    String fieldName = chunks[3];

    return new PersistentFieldChangeImpl(componentId, fieldName, value);
  }
 public void postChange(
     String prefix, String pageName, String componentId, String fieldName, Object newValue) {
   touch();
   String key = buildKey(prefix, pageName, componentId, fieldName);
   if (LOG.isTraceEnabled()) {
     LOG.trace("Adding change to screen '" + this.id + "': " + key + "=>" + newValue);
   }
   if (newValue == null) {
     state.remove(key);
   } else {
     state.put(key, newValue);
   }
 }
 public ScreenState(String pageName, int idleTimeoutInSeconds) {
   touch();
   this.pageName = pageName;
   this.id = Long.toString(Math.abs(RND.nextLong()));
   this.idleTimeoutInSeconds = idleTimeoutInSeconds;
   LOG.trace(
       "Creating new screen state: id="
           + this.id
           + ", page="
           + pageName
           + ", timeout="
           + idleTimeoutInSeconds);
 }
 public Map<String, Object> gatherFieldChanges(String prefix, String pageName) {
   touch();
   prefix = prefix + ":" + pageName;
   Map<String, Object> result = new HashMap<String, Object>();
   for (String key : state.keySet()) {
     if (key.startsWith(prefix)) {
       if (LOG.isTraceEnabled()) {
         LOG.trace(
             "Gathering changes from screen '" + this.id + "': " + key + "=>" + state.get(key));
       }
       result.put(key, state.get(key));
     }
   }
   return result;
 }