use of org.qi4j.tools.model.descriptor.ModuleDetailDescriptor in project qi4j-sdk by Qi4j.
the class EntityViewer method initEntityCombo.
private void initEntityCombo(DefaultComboBoxModel entityComboModel) {
// create the visitor to traverse the QI4J to find the module
ApplicationDetailDescriptor visitor = ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor(model);
// find all entities
Iterable<LayerDetailDescriptor> layerDescIter = visitor.layers();
for (LayerDetailDescriptor layerDesc : layerDescIter) {
Iterable<ModuleDetailDescriptor> moduleDescIter = layerDesc.modules();
for (ModuleDetailDescriptor moduleDesc : moduleDescIter) {
Iterable<EntityDetailDescriptor> entityDescIter = moduleDesc.entities();
for (EntityDetailDescriptor entity : entityDescIter) {
entityComboModel.addElement(entity);
}
}
}
}
use of org.qi4j.tools.model.descriptor.ModuleDetailDescriptor in project qi4j-sdk by Qi4j.
the class DetailModelPane method setDescriptorImpl.
private void setDescriptorImpl(Object objectDescriptor) {
Component curSelectedComp = tabPane.getSelectedComponent();
tabPane.removeAll();
generalPane.setDescriptor(objectDescriptor);
dependencyPane.setDescriptor(objectDescriptor);
methodPane.setDescriptor(objectDescriptor);
statePane.setDescriptor(objectDescriptor);
serviceConfigurationPane.setDescriptor(objectDescriptor);
serviceUsagePane.setDescriptor(objectDescriptor);
importedByPane.setDescriptor(objectDescriptor);
apiPane.setDescriptor(objectDescriptor);
spiPane.setDescriptor(objectDescriptor);
if (objectDescriptor instanceof LayerDetailDescriptor || objectDescriptor instanceof ModuleDetailDescriptor) {
tabPane.add(bundle.getString("CTL_APITab.Text"), apiPane);
tabPane.add(bundle.getString("CTL_SPITab.Text"), spiPane);
} else if (objectDescriptor instanceof ServiceDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_DependencyTab.Text"), dependencyPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
tabPane.add(bundle.getString("CTL_StateTab.Text"), statePane);
tabPane.add(bundle.getString("CTL_ServiceConfiguration.Text"), serviceConfigurationPane);
tabPane.add(bundle.getString("CTL_ServiceUsage.Text"), serviceUsagePane);
} else if (objectDescriptor instanceof ImportedServiceDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
tabPane.add(bundle.getString("CTL_ServiceUsage.Text"), serviceUsagePane);
tabPane.add(bundle.getString("CTL_ImportedBy.Text"), importedByPane);
} else if (objectDescriptor instanceof EntityDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_DependencyTab.Text"), dependencyPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
tabPane.add(bundle.getString("CTL_StateTab.Text"), statePane);
} else if (objectDescriptor instanceof ValueDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_DependencyTab.Text"), dependencyPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
tabPane.add(bundle.getString("CTL_StateTab.Text"), statePane);
} else if (objectDescriptor instanceof ObjectDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_DependencyTab.Text"), dependencyPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
} else if (objectDescriptor instanceof TransientDetailDescriptor) {
tabPane.add(bundle.getString("CTL_GeneralTab.Text"), generalPane);
tabPane.add(bundle.getString("CTL_DependencyTab.Text"), dependencyPane);
tabPane.add(bundle.getString("CTL_MethodTab.Text"), methodPane);
tabPane.add(bundle.getString("CTL_StateTab.Text"), statePane);
}
if (linkActivatedInProgress) {
// for linking always display the first tab (General)
linkActivatedInProgress = false;
tabPane.setSelectedIndex(0);
} else {
// if not linking, then maintain the current selected tab
if (curSelectedComp != null) {
int index = tabPane.indexOfComponent(curSelectedComp);
if (index != -1) {
tabPane.setSelectedIndex(index);
}
}
}
}
use of org.qi4j.tools.model.descriptor.ModuleDetailDescriptor in project qi4j-sdk by Qi4j.
the class ServiceUsageFinder method collectInModules.
private void collectInModules(Iterable<ModuleDetailDescriptor> iter) {
for (ModuleDetailDescriptor descriptor : iter) {
collectInServices(descriptor.services());
collectInEntities(descriptor.entities());
collectInValues(descriptor.values());
collectInTransients(descriptor.composites());
collectInObjects(descriptor.objects());
}
}
use of org.qi4j.tools.model.descriptor.ModuleDetailDescriptor in project qi4j-sdk by Qi4j.
the class ServiceConfigurationFinder method findInModules.
private Object findInModules(Iterable<ModuleDetailDescriptor> iter, Class<?> configType) {
Object configDescriptor = null;
for (ModuleDetailDescriptor descriptor : iter) {
Object obj = findInTypes(descriptor.services(), configType);
if (obj != null) {
configDescriptor = obj;
break;
}
obj = findInTypes(descriptor.entities(), configType);
if (obj != null) {
configDescriptor = obj;
break;
}
// findInTransients
obj = findInTypes(descriptor.composites(), configType);
if (obj != null) {
configDescriptor = obj;
break;
}
obj = findInTypes(descriptor.values(), configType);
if (obj != null) {
configDescriptor = obj;
break;
}
obj = findInTypes(descriptor.objects(), configType);
if (obj != null) {
configDescriptor = obj;
break;
}
}
return configDescriptor;
}
Aggregations