We visited the Adriatic Coast (including Puglia and Matera) in October 2012, mostly by public transportation, and visited all of the places you mentioned except the Tremiti Islands. We stayed in Trani (4 nights), took a train to Bari and onward to Matera (2 nights), picked up a car there and stayed at Masseria Montenapoleone near Pezze di Greco (6 nights) (visiting Ostuni, Alberobello and Locorotondo from there), then returned the car in Brindisi and took the train to Lecce (6 nights).
Matera is a must-see. Easy to get to via public transportation. I think 2 nights might be enough here. The masseria was our favorite stop. A masseria is similar to an agriturismo .... located in the countryside. Quiet, beautiful. Ours had a pool and fabulous food. If you can work up your nerve to drive, it makes it a lot easier to see Ostuni and the Trulli villages with a car. We also enjoyed driving to the coast, seeing Monopoli and Polignano a Mare -- gorgeous little seaside village. Driving was pretty easy; a GPS is highly recommended, as many of the little roads are not marked. There's a great highway that runs along the coast; once you get to the little towns, there's hardly any traffic to deal with.
We found Lecce to be a frustrating home base. Everything in town -- all shops, restaurants, offices -- closes around 2 pm daily. It becomes a ghost town. Shops start reopening around 6 pm but restaurants don't open until 8 pm. You can't even get a pizza or sandwich or a piece of cheese between 2 pm and 8 pm. So you have to plan carefully and have snacks in your room in case you are hungry after returning from a day trip. We took a day trip to Otranto, and another to Gallipoli. Gallipoli was our favorite. Gorgeous little town. I wished we had stayed here for a few days. Another enjoyable outing from Lecce was an escorted visit to two wineries, with a company called Experience Path. They can set you up for wine tastings, cooking classes, bicycle trips ... whatever. Highly recommended.
Public transportation this far south in Italy is not as well organized as in the more heavily touristed areas. In the little Lecce train station, there are 3 widely-separated ticket windows, depending on who runs the train you want to take, which you of course don't know so there is a bit of running back and forth. For our trip to Gallipoli, the ticket vendor was in a tobacco shop at the end of the station. We luckily bought a round-trip ticket and took note of the schedule, because when returning around 4 pm, the Gallipoli train station was unmanned (no ticket office at all) and there were no signs indicating train arrival/departure times. Not a lot of English spoken down here either, so we weren't positive we were on the correct train back to Lecce until we were about half-way there. That being said, it all added to the adventure of the outing.
Puglia is absolutely gorgeous, with far less tourists than you'll find elsewhere in Italy. The food is wonderful. I think you'll have a great time. Brush up on your Italian, and consider staying in a masseria. Have fun!