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

Add edges and links to table view #2011

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
84cbba8
Add option to view edge and link info
Quasar985 Apr 5, 2024
a755422
Remove unused code and add more logging
Quasar985 Apr 8, 2024
78ebfe9
Update copyright
Quasar985 Apr 8, 2024
d905a62
Fix bug with showing key attributes and updated switch statements
Quasar985 Apr 8, 2024
4564281
Make selection work correctly with edges and links
Quasar985 Apr 10, 2024
a6c6991
Fix bug with show cloumns not working on edge or link table
Quasar985 Apr 10, 2024
422d0b2
Update link table columns, clean code and update tests
Quasar985 Apr 10, 2024
d626a63
Update equals functions in TableViewState
Quasar985 Apr 10, 2024
3663c99
Remove unused imports
Quasar985 Apr 10, 2024
dfaea63
Fix bug with selecting edges and links on graph not showing up in tab…
Quasar985 Apr 11, 2024
5d5e276
Update function description
Quasar985 Apr 11, 2024
ccabe73
Add column visibility filters for low and high vertices
Quasar985 Apr 11, 2024
8f4a905
Merge branch 'master' into enhancement/table-view-edges-links
Quasar985 Apr 11, 2024
28f1e9f
Refactor element button to show selection menu
Quasar985 Apr 11, 2024
e15b1e2
Update unit test and fix bug with menu position
Quasar985 Apr 11, 2024
89e0716
Format code
Quasar985 Apr 11, 2024
9ac6ad3
Update formatting
Quasar985 Apr 12, 2024
2c37ffa
Remove unneeded statement
Quasar985 Apr 12, 2024
e4eb8f3
Remove verification for graph release
Quasar985 Apr 12, 2024
6d301e5
Merge branch 'master' into enhancement/table-view-edges-links
Quasar985 Apr 12, 2024
5f6284a
Update TableNGTest.java
Quasar985 Apr 12, 2024
8834d42
Fix code smell, add tests
Quasar985 Apr 14, 2024
78a6873
Update TableCellFactoryNGTest.java
Quasar985 Apr 15, 2024
9b08daa
Update unit tests
Quasar985 Apr 15, 2024
e7097d3
Update unit tests
Quasar985 Apr 15, 2024
551b50b
Add unit test for ElementTypeContextMenu and comment some code
Quasar985 Apr 15, 2024
a33f6f4
Create headless test
Quasar985 Apr 15, 2024
9e7c7a5
Remove headless test and add init test
Quasar985 Apr 15, 2024
5a4994e
Add getters and unit tests
Quasar985 Apr 15, 2024
0834b7a
Clean handler code
Quasar985 Apr 15, 2024
aec5da2
Fix code smells
Quasar985 Apr 15, 2024
d7e7afa
Rearrange menu layout
Quasar985 Apr 16, 2024
839052e
Update whats new and help
Quasar985 Apr 16, 2024
4558d2d
Fix incorrect display of multivalues
Quasar985 Apr 17, 2024
5553788
Update TableNGTest.java
Quasar985 Apr 17, 2024
179fb12
Update TableNGTest.java
Quasar985 Apr 17, 2024
7899243
Fix format code smell
Quasar985 Apr 17, 2024
ed9b3db
Merge branch 'master' into enhancement/table-view-edges-links
Quasar985 May 6, 2024
a259ce4
Fix code review
Quasar985 May 7, 2024
e5b8195
Merge branch 'enhancement/table-view-edges-links' of https://github.c…
Quasar985 May 7, 2024
08f3ce2
Update project.xml
Quasar985 May 7, 2024
18622c5
update help images
Quasar985 Jun 14, 2024
78576cc
Remove commented code
Quasar985 Jun 14, 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 Australian Signals Directorate
* Copyright 2010-2024 Australian Signals Directorate
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,7 +70,9 @@ private GraphRecordStoreUtilities() {
public static final String DIRECTED_KEY = "[directed]<string>";
public static final String COMPLETE_WITH_SCHEMA_KEY = "[complete_with_schema]<string>";
public static final String DELETE_KEY = "[delete]<string>";

public static final String LINK_LOW = "low.";
public static final String LINK_HIGH = "high.";

private static final String SELECTED_ATTRIBUTE_NAME = "selected";
private static final String FALSE = "false";
private static final String NUMBER_STRING_STRING_FORMAT = "%d:%s:%s";
Expand All @@ -86,7 +88,13 @@ private GraphRecordStoreUtilities() {
"destination.Identifier",
"destination.Label",
"source.Type",
"destination.Type"
"destination.Type",
"low.Identifier",
"low.Type",
"low.Label",
"high.Identifier",
"high.Type",
"high.Label"
);
private static final List<String> ApprovedTypes = SchemaVertexTypeUtilities.getTypes().stream().map(i -> i.getName()).collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ public TableViewTopComponent() {
// the selection. The table also needs to have its element type set to TRANSACTION
addAttributeValueChangeHandler(VisualConcept.TransactionAttribute.SELECTED, graph -> {
if (needsUpdate() && currentState != null
&& currentState.getElementType() == GraphElementType.TRANSACTION) {
&& (currentState.getElementType() == GraphElementType.TRANSACTION
|| currentState.getElementType() == GraphElementType.EDGE
|| currentState.getElementType() == GraphElementType.LINK)) {
if (currentState.isSelectedOnly()) {
executorService.submit(new TriggerDataUpdateTask(pane, graph, getCurrentState()));
} else {
Expand Down Expand Up @@ -335,9 +337,9 @@ protected TablePane createContent() {

@Override
protected String createStyle() {
return JavafxStyleManager.isDarkTheme()
? "resources/table-view-dark.css"
: "resources/table-view-light.css";
return JavafxStyleManager.isDarkTheme()
? "resources/table-view-dark.css"
: "resources/table-view-light.css";
}

@Override
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright 2010-2024 Australian Signals Directorate
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package au.gov.asd.tac.constellation.views.tableview.components;

import au.gov.asd.tac.constellation.graph.GraphElementType;
import au.gov.asd.tac.constellation.plugins.PluginExecution;
import au.gov.asd.tac.constellation.views.tableview.TableViewTopComponent;
import au.gov.asd.tac.constellation.views.tableview.plugins.UpdateStatePlugin;
import au.gov.asd.tac.constellation.views.tableview.state.TableViewState;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.CustomMenuItem;
import javafx.scene.control.Label;

/**
*
* @author Quasar985
*/
public class ElementTypeContextMenu {

private static final String TRANSACTION = "Transactions";
private static final String VERTEX = "Vertices";
private static final String EDGE = "Edges";
private static final String LINK = "Links";

private final Table table;

private ContextMenu contextMenu;

private CustomMenuItem transactionsMenu;
private CustomMenuItem verticesMenu;
private CustomMenuItem edgesMenu;
private CustomMenuItem linksMenu;

/**
* Creates a new column visibility context menu.
*
* @param table the table that this menu was will be associated to
*/
public ElementTypeContextMenu(final Table table) {
this.table = table;
}

/**
* Initializes the column visibility context menu. Until this method is
* called, all menu UI components will be null.
*/
public void init() {
contextMenu = new ContextMenu();

transactionsMenu = createCustomMenu(TRANSACTION, e -> {
if (getTableViewTopComponent().getCurrentState() != null) {
final TableViewState newState = new TableViewState(getTableViewTopComponent().getCurrentState());
newState.setElementType(GraphElementType.TRANSACTION);

PluginExecution.withPlugin(
new UpdateStatePlugin(newState)
).executeLater(getTableViewTopComponent().getCurrentGraph());
}
e.consume();
});

verticesMenu = createCustomMenu(VERTEX, e -> {
if (getTableViewTopComponent().getCurrentState() != null) {
final TableViewState newState = new TableViewState(getTableViewTopComponent().getCurrentState());
newState.setElementType(GraphElementType.VERTEX);

PluginExecution.withPlugin(
new UpdateStatePlugin(newState)
).executeLater(getTableViewTopComponent().getCurrentGraph());
}
e.consume();
});

edgesMenu = createCustomMenu(EDGE, e -> {
if (getTableViewTopComponent().getCurrentState() != null) {
final TableViewState newState = new TableViewState(getTableViewTopComponent().getCurrentState());
newState.setElementType(GraphElementType.EDGE);

PluginExecution.withPlugin(
new UpdateStatePlugin(newState)
).executeLater(getTableViewTopComponent().getCurrentGraph());
}
e.consume();
});

linksMenu = createCustomMenu(LINK, e -> {
if (getTableViewTopComponent().getCurrentState() != null) {
final TableViewState newState = new TableViewState(getTableViewTopComponent().getCurrentState());
newState.setElementType(GraphElementType.LINK);

PluginExecution.withPlugin(
new UpdateStatePlugin(newState)
).executeLater(getTableViewTopComponent().getCurrentGraph());
}
e.consume();
});

contextMenu.getItems().addAll(transactionsMenu, verticesMenu, edgesMenu, linksMenu);
}

/**
* Create a custom menu item that will be added to menu buttons on the
* context menu. Sets the associated text and adds a listener for when it is
* clicked.
*
* @param title the title to be associated to the menu item
* @param handler the action handler that will be called when the menu item
* is clicked
* @return the created menu item
*/
private CustomMenuItem createCustomMenu(final String title,
final EventHandler<ActionEvent> handler) {
final CustomMenuItem menuItem = new CustomMenuItem(new Label(title));

menuItem.setHideOnClick(false);
menuItem.setOnAction(handler);

return menuItem;
}

/**
* Convenience method for accessing the table view top component.
*
* @return the table view top component
*/
private TableViewTopComponent getTableViewTopComponent() {
return table.getParentComponent().getParentComponent();
}

/**
* Gets the element type context menu.
*
* @return the element type context menu
*/
public ContextMenu getContextMenu() {
return contextMenu;
}
}
Loading
Loading