final JList detailList = masterDetailList.getDetailList();
detailList.setCellRenderer(new SchemaElementsRenderer());
masterList.setCellRenderer(new SimilarTypeRenderer());
// build master view
final GridBagLayoutBuilder typeListPanelBuilder = new GridBagLayoutBuilder();
typeListPanelBuilder.append(cf.createLabel("similarTypesView.typeList.label", new ValueModel[] { numSimilarTypesSchema})).nextLine();
typeListPanelBuilder.append(cf.createScrollPane(masterList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), 1, 1, true, true);
final CommandGroup group = getWindowCommandManager().createCommandGroup("similarTypesCommandGroup", new Object[] { similarTypesTypeHierarchyCommand, similarTypesInspectionCommand, "separator", GlobalCommandIds.PROPERTIES});
masterList.addMouseListener(new PopupMenuMouseListener(group.createPopupMenu()));
masterList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent evt) {
Map<String, XSObject> parameters = new HashMap<String, XSObject>();
final SimilarTypeListModelEntry similarTypeListModelEntry = (SimilarTypeListModelEntry) masterList.getSelectedValue();
if (null == similarTypeListModelEntry) return;
parameters.put(XsElementPropertiesExecutor.OBJECT, similarTypeListModelEntry.getType());
xsElementPropertiesExecutor.execute(parameters);
}
});
// build client view
final GridBagLayoutBuilder similarTypesListPanelBuilder = new GridBagLayoutBuilder();
similarTypesListPanelBuilder.append(cf.createLabel("similarTypesView.similarTypeList.label", new ValueModel[] { numSimilarTypes})).nextLine();
similarTypesListPanelBuilder.append(cf.createScrollPane(detailList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), 1, 1, true, true);
final CommandGroup detailListGroup = getWindowCommandManager().createCommandGroup("typeListCommandGroup", new Object[] { typesListTypeHierarchyCommand, typesListTypeInspectionCommand, "separator", GlobalCommandIds.PROPERTIES});
detailList.addMouseListener(new PopupMenuMouseListener(detailListGroup.createPopupMenu()));
detailList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent evt) {
Map<String, XSObject> parameters = new HashMap<String, XSObject>();
parameters.put(XsElementPropertiesExecutor.OBJECT, (XSObject) detailList.getSelectedValue());
xsElementPropertiesExecutor.execute(parameters);
}
});
// build main component
JSplitPane jspSimilarTypes = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jspSimilarTypes.setDividerLocation(0.66f);
jspSimilarTypes.setTopComponent(typeListPanelBuilder.getPanel());
jspSimilarTypes.setBottomComponent(similarTypesListPanelBuilder.getPanel());
JPanel jpSimilarTypes = cf.createPanel(new BorderLayout());
jpSimilarTypes.add(jspSimilarTypes, BorderLayout.CENTER);
jpSimilarTypes.add(FilterToolbarFactory.createFilterToolBar(elementTypeConstraint), BorderLayout.NORTH);