Well, if your approach works, then it should be fine I guess.
Otherwise you can take a look at the MidiKeyboardComponent class. It displays a virtual keyboard, which you can click on with your mouse. You can see it in action in the JUCE Demo "Midi I/O". When you create a MidiKeyboardComponent, you give it a MidiKeyboardState. This keyboard state makes the Midi events available. You can pass a Midi buffer to it and it is going to add the Midi events, which were created by the mouse clicks. To do so, use the function MidiKeyboardState::processNextMidiBuffer(...).
You can create a similar processNextMidiBuffer(...) function for your component.
Now maybe you are wondering how to let the processNextMidiBuffer(...) function interact with the AudioDeviceManager. Well, I assume you have already created a Midi collector using the MidiMessageCollector class. And I assume, you already have added the Midi collector to your audio device manager using code such as
myAudioDeviceManager.addMidiInputCallback (String::empty, &myMidiCollector);
So that means, your audio device manager is happily filling your Midi collector with Midi events, from your external Midi keyboard. Somewhere in your application you have an audio or Midi loop. That is: a function, which gets called over and over again, to process your audio and/or Midi data (e.g. AudioSource::getNextAudioBlock(...) ). Inside of that loop you probably already have code similar to
// fill a midi buffer with incoming messages from the external midi device.
MidiBuffer incomingMidi;
myMidiCollector.removeNextBlockOfMessages (incomingMidi, bufferToFill.numSamples);
Now just add the processNextMidiBuffer(...) function, which I talked about above. So altogether the code could look similar to:
// fill a midi buffer with incoming messages from the external midi device.
MidiBuffer incomingMidi;
myMidiCollector.removeNextBlockOfMessages (incomingMidi, bufferToFill.numSamples);
// Add midi data from my own GUI component, which I click on on with the mouse:
myGUIComponent.processNextMidiBuffer (incomingMidi, 0, bufferToFill.numSamples, true);