diff --git a/CoreAlgorithmPlugins/nbproject/project.xml b/CoreAlgorithmPlugins/nbproject/project.xml index dcb5abc8d9..f6903202aa 100644 --- a/CoreAlgorithmPlugins/nbproject/project.xml +++ b/CoreAlgorithmPlugins/nbproject/project.xml @@ -78,6 +78,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + org.netbeans.modules.settings diff --git a/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/hierarchical/HierarchicalControllerTopComponent.java b/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/hierarchical/HierarchicalControllerTopComponent.java index 6024600f48..8c5b71b555 100644 --- a/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/hierarchical/HierarchicalControllerTopComponent.java +++ b/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/hierarchical/HierarchicalControllerTopComponent.java @@ -35,12 +35,13 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.awt.Component; import java.awt.Container; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -57,6 +58,7 @@ import org.openide.util.LookupListener; import org.openide.util.NbBundle.Messages; import org.openide.util.Utilities; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -91,7 +93,8 @@ "CTL_HierarchicalControllerTopComponent=Hierarchical", "HINT_HierarchicalControllerTopComponent=Use this window to view communities of interest in the graph" }) -public final class HierarchicalControllerTopComponent extends TopComponent implements LookupListener, GraphChangeListener { +@ServiceProvider(service = AbstractTopComponent.class) +public final class HierarchicalControllerTopComponent extends AbstractTopComponent implements LookupListener, GraphChangeListener { private static final String INFO_STRING = "%s clusters"; private static final String TOGGLE_DISABLED = "Toggle Interactive: Disabled"; @@ -704,6 +707,26 @@ private void setNode(final GraphNode node) { setGroups(false); } + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected Object createContent() { + return nestedDiagramScrollPane; + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_HierarchicalControllerTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "output"; + } + @PluginInfo(pluginType = PluginType.UPDATE, tags = {PluginTags.MODIFY}) public static final class ColorClusters extends SimpleEditPlugin { diff --git a/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/ktruss/KTrussControllerTopComponent.java b/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/ktruss/KTrussControllerTopComponent.java index fd78cb03b2..0a5479c3b2 100644 --- a/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/ktruss/KTrussControllerTopComponent.java +++ b/CoreAlgorithmPlugins/src/au/gov/asd/tac/constellation/plugins/algorithms/clustering/ktruss/KTrussControllerTopComponent.java @@ -31,6 +31,8 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; @@ -52,11 +54,11 @@ import org.openide.util.LookupListener; import org.openide.util.NbBundle.Messages; import org.openide.util.Utilities; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * Top component which controls the display of k-trusses after running the - * k-truss plugin. + * Top component which controls the display of k-trusses after running the k-truss plugin. */ @ConvertAsProperties( dtd = "-//au.gov.asd.tac.constellation.plugins.algorithms.clustering//KTruss//EN", @@ -87,7 +89,8 @@ "CTL_KTrussControllerTopComponent=K-Truss", "HINT_KTrussControllerTopComponent=K-Truss" }) -public final class KTrussControllerTopComponent extends TopComponent implements LookupListener, GraphChangeListener, ComponentListener { +@ServiceProvider(service = AbstractTopComponent.class) +public final class KTrussControllerTopComponent extends AbstractTopComponent implements LookupListener, GraphChangeListener, ComponentListener { private static final String TOGGLE_DISABLED = "Toggle Interactive: Disabled"; private static final String TOGGLE_ENABLED = "Toggle Interactive: Enabled"; @@ -118,10 +121,10 @@ public KTrussControllerTopComponent() { nestedPanelIsVisible = false; updateInteractiveButton(interactiveButton.getText().equals(TOGGLE_DISABLED)); } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -600,8 +603,7 @@ private void setNode(final GraphNode node) { } /** - * We need to listen to the graph to know when a new KTrussState has been - * set. + * We need to listen to the graph to know when a new KTrussState has been set. * * @param evt The change event. */ @@ -792,6 +794,16 @@ private void selectOnGraph() { PluginExecution.withPlugin(select).interactively(true).executeLater(graph); } + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected Object createContent() { + return dp; + } + @PluginInfo(pluginType = PluginType.UPDATE, tags = {PluginTags.MODIFY}) public static final class RemoveOverlayColors extends SimpleEditPlugin { @@ -1029,6 +1041,16 @@ void readProperties(final java.util.Properties p) { // Required for @ConvertAsProperties, intentionally left blank } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_KTrussControllerTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "output"; + } + @PluginInfo(pluginType = PluginType.UPDATE, tags = {PluginTags.MODIFY}) public static class KTrussCalculatePlugin extends SimpleEditPlugin { diff --git a/CoreAnalyticView/src/au/gov/asd/tac/constellation/views/analyticview/AnalyticViewTopComponent.java b/CoreAnalyticView/src/au/gov/asd/tac/constellation/views/analyticview/AnalyticViewTopComponent.java index 3510e5a092..8c36e3ff7f 100644 --- a/CoreAnalyticView/src/au/gov/asd/tac/constellation/views/analyticview/AnalyticViewTopComponent.java +++ b/CoreAnalyticView/src/au/gov/asd/tac/constellation/views/analyticview/AnalyticViewTopComponent.java @@ -22,7 +22,9 @@ import au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute; import au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept; import au.gov.asd.tac.constellation.plugins.parameters.PluginParameters; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.analyticview.analytics.AnalyticPlugin; import java.util.ArrayList; @@ -35,6 +37,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -66,8 +69,9 @@ "CTL_AnalyticViewTopComponent=Analytic View", "HINT_AnalyticViewTopComponent=Analytic View" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class AnalyticViewTopComponent extends JavaFxTopComponent { - + private static final String ANALYTIC_VIEW_GRAPH_CHANGED_THREAD_NAME = "Analytic View Graph Changed Updater"; private final AnalyticViewPane analyticViewPane; private final AnalyticViewController analyticController; @@ -127,7 +131,7 @@ public AnalyticViewTopComponent() { analyticViewPane.getConfigurationPane().updateSelectablePluginsParameters(); } })); - + refreshRunnable = () -> { final List devNull = new ArrayList<>(); while (!queue.isEmpty()) { @@ -140,7 +144,8 @@ public AnalyticViewTopComponent() { } /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -227,7 +232,7 @@ protected void componentShowing() { analyticController.readState(); handleNewGraph(activeGraph); } - + @Override protected void handleGraphChange(final GraphChangeEvent event) { if (event == null) { // can be null at this point in time @@ -257,4 +262,14 @@ protected void handleComponentClosed() { super.handleComponentClosed(); analyticViewPane.reset(); } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_AnalyticViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreAttributeEditorView/src/au/gov/asd/tac/constellation/views/attributeeditor/AttributeEditorTopComponent.java b/CoreAttributeEditorView/src/au/gov/asd/tac/constellation/views/attributeeditor/AttributeEditorTopComponent.java index 89e4b27207..3b3b9e882f 100644 --- a/CoreAttributeEditorView/src/au/gov/asd/tac/constellation/views/attributeeditor/AttributeEditorTopComponent.java +++ b/CoreAttributeEditorView/src/au/gov/asd/tac/constellation/views/attributeeditor/AttributeEditorTopComponent.java @@ -22,7 +22,9 @@ import au.gov.asd.tac.constellation.graph.monitor.GraphChangeListener; import au.gov.asd.tac.constellation.graph.node.GraphNode; import au.gov.asd.tac.constellation.preferences.utilities.PreferenceUtilities; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.util.ArrayList; import java.util.List; @@ -37,41 +39,32 @@ import org.openide.awt.UndoRedo; import org.openide.util.NbBundle.Messages; import org.openide.util.NbPreferences; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * This is the top component for Constellation's 'attribute editor' view. The - * attribute editor is a simple user interface which allows users to view and - * edit the values for any of the graph's attributes. Like many other - * Constellation views, its display corresponds to the current selection on the - * active graph. The attribute editor also facilitates the adding/removing and - * editing of attributes (as opposed to their values). + * This is the top component for Constellation's 'attribute editor' view. The attribute editor is a simple user + * interface which allows users to view and edit the values for any of the graph's attributes. Like many other + * Constellation views, its display corresponds to the current selection on the active graph. The attribute editor also + * facilitates the adding/removing and editing of attributes (as opposed to their values). *
* There are four main components to the editor: *
    - *
  • The user interface, contained here, in {@link AttributeEditorPanel}, and - * {@link AttributeTitledPane}. - *
  • The data model, described in {@link AttributeState} and - * {@link AttributeData}, which is populated from the graph using - * {@link AttributeReader}. - *
  • - * {@link au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor} - * classes that describe how each type of attribute should be displayed and - * edited. - *
  • - * {@link au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation} - * classes that make changes to attributes and their values on the graph, - * usually through plugins. + *
  • The user interface, contained here, in {@link AttributeEditorPanel}, and {@link AttributeTitledPane}. + *
  • The data model, described in {@link AttributeState} and {@link AttributeData}, which is populated from the + * graph using {@link AttributeReader}. + *
  • {@link au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor} + * classes that describe how each type of attribute should be displayed and edited. + *
  • {@link au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation} classes that + * make changes to attributes and their values on the graph, usually through plugins. *
  • *
- * Note that whilst the structure is to remain as above, the details of the last - * two components are to be significantly changed in the future. This will - * entail disentanglement of the GUI, the graph editing, and the representation - * of attributes. + * Note that whilst the structure is to remain as above, the details of the last two components are to be significantly + * changed in the future. This will entail disentanglement of the GUI, the graph editing, and the representation of + * attributes. * * @see AttributeEditorPanel - * @see - * au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor + * @see au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor */ @ConvertAsProperties( dtd = "-//au.gov.asd.tac.constellation.views.attributeeditor//AttributeEditor//EN", @@ -103,6 +96,7 @@ "CTL_AttributeEditorTopComponent=Attribute Editor", "HINT_AttributeEditorTopComponent=Attribute Editor" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class AttributeEditorTopComponent extends JavaFxTopComponent implements GraphManagerListener, GraphChangeListener, UndoRedo.Provider, PreferenceChangeListener { private static final String ATTRIBUTE_EDITOR_GRAPH_CHANGED_THREAD_NAME = "Attribute Editor Graph Changed Updater"; @@ -134,7 +128,6 @@ public AttributeEditorTopComponent() { } }; - GraphManager.getDefault().addGraphManagerListener(AttributeEditorTopComponent.this); newActiveGraph(GraphManager.getDefault().getActiveGraph()); initContent(); @@ -145,9 +138,8 @@ public Object[] getMoreData(final AttributeData attribute) { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -173,7 +165,7 @@ protected void handleComponentOpened() { newActiveGraph(GraphManager.getDefault().getActiveGraph()); PreferenceUtilities.addPreferenceChangeListener(prefs.absolutePath(), this); - + // Ensure that all the 'Show Empty' buttons are toggled on when panel // is re-displayed if (attributePanel != null) { @@ -265,11 +257,21 @@ protected String createStyle() { protected AttributeEditorPanel createContent() { return attributePanel; } - + @Override protected void handlePreferenceChange(final PreferenceChangeEvent event) { if (reader != null) { attributePanel.updateEditorPanel(reader.refreshAttributes(true)); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_AttributeEditorTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreConversationView/src/au/gov/asd/tac/constellation/views/conversationview/ConversationViewTopComponent.java b/CoreConversationView/src/au/gov/asd/tac/constellation/views/conversationview/ConversationViewTopComponent.java index 67e3021464..630b9af9e1 100644 --- a/CoreConversationView/src/au/gov/asd/tac/constellation/views/conversationview/ConversationViewTopComponent.java +++ b/CoreConversationView/src/au/gov/asd/tac/constellation/views/conversationview/ConversationViewTopComponent.java @@ -16,6 +16,8 @@ package au.gov.asd.tac.constellation.views.conversationview; import au.gov.asd.tac.constellation.graph.Graph; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.util.Properties; import javafx.application.Platform; @@ -24,12 +26,12 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * Top component which displays the Conversation View. The conversation view - * displays content on nodes and transactions in the graph in a chat style - * window. + * Top component which displays the Conversation View. The conversation view displays content on nodes and transactions + * in the graph in a chat style window. * * @see Conversation * @see ConversationBox @@ -64,6 +66,7 @@ "CTL_ConversationViewTopComponent=Conversation View", "HINT_ConversationViewTopComponent=Conversation View" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class ConversationViewTopComponent extends JavaFxTopComponent { private final ConversationController controller; @@ -73,7 +76,7 @@ public ConversationViewTopComponent() { setName(Bundle.CTL_ConversationViewTopComponent()); setToolTipText(Bundle.HINT_ConversationViewTopComponent()); Platform.setImplicitExit(false); - controller = ConversationController.getDefault(); + controller = ConversationController.getDefault(); controller.getConversation().getGraphUpdateManager().setManaged(true); initContent(); } @@ -117,16 +120,25 @@ protected String createStyle() { protected ConversationBox createContent() { return controller.getConversationBox(); } - + @Override protected void handleNewGraph(final Graph graph) { controller.updateComponent(); } - + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ConversationViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/DataAccessViewTopComponent.java b/CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/DataAccessViewTopComponent.java index 46c7bd2f86..5969e0430f 100644 --- a/CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/DataAccessViewTopComponent.java +++ b/CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/DataAccessViewTopComponent.java @@ -19,8 +19,10 @@ import au.gov.asd.tac.constellation.graph.manager.GraphManager; import au.gov.asd.tac.constellation.graph.monitor.GraphChangeEvent; import au.gov.asd.tac.constellation.security.proxy.ProxyUtilities; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; import au.gov.asd.tac.constellation.utilities.threadpool.ConstellationGlobalThreadPool; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.dataaccess.components.ButtonToolbar; import au.gov.asd.tac.constellation.views.dataaccess.panes.DataAccessPane; @@ -37,6 +39,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -70,13 +73,14 @@ "CTL_DataAccessViewTopComponent=Data Access View", "HINT_DataAccessViewTopComponent=Data Access View" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class DataAccessViewTopComponent extends JavaFxTopComponent { - + private static final String DATA_ACCESS_VIEW_GRAPH_CHANGED_THREAD_NAME = "Data Access View Graph Changed Updater"; private final ExecutorService executorService = ConstellationGlobalThreadPool.getThreadPool().getFixedThreadPool("DAV-Thread", 1); private final DataAccessPane dataAccessPane; - + private LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); private Thread refreshThread; private final Runnable refreshRunnable; @@ -94,7 +98,7 @@ public DataAccessViewTopComponent() { dataAccessPane = new DataAccessPane(this); dataAccessPane.addUIComponents(); - + // The data access pane that is initialized above is returned in the // overridden method getContent() below. That is how the initContent() // in the super class can reference it and add the data accees view to @@ -108,7 +112,7 @@ public DataAccessViewTopComponent() { }); ProxyUtilities.setProxySelector(null); - + refreshRunnable = () -> { final List devNull = new ArrayList<>(); while (!queue.isEmpty()) { @@ -125,10 +129,10 @@ public DataAccessViewTopComponent() { public DataAccessPane getDataAccessPane() { return dataAccessPane; } - + /** - * A fixed single thread pool for execution of jobs in the data access view - * that need to happen in an asynchronous manner. + * A fixed single thread pool for execution of jobs in the data access view that need to happen in an asynchronous + * manner. * * @return a fixed single thread pool */ @@ -143,8 +147,8 @@ public DataAccessPane createContent() { @Override public String createStyle() { - return JavafxStyleManager.isDarkTheme() - ? "resources/data-access-view-dark.css" + return JavafxStyleManager.isDarkTheme() + ? "resources/data-access-view-dark.css" : "resources/data-access-view-light.css"; } @@ -179,23 +183,19 @@ protected void handleNewGraph(final Graph graph) { System.setProperty("dav.graph.ready", Boolean.FALSE.toString()); if (needsUpdate() && getDataAccessPane() != null) { getDataAccessPane().update(graph); - Platform.runLater(() -> - DataAccessUtilities.loadDataAccessState(getDataAccessPane(), graph) - ); + Platform.runLater(() -> DataAccessUtilities.loadDataAccessState(getDataAccessPane(), graph)); } - Platform.runLater(() -> - // nested runLater so it runs after all the other triggered processes for opening a graph have been run - Platform.runLater(() -> System.setProperty("dav.graph.ready", Boolean.TRUE.toString())) - ); + + Platform.runLater(() + -> // nested runLater so it runs after all the other triggered processes for opening a graph have been run + Platform.runLater(() -> System.setProperty("dav.graph.ready", Boolean.TRUE.toString()))); } /** - * Add or remove all quality control auto vetter listeners. These listeners - * are tied to DefaultQualityControlAutoButton buttons found nested within - * the button toolbar. + * Add or remove all quality control auto vetter listeners. These listeners are tied to + * DefaultQualityControlAutoButton buttons found nested within the button toolbar. * - * @param add Should quality control auto vetter listeners be added (true) - * or removed (false). + * @param add Should quality control auto vetter listeners be added (true) or removed (false). */ private void manageQualityControlListeners(final boolean add) { // Dig down to the button toolbar and find any quality control auto @@ -223,7 +223,7 @@ private void manageQualityControlListeners(final boolean add) { } } } - + @Override protected void handleGraphChange(final GraphChangeEvent event) { if (event == null) { // can be null at this point in time @@ -246,10 +246,19 @@ protected void handleGraphChange(final GraphChangeEvent event) { } } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_DataAccessViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreErrorReportView/src/au/gov/asd/tac/constellation/views/errorreport/ErrorReportTopComponent.java b/CoreErrorReportView/src/au/gov/asd/tac/constellation/views/errorreport/ErrorReportTopComponent.java index bf674b8466..895b844913 100644 --- a/CoreErrorReportView/src/au/gov/asd/tac/constellation/views/errorreport/ErrorReportTopComponent.java +++ b/CoreErrorReportView/src/au/gov/asd/tac/constellation/views/errorreport/ErrorReportTopComponent.java @@ -22,15 +22,15 @@ import au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType; import au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.font.FontUtilities; import au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; -import javafx.scene.layout.BorderPane; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.awt.Color; import java.awt.Image; import java.io.IOException; -import javafx.scene.input.MouseEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -58,6 +58,8 @@ import javafx.scene.control.Tooltip; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.BorderPane; import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; @@ -71,6 +73,7 @@ import org.openide.awt.ActionReferences; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -105,7 +108,7 @@ "CTL_ErrorReportTopComponent=Error Report", "HINT_ErrorReportTopComponent=Error Report" }) - +@ServiceProvider(service = AbstractTopComponent.class) public class ErrorReportTopComponent extends JavaFxTopComponent { private static final Logger LOGGER = Logger.getLogger(ErrorReportTopComponent.class.getName()); @@ -119,7 +122,7 @@ public enum SeverityCode { WARNING("WARNING"), INFO("INFO"), FINE("FINE"); - + private final String code; SeverityCode(final String severityCode) { @@ -184,7 +187,7 @@ public static SeverityCode getSeverityCodeEntry(final String severityCode) { public static final String REPORT_SETTINGS_PARAMETER_ID = PluginParameter.buildId(ErrorReportTopComponent.class, "report_settings"); public static final String POPUP_REPORT_SETTINGS_PARAMETER_ID = PluginParameter.buildId(ErrorReportTopComponent.class, "popup_report_settings"); - ErrorReportTopComponent() { + public ErrorReportTopComponent() { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setHorizontalGroup( @@ -198,7 +201,7 @@ public static SeverityCode getSeverityCodeEntry(final String severityCode) { setName(Bundle.CTL_ErrorReportTopComponent()); setToolTipText(Bundle.HINT_ErrorReportTopComponent()); initContent(); - + final TimerTask refreshAction = new TimerTask() { @Override public void run() { @@ -208,7 +211,7 @@ public void run() { refreshTimer = new Timer(); refreshTimer.schedule(refreshAction, 745, 1475); } - + /** * @return the params */ @@ -266,7 +269,7 @@ protected BorderPane createContent() { updateSettings(); final List settingOptions = Arrays.asList(SeverityCode.SEVERE.getCode(), SeverityCode.WARNING.getCode(), SeverityCode.INFO.getCode(), SeverityCode.FINE.getCode()); - + final PluginParameter reportSettingOptions = MultiChoiceParameterType.build(REPORT_SETTINGS_PARAMETER_ID); reportSettingOptions.setName("Report Settings"); reportSettingOptions.setDescription("Report Settings"); @@ -339,7 +342,7 @@ protected BorderPane createContent() { multiRedispItem.setToggleGroup(popupFrequency); oneRedispItem.setSelected(true); - final int applicationFontSize = FontUtilities.getApplicationFontSize(); + final int applicationFontSize = FontUtilities.getApplicationFontSize(); popupControl.getItems().addAll(neverItem, oneItem, oneRedispItem, multiItem, multiRedispItem); popupControl.setMaxWidth(200); popupControl.setMinHeight(26); @@ -389,7 +392,7 @@ protected BorderPane createContent() { final ToolBar controlToolbar2 = new ToolBar(); final Label reportSettingsLabel = new Label("Report:"); final Label popupReportSettingsLabel = new Label("Popup:"); - + final MultiChoiceInputPane reportSettingPane = new MultiChoiceInputPane(reportSettingOptions); reportSettingsLabel.setPadding(new Insets(0, -5, 0, 0)); reportSettingsLabel.autosize(); @@ -649,10 +652,10 @@ private void updateSessionErrorsBox() { refreshSessionErrors(); final Date nextFilterDate = new Date(); final int errCount = sessionErrors.size(); - // rebuild + // rebuild sessionErrorsBox.getChildren().clear(); - // check popup selection + // check popup selection List popupChoices = new ArrayList<>(); if (getParams().hasParameter(POPUP_REPORT_SETTINGS_PARAMETER_ID)) { MultiChoiceParameterValue multiChoiceValue = getParams().getMultiChoiceValue(POPUP_REPORT_SETTINGS_PARAMETER_ID); @@ -792,7 +795,7 @@ private void updateFlashingIcons(final List errorReportLevels, final Lis } alertStateActive = !alertStateActive; } - + private int getPopupControlValue() { return popupMode; } @@ -1072,7 +1075,17 @@ private TitledPane generateErrorReportTitledPane(final ErrorReportEntry entry) { return ttlPane; } - + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ErrorReportTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "rightSlidingSide"; + } + protected void refreshErrorFlashing() { Platform.runLater(() -> { boolean gracePeriodRefresh = false; diff --git a/CoreFindView/nbproject/project.xml b/CoreFindView/nbproject/project.xml index 754fb7e98b..51fbbba83e 100644 --- a/CoreFindView/nbproject/project.xml +++ b/CoreFindView/nbproject/project.xml @@ -78,6 +78,14 @@ 1.0 + + au.gov.asd.tac.constellation.preferences + + + + 1.0 + + au.gov.asd.tac.constellation.utilities diff --git a/CoreFindView/src/au/gov/asd/tac/constellation/views/find/FindViewTopComponent.java b/CoreFindView/src/au/gov/asd/tac/constellation/views/find/FindViewTopComponent.java index f5b76e3368..1d57e9709f 100644 --- a/CoreFindView/src/au/gov/asd/tac/constellation/views/find/FindViewTopComponent.java +++ b/CoreFindView/src/au/gov/asd/tac/constellation/views/find/FindViewTopComponent.java @@ -18,18 +18,18 @@ import au.gov.asd.tac.constellation.graph.Graph; import au.gov.asd.tac.constellation.graph.GraphElementType; import au.gov.asd.tac.constellation.graph.manager.GraphManager; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.find.components.FindViewPane; import au.gov.asd.tac.constellation.views.find.components.advanced.AdvancedCriteriaBorderPane; -import java.awt.Dimension; -import java.awt.Window; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; /** * Find View Top Component. @@ -42,7 +42,7 @@ persistenceType = TopComponent.PERSISTENCE_ALWAYS ) @TopComponent.Registration( - mode = "properties", + mode = "output", openAtStartup = false ) @ActionID( @@ -62,7 +62,7 @@ "CTL_FindViewTopComponent=Find and Replace", "HINT_FindViewTopComponent=Find and Replace" }) - +@ServiceProvider(service = AbstractTopComponent.class) public final class FindViewTopComponent extends JavaFxTopComponent { private final FindViewPane pane; @@ -80,10 +80,7 @@ public FindViewTopComponent() { this.pane = new FindViewPane(this); initContent(); - // Set the findView window to float - WindowManager.getDefault().setTopComponentFloating(this, true); - - // View will be disable if no graphs are opened, enabled if otherwise + // View will be disabled if no graphs are opened, enabled if otherwise. disableFindView(); /** @@ -142,20 +139,6 @@ protected void handleComponentOpened() { UpdateUI(); disableFindView(); focusFindTextField(); - WindowManager.getDefault().setTopComponentFloating(this, true); - - this.setRequestFocusEnabled(true); - - /** - * This loops through all the current windows and compares this top components top level ancestor with the - * windows parent. If they match the window is the find view so we set the size of the window. - */ - for (final Window window : Window.getWindows()) { - if (this.getTopLevelAncestor() != null && this.getTopLevelAncestor().getName().equals(window.getName())) { - window.setMinimumSize(new Dimension(600, 350)); - window.setSize(new Dimension(600, 350)); - } - } } /** @@ -245,7 +228,16 @@ public void UpdateUI() { // functionality for the change criteriapane function criteriaPane.setUpdateUI(false); } + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_FindViewTopComponent(), Boolean.TRUE); + } + @Override + protected String getModeName() { + return "output"; } // //GEN-BEGIN:initComponents @@ -263,7 +255,6 @@ private void initComponents() { ); }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } diff --git a/CoreGraphNode/nbproject/genfiles.properties b/CoreGraphNode/nbproject/genfiles.properties index 68cdadc66d..0dac51aa5a 100644 --- a/CoreGraphNode/nbproject/genfiles.properties +++ b/CoreGraphNode/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=856b9c6f +build.xml.data.CRC32=086632b7 build.xml.script.CRC32=ab19df9f build.xml.stylesheet.CRC32=15ca8a54@2.95 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=856b9c6f +nbproject/build-impl.xml.data.CRC32=086632b7 nbproject/build-impl.xml.script.CRC32=2a6ab1a9 nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95 diff --git a/CoreGraphNode/nbproject/project.xml b/CoreGraphNode/nbproject/project.xml index bfe13b1fd7..0a6351bc25 100644 --- a/CoreGraphNode/nbproject/project.xml +++ b/CoreGraphNode/nbproject/project.xml @@ -54,6 +54,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + org.netbeans.api.progress diff --git a/CoreGraphNode/src/au/gov/asd/tac/constellation/graph/node/gui/SimpleGraphTopComponent.java b/CoreGraphNode/src/au/gov/asd/tac/constellation/graph/node/gui/SimpleGraphTopComponent.java index 0f2ae8e788..4eb2a5685f 100644 --- a/CoreGraphNode/src/au/gov/asd/tac/constellation/graph/node/gui/SimpleGraphTopComponent.java +++ b/CoreGraphNode/src/au/gov/asd/tac/constellation/graph/node/gui/SimpleGraphTopComponent.java @@ -68,7 +68,7 @@ }) public final class SimpleGraphTopComponent extends CloneableTopComponent implements GraphChangeListener, UndoRedo.Provider { - private final InstanceContent content; + private final InstanceContent instanceContent; private final Graph graph; private final GraphNode graphNode; @@ -85,12 +85,12 @@ public SimpleGraphTopComponent() { final GraphDataObject gdo = GraphObjectUtilities.createMemoryDataObject("graph", true); graph = new DualGraph(null); graphNode = new GraphNode(graph, gdo, this, null); - content = new InstanceContent(); - content.add(getActionMap()); - content.add(graphNode.getDataObject()); - content.add(graph); - content.add(graphNode); - associateLookup(new AbstractLookup(content)); + instanceContent = new InstanceContent(); + instanceContent.add(getActionMap()); + instanceContent.add(graphNode.getDataObject()); + instanceContent.add(graph); + instanceContent.add(graphNode); + associateLookup(new AbstractLookup(instanceContent)); setActivatedNodes(new Node[]{ graphNode }); @@ -112,13 +112,13 @@ public SimpleGraphTopComponent(final GraphDataObject gdo, final Graph graph) { graphNode = new GraphNode(graph, gdo, this, null); - content = new InstanceContent(); - content.add(getActionMap()); - content.add(graphNode.getDataObject()); - content.add(graph); - content.add(graphNode); + instanceContent = new InstanceContent(); + instanceContent.add(getActionMap()); + instanceContent.add(graphNode.getDataObject()); + instanceContent.add(graph); + instanceContent.add(graphNode); - associateLookup(new AbstractLookup(content)); + associateLookup(new AbstractLookup(instanceContent)); setActivatedNodes(new Node[]{ graphNode @@ -362,16 +362,16 @@ private void initComponents() { // End of variables declaration//GEN-END:variables @Override - public void componentClosed() { + protected void componentClosed() { super.componentClosed(); setActivatedNodes(new Node[]{}); graph.removeGraphChangeListener(this); - content.remove(graphNode.getDataObject()); - content.remove(graph); - content.remove(graphNode); + instanceContent.remove(graphNode.getDataObject()); + instanceContent.remove(graph); + instanceContent.remove(graphNode); graphNode.destroy(); } diff --git a/CoreGraphUtilities/nbproject/genfiles.properties b/CoreGraphUtilities/nbproject/genfiles.properties index da25225674..0060cd95d6 100644 --- a/CoreGraphUtilities/nbproject/genfiles.properties +++ b/CoreGraphUtilities/nbproject/genfiles.properties @@ -1,8 +1,9 @@ -build.xml.data.CRC32=d586275c + +build.xml.data.CRC32=9c58d274 build.xml.script.CRC32=b3425ef2 build.xml.stylesheet.CRC32=15ca8a54@2.95 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=d586275c +nbproject/build-impl.xml.data.CRC32=9c58d274 nbproject/build-impl.xml.script.CRC32=e3eaeb91 nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95 diff --git a/CoreGraphUtilities/nbproject/project.xml b/CoreGraphUtilities/nbproject/project.xml index 0109feef02..6239a34300 100644 --- a/CoreGraphUtilities/nbproject/project.xml +++ b/CoreGraphUtilities/nbproject/project.xml @@ -86,6 +86,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + org.netbeans.modules.settings diff --git a/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/perspectives/PerspectiveBookmarkTopComponent.java b/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/perspectives/PerspectiveBookmarkTopComponent.java index f748907f0b..ea50d988b6 100644 --- a/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/perspectives/PerspectiveBookmarkTopComponent.java +++ b/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/perspectives/PerspectiveBookmarkTopComponent.java @@ -34,8 +34,10 @@ import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.utilities.camera.Camera; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.graphics.Vector3f; import au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.concurrent.ExecutionException; @@ -43,6 +45,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JList; +import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.DialogDescriptor; @@ -53,6 +56,7 @@ import org.openide.awt.ActionReferences; import org.openide.util.HelpCtx; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -89,7 +93,8 @@ "MSG_AddPerspective=Add perspective", "MSG_RemovePerspective=Remove perspective" }) -public final class PerspectiveBookmarkTopComponent extends TopComponent implements GraphManagerListener { +@ServiceProvider(service = AbstractTopComponent.class) +public final class PerspectiveBookmarkTopComponent extends AbstractTopComponent implements GraphManagerListener { private static final Logger LOGGER = Logger.getLogger(PerspectiveBookmarkTopComponent.class.getName()); @@ -120,8 +125,7 @@ private void moveToPerspective() { /** * Update the data on the graph. *

- * A new instance of the model is created, so graph undo/redo works - * correctly. + * A new instance of the model is created, so graph undo/redo works correctly. * */ private void updateOnGraph(final String actionType) { @@ -159,9 +163,8 @@ private void renamePerspective() { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -331,13 +334,13 @@ private void helpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI // End of variables declaration//GEN-END:variables @Override - public void componentOpened() { + protected void componentOpened() { enableUI(GraphManager.getDefault().getActiveGraph() != null); GraphManager.getDefault().addGraphManagerListener(this); } @Override - public void componentClosed() { + protected void componentClosed() { GraphManager.getDefault().removeGraphManagerListener(this); } @@ -363,7 +366,7 @@ public void graphClosed(final Graph graph) { public void newActiveGraph(final Graph graph) { enableUI(graph != null); if (graph != null) { - try (final ReadableGraph rg = graph.getReadableGraph()){ + try (final ReadableGraph rg = graph.getReadableGraph()) { final int pId = rg.getAttribute(GraphElementType.META, PerspectiveAttributeDescription.ATTRIBUTE_NAME); if (pId != Graph.NOT_FOUND) { perspectiveModel = (PerspectiveModel) rg.getObjectValue(pId, 0); @@ -379,8 +382,13 @@ public void newActiveGraph(final Graph graph) { } @Override - public HelpCtx getHelpCtx() { - return new HelpCtx("au.gov.asd.tac.constellation.functionality.perspectives.Perspective"); + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected JScrollPane createContent() { + return jScrollPane1; } /** @@ -492,4 +500,14 @@ public void edit(final GraphWriteMethods graph, final PluginInteraction interact SwingUtilities.invokeLater(() -> perspectivesList.setSelectedIndex(ix)); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_PerspectiveBookmarkTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/planes/PlaneManagerTopComponent.java b/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/planes/PlaneManagerTopComponent.java index e74a231ce3..ab90ce1110 100644 --- a/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/planes/PlaneManagerTopComponent.java +++ b/CoreGraphUtilities/src/au/gov/asd/tac/constellation/graph/utilities/planes/PlaneManagerTopComponent.java @@ -36,9 +36,11 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.file.FileExtensionConstants; import au.gov.asd.tac.constellation.utilities.gui.filechooser.FileChooser; import au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.io.File; @@ -50,6 +52,7 @@ import javax.imageio.ImageIO; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileFilter; import org.apache.commons.lang3.Strings; @@ -69,11 +72,11 @@ import org.openide.util.LookupListener; import org.openide.util.NbBundle.Messages; import org.openide.util.Utilities; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * Top component which allows the user to manipulate planes in the graph - * display. + * Top component which allows the user to manipulate planes in the graph display. */ @ConvertAsProperties( dtd = "-//au.gov.asd.tac.constellation.graph.utilities.planes//PlaneManager//EN", @@ -104,7 +107,8 @@ "CTL_PlaneManagerTopComponent=Plane Manager", "HINT_PlaneManagerTopComponent=Plane Manager" }) -public final class PlaneManagerTopComponent extends TopComponent implements LookupListener, GraphChangeListener { +@ServiceProvider(service = AbstractTopComponent.class) +public final class PlaneManagerTopComponent extends AbstractTopComponent implements LookupListener, GraphChangeListener { private static final String TITLE = "Import plane"; @@ -238,9 +242,8 @@ public void resultChanged(final LookupEvent lev) { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -311,13 +314,13 @@ private void actionsButtonMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST // End of variables declaration//GEN-END:variables @Override - public void componentOpened() { + protected void componentOpened() { result.addLookupListener(this); resultChanged(null); } @Override - public void componentClosed() { + protected void componentClosed() { result.removeLookupListener(this); setNode(null); } @@ -372,7 +375,7 @@ private void setNode(final GraphNode node) { if (node != null) { graphNode = node; graph = graphNode.getGraph(); - + try (final ReadableGraph rg = graph.getReadableGraph()) { planesAttr = rg.getAttribute(GraphElementType.META, PlaneState.ATTRIBUTE_NAME); if (planesAttr != Graph.NOT_FOUND) { @@ -422,6 +425,16 @@ public String getDescription() { }); } + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected JScrollPane createContent() { + return jScrollPane1; + } + /** * Plugin to update the plane visibility on the graph. */ @@ -668,4 +681,14 @@ protected void edit(final GraphWriteMethods wg, final PluginInteraction interact wg.setObjectValue(planesAttr, 0, state); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_PlaneManagerTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/HistogramTopComponent.java b/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/HistogramTopComponent.java index 4fcd5a12a8..86dd9f6dab 100644 --- a/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/HistogramTopComponent.java +++ b/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/HistogramTopComponent.java @@ -38,6 +38,8 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.plugins.templates.SimpleReadPlugin; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.histogram.formats.BinFormatter; import java.awt.BorderLayout; import java.util.LinkedHashMap; @@ -52,6 +54,7 @@ import org.openide.awt.ActionReferences; import org.openide.awt.UndoRedo; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -89,7 +92,8 @@ "CTL_HistogramTopComponent=Histogram", "HINT_HistogramTopComponent=The histogram view will display attribute values as a bar chart" }) -public final class HistogramTopComponent extends TopComponent implements GraphManagerListener, GraphChangeListener, UndoRedo.Provider { +@ServiceProvider(service = AbstractTopComponent.class) +public final class HistogramTopComponent extends AbstractTopComponent implements GraphManagerListener, GraphChangeListener, UndoRedo.Provider { private static final int MIN_WIDTH = 425; private static final int MIN_HEIGHT = 400; @@ -111,6 +115,7 @@ public final class HistogramTopComponent extends TopComponent implements GraphMa private int selectedAttribute = Graph.NOT_FOUND; private long latestGraphChangeID = 0; private ElementSet currentFilter; + private final JScrollPane displayScroll; public HistogramTopComponent() { initComponents(); @@ -122,7 +127,7 @@ public HistogramTopComponent() { add(controls, BorderLayout.SOUTH); display = new HistogramDisplay(this); - final JScrollPane displayScroll = new JScrollPane(display, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + displayScroll = new JScrollPane(display, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); displayScroll.getVerticalScrollBar().setUnitIncrement(HistogramDisplay.MAXIMUM_BAR_HEIGHT); add(displayScroll, BorderLayout.CENTER); } @@ -317,7 +322,7 @@ public void modifyBinHeight(final int change) { private void reset() { if (currentGraph != null) { - try (final ReadableGraph rg = currentGraph.getReadableGraph()){ + try (final ReadableGraph rg = currentGraph.getReadableGraph()) { reset(rg); } } else { @@ -565,6 +570,16 @@ public void graphClosed(Graph graph) { // Required for GraphManagerListener, intentionally left blank. } + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected JScrollPane createContent() { + return displayScroll; + } + /** * Plugin to update histogram state. */ @@ -781,4 +796,14 @@ protected void edit(final GraphWriteMethods graph, final PluginInteraction inter SwingUtilities.invokeLater(display::repaint); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_HistogramTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/rewrite/HistogramTopComponent2.java b/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/rewrite/HistogramTopComponent2.java index 47f8a3875e..10f9ce599f 100644 --- a/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/rewrite/HistogramTopComponent2.java +++ b/CoreHistogramView/src/au/gov/asd/tac/constellation/views/histogram/rewrite/HistogramTopComponent2.java @@ -36,7 +36,9 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.plugins.templates.SimpleReadPlugin; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.histogram.AttributeType; import au.gov.asd.tac.constellation.views.histogram.BinCollection; @@ -57,6 +59,7 @@ import org.openide.awt.ActionReferences; import org.openide.awt.UndoRedo; import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -96,7 +99,7 @@ "CTL_HistogramTopComponent2=New Histogram", "HINT_HistogramTopComponent2=The histogram view will display attribute values as a bar chart" }) - +@ServiceProvider(service = AbstractTopComponent.class) public final class HistogramTopComponent2 extends JavaFxTopComponent { private static final int MIN_WIDTH = 425; @@ -877,4 +880,14 @@ protected void edit(final GraphWriteMethods graph, final PluginInteraction inter histogramPane.updateDisplay(); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_HistogramTopComponent2(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/DelimitedImportTopComponent.java b/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/DelimitedImportTopComponent.java index 03424a471b..102d3eb0f0 100644 --- a/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/DelimitedImportTopComponent.java +++ b/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/DelimitedImportTopComponent.java @@ -17,16 +17,19 @@ import au.gov.asd.tac.constellation.plugins.importexport.ConfigurationPane; import au.gov.asd.tac.constellation.plugins.importexport.ImportTopComponent; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import javafx.application.Platform; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * The Delimited Import Top Component. This class provides the Import Delimited - * window and handles all interactions with the graph. + * The Delimited Import Top Component. This class provides the Import Delimited window and handles all interactions with + * the graph. * * @author aldebaran30701 */ @@ -49,6 +52,7 @@ @Messages({ "CTL_ImportDelimitedFileAction=From File...", "HINT_ImportDelimitedFile=Import from File"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class DelimitedImportTopComponent extends ImportTopComponent { private final DelimitedImportPane delimitedImportPane; @@ -99,10 +103,24 @@ protected void preparePane() { }); } + @Override + protected void handleComponentOpened() { + super.handleComponentOpened(); + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ImportDelimitedFileAction(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/jdbc/JDBCImportTopComponent.java b/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/jdbc/JDBCImportTopComponent.java index f16ff5387f..09fd5f3d2d 100644 --- a/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/jdbc/JDBCImportTopComponent.java +++ b/CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/jdbc/JDBCImportTopComponent.java @@ -18,16 +18,19 @@ import au.gov.asd.tac.constellation.plugins.importexport.ConfigurationPane; import au.gov.asd.tac.constellation.plugins.importexport.ImportPane; import au.gov.asd.tac.constellation.plugins.importexport.ImportTopComponent; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import javafx.application.Platform; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * The JDBC Import Top Component. This class provides the Import JDBC window and - * handles all interactions with the graph. + * The JDBC Import Top Component. This class provides the Import JDBC window and handles all interactions with the + * graph. * * @author aldebaran30701 */ @@ -50,6 +53,7 @@ @Messages({ "CTL_ImportJDBCFileAction=From Database...", "HINT_ImportJDBCFile=Import from Database"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class JDBCImportTopComponent extends ImportTopComponent { private final JDBCImportPane jdbcImportPane; @@ -63,7 +67,7 @@ public final class JDBCImportTopComponent extends ImportTopComponent { 7. Drag and drop attributes onto columns. 8. Right click an attribute for more options. 9. Click the 'Import' button to add data to your graph. - + HINTS: * See all supported attributes with 'Options > Show all schema attributes'. * Filter in the Configuration Pane by adding searches of the form =="".* E.g. first_name=="Nick" @@ -101,10 +105,24 @@ protected void preparePane() { }); } + @Override + protected void handleComponentOpened() { + super.handleComponentOpened(); + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ImportJDBCFileAction(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreInteractiveGraph/nbproject/project.xml b/CoreInteractiveGraph/nbproject/project.xml index 16d89b43c2..3660755b3d 100644 --- a/CoreInteractiveGraph/nbproject/project.xml +++ b/CoreInteractiveGraph/nbproject/project.xml @@ -94,6 +94,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + au.gov.asd.tac.constellation.views.namedselection diff --git a/CoreLayersView/src/au/gov/asd/tac/constellation/views/layers/LayersViewTopComponent.java b/CoreLayersView/src/au/gov/asd/tac/constellation/views/layers/LayersViewTopComponent.java index d04ed523c7..0ae528671e 100644 --- a/CoreLayersView/src/au/gov/asd/tac/constellation/views/layers/LayersViewTopComponent.java +++ b/CoreLayersView/src/au/gov/asd/tac/constellation/views/layers/LayersViewTopComponent.java @@ -20,7 +20,9 @@ import au.gov.asd.tac.constellation.graph.monitor.AttributeValueMonitor; import au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute; import au.gov.asd.tac.constellation.plugins.logging.ConstellationLogger; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.layers.components.LayersViewPane; import au.gov.asd.tac.constellation.views.layers.state.LayersViewConcept; @@ -30,12 +32,13 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; /** - * The Layers View Top Component. This class provides the Layers View window and - * handles all interactions with the graph. + * The Layers View Top Component. This class provides the Layers View window and handles all interactions with the + * graph. * * @author aldebaran30701 */ @@ -59,6 +62,7 @@ "CTL_LayersViewAction=Layers View", "CTL_LayersViewTopComponent=Layers View", "HINT_LayersViewTopComponent=Layers View"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class LayersViewTopComponent extends JavaFxTopComponent { private final LayersViewController layersViewController; @@ -152,43 +156,46 @@ protected void componentActivated() { if (!isShowingFlag()) { if (WindowManager.getDefault().isTopComponentFloating(this)) { ConstellationLogger.getDefault().viewInfo(this, "Activated / Floating"); - } + } if (WindowManager.getDefault().isTopComponentMinimized(this)) { - ConstellationLogger.getDefault().viewInfo(this, "Activated / Minimised"); + ConstellationLogger.getDefault().viewInfo(this, "Activated / Minimised"); } - if (!WindowManager.getDefault().isTopComponentMinimized(this) && - !WindowManager.getDefault().isTopComponentFloating(this)) { + if (!WindowManager.getDefault().isTopComponentMinimized(this) + && !WindowManager.getDefault().isTopComponentFloating(this)) { ConstellationLogger.getDefault().viewInfo(this, "Activated / Docked"); } - setShowingFlag(true); + setShowingFlag(true); } } - + @Override protected void componentHidden() { setComponentVisible(false); setShowingFlag(false); } - + protected void preparePane() { createContent().setDefaultLayers(); getLayersViewController().readState(); getLayersViewController().addAttributes(); } - + /** - * Sets the status of the pane dependent on if a graph is currently active. - * The status is used to enable or disable the view when a graph exists. + * Sets the status of the pane dependent on if a graph is currently active. The status is used to enable or disable + * the view when a graph exists. */ - protected void setPaneStatus(){ + protected void setPaneStatus() { createContent().setEnabled(GraphManager.getDefault().getActiveGraph() != null); } public LayersViewPane getLayersViewPane() { return layersViewPane; } - + /** + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. + * * @return the layersViewController */ protected LayersViewController getLayersViewController() { @@ -209,11 +216,19 @@ protected void setShowingFlag(final boolean showingFlag) { this.showingFlag = showingFlag; } - + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_LayersViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreMapView/src/au/gov/asd/tac/constellation/views/mapview/MapViewTopComponent.java b/CoreMapView/src/au/gov/asd/tac/constellation/views/mapview/MapViewTopComponent.java index 86af7f5868..f483a866ff 100644 --- a/CoreMapView/src/au/gov/asd/tac/constellation/views/mapview/MapViewTopComponent.java +++ b/CoreMapView/src/au/gov/asd/tac/constellation/views/mapview/MapViewTopComponent.java @@ -37,6 +37,7 @@ import au.gov.asd.tac.constellation.plugins.templates.PluginTags; import au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.geospatial.Distance; import au.gov.asd.tac.constellation.utilities.geospatial.Geohash; import au.gov.asd.tac.constellation.utilities.geospatial.Mgrs; @@ -47,6 +48,7 @@ import au.gov.asd.tac.constellation.utilities.icon.AnalyticIconProvider; import au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider; import au.gov.asd.tac.constellation.utilities.threadpool.ConstellationGlobalThreadPool; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.SwingTopComponent; import au.gov.asd.tac.constellation.views.mapview.exporters.MapExporter; import au.gov.asd.tac.constellation.views.mapview.exporters.MapExporter.MapExporterWrapper; @@ -89,11 +91,12 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * The Map View Top Component. This class provides the Map View window and - * toolbar and handles all interactions with the graph. + * The Map View Top Component. This class provides the Map View window and toolbar and handles all interactions with the + * graph. */ @TopComponent.Description( preferredID = "MapViewTopComponent", @@ -115,6 +118,7 @@ "CTL_MapViewAction=Map View", "CTL_MapViewTopComponent=Map View", "HINT_MapViewTopComponent=Map View"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class MapViewTopComponent extends SwingTopComponent { private static final String UPDATE_SELECTION_PLUGIN = "Map View: Update Selection on Graph"; @@ -218,7 +222,8 @@ public MapViewTopComponent() { if (currentGraph != null) { final String zoomAction = (String) event.getSource(); switch (zoomAction) { - case ZOOM_ALL -> renderer.zoomToMarkers(markerState); + case ZOOM_ALL -> + renderer.zoomToMarkers(markerState); case ZOOM_SELECTION -> { final MarkerState selectedOnlyState = new MarkerState(); selectedOnlyState.setShowSelectedOnly(true); @@ -422,7 +427,7 @@ private void zoomLocationBasedOnGeoType(final String geoType, final String locat NotifyDisplayer.display("Invalid coordinate data provided, radius should be greater than or equal to 0", NotifyDescriptor.ERROR_MESSAGE); return; } - + final Location coordinateLocation = new Location(latitude, longitude); if (radius > 0) { final float radiusDD = (float) Distance.Haversine.kilometersToDecimalDegrees(radius); @@ -452,7 +457,8 @@ private void zoomLocationBasedOnGeoType(final String geoType, final String locat final ConstellationPointFeature mgrsFeature = new ConstellationPointFeature(mgrsLocation); marker = renderer.addCustomMarker(mgrsFeature); } - default -> marker = null; + default -> + marker = null; } renderer.zoomToLocation(marker == null ? null : marker.getLocation()); } @@ -477,12 +483,15 @@ private PluginParameters createParameters() { @SuppressWarnings("unchecked") //master will need to be of type SingleChoiceParameter final PluginParameter typedMaster = (PluginParameter) master; switch (SingleChoiceParameterType.getChoice(typedMaster)) { - case GEO_TYPE_COORDINATE -> params.get(PARAMETER_LOCATION) + case GEO_TYPE_COORDINATE -> + params.get(PARAMETER_LOCATION) .setDescription("Enter a coordinate in decimal degrees (and optionally a radius " + "in kilometers) with components separated by spaces or commas"); - case GEO_TYPE_GEOHASH -> params.get(PARAMETER_LOCATION) + case GEO_TYPE_GEOHASH -> + params.get(PARAMETER_LOCATION) .setDescription("Enter a base-16 geohash value"); - case GEO_TYPE_MGRS -> params.get(PARAMETER_LOCATION) + case GEO_TYPE_MGRS -> + params.get(PARAMETER_LOCATION) .setDescription("Enter an MGRS value"); default -> { // do nothing @@ -579,9 +588,8 @@ protected Component createContent() { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -644,7 +652,15 @@ protected void edit(final GraphWriteMethods graph, final PluginInteraction inter } } } + } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_MapViewTopComponent(), Boolean.FALSE); } + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreNamedSelectionView/src/au/gov/asd/tac/constellation/views/namedselection/NamedSelectionTopComponent.java b/CoreNamedSelectionView/src/au/gov/asd/tac/constellation/views/namedselection/NamedSelectionTopComponent.java index 143a18dec0..b1ef08abfe 100644 --- a/CoreNamedSelectionView/src/au/gov/asd/tac/constellation/views/namedselection/NamedSelectionTopComponent.java +++ b/CoreNamedSelectionView/src/au/gov/asd/tac/constellation/views/namedselection/NamedSelectionTopComponent.java @@ -16,7 +16,9 @@ package au.gov.asd.tac.constellation.views.namedselection; import au.gov.asd.tac.constellation.utilities.color.ConstellationColor; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.SwingTopComponent; import au.gov.asd.tac.constellation.views.namedselection.panes.NamedSelectionListElement; import au.gov.asd.tac.constellation.views.namedselection.panes.NamedSelectionModDescPanel; @@ -50,11 +52,11 @@ import org.openide.awt.ActionReferences; import org.openide.util.HelpCtx; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** - * Top component which displays the named selection browser, and handles named - * selection user interactions. + * Top component which displays the named selection browser, and handles named selection user interactions. * * @author betelgeuse */ @@ -85,15 +87,15 @@ "CTL_NamedSelectionAction=Named Selections", "CTL_NamedSelectionTopComponent=Named Selections", "HINT_NamedSelectionTopComponent=This window presents all named selections for an active graph."}) +@ServiceProvider(service = AbstractTopComponent.class) public final class NamedSelectionTopComponent extends SwingTopComponent { // Labels used to mask UI in the event of having no active graph: private final JLabel lblNoGraph = new JLabel(Bundle.No_Active_Graph()); - private final JPanel panelNoGraph = new JPanel(); + private final JPanel panelNoGraph = new JPanel(); private final int fontsize = UIManager.getFont("controlFont") != null ? UIManager.getFont("controlFont").getSize() : 12; /** - * Uses an overloaded MouseAdapter class to intercept mouse interactions on - * the lstNamedSelections. + * Uses an overloaded MouseAdapter class to intercept mouse interactions on the lstNamedSelections. * * @see MouseAdapter */ @@ -105,8 +107,8 @@ public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { retrieveSelection(); } - - // Right click: open context menu on the named selection 'under' the mouse pointer: + + // Right click: open context menu on the named selection 'under' the mouse pointer: } else if (e.getButton() == MouseEvent.BUTTON3) { lstNamedSelections.setSelectedIndex(lstNamedSelections.locationToIndex(e.getPoint())); @@ -131,8 +133,7 @@ public void mouseClicked(final MouseEvent e) { } }; /** - * Uses an overloaded KeyAdapter class to intercept mouse interactions on - * the lstNamedSelections. + * Uses an overloaded KeyAdapter class to intercept mouse interactions on the lstNamedSelections. * * @see KeyAdapter */ @@ -190,9 +191,8 @@ public NamedSelectionTopComponent() { } /** - * Overridden componentOpened method ensures that the - * NamedSelectionManager is instantiated to ensure that - * elements of this component are updated. + * Overridden componentOpened method ensures that the NamedSelectionManager is + * instantiated to ensure that elements of this component are updated. */ @Override protected void handleComponentOpened() { @@ -203,11 +203,9 @@ protected void handleComponentOpened() { } /** - * Updates the NamedSelectionTopComponent with the latest - * NamedSelections. + * Updates the NamedSelectionTopComponent with the latest NamedSelections. * - * @param selections The ArrayList<NamedSelection> - * pertinent to the currently active graph. + * @param selections The ArrayList<NamedSelection> pertinent to the currently active graph. * * @see NamedSelection * @see NamedSelectionTopComponent @@ -238,32 +236,27 @@ public void updateState(final List selections) { } /** - * Sets the selected state of the toggle button responsible for dimming - * others. + * Sets the selected state of the toggle button responsible for dimming others. * - * @param isDimOthers true sets the button selected state * to - * true. + * @param isDimOthers true sets the button selected state * to true. */ public void updateDimOthers(final boolean isDimOthers) { btnDimMode.setSelected(isDimOthers); } /** - * Sets the selected state of the toggle button responsible for causing - * result of named selection to be returned in a selected/non selected - * manner. + * Sets the selected state of the toggle button responsible for causing result of named selection to be returned in + * a selected/non selected manner. * - * @param isSelectResults true sets the button selected state - * to true. + * @param isSelectResults true sets the button selected state to true. */ public void updateSelectResults(final boolean isSelectResults) { btnSelectResults.setSelected(isSelectResults); } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -498,8 +491,7 @@ private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR /** * Event handler for btnIntersection clicks. *

- * This triggers an intersection operation for the currently selected named - * selections. + * This triggers an intersection operation for the currently selected named selections. * * @param evt The registered event. */ @@ -510,8 +502,7 @@ private void btnIntersectionActionPerformed(java.awt.event.ActionEvent evt) {//G /** * Event handler for btnUnion clicks. *

- * This triggers a union operation for the currently selected named - * selections. + * This triggers a union operation for the currently selected named selections. * * @param evt The registered event. */ @@ -535,9 +526,8 @@ private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: *

* This triggers the recall of the currently selected named selection. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -550,9 +540,8 @@ private void mnuSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR *

* This causes currently selected named selection to be removed. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -565,9 +554,8 @@ private void mnuRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR *

* This causes currently selected named selection to be renamed. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -578,8 +566,7 @@ private void mnuRenameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR /** * Event handler for btnDimMode clicks. *

- * This causes the state of the 'dim others' button to be toggled (and saved - * to the graph). + * This causes the state of the 'dim others' button to be toggled (and saved to the graph). * * @param evt The registered event. */ @@ -590,8 +577,8 @@ private void btnDimModeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST: /** * Event handler for btnSelectResults clicks. *

- * This causes the state of the 'return results of operations as "selected"' - * button to be toggled (and saved to the graph). + * This causes the state of the 'return results of operations as "selected"' button to be toggled (and saved to the + * graph). * * @param evt The registered event. */ @@ -602,12 +589,11 @@ private void btnSelectResultsMouseClicked(java.awt.event.MouseEvent evt) {//GEN- /** * Event handler for mnuDimOthers selections. *

- * This causes currently selected named selection to be returned, and all - * non-member graph elements of the given named selection to be dimmed. + * This causes currently selected named selection to be returned, and all non-member graph elements of the given + * named selection to be dimmed. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -618,12 +604,10 @@ private void mnuDimOthersActionPerformed(java.awt.event.ActionEvent evt) {//GEN- /** * Event handler for mnuClone selections. *

- * This causes currently selected named selections to be cloned to a new - * named selection. + * This causes currently selected named selections to be cloned to a new named selection. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -634,12 +618,11 @@ private void mnuCloneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS /** * Event handler for mnuDescritpion selections. *

- * This causes the a dialog box to be created that allows for the - * modification of the given named selection's description. + * This causes the a dialog box to be created that allows for the modification of the given named selection's + * description. *

- * As this menu item appears in the context menu (right-click menu), the - * selection would typically be updated to what is under the mouse pointer - * at the time of the mouse click. + * As this menu item appears in the context menu (right-click menu), the selection would typically be updated to + * what is under the mouse pointer at the time of the mouse click. * * @param evt The registered event. */ @@ -710,8 +693,7 @@ void readProperties(final java.util.Properties p) { } /** - * Handles the enabling and disabling of the top component based on whether - * there is an active graph. + * Handles the enabling and disabling of the top component based on whether there is an active graph. * * @param isEnabled true if there is an active graph. */ @@ -736,8 +718,7 @@ private void toggleUI(final boolean isEnabled) { } /** - * Helper method that adds a NamedSelection to the list of - * current Named Selections. + * Helper method that adds a NamedSelection to the list of current Named Selections. * * @param selection The selection to be appended to the list. */ @@ -749,8 +730,8 @@ private void addElement(final NamedSelection selection) { } /** - * Helper method that removes the currently selected - * NamedSelections from the list of current Named Selections. + * Helper method that removes the currently selected NamedSelections from the list of current Named + * Selections. */ private void removeElement() { final int[] indices = lstNamedSelections.getSelectedIndices(); @@ -799,8 +780,8 @@ private void renameElement() { } /** - * Helper method that modifies the description of the highlighted named - * selection through the NamedSelectionManager. + * Helper method that modifies the description of the highlighted named selection through the + * NamedSelectionManager. * * @see NamedSelectionManager */ @@ -829,8 +810,8 @@ private void modifyDescription() { } /** - * Helper method that requests the locked state to be switched for the - * current selection through the NamedSelectionManager. + * Helper method that requests the locked state to be switched for the current selection through the + * NamedSelectionManager. * * @see NamedSelectionManager */ @@ -846,8 +827,8 @@ private void setLocked() { } /** - * Helper method that requests the Manager dims all other graph elements - * other than those in the currently highlighted named selection. + * Helper method that requests the Manager dims all other graph elements other than those in the currently + * highlighted named selection. * * @see NamedSelectionManager */ @@ -860,8 +841,7 @@ private void dimAllOthers() { } /** - * Helper method that requests the current Named Selection gets cloned in - * the NamedSelectionManager. + * Helper method that requests the current Named Selection gets cloned in the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -874,9 +854,8 @@ private void cloneSelection() { } /** - * Helper method that determines the currently highlighted named selections, - * and requests an intersection operation be performed on them through the - * NamedSelectionManager. + * Helper method that determines the currently highlighted named selections, and requests an intersection operation + * be performed on them through the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -895,9 +874,8 @@ private void performIntersection() { } /** - * Helper method that determines the currently highlighted named selections, - * and requests a union operation be performed on them through the - * NamedSelectionManager. + * Helper method that determines the currently highlighted named selections, and requests a union operation be + * performed on them through the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -924,8 +902,7 @@ private void clearAllNamedSelections() { } /** - * Helper method that requests a named selection be created through the - * NamedSelectionManager. + * Helper method that requests a named selection be created through the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -934,8 +911,7 @@ private void addSelection() { } /** - * Helper method that requests a named selection be overwritten through the - * NamedSelectionManager. + * Helper method that requests a named selection be overwritten through the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -946,8 +922,7 @@ private void overwriteSelection() { } /** - * Helper method that requests a named selection be recalled through the - * NamedSelectionManager. + * Helper method that requests a named selection be recalled through the NamedSelectionManager. * * @see NamedSelectionManager */ @@ -961,8 +936,7 @@ private void retrieveSelection() { } /** - * Helper method that updates the dim others state in the - * NamedSelectionManager + * Helper method that updates the dim others state in the NamedSelectionManager * * @see NamedSelectionManager */ @@ -971,8 +945,7 @@ private void setDimState() { } /** - * Helper method that updates the select results state in the - * NamedSelectionManager + * Helper method that updates the select results state in the NamedSelectionManager * * @see NamedSelectionManager */ @@ -981,11 +954,10 @@ private void setSelectResultsState() { } /** - * Helper method that notifies the user that they are trying to perform - * modifications on a locked / protected named selection. + * Helper method that notifies the user that they are trying to perform modifications on a locked / protected named + * selection. * - * @param name The name of the selection that is being intercepted from - * modification. + * @param name The name of the selection that is being intercepted from modification. */ private void notifyProtected(final String name) { final NamedSelectionProtectedPanel panel = new NamedSelectionProtectedPanel(name); @@ -1000,11 +972,9 @@ protected JPanel createContent() { } /** - * Extended JList used in the generation of the list of named - * selections. + * Extended JList used in the generation of the list of named selections. *

- * This class has been extended so that tooltips can be intercepted and - * populated with named selection descriptions. + * This class has been extended so that tooltips can be intercepted and populated with named selection descriptions. * * @see JList */ @@ -1020,8 +990,7 @@ public String getToolTipText(final MouseEvent e) { } /** - * Helper class used to force updates to lstNamedSelections to - * the EDT thread. + * Helper class used to force updates to lstNamedSelections to the EDT thread. * * @see SwingUtilities.invokeLater */ @@ -1035,8 +1004,7 @@ public void run() { } /** - * Custom ListCellrenderer which is able to handle - * NamedSelections. + * Custom ListCellrenderer which is able to handle NamedSelections. *

* This class is utilized by lstNamedSelections. * @@ -1091,8 +1059,7 @@ public Component getListCellRendererComponent(final JListNamedSelections. + * Custom list model that is able to handle and store NamedSelections. * * @see AbstractListModel * @see NamedSelection @@ -1132,11 +1099,9 @@ public void removeElementAt(final int index) { } /** - * Remove the named selection that matches the 'prototype' named - * selection. + * Remove the named selection that matches the 'prototype' named selection. * - * @param selection The named selection that acts as a prototype for - * removal. + * @param selection The named selection that acts as a prototype for removal. */ public void removeElement(final NamedSelection selection) { final int index = selections.indexOf(selection); @@ -1152,4 +1117,14 @@ public void clearNamedSelections() { fireContentsChanged(this, 0, 0); } } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_NamedSelectionTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } } diff --git a/CoreNotesView/src/au/gov/asd/tac/constellation/views/notes/NotesViewTopComponent.java b/CoreNotesView/src/au/gov/asd/tac/constellation/views/notes/NotesViewTopComponent.java index 803df3feba..7e9a5ff4e1 100644 --- a/CoreNotesView/src/au/gov/asd/tac/constellation/views/notes/NotesViewTopComponent.java +++ b/CoreNotesView/src/au/gov/asd/tac/constellation/views/notes/NotesViewTopComponent.java @@ -25,7 +25,9 @@ import au.gov.asd.tac.constellation.plugins.reporting.GraphReportListener; import au.gov.asd.tac.constellation.plugins.reporting.GraphReportManager; import au.gov.asd.tac.constellation.plugins.reporting.PluginReport; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.util.ArrayList; import java.util.List; @@ -36,6 +38,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -63,13 +66,14 @@ "CTL_NotesViewAction=Notes View", "CTL_NotesViewTopComponent=Notes View", "HINT_NotesViewTopComponent=Notes View"}) +@ServiceProvider(service = AbstractTopComponent.class) public class NotesViewTopComponent extends JavaFxTopComponent implements GraphReportListener, UndoRedoReportListener { - + private final NotesViewController notesViewController; private final NotesViewPane notesViewPane; private static final Logger LOGGER = Logger.getLogger(NotesViewTopComponent.class.getName()); private static final String NOTES_VIEW_GRAPH_CHANGED_THREAD_NAME = "Notes View Graph Changed Updater"; - + private LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); private Thread refreshThread; private final Runnable refreshRunnable; @@ -103,7 +107,7 @@ public NotesViewTopComponent() { } notesViewPane.updateNotesUI(); }); - + refreshRunnable = () -> { final List devNull = new ArrayList<>(); while (!queue.isEmpty()) { @@ -127,12 +131,11 @@ protected void handleNewGraph(final Graph graph) { if (graph == null) { notesViewPane.getCreateNewNoteButton().setDisable(true); - } + } LOGGER.log(Level.FINE, "Handling new graph"); } - @Override protected void handleGraphClosed(final Graph graph) { if (needsUpdate() && graph != null) { @@ -142,7 +145,7 @@ protected void handleGraphClosed(final Graph graph) { LOGGER.log(Level.FINE, "Handling graph closed"); } - + @Override protected void handleGraphChange(final GraphChangeEvent event) { if (event == null) { // can be null at this point in time @@ -164,7 +167,7 @@ protected void handleGraphChange(final GraphChangeEvent event) { } } } - + @Override protected void componentShowing() { super.componentShowing(); @@ -175,7 +178,8 @@ protected void componentShowing() { protected void handleComponentOpened() { super.handleComponentOpened(); /** - * listener is not removed so that plugin reports created when the Notes View is not open will render when it is opened later. + * listener is not removed so that plugin reports created when the Notes View is not open will render when it is + * opened later. */ GraphReportManager.addGraphReportListener(this); UndoRedoReportManager.addUndoRedoReportListener(this); @@ -235,8 +239,19 @@ public void fireNewUndoRedoReport(final UndoRedoReport undoRedoReport) { } } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_NotesViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the FormEditor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the FormEditor. */ private void initComponents() {//GEN-BEGIN:initComponents setLayout(new java.awt.BorderLayout()); diff --git a/CorePluginReporterView/src/au/gov/asd/tac/constellation/views/pluginreporter/PluginReporterTopComponent.java b/CorePluginReporterView/src/au/gov/asd/tac/constellation/views/pluginreporter/PluginReporterTopComponent.java index 730eefc68d..7f07fc2877 100644 --- a/CorePluginReporterView/src/au/gov/asd/tac/constellation/views/pluginreporter/PluginReporterTopComponent.java +++ b/CorePluginReporterView/src/au/gov/asd/tac/constellation/views/pluginreporter/PluginReporterTopComponent.java @@ -20,7 +20,9 @@ import au.gov.asd.tac.constellation.plugins.reporting.GraphReportListener; import au.gov.asd.tac.constellation.plugins.reporting.GraphReportManager; import au.gov.asd.tac.constellation.plugins.reporting.PluginReport; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.pluginreporter.panes.PluginReporterPane; import javafx.application.Platform; @@ -29,6 +31,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -64,6 +67,7 @@ "CTL_PluginReporterTopComponent=Plugin Reporter", "HINT_PluginReporterTopComponent=Plugin Reporter" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class PluginReporterTopComponent extends JavaFxTopComponent implements GraphReportListener { private final PluginReporterPane reporterPane; @@ -159,4 +163,14 @@ protected String createStyle() { protected PluginReporterPane createContent() { return reporterPane; } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_PluginReporterTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "rightSlidingSide"; + } } diff --git a/CorePreferences/nbproject/project.xml b/CorePreferences/nbproject/project.xml index 9c575e8b3c..50e85e6da8 100644 --- a/CorePreferences/nbproject/project.xml +++ b/CorePreferences/nbproject/project.xml @@ -31,6 +31,14 @@ 1.71 + + org.netbeans.libs.batik.read + + + + 1.18.0.1 + + org.netbeans.libs.flatlaf @@ -97,6 +105,14 @@ 9.32 + + org.openide.windows + + + + 6.100 + + diff --git a/CorePreferences/release/modules/ext/docs/CorePreferences/preferences-toc.xml b/CorePreferences/release/modules/ext/docs/CorePreferences/preferences-toc.xml index e3d4eb97e2..31f8d3ea60 100644 --- a/CorePreferences/release/modules/ext/docs/CorePreferences/preferences-toc.xml +++ b/CorePreferences/release/modules/ext/docs/CorePreferences/preferences-toc.xml @@ -1,7 +1,7 @@ - + diff --git a/CorePreferences/test/unit/src/au/gov/asd/tac/constellation/preferences/PreferencesHelpProviderNGTest.java b/CorePreferences/test/unit/src/au/gov/asd/tac/constellation/preferences/PreferencesHelpProviderNGTest.java index f2d9aedece..446702239f 100644 --- a/CorePreferences/test/unit/src/au/gov/asd/tac/constellation/preferences/PreferencesHelpProviderNGTest.java +++ b/CorePreferences/test/unit/src/au/gov/asd/tac/constellation/preferences/PreferencesHelpProviderNGTest.java @@ -1,12 +1,12 @@ /* * Copyright 2010-2025 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. @@ -29,7 +29,7 @@ * @author antares */ public class PreferencesHelpProviderNGTest { - + @BeforeClass public static void setUpClass() throws Exception { // Not currently required @@ -56,12 +56,12 @@ public void tearDownMethod() throws Exception { @Test public void testGetHelpMap() { System.out.println("getHelpMap"); - + final PreferencesHelpProvider instance = new PreferencesHelpProvider(); final Map helpMap = instance.getHelpMap(); assertEquals(helpMap.size(), 3); - //not going to go through and assert the existence of each specific item in the map + //not going to go through and assert the existence of each specific item in the map //but will assert they're all correctly located within the plugin reporter package final String packageStart = "au.gov.asd.tac.constellation.preferences."; for (final String path : helpMap.keySet()) { @@ -75,7 +75,7 @@ public void testGetHelpMap() { @Test public void testGetHelpTOC() { System.out.println("getHelpTOC"); - + final PreferencesHelpProvider instance = new PreferencesHelpProvider(); final String tocLocation = instance.getHelpTOC(); @@ -88,5 +88,5 @@ public void testGetHelpTOC() { assertTrue(tocLocation.indexOf("docs") < tocLocation.indexOf("CorePreferences")); assertTrue(tocLocation.indexOf("CorePreferences") < tocLocation.indexOf("preferences-toc.xml")); - } + } } diff --git a/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/QualityControlViewTopComponent.java b/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/QualityControlViewTopComponent.java index f1196f4cd2..3fc4d72315 100644 --- a/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/QualityControlViewTopComponent.java +++ b/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/QualityControlViewTopComponent.java @@ -16,6 +16,8 @@ package au.gov.asd.tac.constellation.views.qualitycontrol; import au.gov.asd.tac.constellation.graph.Graph; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.qualitycontrol.daemon.QualityControlAutoVetter; import au.gov.asd.tac.constellation.views.qualitycontrol.daemon.QualityControlListener; @@ -24,6 +26,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -51,6 +54,7 @@ "CTL_QualityControlViewAction=Quality Control View", "CTL_QualityControlViewTopComponent=Quality Control View", "HINT_QualityControlViewTopComponent=Quality Control View"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class QualityControlViewTopComponent extends JavaFxTopComponent implements QualityControlListener { private final QualityControlViewPane qualityControlViewPane; @@ -106,12 +110,22 @@ protected void componentShowing() { protected void componentActivated() { setVisible(true); } - + @Override protected void handleGraphClosed(final Graph graph) { qualityControlViewPane.refreshQualityControlView(null); } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_QualityControlViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The * content of this method is always regenerated by the Form Editor. diff --git a/CoreScatterPlotView/src/au/gov/asd/tac/constellation/views/scatterplot/ScatterPlotTopComponent.java b/CoreScatterPlotView/src/au/gov/asd/tac/constellation/views/scatterplot/ScatterPlotTopComponent.java index 78ddea4f9d..f1d36ec137 100644 --- a/CoreScatterPlotView/src/au/gov/asd/tac/constellation/views/scatterplot/ScatterPlotTopComponent.java +++ b/CoreScatterPlotView/src/au/gov/asd/tac/constellation/views/scatterplot/ScatterPlotTopComponent.java @@ -20,7 +20,9 @@ import au.gov.asd.tac.constellation.graph.manager.GraphManager; import au.gov.asd.tac.constellation.graph.monitor.AttributeValueMonitor; import au.gov.asd.tac.constellation.plugins.PluginExecution; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.scatterplot.state.ScatterPlotConcept; import au.gov.asd.tac.constellation.views.scatterplot.state.ScatterPlotState; @@ -31,6 +33,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -62,6 +65,7 @@ "CTL_ScatterPlotTopComponent=Scatter Plot", "HINT_ScatterPlotTopComponent=Scatter Plot" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class ScatterPlotTopComponent extends JavaFxTopComponent { private ScatterPlotState currentState; @@ -201,8 +205,8 @@ protected ScatterPlotPane createContent() { @Override protected String createStyle() { return JavafxStyleManager.isDarkTheme() - ? "resources/scatter-pane-dark.css" - : "resources/scatter-pane-light.css"; + ? "resources/scatter-pane-dark.css" + : "resources/scatter-pane-light.css"; } @Override @@ -228,8 +232,19 @@ protected void componentShowing() { refreshHandler.accept(currentGraph); } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ScatterPlotTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreSchemaView/src/au/gov/asd/tac/constellation/views/schemaview/SchemaViewTopComponent.java b/CoreSchemaView/src/au/gov/asd/tac/constellation/views/schemaview/SchemaViewTopComponent.java index 14f52e0504..d9516ca798 100644 --- a/CoreSchemaView/src/au/gov/asd/tac/constellation/views/schemaview/SchemaViewTopComponent.java +++ b/CoreSchemaView/src/au/gov/asd/tac/constellation/views/schemaview/SchemaViewTopComponent.java @@ -15,12 +15,15 @@ */ package au.gov.asd.tac.constellation.views.schemaview; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -46,6 +49,7 @@ "CTL_SchemaViewAction=Schema View", "CTL_SchemaViewTopComponent=Schema View", "HINT_SchemaViewTopComponent=Schema View"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class SchemaViewTopComponent extends JavaFxTopComponent { private final SchemaViewPane schemaViewPane; @@ -64,9 +68,9 @@ public SchemaViewTopComponent() { @Override protected String createStyle() { - return JavafxStyleManager.isDarkTheme() - ? "resources/schema-view-dark.css" - : "resources/schema-view-light.css"; + return JavafxStyleManager.isDarkTheme() + ? "resources/schema-view-dark.css" + : "resources/schema-view-light.css"; } @Override @@ -86,10 +90,19 @@ protected void handleComponentClosed() { schemaViewPane.clear(); } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_SchemaViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreScriptingView/src/au/gov/asd/tac/constellation/views/scripting/ScriptingViewTopComponent.java b/CoreScriptingView/src/au/gov/asd/tac/constellation/views/scripting/ScriptingViewTopComponent.java index 07d6760f34..442b531dbd 100644 --- a/CoreScriptingView/src/au/gov/asd/tac/constellation/views/scripting/ScriptingViewTopComponent.java +++ b/CoreScriptingView/src/au/gov/asd/tac/constellation/views/scripting/ScriptingViewTopComponent.java @@ -17,12 +17,15 @@ import au.gov.asd.tac.constellation.graph.Graph; import au.gov.asd.tac.constellation.graph.manager.GraphManager; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.SwingTopComponent; import javax.swing.ScrollPaneConstants; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -51,6 +54,7 @@ "CTL_ScriptingViewAction=Scripting View", "CTL_ScriptingViewTopComponent=Scripting View", "HINT_ScriptingViewTopComponent=Scripting View"}) +@ServiceProvider(service = AbstractTopComponent.class) public final class ScriptingViewTopComponent extends SwingTopComponent { private final ScriptingViewPane scriptingViewPane; @@ -92,10 +96,19 @@ protected void componentShowing() { handleNewGraph(GraphManager.getDefault().getActiveGraph()); } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_ScriptingViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreTableView/src/au/gov/asd/tac/constellation/views/tableview/TableViewTopComponent.java b/CoreTableView/src/au/gov/asd/tac/constellation/views/tableview/TableViewTopComponent.java index dd4de3cef5..8d12cfe497 100644 --- a/CoreTableView/src/au/gov/asd/tac/constellation/views/tableview/TableViewTopComponent.java +++ b/CoreTableView/src/au/gov/asd/tac/constellation/views/tableview/TableViewTopComponent.java @@ -27,6 +27,7 @@ import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; import au.gov.asd.tac.constellation.utilities.threadpool.ConstellationGlobalThreadPool; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import au.gov.asd.tac.constellation.views.tableview.panes.TablePane; import au.gov.asd.tac.constellation.views.tableview.plugins.SelectionToGraphPlugin; @@ -46,6 +47,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; @@ -81,6 +83,7 @@ "CTL_TableViewTopComponent=Table View", "HINT_TableViewTopComponent=Table View" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class TableViewTopComponent extends JavaFxTopComponent { public static final Object TABLE_LOCK = new Object(); @@ -91,7 +94,7 @@ public final class TableViewTopComponent extends JavaFxTopComponent { private final Set columnAttributeMonitors; private TableViewState currentState; - + private boolean showingFlag; public TableViewTopComponent() { @@ -167,10 +170,9 @@ public TableViewTopComponent() { } /** - * Copy's the existing table view state and sets the new state's element - * type to the passed value. Also ensures the new state is in "Selected - * Only" mode. The graph table view state attribute is updated with the new - * state and then the table's selection is updated. + * Copy's the existing table view state and sets the new state's element type to the passed value. Also ensures the + * new state is in "Selected Only" mode. The graph table view state attribute is updated with the new state and then + * the table's selection is updated. * * @param elementType the element type to set to the new state * @param elementId can be anything, not used @@ -257,46 +259,40 @@ public ExecutorService getExecutorService() { } /** - * Get column attributes that were present in the old state but not in the - * new one. + * Get column attributes that were present in the old state but not in the new one. * * @param oldState the old table state * @param newState the new table state - * @return a set of column attributes that are present in the old state but - * not the new one + * @return a set of column attributes that are present in the old state but not the new one */ protected Set> getRemovedAttributes(final TableViewState oldState, final TableViewState newState) { return new HashSet<>(CollectionUtils.subtract( - oldState != null && oldState.getColumnAttributes() != null - ? oldState.getColumnAttributes() : new HashSet<>(), - newState != null && newState.getColumnAttributes() != null - ? newState.getColumnAttributes() : new HashSet<>()) + oldState != null && oldState.getColumnAttributes() != null + ? oldState.getColumnAttributes() : new HashSet<>(), + newState != null && newState.getColumnAttributes() != null + ? newState.getColumnAttributes() : new HashSet<>()) ); } /** - * Get column attributes that were not present in the old state but are - * present in the new state. + * Get column attributes that were not present in the old state but are present in the new state. * * @param oldState the old table state * @param newState the new table state - * @return a set of column attributes that were not present in the old state - * but are present in the new state + * @return a set of column attributes that were not present in the old state but are present in the new state */ protected Set> getAddedAttributes(final TableViewState oldState, final TableViewState newState) { return new HashSet<>(CollectionUtils.subtract( - newState != null && newState.getColumnAttributes() != null - ? newState.getColumnAttributes() : new HashSet<>(), - oldState != null && oldState.getColumnAttributes() != null - ? oldState.getColumnAttributes() : new HashSet<>()) + newState != null && newState.getColumnAttributes() != null + ? newState.getColumnAttributes() : new HashSet<>(), + oldState != null && oldState.getColumnAttributes() != null + ? oldState.getColumnAttributes() : new HashSet<>()) ); } /** - * Update the current table state with the table state stored in the passed - * graph attributes. If a table state does not exist in the graph attribute - * then it will crate and new state and set it to the current state in the - * table. + * Update the current table state with the table state stored in the passed graph attributes. If a table state does + * not exist in the graph attribute then it will crate and new state and set it to the current state in the table. * * @param graph the graph that the new state will be extracted from */ @@ -339,9 +335,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 @@ -352,10 +348,9 @@ protected void componentShowing() { } /** - * Update the current state with the new state pulled from the passed - * graph's attributes and update the attribute handlers so that the table is - * only notified for attribute changes that it cares about. Then trigger a - * table refresh using the new graph as its source of truth. + * Update the current state with the new state pulled from the passed graph's attributes and update the attribute + * handlers so that the table is only notified for attribute changes that it cares about. Then trigger a table + * refresh using the new graph as its source of truth. * * @param graph the new graph */ @@ -409,8 +404,8 @@ protected void handleNewGraph(final Graph graph) { } /** - * When the graph is closed change the graphs pagination to a pagination - * over nothing and update the table. This will essentially clear the table. + * When the graph is closed change the graphs pagination to a pagination over nothing and update the table. This + * will essentially clear the table. * * @param graph the graph being closed */ @@ -419,31 +414,31 @@ protected void handleGraphClosed(final Graph graph) { getTablePane().getActiveTableReference().updatePagination( getTablePane().getActiveTableReference().getUserTablePreferences().getMaxRowsPerPage(), null, getTablePane()); } - + @Override protected void componentActivated() { setComponentVisible(true); if (!isShowingFlag()) { if (WindowManager.getDefault().isTopComponentFloating(this)) { ConstellationLogger.getDefault().viewInfo(this, "Activated / Floating"); - } + } if (WindowManager.getDefault().isTopComponentMinimized(this)) { - ConstellationLogger.getDefault().viewInfo(this, "Activated / Minimised"); + ConstellationLogger.getDefault().viewInfo(this, "Activated / Minimised"); } - if (!WindowManager.getDefault().isTopComponentMinimized(this) && - !WindowManager.getDefault().isTopComponentFloating(this)) { + if (!WindowManager.getDefault().isTopComponentMinimized(this) + && !WindowManager.getDefault().isTopComponentFloating(this)) { ConstellationLogger.getDefault().viewInfo(this, "Activated / Docked"); } - setShowingFlag(true); + setShowingFlag(true); } } - + @Override protected void componentHidden() { setComponentVisible(false); setShowingFlag(false); } - + /** * @return the showingFlag */ @@ -458,6 +453,16 @@ protected void setShowingFlag(final boolean showingFlag) { this.showingFlag = showingFlag; } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_TableViewTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "output"; + } + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/CoreTesting/nbproject/genfiles.properties b/CoreTesting/nbproject/genfiles.properties index 769e86cdb0..9c3ba8e366 100644 --- a/CoreTesting/nbproject/genfiles.properties +++ b/CoreTesting/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=4291c080 +build.xml.data.CRC32=580b9e03 build.xml.script.CRC32=b5f9ba5a build.xml.stylesheet.CRC32=15ca8a54@2.95 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=4291c080 +nbproject/build-impl.xml.data.CRC32=580b9e03 nbproject/build-impl.xml.script.CRC32=b7b1c265 nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95 diff --git a/CoreTesting/nbproject/project.xml b/CoreTesting/nbproject/project.xml index fc01e37ed9..203ab79071 100644 --- a/CoreTesting/nbproject/project.xml +++ b/CoreTesting/nbproject/project.xml @@ -102,6 +102,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + au.gov.asd.tac.constellation.views.layers diff --git a/CoreTesting/src/au/gov/asd/tac/constellation/testing/memory/MemoryManagerTopComponent.java b/CoreTesting/src/au/gov/asd/tac/constellation/testing/memory/MemoryManagerTopComponent.java index 00f2bce182..0b0e14f9fe 100644 --- a/CoreTesting/src/au/gov/asd/tac/constellation/testing/memory/MemoryManagerTopComponent.java +++ b/CoreTesting/src/au/gov/asd/tac/constellation/testing/memory/MemoryManagerTopComponent.java @@ -15,16 +15,20 @@ */ package au.gov.asd.tac.constellation.testing.memory; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.memory.MemoryManager; import au.gov.asd.tac.constellation.utilities.memory.MemoryManager.ClassStats; import au.gov.asd.tac.constellation.utilities.memory.MemoryManagerListener; import au.gov.asd.tac.constellation.utilities.text.SeparatorConstants; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.util.Map; import java.util.Map.Entry; +import javax.swing.JScrollPane; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -57,7 +61,8 @@ "CTL_MemoryManagerTopComponent=Memory Manager", "HINT_MemoryManagerTopComponent=Memory Manager" }) -public final class MemoryManagerTopComponent extends TopComponent implements MemoryManagerListener { +@ServiceProvider(service = AbstractTopComponent.class) +public final class MemoryManagerTopComponent extends AbstractTopComponent implements MemoryManagerListener { public MemoryManagerTopComponent() { initComponents(); @@ -66,9 +71,8 @@ public MemoryManagerTopComponent() { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -146,4 +150,24 @@ private void updateObjectCounts() { objectCountsTextArea.setText(result.toString()); } + + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected JScrollPane createContent() { + return jScrollPane1; + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_MemoryManagerTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "rightSlidingSide"; + } } diff --git a/CoreTimelineView/nbproject/project.xml b/CoreTimelineView/nbproject/project.xml index 05a38878a4..25258c1ee2 100644 --- a/CoreTimelineView/nbproject/project.xml +++ b/CoreTimelineView/nbproject/project.xml @@ -70,6 +70,14 @@ 1.0 + + au.gov.asd.tac.constellation.views + + + + 1.0 + + org.netbeans.modules.settings diff --git a/CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/TimelineTopComponent.java b/CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/TimelineTopComponent.java index 3756c7db24..e03ad4c1f4 100644 --- a/CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/TimelineTopComponent.java +++ b/CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/TimelineTopComponent.java @@ -28,8 +28,10 @@ import au.gov.asd.tac.constellation.graph.node.GraphNode; import au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept; import au.gov.asd.tac.constellation.plugins.PluginExecution; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; import au.gov.asd.tac.constellation.utilities.temporal.TimeZoneUtilities; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import java.awt.BorderLayout; import java.time.ZoneId; import java.util.ArrayList; @@ -62,6 +64,7 @@ import org.openide.util.LookupListener; import org.openide.util.NbBundle.Messages; import org.openide.util.Utilities; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -100,7 +103,8 @@ "NoGraph=", "NoTemporal=" }) -public final class TimelineTopComponent extends TopComponent implements LookupListener, GraphChangeListener, UndoRedo.Provider { +@ServiceProvider(service = AbstractTopComponent.class) +public final class TimelineTopComponent extends AbstractTopComponent implements LookupListener, GraphChangeListener, UndoRedo.Provider { private static final Logger LOGGER = Logger.getLogger(TimelineTopComponent.class.getName()); @@ -368,7 +372,7 @@ public boolean canClose() { } @Override - public void componentClosed() { + protected void componentClosed() { super.componentClosed(); result.removeLookupListener(this); } @@ -783,7 +787,7 @@ public void graphChanged(final GraphChangeEvent evt) { if (temporalAttrId != Graph.NOT_FOUND) { currentTemporalAttributeModificationCount = rg.getValueModificationCounter(temporalAttrId); } - + // Detect graph changes to attributes: if (currentAttributeModificationCount != oldAttributeModificationCount) { Platform.runLater(() -> { @@ -808,4 +812,24 @@ public void graphChanged(final GraphChangeEvent evt) { } } // + + @Override + protected void initContent() { + // Required for AbstractTopComponent, intentionally left blank. + } + + @Override + protected StackPane createContent() { + return root; + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_TimelineTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "output"; + } } diff --git a/CoreViewFramework/nbproject/genfiles.properties b/CoreViewFramework/nbproject/genfiles.properties index fe28b9b2e6..0f8f999aef 100644 --- a/CoreViewFramework/nbproject/genfiles.properties +++ b/CoreViewFramework/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=af0d52c8 +build.xml.data.CRC32=920b9d4e build.xml.script.CRC32=4204cb81 build.xml.stylesheet.CRC32=15ca8a54@2.95 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=af0d52c8 +nbproject/build-impl.xml.data.CRC32=920b9d4e nbproject/build-impl.xml.script.CRC32=3b403878 nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95 diff --git a/CoreViewFramework/nbproject/project.xml b/CoreViewFramework/nbproject/project.xml index 218f47b6ba..3b7537fba0 100644 --- a/CoreViewFramework/nbproject/project.xml +++ b/CoreViewFramework/nbproject/project.xml @@ -6,6 +6,14 @@ au.gov.asd.tac.constellation.views + + au.gov.asd.tac.constellation.dependencies + + + + 1.0 + + au.gov.asd.tac.constellation.graph @@ -14,6 +22,14 @@ 1.0.6 + + au.gov.asd.tac.constellation.help + + + + 1.0 + + au.gov.asd.tac.constellation.plugins @@ -38,6 +54,23 @@ 1.0 + + org.netbeans.modules.options.api + + + + 1 + 1.68 + + + + org.openide.util + + + + 9.31 + + org.openide.util.lookup diff --git a/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/resources/viewPanel.png b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/resources/viewPanel.png new file mode 100644 index 0000000000..2b6a82c54e Binary files /dev/null and b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/resources/viewPanel.png differ diff --git a/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/view-preferences.md b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/view-preferences.md new file mode 100644 index 0000000000..cd0234c639 --- /dev/null +++ b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/view-preferences.md @@ -0,0 +1,11 @@ +# View Default Floating Preferences + +View preferences can be accessed via Setup -> Options -> +CONSTELLATION -> View. + +
+View Options Panel +
+ +
+Checking a checkbox in the "Floating" column will determine whether the associated view opens as a docked pane, or as a floating window. If you alter a view's floating preference while it is open, the changes will not take effect until the view is closed and opened again. \ No newline at end of file diff --git a/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/viewframework-toc.xml b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/viewframework-toc.xml new file mode 100644 index 0000000000..81ad2b87bd --- /dev/null +++ b/CoreViewFramework/release/modules/ext/docs/CoreViewFramework/viewframework-toc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/AbstractTopComponent.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/AbstractTopComponent.java index d98b6e135f..b27eee5769 100644 --- a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/AbstractTopComponent.java +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/AbstractTopComponent.java @@ -16,7 +16,17 @@ package au.gov.asd.tac.constellation.views; import au.gov.asd.tac.constellation.plugins.logging.ConstellationLogger; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; +import au.gov.asd.tac.constellation.views.preferences.ViewOptionsPanelController; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Window; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Map; +import java.util.prefs.Preferences; import org.openide.util.HelpCtx; +import org.openide.util.NbPreferences; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; @@ -30,12 +40,12 @@ public abstract class AbstractTopComponent

extends TopComponent { protected P content; - private boolean isVisible; + private PropertyChangeListener pcl; + private final Preferences prefs = NbPreferences.forModule(ViewOptionsPanelController.class); /** - * Checks if the view will need an update when a graph changes based on if - * the view is visible currently. + * Checks if the view will need an update when a graph changes based on if the view is visible currently. * * @return true if the view is visible and needs updating */ @@ -48,15 +58,13 @@ protected void setComponentVisible(final boolean visibility) { } /** - * Builds and initialises the content for this top component. You should - * call this method in the constructor of your TopComponent implementation - * after calling the initComponents() method. + * Builds and initialises the content for this top component. You should call this method in the constructor of your + * TopComponent implementation after calling the initComponents() method. */ protected abstract void initContent(); /** - * This is where you pass in content which will be rendered within the - * AbstractTopComponent. + * This is where you pass in content which will be rendered within the AbstractTopComponent. * * @return */ @@ -82,14 +90,103 @@ public boolean getVisibility() { @Override protected void componentOpened() { + final WindowManager windowManager = WindowManager.getDefault(); + final ViewOptionsPanelController controller = new ViewOptionsPanelController(); + + pcl = (final PropertyChangeEvent evt) -> { // Fires when a view is floated or docked manually via the context menu. + prefs.putBoolean(this.getName(), windowManager.isTopComponentFloating(this)); + controller.update(); + }; + + this.addPropertyChangeListener(pcl); super.componentOpened(); + final Map defaultPrefs = controller.getPanel().getDefaultPrefs(); + + if (defaultPrefs.containsKey(this.getName())) { + final Boolean isFloating = prefs.getBoolean(this.getName(), defaultPrefs.get(this.getName())); + WindowManager.getDefault().setTopComponentFloating(this, isFloating); + + if (isFloating) { + // This loops through all the current windows and compares this top component's top level ancestor + // with the window's parent. Sets the size and location for the floating component if a match is found. + for (final Window window : Window.getWindows()) { + if (this.getTopLevelAncestor() != null && this.getTopLevelAncestor().getName().equals(window.getName())) { + final Frame mainWindow = windowManager.getMainWindow(); + final int mainWidth = mainWindow.getWidth(); + final int mainHeight = mainWindow.getHeight(); + final int mainX = mainWindow.getX(); + final int mainY = mainWindow.getY(); + + final Dimension sideSize = new Dimension( + Math.round(mainWidth * 0.3F), + Math.round(mainHeight * (mainWidth > mainHeight ? 0.892F : 0.94F)) + ); + + final Dimension bottomSize = new Dimension( + mainWidth, + Math.round(mainHeight * 0.3F) + ); + + final Dimension size; + + switch (getModeName()) { + case "leftSlidingSide", "explorer", "navigator" -> { + size = sideSize; + window.setLocation( + mainX, + mainY + mainHeight - size.height + ); + } + case "commonpalette", "properties", "rightSlidingSide" -> { + size = sideSize; + window.setLocation( + mainX + mainWidth - size.width, + mainY + mainHeight - size.height + ); + } + case "output", "bottomSlidingSide", "isSliding" -> { + switch (this.getName()) { + case "Find and Replace" -> { + size = new Dimension(600, 350); + window.setLocation( + mainX, + mainY + mainHeight - sideSize.height + ); + } + default -> { + size = bottomSize; + window.setLocation( + mainX, + mainY + mainHeight - size.height + ); + } + } + } + default -> { // Any other mode, default to opening on the left side. + size = sideSize; + window.setLocation( + mainX, + mainY + mainHeight - size.height + ); + } + } + + window.setSize(size); + } + } + + this.setRequestFocusEnabled(true); + } + } + isVisible = true; ConstellationLogger.getDefault().viewStarted(this); } @Override protected void componentClosed() { + this.removePropertyChangeListener(pcl); super.componentClosed(); isVisible = false; @@ -160,4 +257,8 @@ protected void componentDeactivated() { public final HelpCtx getHelpCtx() { return new HelpCtx(getClass().getName()); } + + public abstract Tuple getDefaultFloatingInfo(); + + protected abstract String getModeName(); } diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/ViewFrameworkHelpProvider.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/ViewFrameworkHelpProvider.java new file mode 100644 index 0000000000..7aa6428ae5 --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/ViewFrameworkHelpProvider.java @@ -0,0 +1,56 @@ +/* + * Copyright 2010-2026 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; + +import au.gov.asd.tac.constellation.help.HelpPageProvider; +import java.util.HashMap; +import java.util.Map; +import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; + +/** + * Provider to get help pages for the View Framework module. + * + * @author sol695510 + */ +@ServiceProvider(service = HelpPageProvider.class, position = 2900) +@NbBundle.Messages("ViewFrameworkHelpProvider=View Framework Help Provider") +public class ViewFrameworkHelpProvider extends HelpPageProvider { + + private static final String MODULE_PATH = "ext" + SEP + "docs" + SEP + "CoreViewFramework" + SEP; + + /** + * Provides a map of all the help files Maps the file name to the md file name + * + * @return Map of the file names vs md file names + */ + @Override + public Map getHelpMap() { + final Map map = new HashMap<>(); + map.put("au.gov.asd.tac.constellation.views.preferences", MODULE_PATH + "view-preferences.md"); + return map; + } + + /** + * Provides a location as a string of the TOC xml file in the module + * + * @return List of help resources + */ + @Override + public String getHelpTOC() { + return MODULE_PATH + "viewframework-toc.xml"; + } +} diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.form b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.form new file mode 100644 index 0000000000..4ce2787fc8 --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.form @@ -0,0 +1,53 @@ + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.java new file mode 100644 index 0000000000..b18dd8ab2d --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanel.java @@ -0,0 +1,146 @@ +/* + * Copyright 2010-2026 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.preferences; + +import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; +import java.util.prefs.Preferences; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.table.DefaultTableModel; +import org.openide.util.Lookup; +import org.openide.util.NbPreferences; + +/** + * UI panel for view floating options. + * + * @author sol695510 + */ +public class ViewOptionsPanel extends JPanel { + + private final Preferences prefs = NbPreferences.forModule(ViewOptionsPanelController.class); + private final Map defaultPrefs = new TreeMap<>(); + private DefaultTableModel tableModel; + + protected ViewOptionsPanel() { + initComponents(); + createTableModel(); + jLabel.setText("Set whether a view opens docked or floating by default."); + jLabel.setBorder(new EmptyBorder(0, 0, 10, 0)); + } + + protected final void createTableModel() { + tableModel = new DefaultTableModel(new Object[]{"View", "Floating"}, 0) { + @Override + public Class getColumnClass(final int column) { + return column == 0 ? String.class : Boolean.class; + } + + @Override + public boolean isCellEditable(final int row, final int column) { + return column != 0; + } + }; + + final Map options = getOptionsFromPrefs().isEmpty() ? getDefaultPrefs() : getOptionsFromPrefs(); + + for (final Map.Entry entry : options.entrySet()) { + tableModel.addRow(new Object[]{entry.getKey(), entry.getValue()}); + } + + jTable.setModel(tableModel); + jTable.getTableHeader().setReorderingAllowed(false); + } + + protected final void fireTableDataChanged() { + tableModel.fireTableDataChanged(); + } + + /** + * Returns the view preference selections from the options menu. + * + * @return a map containing the view preference selections from the options menu. + */ + protected final Map getOptionsFromUI() { + final Map optionsFromUI = new TreeMap<>(); + + for (int i = 0; i < tableModel.getRowCount(); i++) { + optionsFromUI.put((String) tableModel.getValueAt(i, 0), (Boolean) tableModel.getValueAt(i, 1)); + } + + return Collections.unmodifiableMap(optionsFromUI); + } + + /** + * Returns the view preference selections from the NB Preferences. + * + * @return a map containing the view preference selections from the NB Preferences. + */ + protected final Map getOptionsFromPrefs() { + final Map optionsFromPrefs = new TreeMap<>(); + + for (final Map.Entry entry : getDefaultPrefs().entrySet()) { + optionsFromPrefs.put(entry.getKey(), prefs.getBoolean(entry.getKey(), entry.getValue())); + } + + return Collections.unmodifiableMap(optionsFromPrefs); + } + + /** + * Returns the view preference selections from the defaults defined in each applicable view. + * + * @return a map containing the view preference selections from the defaults defined in each applicable view. + */ + public final Map getDefaultPrefs() { + + if (defaultPrefs.isEmpty()) { + Lookup.getDefault().lookupAll(ViewOptionsProvider.class).forEach(lookup -> defaultPrefs.putAll(lookup.getDefaultFloatingPreferences())); + } + + return Collections.unmodifiableMap(defaultPrefs); + } + + /** + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the FormEditor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel = new javax.swing.JLabel(); + jScrollPane = new javax.swing.JScrollPane(); + jTable = new javax.swing.JTable(); + + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + setLayout(new java.awt.BorderLayout()); + + jLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + jLabel.setText("View options description here."); + jLabel.setToolTipText(""); + add(jLabel, java.awt.BorderLayout.PAGE_START); + + jScrollPane.setViewportView(jTable); + + add(jScrollPane, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel; + private javax.swing.JScrollPane jScrollPane; + private javax.swing.JTable jTable; + // End of variables declaration//GEN-END:variables +} diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelController.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelController.java new file mode 100644 index 0000000000..ce66f04dff --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelController.java @@ -0,0 +1,111 @@ +/* + * Copyright 2010-2026 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.preferences; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.prefs.Preferences; +import javax.swing.JComponent; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; +import org.openide.util.NbPreferences; + +/** + * UI Controller for the view floating options panel. + * + * @author sol695510 + */ +@OptionsPanelController.SubRegistration( + location = "constellation", + displayName = "#ViewOptions_DisplayName", + keywords = "#ViewOptions_Keywords", + keywordsCategory = "constellation/ViewPreferences", + position = 1000) +@org.openide.util.NbBundle.Messages({ + "ViewOptions_DisplayName=View", + "ViewOptions_Keywords=View" +}) +public class ViewOptionsPanelController extends OptionsPanelController { + + private final Preferences prefs = NbPreferences.forModule(ViewOptionsPanelController.class); + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private ViewOptionsPanel panel; + + @Override + public void update() { + getPanel().fireTableDataChanged(); + getPanel().createTableModel(); + } + + @Override + public void applyChanges() { + if (isValid()) { + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + + if (isChanged()) { + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + + for (final String view : panel.getDefaultPrefs().keySet()) { + prefs.putBoolean(view, getPanel().getOptionsFromUI().get(view)); + } + } + } + } + + @Override + public void cancel() { + // Required for OptionsPanelController, intentionally left blank. + } + + @Override + public boolean isValid() { + return true; + } + + @Override + public boolean isChanged() { + return !getPanel().getOptionsFromUI().equals(getPanel().getOptionsFromPrefs()); + } + + @Override + public JComponent getComponent(final Lookup lookup) { + return getPanel(); + } + + @Override + public HelpCtx getHelpCtx() { + return new HelpCtx("au.gov.asd.tac.constellation.views.preferences"); + } + + @Override + public void addPropertyChangeListener(final PropertyChangeListener pcl) { + pcs.addPropertyChangeListener(pcl); + } + + @Override + public void removePropertyChangeListener(final PropertyChangeListener pcl) { + pcs.removePropertyChangeListener(pcl); + } + + public ViewOptionsPanel getPanel() { + if (panel == null) { + panel = new ViewOptionsPanel(); + } + + return panel; + } +} diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPreferencesMap.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPreferencesMap.java new file mode 100644 index 0000000000..9a848c1fc1 --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPreferencesMap.java @@ -0,0 +1,53 @@ +/* + * Copyright 2010-2026 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.preferences; + +import au.gov.asd.tac.constellation.views.AbstractTopComponent; +import java.awt.EventQueue; +import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; +import org.openide.util.Lookup; +import org.openide.util.lookup.ServiceProvider; + +/** + * Creates a map of the default floating preferences for the currently applicable views. + * + * @author sol695510 + */ +@ServiceProvider(service = ViewOptionsProvider.class) +public class ViewOptionsPreferencesMap extends ViewOptionsProvider { + + final Map dfpInfo = new TreeMap<>(); + + /** + * Gets a map of the default floating preferences. + * + * @return a map of the default floating preferences. + */ + @Override + public Map getDefaultFloatingPreferences() { + + if (dfpInfo.isEmpty()) { + EventQueue.invokeLater(() -> Lookup.getDefault().lookupAll(AbstractTopComponent.class).forEach(lookup -> dfpInfo.put( + (String) lookup.getDefaultFloatingInfo().getFirst(), + (Boolean) lookup.getDefaultFloatingInfo().getSecond() + ))); + } + + return Collections.unmodifiableMap(dfpInfo); + } +} diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsProvider.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsProvider.java new file mode 100644 index 0000000000..15cee8b61f --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsProvider.java @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2026 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.preferences; + +import java.util.Map; + +/** + * Class to provide the default floating preferences for each view. + * + * @author sol695510 + */ +public abstract class ViewOptionsProvider { + + public abstract Map getDefaultFloatingPreferences(); +} diff --git a/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsUtility.java b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsUtility.java new file mode 100644 index 0000000000..d8d69e5453 --- /dev/null +++ b/CoreViewFramework/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsUtility.java @@ -0,0 +1,212 @@ +/* + * Copyright 2010-2026 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.preferences; + +import au.gov.asd.tac.constellation.utilities.text.SeparatorConstants; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; +import java.awt.EventQueue; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; +import java.util.Scanner; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executors; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; +import org.openide.util.Lookup; +import org.openide.windows.OnShowing; + +/** + * Handles operations on the file the default floating preferences are saved to. + * + * @author sol695510 + */ +@OnShowing() +public class ViewOptionsUtility implements Runnable { + + private static final Logger LOGGER = Logger.getLogger(ViewOptionsUtility.class.getName()); + + private static String resourceDirectory = ""; + private static File dfpFile; + private static final Map dfpFromFile = new TreeMap<>(); + + // This is the system property that is set to true in order to make the AWT thread run in headless mode for tests, etc. + private static final String AWT_HEADLESS_PROPERTY = "java.awt.headless"; + + /** + * Generate the default viewing preferences in developer versions of code. + */ + @Override + public void run() { + if (Boolean.TRUE.toString().equalsIgnoreCase(System.getProperty(AWT_HEADLESS_PROPERTY))) { + return; + } + + CompletableFuture.runAsync(this::updateDFPFile, Executors.newSingleThreadExecutor()); + } + + /** + * Update the file containing the default viewing preferences. + */ + protected void updateDFPFile() { + // Change boolean to true to update default floating preferences file, revert back to false after updating. + final boolean updateDFP = false; + + if (updateDFP) { + createDFPFile(getResourceDirectory()); + } + } + + /** + * Create a default viewing preferences file at the given file path. + * + * @param filePath + */ + protected static void createDFPFile(final String filePath) { + if (filePath == null) { + throw new IllegalArgumentException("Null file path used for creation of DFP file"); + } + + try { + if (Files.deleteIfExists(FileSystems.getDefault().getPath(filePath))) { + LOGGER.log(Level.FINE, "Previous DFP file was replaced at: {0}", filePath); + } + } catch (final IOException ex) { + LOGGER.log(Level.SEVERE, "Path to DFP file was invalid: %s".formatted(filePath), ex); + } + + dfpFile = new File(filePath); + + try (final BufferedWriter writer = new BufferedWriter(new FileWriter(dfpFile))) { + final Map dfpFromLookUp = getDFPFromLookup(); + + for (final Map.Entry entry : dfpFromLookUp.entrySet()) { + writer.write(entry.getKey() + SeparatorConstants.COLON + entry.getValue() + "\n"); + } + + dfpFile.createNewFile(); + + LOGGER.log(Level.FINE, "DFP file was created at: {0}", filePath); + } catch (final IOException ex) { + LOGGER.log(Level.SEVERE, "Unable to create DFP file. FilePath: %s".formatted(filePath), ex); + } + } + + /** + * Read the default floating preferences file from the given file path. + * + * @param filePath + */ + protected static void readDFPFile(final String filePath) { + if (filePath == null) { + throw new IllegalArgumentException("Null file path used for reading of DFP file"); + } + + dfpFile = new File(filePath); + + try (final BufferedReader reader = new BufferedReader(new FileReader(dfpFile))) { + final Scanner sc = new Scanner(reader); + + while (sc.hasNextLine()) { + final String nextLine = sc.nextLine(); + final String[] ss = nextLine.split(SeparatorConstants.COLON); + dfpFromFile.put(ss[0].trim(), Boolean.valueOf(ss[1].trim())); + } + + LOGGER.log(Level.FINE, "DFP file was read at: {0}", filePath); + } catch (final IOException ex) { + LOGGER.log(Level.SEVERE, "Unable to read DFP file. FilePath: %s".formatted(filePath), ex); + } + } + + /** + * Get a map of the default floating preferences from the lookup. + * + * @return a map of the default floating preferences. + */ + protected static Map getDFPFromLookup() { + final Map dfpFromLookup = new TreeMap<>(); + + try { + EventQueue.invokeAndWait(() -> Lookup.getDefault().lookupAll(AbstractTopComponent.class).forEach(lookup -> dfpFromLookup.put( + (String) lookup.getDefaultFloatingInfo().getFirst(), + (Boolean) lookup.getDefaultFloatingInfo().getSecond() + ))); + } catch (InterruptedException | InvocationTargetException ex) { + LOGGER.log(Level.SEVERE, "There was a problem retrieving the default floating info.", ex); + } + + return Collections.unmodifiableMap(dfpFromLookup); + } + + /** + * Get a map of the default floating preferences from the file they are saved to. + * + * @return a map of the default floating preferences. + */ + public static Map getDFPFromFile() { + if (dfpFromFile.isEmpty()) { + readDFPFile(getResourceDirectory()); + } + + return Collections.unmodifiableMap(dfpFromFile); + } + + /** + * Get the file path to the file where the default floating preferences are saved to. + * + * @return the file path to the default floating preferences file. + */ + protected static String getResourceDirectory() { + if (resourceDirectory.isBlank()) { + try { + final String source = ViewOptionsUtility.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + final URI uri = URI.create(source); + final Path path = Paths.get(uri); + + final String sep = File.separator; + String[] splitPath = path.toString().split(Pattern.quote(sep)); + + // Keep removing the last directory in the path array until the constellation directory is reached. + while (!"constellation".equals(splitPath[splitPath.length - 1])) { + splitPath = Arrays.copyOfRange(splitPath, 0, splitPath.length - 1); + } + + resourceDirectory = String.join(sep, splitPath) + sep + "dfp.txt"; + + LOGGER.log(Level.FINE, "DFP file directory was retrieved at: {0}", resourceDirectory); + } catch (final IllegalArgumentException ex) { + LOGGER.log(Level.SEVERE, "There was a problem retrieving the directory of the DFP file.", ex); + } + } + + return resourceDirectory; + } +} diff --git a/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelControllerNGTest.java b/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelControllerNGTest.java new file mode 100644 index 0000000000..d7b6551dd8 --- /dev/null +++ b/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelControllerNGTest.java @@ -0,0 +1,257 @@ +/* + * Copyright 2010-2025 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.preferences; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.List; +import java.util.Map; +import static java.util.Map.entry; +import org.mockito.MockedConstruction; +import static org.mockito.Mockito.mockConstruction; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; + +/** + * Test class of ViewOptionsPanelController. + * + * @author sol695510 + */ +public class ViewOptionsPanelControllerNGTest { + + final Map prefsAllFalse = Map.ofEntries( + entry("Analytic View", Boolean.FALSE), + entry("Attribute Editor", Boolean.FALSE), + entry("Conversation View", Boolean.FALSE), + entry("Data Access View", Boolean.FALSE), + entry("Error Report", Boolean.FALSE)); + + final Map prefsAllTrue = Map.ofEntries( + entry("Analytic View", Boolean.TRUE), + entry("Attribute Editor", Boolean.TRUE), + entry("Conversation View", Boolean.TRUE), + entry("Data Access View", Boolean.TRUE), + entry("Error Report", Boolean.TRUE)); + + /** + * Test of update method, of class ViewOptionsPanelController. + */ + @Test + public void testUpdate() { + System.out.println("update"); + + try (MockedConstruction mockVOP = mockConstruction(ViewOptionsPanel.class)) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + instance.update(); + + // Assert that a mock of the ViewOptionsPanel was constructed. + final List constructedVOP = mockVOP.constructed(); + assertEquals(constructedVOP.size(), 1); + + // Verify that these methods were run on the constructed mock. + verify(constructedVOP.get(0), times(1)).fireTableDataChanged(); + verify(constructedVOP.get(0), times(1)).createTableModel(); + } + } + + /** + * Test of applyChanges method, of class ViewOptionsPanelController. + */ + @Test + public void testApplyChanges() { + System.out.println("applyChanges"); + + // When isChanged() returns true. + try (MockedConstruction mockVOP = mockConstruction(ViewOptionsPanel.class, (mockInstance, context) -> { + when(mockInstance.getOptionsFromUI()).thenReturn(prefsAllFalse); + when(mockInstance.getOptionsFromPrefs()).thenReturn(prefsAllTrue); + }); MockedConstruction mockPCS = mockConstruction(PropertyChangeSupport.class)) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + instance.applyChanges(); + + // Assert that a mock of the ViewOptionsPanel was constructed. + final List constructedVOP = mockVOP.constructed(); + assertEquals(constructedVOP.size(), 1); + + // Assert that a mock of the PropertyChangeSupport was constructed. + final List constructedPCS = mockPCS.constructed(); + assertEquals(constructedPCS.size(), 1); + + // Verify that this method was run during isValid(). + verify(constructedPCS.get(0), times(1)).firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + + // Verify that these methods were run during isChanged(). + verify(constructedVOP.get(0), times(1)).getOptionsFromPrefs(); + verify(constructedVOP.get(0), times(1)).getOptionsFromUI(); + + // Verify that this method was run due to isChanged() returning true. + verify(constructedPCS.get(0), times(1)).firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } + + // When isChanged() returns false. + try (MockedConstruction mockVOP = mockConstruction(ViewOptionsPanel.class, (mockInstance, context) -> { + when(mockInstance.getOptionsFromUI()).thenReturn(prefsAllFalse); + when(mockInstance.getOptionsFromPrefs()).thenReturn(prefsAllFalse); + }); MockedConstruction mockPCS = mockConstruction(PropertyChangeSupport.class)) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + instance.applyChanges(); + + // Assert that a mock of the ViewOptionsPanel was not constructed. + final List constructedVOP = mockVOP.constructed(); + assertEquals(constructedVOP.size(), 1); + + // Assert that a mock of the PropertyChangeSupport was constructed. + final List constructedPCS = mockPCS.constructed(); + assertEquals(constructedPCS.size(), 1); + + // Verify that this method was run during isValid(). + verify(constructedPCS.get(0), times(1)).firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + + // Verify that these methods were run during isChanged(). + verify(constructedVOP.get(0), times(1)).getOptionsFromPrefs(); + verify(constructedVOP.get(0), times(1)).getOptionsFromUI(); + + // Verify that this method was not run due to isChanged() returning false. + verify(constructedPCS.get(0), times(0)).firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } + } + + /** + * Test of isChanged method, of class ViewOptionsPanelController. + */ + @Test + public void testIsChanged() { + System.out.println("isChanged"); + + // When the options from the NbPreferences and UI differ. + try (MockedConstruction mockVOP = mockConstruction(ViewOptionsPanel.class, (mockInstance, context) -> { + when(mockInstance.getOptionsFromUI()).thenReturn(prefsAllFalse); + when(mockInstance.getOptionsFromPrefs()).thenReturn(prefsAllTrue); + })) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + final boolean result = instance.isChanged(); + final boolean expResult = true; + assertEquals(result, expResult); + + // Assert that a mock of the ViewOptionsPanel was constructed. + final List constructed = mockVOP.constructed(); + assertEquals(constructed.size(), 1); + + // Verify that these methods were run during isChanged(). + verify(constructed.get(0), times(1)).getOptionsFromPrefs(); + verify(constructed.get(0), times(1)).getOptionsFromUI(); + } + + // When the options from the NbPreferences and UI match. + try (MockedConstruction mockVOP = mockConstruction(ViewOptionsPanel.class, (mockInstance, context) -> { + when(mockInstance.getOptionsFromUI()).thenReturn(prefsAllFalse); + when(mockInstance.getOptionsFromPrefs()).thenReturn(prefsAllFalse); + })) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + final boolean result = instance.isChanged(); + final boolean expResult = false; + assertEquals(result, expResult); + + // Assert that a mock of the ViewOptionsPanel was constructed. + final List constructed = mockVOP.constructed(); + assertEquals(constructed.size(), 1); + + // Verify that these methods were run during isChanged(). + verify(constructed.get(0), times(1)).getOptionsFromPrefs(); + verify(constructed.get(0), times(1)).getOptionsFromUI(); + } + } + + /** + * Test of getComponent method, of class ViewOptionsPanelController. + */ + @Test + public void testGetComponent() { + System.out.println("getComponent"); + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + + final Object result = instance.getComponent(Lookup.EMPTY); + assertEquals(result.getClass(), ViewOptionsPanel.class); + } + + /** + * Test of getHelpCtx method, of class ViewOptionsPanelController. + */ + @Test + public void testGetHelpCtx() { + System.out.println("getHelpCtx"); + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + + final Object result1 = instance.getHelpCtx(); + assertEquals(result1.getClass(), HelpCtx.class); + + final HelpCtx result2 = instance.getHelpCtx(); + assertEquals(result2.getHelpID(), "au.gov.asd.tac.constellation.views.preferences"); + } + + /** + * Test of addPropertyChangeListener of class ViewOptionsPanelController. + */ + @Test + public void testAddPropertyChangeListener() { + System.out.println("addPropertyChangeListener"); + final PropertyChangeListener pcl = null; + + try (MockedConstruction mockPCS = mockConstruction(PropertyChangeSupport.class)) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + instance.addPropertyChangeListener(pcl); + + // Assert that a mock of the PropertyChangeSupport was constructed. + final List constructed = mockPCS.constructed(); + assertEquals(constructed.size(), 3); // Why 3 and not 1? + + verify(constructed.get(2), times(1)).addPropertyChangeListener(pcl); + } + } + + /** + * Test of removePropertyChangeListener methods of class ViewOptionsPanelController. + */ + @Test + public void testRemovePropertyChangeListener() { + System.out.println("removePropertyChangeListener"); + final PropertyChangeListener pcl = null; + + try (MockedConstruction mockPCS = mockConstruction(PropertyChangeSupport.class)) { + + final ViewOptionsPanelController instance = new ViewOptionsPanelController(); + instance.removePropertyChangeListener(pcl); + + // Assert that a mock of the PropertyChangeSupport was constructed. + final List constructed = mockPCS.constructed(); + assertEquals(constructed.size(), 1); + + verify(constructed.get(0), times(1)).removePropertyChangeListener(pcl); + } + } +} diff --git a/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelNGTest.java b/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelNGTest.java new file mode 100644 index 0000000000..8d7383862c --- /dev/null +++ b/CoreViewFramework/test/unit/src/au/gov/asd/tac/constellation/views/preferences/ViewOptionsPanelNGTest.java @@ -0,0 +1,83 @@ +/* + * Copyright 2010-2026 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.preferences; + +import java.util.List; +import javax.swing.table.DefaultTableModel; +import org.mockito.MockedConstruction; +import static org.mockito.Mockito.mockConstruction; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.Test; + +/** + * Test of class ViewOptionsPanel. + * + * @author sol695510 + */ +public class ViewOptionsPanelNGTest { + + /** + * Test of createTableModel method, of class ViewOptionsPanel. + */ + @Test + public void testCreateTableModel() { + System.out.println("createTableModel"); + + try (MockedConstruction mockDTM = mockConstruction(DefaultTableModel.class)) { + + final ViewOptionsPanel instance = new ViewOptionsPanel(); + instance.createTableModel(); + + // Assert that a mock of the DefaultTableModel was constructed. + final List constructedDTM = mockDTM.constructed(); + assertEquals(constructedDTM.size(), 3); // Why 3 and not 1? + + // Verify that the DefaultTableModel was correctly constructed. + assertEquals(constructedDTM.get(2).getColumnClass(0), String.class); + assertEquals(constructedDTM.get(2).getColumnClass(1), Boolean.class); + + for (int i = 1; i < 28; i++) { + assertFalse(constructedDTM.get(2).isCellEditable(i, 0)); + assertTrue(constructedDTM.get(2).isCellEditable(i, 1)); + } + } + } + + /** + * Test of fireTableDataChanged method, of class ViewOptionsPanel. + */ + @Test + public void testFireTableDataChanged() { + System.out.println("fireTableDataChanged"); + + try (MockedConstruction mockDTM = mockConstruction(DefaultTableModel.class)) { + + final ViewOptionsPanel instance = new ViewOptionsPanel(); + instance.fireTableDataChanged(); + + // Assert that a mock of the DefaultTableModel was constructed. + final List constructedDTM = mockDTM.constructed(); + assertEquals(constructedDTM.size(), 2); // Why 2 and not 1? + + // Verify that this method was run on the constructed mock. + verify(constructedDTM.get(1), times(1)).fireTableDataChanged(); + } + } +} diff --git a/CoreWebView/nbproject/project.xml b/CoreWebView/nbproject/project.xml index 2314dae94f..b2405fac8b 100644 --- a/CoreWebView/nbproject/project.xml +++ b/CoreWebView/nbproject/project.xml @@ -6,6 +6,14 @@ au.gov.asd.tac.constellation.views.webview + + au.gov.asd.tac.constellation.views + + + + 1.0 + + org.openide.util diff --git a/CoreWelcomeView/src/au/gov/asd/tac/constellation/views/welcome/WelcomeTopComponent.java b/CoreWelcomeView/src/au/gov/asd/tac/constellation/views/welcome/WelcomeTopComponent.java index 97222c9980..c19f552c76 100644 --- a/CoreWelcomeView/src/au/gov/asd/tac/constellation/views/welcome/WelcomeTopComponent.java +++ b/CoreWelcomeView/src/au/gov/asd/tac/constellation/views/welcome/WelcomeTopComponent.java @@ -15,6 +15,7 @@ */ package au.gov.asd.tac.constellation.views.welcome; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.awt.BorderLayout; @@ -85,9 +86,8 @@ public void readProperties(final java.util.Properties p) { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -144,8 +144,8 @@ public void componentShown(java.awt.event.ComponentEvent evt) { }// //GEN-END:initComponents private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown - Platform.runLater(()-> { - if (pane.getBottomRecentSection().getChildren()!= null) { + Platform.runLater(() -> { + if (pane.getBottomRecentSection().getChildren() != null) { pane.refreshRecentFiles(); } }); @@ -166,4 +166,19 @@ protected String createStyle() { protected WelcomeViewPane createContent() { return pane; } + + @Override + protected void handleComponentOpened() { + super.handleComponentOpened(); + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_WelcomeTopComponentTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "editor"; + } } diff --git a/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/WhatsNewTopComponent.java b/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/WhatsNewTopComponent.java index 94c7458650..af73721223 100644 --- a/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/WhatsNewTopComponent.java +++ b/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/WhatsNewTopComponent.java @@ -15,6 +15,7 @@ */ package au.gov.asd.tac.constellation.views.whatsnew; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -90,9 +91,8 @@ public void readProperties(final java.util.Properties p) { } /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The + * content of this method is always regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() { @@ -162,4 +162,19 @@ protected WhatsNewViewPane createContent() { public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } + + @Override + protected void handleComponentOpened() { + super.handleComponentOpened(); + } + + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_TutorialTopComponentTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "editor"; + } } diff --git a/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt b/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt index 8bf52a9190..151b6ff902 100644 --- a/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt +++ b/CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt @@ -1,9 +1,13 @@ == 3030-12-31 Getting Started

If you're new to Constellation, read the getting started guide.

+== 2026-06-05 Add preference option to set whether views open docked or floating by default +

Views can now be set to open docked or floating by default via Setup -> Options -> CONSTELLATION -> View. + == 2026-02-11 Add "Arrange in 2D" option to Layer By Time

This new option allows a user to arrange the result of Layer By Time into a more readable format. + == 2026-01-13 Renamed "Chinese Whispers" to "Label Propagation"

"Chinese Whispers" clustering has been renamed to "Label Propagation". diff --git a/CoreWordCloudView/src/au/gov/asd/tac/constellation/views/wordcloud/ui/WordCloudTopComponent.java b/CoreWordCloudView/src/au/gov/asd/tac/constellation/views/wordcloud/ui/WordCloudTopComponent.java index 4b1a80ae8b..5badb92078 100644 --- a/CoreWordCloudView/src/au/gov/asd/tac/constellation/views/wordcloud/ui/WordCloudTopComponent.java +++ b/CoreWordCloudView/src/au/gov/asd/tac/constellation/views/wordcloud/ui/WordCloudTopComponent.java @@ -17,7 +17,9 @@ import au.gov.asd.tac.constellation.graph.Graph; import au.gov.asd.tac.constellation.graph.manager.GraphManager; +import au.gov.asd.tac.constellation.utilities.datastructure.Tuple; import au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager; +import au.gov.asd.tac.constellation.views.AbstractTopComponent; import au.gov.asd.tac.constellation.views.JavaFxTopComponent; import java.awt.BorderLayout; import java.awt.Dimension; @@ -29,6 +31,7 @@ import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.util.NbBundle.Messages; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** @@ -63,6 +66,7 @@ "CTL_WordCloudTopComponent=Word Cloud View", "HINT_WordCloudTopComponent=Word Cloud View" }) +@ServiceProvider(service = AbstractTopComponent.class) public final class WordCloudTopComponent extends JavaFxTopComponent { private final JFXPanel panel = new JFXPanel(); @@ -92,8 +96,8 @@ public WordCloudTopComponent() { panel.setScene(scene); // Update word cloud pane's size when window size changes - scene.heightProperty().addListener((obv, oldVal, newVal) -> - wordCloudPane.setContentHeight(newVal.intValue())); + scene.heightProperty().addListener((obv, oldVal, newVal) + -> wordCloudPane.setContentHeight(newVal.intValue())); } @Override @@ -116,7 +120,7 @@ public void handleNewGraph(final Graph graph) { } if (graph != null) { - // Add listener to new graph + // Add listener to new graph this.graph = graph; this.graph.addGraphChangeListener(this); @@ -152,7 +156,7 @@ protected void handleGraphClosed(final Graph graph) { } setPaneStatus(); } - + @Override protected void handleComponentOpened() { super.handleComponentOpened(); @@ -166,15 +170,25 @@ protected void componentShowing() { controller.updateGraph(); setPaneStatus(); } - + /** - * Sets the status of the pane dependent on if a graph is currently active. - * The status is used to enable or disable the view when a graph exists. + * Sets the status of the pane dependent on if a graph is currently active. The status is used to enable or disable + * the view when a graph exists. */ - protected void setPaneStatus(){ + protected void setPaneStatus() { createContent().setEnabled(GraphManager.getDefault().getActiveGraph() != null); } + @Override + public Tuple getDefaultFloatingInfo() { + return Tuple.create(Bundle.CTL_WordCloudTopComponent(), Boolean.FALSE); + } + + @Override + protected String getModeName() { + return "explorer"; + } + /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The * content of this method is always regenerated by the Form Editor. diff --git a/dfp.txt b/dfp.txt new file mode 100644 index 0000000000..96fc43e50e --- /dev/null +++ b/dfp.txt @@ -0,0 +1,27 @@ +Analytic View:false +Attribute Editor:false +Conversation View:false +Data Access View:false +Error Report:false +Find and Replace:true +From Database...:false +From File...:false +Hierarchical:false +Histogram:false +K-Truss:false +Layers View:false +Map View:false +Memory Manager:false +Named Selections:false +New Histogram:false +Notes View:false +Perspective Bookmarks:false +Plane Manager:false +Plugin Reporter:false +Quality Control View:false +Scatter Plot:false +Schema View:false +Scripting View:false +Table View:false +Timeline:false +Word Cloud View:false diff --git a/search.json b/search.json index c92fcbe174..faed40fcb7 100644 --- a/search.json +++ b/search.json @@ -774,198 +774,204 @@ } ,{ "id": 129, + "title": "View", + "category": "Preferences", + "link": "ext\\docs\\CorePreferences\\view-preferences.html" +} +,{ + "id": 130, "title": "Label Fonts", "category": "Preferences", "link": "ext\\docs\\CoreOpenGLDisplay\\label-fonts-preferences.html" } ,{ - "id": 130, + "id": 131, "title": "Online Help", "category": "Preferences", "link": "ext\\docs\\CoreHelp\\help-options.html" } ,{ - "id": 131, + "id": 132, "title": "Proxy", "category": "Preferences", "link": "ext\\docs\\CoreSecurity\\proxy-preferences.html" } ,{ - "id": 132, + "id": 133, "title": "Grid", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\grid-arrangement.html" } ,{ - "id": 133, + "id": 134, "title": "Line", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\line-arrangement.html" } ,{ - "id": 134, + "id": 135, "title": "Circle", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\circle-arrangement.html" } ,{ - "id": 135, + "id": 136, "title": "Tree", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\tree-arrangement.html" } ,{ - "id": 136, + "id": 137, "title": "Proximity", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\proximity-arrangement.html" } ,{ - "id": 137, + "id": 138, "title": "Hierarchy", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\hierarchy-arrangement.html" } ,{ - "id": 138, + "id": 139, "title": "Node Attribute", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\node-attribute-arrangement.html" } ,{ - "id": 139, + "id": 140, "title": "Scatter 3D", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\scatter3d-arrangement.html" } ,{ - "id": 140, + "id": 141, "title": "Sphere", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\sphere-arrangement.html" } ,{ - "id": 141, + "id": 142, "title": "Bubble Tree 3D", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\bubble-tree-3d-arrangement.html" } ,{ - "id": 142, + "id": 143, "title": "Spectral 3D", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\spectral-arrangement.html" } ,{ - "id": 143, + "id": 144, "title": "HDE 3D", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\hde-arrangement.html" } ,{ - "id": 144, + "id": 145, "title": "Flatten Z-Field", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\flatten-z-field.html" } ,{ - "id": 145, + "id": 146, "title": "Contract Graph", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\contract-graph.html" } ,{ - "id": 146, + "id": 147, "title": "Expand Graph", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\expand-graph.html" } ,{ - "id": 147, + "id": 148, "title": "Uncollide", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\uncollide-arrangement.html" } ,{ - "id": 148, + "id": 149, "title": "Layer by Time", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\layer-by-time.html" } ,{ - "id": 149, + "id": 150, "title": "Pin and Unpin Nodes", "category": "Arrangements", "link": "ext\\docs\\CoreArrangementPlugins\\pin-unpin-nodes.html" } ,{ - "id": 150, + "id": 151, "title": "Import From File", "category": "Import/Export", "link": "ext\\docs\\CoreImportExportPlugins\\import-from-file.html" } ,{ - "id": 151, + "id": 152, "title": "Import From Database", "category": "Import/Export", "link": "ext\\docs\\CoreImportExportPlugins\\import-from-database.html" } ,{ - "id": 152, + "id": 153, "title": "Add Hashmod (Experimental)", "category": "Import/Export", "link": "ext\\docs\\CoreImportExportPlugins\\add-hashmod.html" } ,{ - "id": 153, + "id": 154, "title": "Export From Constellation", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-from-constellation.html" } ,{ - "id": 154, + "id": 155, "title": "Export to Image", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-png.html" } ,{ - "id": 155, + "id": 156, "title": "Export to SVG", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-svg.html" } ,{ - "id": 156, + "id": 157, "title": "Export to Shapefile", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-shapefile.html" } ,{ - "id": 157, + "id": 158, "title": "Export to KML", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-kml.html" } ,{ - "id": 158, + "id": 159, "title": "Export to GeoJson", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-geojson.html" } ,{ - "id": 159, + "id": 160, "title": "Export to GeoPackage", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-geopackage.html" } ,{ - "id": 160, + "id": 161, "title": "Export to CSV", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-csv.html" } ,{ - "id": 161, + "id": 162, "title": "Export to XLSX", "category": "Export", "link": "ext\\docs\\CoreImportExportPlugins\\export-to-xlsx.html" diff --git a/toc.md b/toc.md index 55d73ae0fe..8c66b114f5 100644 --- a/toc.md +++ b/toc.md @@ -47,7 +47,16 @@ K-Truss
Hierarchical
Info Map
-

+

@@ -175,15 +184,7 @@

+