import net.pterodactylus.sonitus.data.ControlledComponent;
import net.pterodactylus.sonitus.data.Pipeline;
-import net.pterodactylus.sonitus.gui.PipelinePanel.ComponentHoverListener;
+import net.pterodactylus.sonitus.gui.PipelinePanel.ComponentSelectionListener;
import net.pterodactylus.sonitus.main.Version;
import com.google.common.base.Optional;
tabbedPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
final JPanel pipelineInfoPanel = new JPanel(new BorderLayout(12, 12));
PipelinePanel pipelinePanel = new PipelinePanel(pipeline);
- pipelinePanel.addComponentHoverListener(new ComponentHoverListener() {
+ pipelinePanel.addComponentHoverListener(new ComponentSelectionListener() {
@Override
- public void componentEntered(ControlledComponent controlledComponent) {
+ public void componentSelected(ControlledComponent controlledComponent) {
infoPanelCardLayout.show(infoPanel, controlledComponent.name());
}
});
private final Pipeline pipeline;
/** The component hover listeners. */
- private final EventListenerList componentHoverListeners = new EventListenerList();
+ private final EventListenerList componentSelectionListeners = new EventListenerList();
/**
* Creates a new pipeline panel displaying the given pipeline.
//
/**
- * Adds the given component hover listener to this panel.
+ * Adds the given component selection listener to this panel.
*
- * @param componentHoverListener
- * The component hover listener to add
+ * @param componentSelectionListener
+ * The component selection listener to add
*/
- public void addComponentHoverListener(ComponentHoverListener componentHoverListener) {
- componentHoverListeners.add(ComponentHoverListener.class, componentHoverListener);
+ public void addComponentHoverListener(ComponentSelectionListener componentSelectionListener) {
+ componentSelectionListeners.add(ComponentSelectionListener.class, componentSelectionListener);
}
//
*/
private void addControlled(final ControlledComponent controlledComponent, int level, int position, int width, ControlledComponent parentComponent) {
/* create a GUI component that displays the component. */
- JPanel componentPanel = createComponentPanel(controlledComponent, parentComponent);
+ final JPanel componentPanel = createComponentPanel(controlledComponent, parentComponent);
componentPanel.addMouseListener(new MouseAdapter() {
@Override
- public void mouseEntered(MouseEvent mouseEvent) {
- for (ComponentHoverListener componentHoverListener : componentHoverListeners.getListeners(ComponentHoverListener.class)) {
- componentHoverListener.componentEntered(controlledComponent);
+ public void mouseClicked(MouseEvent e) {
+ for (ComponentSelectionListener componentSelectionListener : componentSelectionListeners.getListeners(ComponentSelectionListener.class)) {
+ componentSelectionListener.componentSelected(controlledComponent);
}
+ selectedComponent = componentPanel;
}
});
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- public static interface ComponentHoverListener extends EventListener {
+ public static interface ComponentSelectionListener extends EventListener {
/**
* Notifies the listener that the mouse is now over the given controlled
* @param controlledComponent
* The controlled component now under the mouse
*/
- void componentEntered(ControlledComponent controlledComponent);
+ void componentSelected(ControlledComponent controlledComponent);
}