} catch (Exception ex) {
ex.printStackTrace();
return;
}
final JDialog d = new JDialog((JFrame)KnowledgeFlowApp.this.getTopLevelAncestor(),
"Manage Perspectives", true);
d.setLayout(new BorderLayout());
JPanel holder = new JPanel();
holder.setLayout(new BorderLayout());
holder.add(m_perspectiveConfigurer, BorderLayout.CENTER);
JButton okBut = new JButton("OK");
JButton cancelBut = new JButton("Cancel");
JPanel butHolder = new JPanel();
butHolder.setLayout(new GridLayout(1,2));
butHolder.add(okBut);
butHolder.add(cancelBut);
holder.add(butHolder, BorderLayout.SOUTH);
okBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
VISIBLE_PERSPECTIVES = new TreeSet<String>();
int[] selected = m_perspectiveConfigurer.getSelectedAttributes();
for (int i = 0; i < selected.length; i++) {
String selectedClassName = pClasses.get(i);
// first check to see if it's in the cache already
if (PERSPECTIVE_CACHE.get(selectedClassName) == null) {
// need to instantiate and add to the cache
try {
Object p = Class.forName(selectedClassName).newInstance();
if (p instanceof KFPerspective &&
p instanceof JPanel) {
String title = ((KFPerspective)p).getPerspectiveTitle();
System.out.println("[KnowledgeFlow] loaded perspective: " + title);
((KFPerspective)p).setLoaded(true);
((KFPerspective)p).setMainKFPerspective(m_mainKFPerspective);
PERSPECTIVE_CACHE.put(selectedClassName, (KFPerspective)p);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
VISIBLE_PERSPECTIVES.add(selectedClassName);
}
setupUserPerspectives();
d.dispose();
}
});
cancelBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
d.dispose();
}
});
d.getContentPane().add(holder, BorderLayout.CENTER);
/* d.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
d.dispose();
}
}); */
d.pack();
d.setVisible(true);
}