![JAR search and dependency download from the Maven repository](/logo.png)
org.datacleaner.widgets.visualization.JobGraphBindingsManager Maven / Gradle / Ivy
/**
* DataCleaner (community edition)
* Copyright (C) 2014 Free Software Foundation, Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.datacleaner.widgets.visualization;
import static javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeListener;
import java.util.Set;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import org.apache.metamodel.schema.Column;
import org.apache.metamodel.schema.Table;
import org.datacleaner.actions.DefaultRenameComponentActionListener;
import org.datacleaner.job.builder.AnalysisJobBuilder;
import org.datacleaner.job.builder.AnalyzerComponentBuilder;
import org.datacleaner.job.builder.ComponentBuilder;
import org.datacleaner.job.builder.FilterComponentBuilder;
import org.datacleaner.job.builder.TransformerComponentBuilder;
/**
* Key-bindings manager for the {@link JobGraph}.
*/
public class JobGraphBindingsManager {
private abstract static class JobGraphBindingAction implements Action {
private boolean _enabled = true;
@Override
public Object getValue(final String key) {
return null;
}
@Override
public void putValue(final String key, final Object value) {
}
@Override
public boolean isEnabled() {
return _enabled;
}
@Override
public void setEnabled(final boolean enabled) {
_enabled = enabled;
}
@Override
public void addPropertyChangeListener(final PropertyChangeListener listener) {
}
@Override
public void removePropertyChangeListener(final PropertyChangeListener listener) {
}
}
private static final int INPUT_MAP_CONDITION = WHEN_IN_FOCUSED_WINDOW;
private static final String KEY_DELETE = "DELETE";
private static final String KEY_BACKSPACE = "BACK_SPACE";
private static final String KEY_F2 = "F2";
private static final String KEY_F5 = "F5";
private static final String KEY_ENTER = "ENTER";
private final JobGraphContext _graphContext;
private final JobGraphActions _actions;
private final JComponent _component;
public JobGraphBindingsManager(final JobGraphContext graphContext, final JobGraphActions actions,
final JComponent component) {
_graphContext = graphContext;
_actions = actions;
_component = component;
}
public void register() {
registerDeleteAction();
registerRenameAction();
registerRefreshAction();
registerEnterConfigurationAction();
}
private void registerRefreshAction() {
registerAction(KEY_F5, KeyStroke.getKeyStroke(KEY_F5), new JobGraphBindingAction() {
@Override
public void actionPerformed(final ActionEvent e) {
_graphContext.getJobGraph().refresh();
}
});
}
private void registerEnterConfigurationAction() {
registerAction(KEY_ENTER, KeyStroke.getKeyStroke(KEY_ENTER), new JobGraphBindingAction() {
@Override
public void actionPerformed(final ActionEvent e) {
final Set
© 2015 - 2025 Weber Informatics LLC | Privacy Policy