I believe Yeats was inspired to write the poem after Maud Gonne rejected his love, as she did throughout her life. Most of his unrequited love poems will have a hint of Maud in them (often referred to as Helen of Troy for instance).A Literature lecturer at University told us that HIS University lecturer interviewed Maud Gonne just before she died. He asked her if she regretted not giving in to WB. In response, she took a book from a shelf and read his poem "When you are old and full of sleep".
Callie