* Shows the component browser.
*/
public void showBrowser()
{
// Initialize the item selection dialog
final DataMemberSelectionDlg dlg = new DataMemberSelectionDlg(ApplicationUtil.getActiveWindow(), true);
dlg.setTitle(title);
// Determine the root object (a complex type item) from the edited object
if (rootObjectPropertyPath != null)
{
Object o = getObject();
try
{
ModelObject rootObject = (ModelObject) PropertyAccessUtil.getProperty(o, rootObjectPropertyPath);
dlg.setRootObject(rootObject);
}
catch (PropertyException e)
{
LogUtil.error(getClass(), "Error accessing property $0 in object of type $1", rootObjectPropertyPath, o.getClass().getName(), e);
}
catch (ClassCastException e)
{
LogUtil.error(getClass(), "Value of property $0 in object of type $1 is not a ModelObject", rootObjectPropertyPath, o.getClass().getName(), e);
}
}
dlg.rebuildTree();
dlg.expand(1);
// Determine the current data member path from the value of the property
String memberPath = (String) value;
dlg.setSelectedMemberPath(memberPath);
// Instantiate the customizer class
if (customizer == null && customizerClassName != null)
{
try
{
customizer = (ComponentSelectionEditorCustomizer) ReflectUtil.instantiate(customizerClassName, ComponentSelectionEditorCustomizer.class, "component selection editor customizer class");
}
catch (Exception e)
{
ExceptionUtil.printTrace(e);
}
}
if (customizer != null)
{
if (!customizer.initializeDialog(this, dlg))
return;
}
dlg.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent we)
{
String memberPath = dlg.getSelectedMemberPath();
if (customizer != null)
{
if (!customizer.dialogClosed(DataMemberPathSelectionEditor.this, dlg, memberPath))
return;
}
if (memberPath != null)
{
textField.setText(memberPath);
textField.requestFocus();
propertyChanged();
}
}
});
if (customizer != null)
{
if (!customizer.dialogInitialized(this, dlg))
return;
}
// Show the dialog
dlg.setVisible(true);
}