Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1875 #2008

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open

#1875 #2008

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c336aa4
#1875
spica198 Apr 9, 2024
81a2b48
#1875
spica198 Apr 11, 2024
b0e34ee
#1875
spica198 Apr 11, 2024
9607b0f
#1875
spica198 Apr 16, 2024
9e25b39
#1875
spica198 Apr 17, 2024
68f6963
#1875
spica198 Apr 17, 2024
ae7d9d2
#1875
spica198 Apr 17, 2024
6b6d54c
#1875
spica198 Apr 17, 2024
33c5fd9
#1875
spica198 Apr 17, 2024
dedc328
Merge branch 'master' into 1875-shortcuts-for-data-access-view-workfl…
spica198 Jun 3, 2024
0f1f8f2
#1875
spica198 Jun 4, 2024
c5cccf9
#1875
spica198 Jun 24, 2024
b26e676
#1875
spica198 Jul 8, 2024
03105f5
Merge branch 'master' into 1875-shortcuts-for-data-access-view-workfl…
spica198 Jul 9, 2024
61ae599
#1875
spica198 Aug 6, 2024
e4c7f74
#1875
spica198 Aug 6, 2024
3bd2b1d
#1875
spica198 Aug 8, 2024
c496320
#1875
spica198 Aug 8, 2024
7e6b71b
#1875
spica198 Sep 13, 2024
65da6c9
#1875
spica198 Sep 16, 2024
26a643e
#1875
spica198 Oct 11, 2024
93b394b
#1875
spica198 Oct 11, 2024
2a71dfc
#1875
spica198 Oct 11, 2024
57682ec
#1875
spica198 Oct 11, 2024
aa28dec
#1875
spica198 Oct 22, 2024
542948b
#1875
spica198 Oct 22, 2024
9991946
#1875
spica198 Oct 22, 2024
07c95bd
#1875
spica198 Nov 22, 2024
79b9d67
#1875
spica198 Nov 22, 2024
37d0f79
#1875
spica198 Nov 22, 2024
11bc868
#1875
spica198 Nov 22, 2024
49e0942
#1875
spica198 Nov 28, 2024
fe5bc63
#1875
spica198 Nov 28, 2024
572984a
#1875
spica198 Nov 28, 2024
f64c28b
#1875
spica198 Nov 28, 2024
4a142bd
#1875
spica198 Nov 28, 2024
5f517e6
#1875
spica198 Nov 28, 2024
637c7a4
#1875
spica198 Nov 28, 2024
e9ab400
#1875
spica198 Nov 28, 2024
5d8d354
#1875
spica198 Nov 28, 2024
b041e9a
#1875
spica198 Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/ant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void saveParameters(final TabPane tabs) {
}

// Can now save the preferences even if no query name parameter is present
JsonIO.saveJsonPreferences(Optional.of(DATA_ACCESS_DIR), dataAccessUserPreferenceses);
JsonIO.saveJsonPreferencesWithKeyboardShortcut(Optional.of(DATA_ACCESS_DIR), dataAccessUserPreferenceses);
}

/**
Expand All @@ -85,7 +85,53 @@ public static void saveParameters(final TabPane tabs) {
* @param dataAccessPane the pane to load the JSON parameter file into
* @see JsonIO#loadJsonPreferences(Optional, TypeReference)
*/

public static void loadParameters(final DataAccessPane dataAccessPane, final String keyboardShortcut) {
final List<DataAccessUserPreferences> loadedParameters = JsonIO
.loadJsonPreferencesWithFilePrefix(
Optional.of(DATA_ACCESS_DIR), Optional.of(keyboardShortcut),
new TypeReference<List<DataAccessUserPreferences>>() {}
);

if (loadedParameters != null) {
dataAccessPane.getDataAccessTabPane().removeTabs();

loadedParameters.forEach(loadedParameter -> {
final QueryPhasePane pluginPane = dataAccessPane.getDataAccessTabPane().newTab(loadedParameter.getStepCaption());

// If an existing global parameter is in the JSON then update it,
// otherwise ignore it
pluginPane.getGlobalParametersPane().getParams().getParameters().entrySet().stream()
.filter(param -> loadedParameter.getGlobalParameters().containsKey(param.getKey()))
.forEach(param ->
param.getValue().setStringValue(
loadedParameter.getGlobalParameters().get(param.getKey())
)
);

// Groups all the parameters in to the plugin groups. Common parameters
// are based on the plugin name that is before the first '.' in the key values

pluginPane.getDataAccessPanes().stream()
// Plugins are disabled by defult. Only load and enable from
// the JSON if the JSON contains data for this plugin and it's
// enabled.
.filter(pane ->
loadedParameter.getPluginParameters().containsKey(pane.getPlugin().getClass().getSimpleName())
&& loadedParameter.getPluginParameters().get(pane.getPlugin().getClass().getSimpleName()).containsKey(getEnabledPluginKey(pane))
&& Boolean.valueOf(
loadedParameter.getPluginParameters().get(pane.getPlugin().getClass().getSimpleName()).get(
getEnabledPluginKey(pane)
))
)
.forEach(pane -> pane.setParameterValues(
loadedParameter.getPluginParameters().get(pane.getPlugin().getClass().getSimpleName())
));
});
}
}
public static void loadParameters(final DataAccessPane dataAccessPane) {

final List<DataAccessUserPreferences> loadedParameters = JsonIO
.loadJsonPreferences(
Optional.of(DATA_ACCESS_DIR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@
import au.gov.asd.tac.constellation.views.dataaccess.components.ButtonToolbar.ExecuteButtonState;
import au.gov.asd.tac.constellation.views.dataaccess.components.DataAccessTabPane;
import au.gov.asd.tac.constellation.views.dataaccess.components.OptionsMenuBar;
import au.gov.asd.tac.constellation.views.dataaccess.io.DataAccessParametersIoProvider;
import au.gov.asd.tac.constellation.views.dataaccess.plugins.DataAccessPlugin;
import au.gov.asd.tac.constellation.views.qualitycontrol.daemon.QualityControlAutoVetterListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
Expand Down Expand Up @@ -114,6 +119,14 @@ public DataAccessPane(final DataAccessViewTopComponent parentComponent) {
);
contextMenuEvent.consume();
});

//read keyboard shortcut to load templates
addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (!event.getCode().isModifierKey()) {
DataAccessParametersIoProvider.loadParameters(this, createCombo(event).getDisplayText().replace('+', ' '));
}
});

// Refresh all the status of menu items, execute buttons etc.
// based on the current state of the data access view
update();
Expand Down Expand Up @@ -371,4 +384,21 @@ protected boolean determineExecuteButtonDisableState(final boolean canExecuteTab
// or the selected plugins contain invalid parameter values.
return !queryIsRunning && !canExecuteTabPane;
}

private KeyCombination createCombo(final KeyEvent event) {
List<KeyCombination.Modifier> modifiers = new ArrayList();
spica198 marked this conversation as resolved.
Show resolved Hide resolved
if (event.isControlDown()) {
modifiers.add(KeyCombination.CONTROL_DOWN);
}
if (event.isMetaDown()) {
modifiers.add(KeyCombination.META_DOWN);
}
if (event.isAltDown()) {
modifiers.add(KeyCombination.ALT_DOWN);
}
if (event.isShiftDown()) {
modifiers.add(KeyCombination.SHIFT_DOWN);
}
return new KeyCodeCombination(event.getCode(), modifiers.toArray(KeyCombination.Modifier[]::new));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void saveParameters(final Map<String, String> tab1GlobalParams,
DataAccessParametersIoProvider.saveParameters(tabPane);

if (isSaveExpected) {
jsonIOStaticMock.verify(() -> JsonIO.saveJsonPreferences(
jsonIOStaticMock.verify(() -> JsonIO.saveJsonPreferencesWithKeyboardShortcut(
eq(Optional.of("DataAccessView")),
eq(mockedPrefConstruction.constructed())
));
Expand Down
Loading