* @param terminal New terminal to be used.
	 * @param source Specifies if the new terminal is the source or target.
	 * @param constraint Constraint to be used for this connection.
	 */
	public void cellConnected(Object edge, Object terminal, boolean source,
			mxConnectionConstraint constraint)
	{
		if (edge != null)
		{
			model.beginUpdate();
			try
			{
				Object previous = model.getTerminal(edge, source);

				// Updates the constraint
				setConnectionConstraint(edge, terminal, source, constraint);
				
				// Checks if the new terminal is a port, uses the ID of the port in the
				// style and the parent of the port as the actual terminal of the edge.
				if (isPortsEnabled())
				{
					// Checks if the new terminal is a port
					String id = null;
	
					if (isPort(terminal) && terminal instanceof mxICell)
					{
						id = ((mxICell) terminal).getId();
						terminal = getTerminalForPort(terminal, source);
					}
	
					// Sets or resets all previous information for connecting to a child port
					String key = (source) ? mxConstants.STYLE_SOURCE_PORT
							: mxConstants.STYLE_TARGET_PORT;
					setCellStyles(key, id, new Object[] { edge });
				}
				
				model.setTerminal(edge, terminal, source);

				if (isResetEdgesOnConnect())
				{
					resetEdge(edge);
				}

				fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED, "edge",
						edge, "terminal", terminal, "source", source,
						"previous", previous));
			}
			finally
			{
				model.endUpdate();
			}
		}
	}