コード例 #1
0
  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);
  }
コード例 #2
0
 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);
   }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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;
 }