コード例 #1
0
  /**
   * Refresh the geometry. Check that the sites that the handles are attached to are the same as the
   * sites at the ends of the connector, and if not, fix them. This is needed because some clients
   * might unnecessarily over-write the sites that a connector is already snapped to. If the
   * grab-handles aren't re-attached accordingly, grabbing and moving them will cause unpredictable
   * results.
   */
  public void refresh() {
    Connector c = (Connector) getChild();

    // Check sites
    if (c != null) {
      if (_headHandle.getSite() != c.getHeadSite()) {
        _headHandle.setSite(c.getHeadSite());
      }

      if (_tailHandle.getSite() != c.getTailSite()) {
        _tailHandle.setSite(c.getTailSite());
      }
    }
  }