Esempio n. 1
0
 /**
  * Returns a collection of those {@link #getDirtyConnectors() dirty connectors} that are actually
  * visible to the client.
  *
  * @return A list of dirty and visible connectors.
  */
 public ArrayList<ClientConnector> getDirtyVisibleConnectors() {
   ArrayList<ClientConnector> dirtyConnectors = new ArrayList<ClientConnector>();
   for (ClientConnector c : getDirtyConnectors()) {
     if (LegacyCommunicationManager.isConnectorVisibleToClient(c)) {
       dirtyConnectors.add(c);
     }
   }
   return dirtyConnectors;
 }
Esempio n. 2
0
  /**
   * Cleans the connector map from all connectors that are no longer attached to the application.
   * This should only be called by the framework.
   */
  public void cleanConnectorMap() {
    if (!unregisteredConnectors.isEmpty()) {
      removeUnregisteredConnectors();
    }

    // Do this expensive check only with assertions enabled
    assert isHierarchyComplete()
        : "The connector hierarchy is corrupted. "
            + "Check for missing calls to super.setParent(), super.attach() and super.detach() "
            + "and that all custom component containers call child.setParent(this) when a child is added and child.setParent(null) when the child is no longer used. "
            + "See previous log messages for details.";

    // remove detached components from paintableIdMap so they
    // can be GC'ed
    Iterator<ClientConnector> iterator = connectorIdToConnector.values().iterator();
    GlobalResourceHandler globalResourceHandler = uI.getSession().getGlobalResourceHandler(false);
    while (iterator.hasNext()) {
      ClientConnector connector = iterator.next();
      assert connector != null;
      if (connector.getUI() != uI) {
        // If connector is no longer part of this uI,
        // remove it from the map. If it is re-attached to the
        // application at some point it will be re-added through
        // registerConnector(connector)

        // This code should never be called as cleanup should take place
        // in detach()

        getLogger()
            .log(
                Level.WARNING,
                "cleanConnectorMap unregistered connector {0}. This should have been done when the connector was detached.",
                getConnectorAndParentInfo(connector));

        if (globalResourceHandler != null) {
          globalResourceHandler.unregisterConnector(connector);
        }
        uninitializedConnectors.remove(connector);
        diffStates.remove(connector);
        iterator.remove();
      } else if (!uninitializedConnectors.contains(connector)
          && !LegacyCommunicationManager.isConnectorVisibleToClient(connector)) {
        uninitializedConnectors.add(connector);
        diffStates.remove(connector);
        if (getLogger().isLoggable(Level.FINE)) {
          getLogger()
              .log(
                  Level.FINE,
                  "cleanConnectorMap removed state for {0} as it is not visible",
                  getConnectorAndParentInfo(connector));
        }
      }
    }

    cleanStreamVariables();
  }