// build help
final HelpViewer h = new HelpViewer(helpID);
// build list
final GroupList gl = new GroupList(listModel);
gl.setCellRenderer(new IconRenderer());
gl.setLayoutOrientation(JList.HORIZONTAL_WRAP);
gl.addListSelectionListener(new ListSelectionListener() {
@Override public void valueChanged(ListSelectionEvent lse) {
if (lse.getValueIsAdjusting()) {
return;
}
// update help
h.setId(((INewFormElement) gl.getSelectedValue()).getHelpID());
}
});
// build layout
JPanel left = new JPanel(new BorderLayout());
left.add(new YHeader(title, icon), BorderLayout.NORTH);
left.add(gl, BorderLayout.CENTER);
// show
if (YDialog.show(title, YFactory.createHorizontPanel(left, h, "newform." + helpID), true) == false) {
return null;
}
// add it?
if (gl.getSelectedValue() != null) {
return (INewFormElement) gl.getSelectedValue();
}
return null;
}