private void initEvents() {
autoMetaEdgeCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
boolean sel = autoMetaEdgeCheckbox.isSelected();
model.settings().putClientProperty(GraphSettings.AUTO_META_EDGES, sel);
sumRadio.setEnabled(sel);
avgRadio.setEnabled(sel);
labelWeight.setEnabled(sel);
}
});
showTreeLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TopComponent tc = WindowManager.getDefault().findTopComponent("HierarchyTopComponent");
if (tc != null) {
tc.open();
tc.requestActive();
HierarchyTopComponent hierarchyTopComponent = (HierarchyTopComponent) tc;
hierarchyTopComponent.refresh();
}
}
});
metaEdgeInfoLabel.addMouseListener(new MouseAdapter() {
RichTooltip richTooltip;
@Override
public void mouseEntered(MouseEvent e) {
String description = NbBundle.getMessage(HierarchyControlPanel.class, "HierarchyControlPanel.info.description");
String title = NbBundle.getMessage(HierarchyControlPanel.class, "HierarchyControlPanel.info.title");
richTooltip = new RichTooltip(title, description);
richTooltip.showTooltip(metaEdgeInfoLabel);
}
@Override
public void mouseExited(MouseEvent e) {
if (richTooltip != null) {
richTooltip.hideTooltip();
richTooltip = null;
}
}
});
metaWeightInfoLabel.addMouseListener(new MouseAdapter() {
RichTooltip richTooltip;
@Override
public void mouseEntered(MouseEvent e) {
String description = NbBundle.getMessage(HierarchyControlPanel.class, "HierarchyControlPanel.weightinfo.description");
String title = NbBundle.getMessage(HierarchyControlPanel.class, "HierarchyControlPanel.weightinfo.title");
richTooltip = new RichTooltip(title, description);
richTooltip.showTooltip(metaWeightInfoLabel);
}
@Override
public void mouseExited(MouseEvent e) {
if (richTooltip != null) {
richTooltip.hideTooltip();
richTooltip = null;
}
}
});
ActionListener radioListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
GraphSettings settings = model.settings();
settings.putClientProperty(GraphSettings.METAEDGE_BUILDER, e.getActionCommand());
}
};
sumRadio.setActionCommand("sum");
avgRadio.setActionCommand("average");