use of org.osate.ge.internal.diagram.runtime.DiagramConfiguration in project osate2 by osate.
the class DiagramConfigurationDialog method main.
public static void main(String[] args) {
final Model model = new Model() {
@Override
public RelativeBusinessObjectReference getRelativeBusinessObjectReference(final Object bo) {
return new RelativeBusinessObjectReference(bo.toString());
}
@Override
public Collection<Object> getChildBusinessObjects(final BusinessObjectContext boc) {
final Collection<Object> children = new ArrayList<>();
for (int i = 1; i <= 100; i++) {
children.add("C" + i);
}
return children;
}
@Override
public String getName(final BusinessObjectContext boc) {
return boc.getBusinessObject().toString();
}
@Override
public ImmutableSet<ContentFilter> getDefaultContentFilters(final Object bo) {
return ImmutableSet.of(TestContentsFilter.FILTER1);
}
@Override
public Map<String, Collection<String>> getAadlProperties() {
final Map<String, Collection<String>> result = new HashMap<>();
result.put("test_ps1", Arrays.asList(new String[] { "a", "c", "b" }));
result.put("test_ps2", Arrays.asList(new String[] { "a", "b", "c" }));
result.put("test_ps3", Arrays.asList(new String[] { "d", "f", "e" }));
return result;
}
@Override
public Object getBusinessObject(final CanonicalBusinessObjectReference ref) {
return new Object();
}
@Override
public String getContextDescription(final Object contextBo) {
return "a::b::c (TestType)";
}
@Override
public boolean shouldShowBusinessObject(final Object bo) {
return !bo.equals("C3");
}
@Override
public Image getImage(final Object bo) {
return null;
}
@Override
public Object resolve(final Object bo) {
return bo;
}
@Override
public boolean isProxy(Object bo) {
return false;
}
};
final DiagramConfiguration diagramConfig = new DiagramConfigurationBuilder(new CustomDiagramType(), false).contextBoReference(new CanonicalBusinessObjectReference("test")).addAadlProperty("test::prop1").addAadlProperty("test_ps2::b").connectionPrimaryLabelsVisible(true).build();
// Create a test business object tree
final BusinessObjectNode rootNode = new BusinessObjectNode(null, UUID.randomUUID(), null, null, Completeness.UNKNOWN, true);
new BusinessObjectNode(rootNode, UUID.randomUUID(), new RelativeBusinessObjectReference("A"), "A", Completeness.UNKNOWN, true);
new BusinessObjectNode(rootNode, UUID.randomUUID(), new RelativeBusinessObjectReference("B"), "B", Completeness.UNKNOWN, true);
new BusinessObjectNode(rootNode, UUID.randomUUID(), new RelativeBusinessObjectReference("C"), "C", Completeness.UNKNOWN, true);
new BusinessObjectNode(rootNode, UUID.randomUUID(), new RelativeBusinessObjectReference("D"), "D", Completeness.UNKNOWN, true);
// Show the dialog
final Result result = DiagramConfigurationDialog.show(null, model, diagramConfig, rootNode, new Object[] { "A", "C1", "C2", "C4" });
if (result == null) {
System.out.println("Dialog was canceled.");
} else {
System.out.println(result.getDiagramConfiguration());
System.out.println(result.getBusinessObjectTree());
}
}
Aggregations