static void handle(final UIDescriptor uiDescriptor, final ServiceItem serviceItem, final Component parent) {
try {
Object factory = uiDescriptor.getUIFactory(Thread.currentThread().getContextClassLoader());
Class factoryClass = factory.getClass();
if(JFrameFactory.class.isAssignableFrom(factoryClass)) {
JFrameFactory uiFactory = (JFrameFactory)factory;
JFrame frame = uiFactory.getJFrame(serviceItem);
frame.validate();
frame.setVisible(true);
}
else if(JWindowFactory.class.isAssignableFrom(factoryClass)) {
JWindowFactory uiFactory = (JWindowFactory)factory;
JWindow window = uiFactory.getJWindow(serviceItem);
window.validate();
window.setVisible(true);
} else if(JComponentFactory.class.isAssignableFrom(factoryClass)) {
JComponentFactory uiFactory = (JComponentFactory)factory;
JComponent component = uiFactory.getJComponent(serviceItem);
String name = component.getAccessibleContext().getAccessibleName();
if(name==null) {
component.getAccessibleContext().setAccessibleName(component.getClass().getName());
}
JComponentFrame componentFrame = new JComponentFrame(component, name);
componentFrame.setLocationRelativeTo(parent);
componentFrame.setVisible(true);
} else if(JDialogFactory.class.isAssignableFrom(factoryClass)) {
JDialogFactory uiFactory = (JDialogFactory)factory;
JDialog dialog = uiFactory.getJDialog(serviceItem);
dialog.validate();
dialog.setVisible(true);
}
} catch (Exception e) {
Util.showError(e, parent, "Service UI Exception");