// Connect / configure the components
m_OutText.setEditable(false);
m_OutText.setFont(new Font("Monospaced", Font.PLAIN, 12));
m_OutText.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
m_OutText.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK)
!= InputEvent.BUTTON1_MASK) {
m_OutText.selectAll();
}
}
});
m_History.setBorder(BorderFactory.createTitledBorder("Result list (right-click for options)"));
m_ClustererEditor.setClassType(Clusterer.class);
m_ClustererEditor.setValue(ExplorerDefaults.getClusterer());
m_ClustererEditor.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
m_StartBut.setEnabled(true);
Capabilities currentFilter = m_ClustererEditor.getCapabilitiesFilter();
Clusterer clusterer = (Clusterer) m_ClustererEditor.getValue();
Capabilities currentSchemeCapabilities = null;
if (clusterer != null && currentFilter != null &&
(clusterer instanceof CapabilitiesHandler)) {
currentSchemeCapabilities = ((CapabilitiesHandler)clusterer).getCapabilities();
if (!currentSchemeCapabilities.supportsMaybe(currentFilter) &&
!currentSchemeCapabilities.supports(currentFilter)) {
m_StartBut.setEnabled(false);
}
}
repaint();
}
});
m_TrainBut.setToolTipText("Cluster the same set that the clusterer"
+ " is trained on");
m_PercentBut.setToolTipText("Train on a percentage of the data and"
+ " cluster the remainder");
m_TestSplitBut.setToolTipText("Cluster a user-specified dataset");
m_ClassesToClustersBut.setToolTipText("Evaluate clusters with respect to a"
+" class");
m_ClassCombo.setToolTipText("Select the class attribute for class based"
+" evaluation");
m_StartBut.setToolTipText("Starts the clustering");
m_StopBut.setToolTipText("Stops a running clusterer");
m_StorePredictionsBut.
setToolTipText("Store predictions in the result list for later "
+"visualization");
m_ignoreBut.setToolTipText("Ignore attributes during clustering");
m_FileChooser.setFileFilter(m_ModelFilter);
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
m_ClassCombo.setPreferredSize(COMBO_SIZE);
m_ClassCombo.setMaximumSize(COMBO_SIZE);
m_ClassCombo.setMinimumSize(COMBO_SIZE);
m_ClassCombo.setEnabled(false);
m_PercentBut.setSelected(ExplorerDefaults.getClustererTestMode() == 2);
m_TrainBut.setSelected(ExplorerDefaults.getClustererTestMode() == 3);
m_TestSplitBut.setSelected(ExplorerDefaults.getClustererTestMode() == 4);
m_ClassesToClustersBut.setSelected(ExplorerDefaults.getClustererTestMode() == 5);
m_StorePredictionsBut.setSelected(ExplorerDefaults.getClustererStoreClustersForVis());
updateRadioLinks();
ButtonGroup bg = new ButtonGroup();
bg.add(m_TrainBut);
bg.add(m_PercentBut);
bg.add(m_TestSplitBut);
bg.add(m_ClassesToClustersBut);
m_TrainBut.addActionListener(m_RadioListener);
m_PercentBut.addActionListener(m_RadioListener);
m_TestSplitBut.addActionListener(m_RadioListener);
m_ClassesToClustersBut.addActionListener(m_RadioListener);
m_SetTestBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setTestSet();
}
});
m_StartBut.setEnabled(false);
m_StopBut.setEnabled(false);
m_ignoreBut.setEnabled(false);
m_StartBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
startClusterer();
}
});
m_StopBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
stopClusterer();
}
});
m_ignoreBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setIgnoreColumns();
}
});
m_History.setHandleRightClicks(false);
// see if we can popup a menu for the selected result
m_History.getList().addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (((e.getModifiers() & InputEvent.BUTTON1_MASK)
!= InputEvent.BUTTON1_MASK) || e.isAltDown()) {
int index = m_History.getList().locationToIndex(e.getPoint());
if (index != -1) {