Skip to content

Commit df24fef

Browse files
Whats New checkbox for startup setting added (#1080)
1 parent 2d4d503 commit df24fef

File tree

6 files changed

+79
-10
lines changed

6 files changed

+79
-10
lines changed

CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.form

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
<Component id="autosavePanel" max="-2" attributes="0"/>
5151
<EmptySpace max="-2" attributes="0"/>
5252
<Component id="startupPanel" min="-2" max="-2" attributes="0"/>
53-
<EmptySpace max="-2" attributes="0"/>
53+
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
5454
<Component id="displayPanel" min="-2" max="-2" attributes="0"/>
5555
<EmptySpace max="-2" attributes="0"/>
5656
<Component id="webserverPanel" min="-2" max="-2" attributes="0"/>
5757
<EmptySpace max="-2" attributes="0"/>
5858
<Component id="notebookPanel" min="-2" max="-2" attributes="0"/>
5959
<EmptySpace max="-2" attributes="0"/>
6060
<Component id="saveLocationPanel" min="-2" max="-2" attributes="0"/>
61-
<EmptySpace pref="17" max="32767" attributes="0"/>
61+
<EmptySpace max="32767" attributes="0"/>
6262
</Group>
6363
</Group>
6464
</DimensionLayout>
@@ -173,8 +173,11 @@
173173
<Group type="103" groupAlignment="0" attributes="0">
174174
<Group type="102" alignment="0" attributes="0">
175175
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
176-
<Component id="startupWelcomeCheckbox" min="-2" max="-2" attributes="0"/>
177-
<EmptySpace max="32767" attributes="0"/>
176+
<Group type="103" groupAlignment="0" attributes="0">
177+
<Component id="startupWhatsNewCheckbox" min="-2" max="-2" attributes="0"/>
178+
<Component id="startupWelcomeCheckbox" min="-2" max="-2" attributes="0"/>
179+
</Group>
180+
<EmptySpace pref="349" max="32767" attributes="0"/>
178181
</Group>
179182
</Group>
180183
</DimensionLayout>
@@ -183,6 +186,8 @@
183186
<Group type="102" alignment="0" attributes="0">
184187
<EmptySpace max="-2" attributes="0"/>
185188
<Component id="startupWelcomeCheckbox" min="-2" max="-2" attributes="0"/>
189+
<EmptySpace type="separate" max="-2" attributes="0"/>
190+
<Component id="startupWhatsNewCheckbox" min="-2" max="-2" attributes="0"/>
186191
<EmptySpace max="32767" attributes="0"/>
187192
</Group>
188193
</Group>
@@ -199,6 +204,16 @@
199204
</Property>
200205
</Properties>
201206
</Component>
207+
<Component class="javax.swing.JCheckBox" name="startupWhatsNewCheckbox">
208+
<Properties>
209+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
210+
<ResourceString bundle="au/gov/asd/tac/constellation/preferences/Bundle.properties" key="ApplicationOptionsPanel.startupWhatsNewCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
211+
</Property>
212+
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
213+
<ResourceString bundle="au/gov/asd/tac/constellation/preferences/Bundle.properties" key="ApplicationOptionsPanel.startupWhatsNewCheckbox.actionCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
214+
</Property>
215+
</Properties>
216+
</Component>
202217
</SubComponents>
203218
</Container>
204219
<Container class="javax.swing.JPanel" name="displayPanel">

CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ public void setWelcomeOnStartup(final boolean welcomeOnStartup) {
8282
startupWelcomeCheckbox.setSelected(welcomeOnStartup);
8383
}
8484

85+
public boolean getWhatsNewOnStartup() {
86+
return startupWhatsNewCheckbox.isSelected();
87+
}
88+
89+
public void setWhatsNewOnStartup(final boolean whatsNewOnStartup) {
90+
startupWhatsNewCheckbox.setSelected(whatsNewOnStartup);
91+
}
92+
8593
public boolean getFreezeGraph() {
8694
return freezeGraphCheckBox.isSelected();
8795
}
@@ -147,6 +155,7 @@ private void initComponents() {
147155
autosaveLabel = new JLabel();
148156
startupPanel = new JPanel();
149157
startupWelcomeCheckbox = new JCheckBox();
158+
startupWhatsNewCheckbox = new JCheckBox();
150159
displayPanel = new JPanel();
151160
freezeGraphCheckBox = new JCheckBox();
152161
webserverPanel = new JPanel();
@@ -215,18 +224,25 @@ public void actionPerformed(ActionEvent evt) {
215224
Mnemonics.setLocalizedText(startupWelcomeCheckbox, NbBundle.getMessage(ApplicationOptionsPanel.class, "ApplicationOptionsPanel.startupWelcomeCheckbox.text")); // NOI18N
216225
startupWelcomeCheckbox.setActionCommand(NbBundle.getMessage(ApplicationOptionsPanel.class, "ApplicationOptionsPanel.startupWelcomeCheckbox.actionCommand")); // NOI18N
217226

227+
Mnemonics.setLocalizedText(startupWhatsNewCheckbox, NbBundle.getMessage(ApplicationOptionsPanel.class, "ApplicationOptionsPanel.startupWhatsNewCheckbox.text")); // NOI18N
228+
startupWhatsNewCheckbox.setActionCommand(NbBundle.getMessage(ApplicationOptionsPanel.class, "ApplicationOptionsPanel.startupWhatsNewCheckbox.actionCommand")); // NOI18N
229+
218230
GroupLayout startupPanelLayout = new GroupLayout(startupPanel);
219231
startupPanel.setLayout(startupPanelLayout);
220232
startupPanelLayout.setHorizontalGroup(startupPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
221233
.addGroup(startupPanelLayout.createSequentialGroup()
222234
.addGap(20, 20, 20)
223-
.addComponent(startupWelcomeCheckbox)
224-
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
235+
.addGroup(startupPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
236+
.addComponent(startupWhatsNewCheckbox)
237+
.addComponent(startupWelcomeCheckbox))
238+
.addContainerGap(349, Short.MAX_VALUE))
225239
);
226240
startupPanelLayout.setVerticalGroup(startupPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
227241
.addGroup(startupPanelLayout.createSequentialGroup()
228242
.addContainerGap()
229243
.addComponent(startupWelcomeCheckbox)
244+
.addGap(18, 18, 18)
245+
.addComponent(startupWhatsNewCheckbox)
230246
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
231247
);
232248

@@ -395,15 +411,15 @@ public void actionPerformed(ActionEvent evt) {
395411
.addComponent(autosavePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
396412
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
397413
.addComponent(startupPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
398-
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
414+
.addGap(23, 23, 23)
399415
.addComponent(displayPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
400416
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
401417
.addComponent(webserverPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
402418
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
403419
.addComponent(notebookPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
404420
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
405421
.addComponent(saveLocationPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
406-
.addContainerGap(17, Short.MAX_VALUE))
422+
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
407423
);
408424

409425
displayPanel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ApplicationOptionsPanel.class, "ApplicationOptionsPanel.displayPanel.AccessibleContext.accessibleName")); // NOI18N
@@ -476,6 +492,7 @@ private void restDirectoryButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:ev
476492
private JPanel saveLocationPanel;
477493
private JPanel startupPanel;
478494
private JCheckBox startupWelcomeCheckbox;
495+
private JCheckBox startupWhatsNewCheckbox;
479496
private JButton userDirectoryButton;
480497
private JLabel userDirectoryLabel;
481498
private JTextField userDirectoryText;

CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanelController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public void update() {
5353
applicationOptionsPanel.setAutosaveEnabled(prefs.getBoolean(ApplicationPreferenceKeys.AUTOSAVE_ENABLED, ApplicationPreferenceKeys.AUTOSAVE_ENABLED_DEFAULT));
5454
applicationOptionsPanel.setAutosaveFrequency(prefs.getInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE_DEFAULT));
5555
applicationOptionsPanel.setWelcomeOnStartup(prefs.getBoolean(ApplicationPreferenceKeys.WELCOME_ON_STARTUP, ApplicationPreferenceKeys.WELCOME_ON_STARTUP_DEFAULT));
56+
applicationOptionsPanel.setWhatsNewOnStartup(prefs.getBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP_DEFAULT));
5657
applicationOptionsPanel.setFreezeGraph(prefs.getBoolean(ApplicationPreferenceKeys.FREEZE_GRAPH_VIEW, ApplicationPreferenceKeys.FREEZE_GRAPH_VIEW_DEFAULT));
5758
applicationOptionsPanel.setWebserverPort(prefs.getInt(ApplicationPreferenceKeys.WEBSERVER_PORT, ApplicationPreferenceKeys.WEBSERVER_PORT_DEFAULT));
5859
applicationOptionsPanel.setNotebookDirectory(prefs.get(ApplicationPreferenceKeys.JUPYTER_NOTEBOOK_DIR, ApplicationPreferenceKeys.JUPYTER_NOTEBOOK_DIR_DEFAULT));
@@ -76,6 +77,7 @@ public void applyChanges() {
7677
prefs.putBoolean(ApplicationPreferenceKeys.AUTOSAVE_ENABLED, applicationOptionsPanel.getAustosaveEnabled());
7778
prefs.putInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, applicationOptionsPanel.getAustosaveFrequency());
7879
prefs.putBoolean(ApplicationPreferenceKeys.WELCOME_ON_STARTUP, applicationOptionsPanel.getWelcomeOnStartup());
80+
prefs.putBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, applicationOptionsPanel.getWhatsNewOnStartup());
7981
prefs.putBoolean(ApplicationPreferenceKeys.FREEZE_GRAPH_VIEW, applicationOptionsPanel.getFreezeGraph());
8082
prefs.putInt(ApplicationPreferenceKeys.WEBSERVER_PORT, applicationOptionsPanel.getWebserverPort());
8183
prefs.put(ApplicationPreferenceKeys.JUPYTER_NOTEBOOK_DIR, applicationOptionsPanel.getNotebookDirectory());
@@ -109,6 +111,7 @@ public boolean isChanged() {
109111
&& applicationOptionsPanel.getAustosaveEnabled() == prefs.getBoolean(ApplicationPreferenceKeys.AUTOSAVE_ENABLED, ApplicationPreferenceKeys.AUTOSAVE_ENABLED_DEFAULT)
110112
&& applicationOptionsPanel.getAustosaveFrequency() == prefs.getInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE_DEFAULT)
111113
&& applicationOptionsPanel.getWelcomeOnStartup() == prefs.getBoolean(ApplicationPreferenceKeys.WELCOME_ON_STARTUP, ApplicationPreferenceKeys.WELCOME_ON_STARTUP_DEFAULT)
114+
&& applicationOptionsPanel.getWhatsNewOnStartup() == prefs.getBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP_DEFAULT)
112115
&& applicationOptionsPanel.getFreezeGraph() == prefs.getBoolean(ApplicationPreferenceKeys.FREEZE_GRAPH_VIEW, ApplicationPreferenceKeys.FREEZE_GRAPH_VIEW_DEFAULT)
113116
&& applicationOptionsPanel.getWebserverPort() == prefs.getInt(ApplicationPreferenceKeys.WEBSERVER_PORT, ApplicationPreferenceKeys.WEBSERVER_PORT_DEFAULT)
114117
&& applicationOptionsPanel.getNotebookDirectory().equals(prefs.get(ApplicationPreferenceKeys.JUPYTER_NOTEBOOK_DIR, ApplicationPreferenceKeys.JUPYTER_NOTEBOOK_DIR_DEFAULT))

CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationPreferenceKeys.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private static String getDefaultUserDir() {
8383
public static final int AUTOSAVE_SCHEDULE_DEFAULT = 5;
8484

8585
/**
86-
* Tutorial window.
86+
* Whats New window.
8787
*/
8888
public static final String TUTORIAL_ON_STARTUP = "tutorialMode";
8989
public static final boolean TUTORIAL_ON_STARTUP_DEFAULT = false;

CorePreferences/src/au/gov/asd/tac/constellation/preferences/Bundle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ApplicationOptionsPanel.autosaveCheckBox.text=Autosave every
1111
ApplicationOptionsPanel.autosaveLabel.text=minutes
1212
ApplicationOptionsPanel.startupPanel.AccessibleContext.accessibleName=Startup
1313
ApplicationOptionsPanel.startupPanel.border.title=Startup
14-
ApplicationOptionsPanel.startupWelcomeCheckbox.text=Display welcome page on startup
14+
ApplicationOptionsPanel.startupWelcomeCheckbox.text=Display Welcome Page on startup
1515
ApplicationOptionsPanel.displayPanel.AccessibleContext.accessibleName=Display
1616
ApplicationOptionsPanel.displayPanel.border.title=Display
1717
ApplicationOptionsPanel.freezeGraphCheckBox.text=Freeze Graph View
@@ -59,3 +59,5 @@ ApplicationFontOptionsPanel.fontSizeSpinner.AccessibleContext.accessibleName=fon
5959
ApplicationFontOptionsPanel.warningLabel1.text=Changes take effect after restarting Constellation.
6060
ApplicationFontOptionsPanel.warningLabel.text=Changes take effect after restarting Constellation.
6161
ApplicationFontOptionsPanel.resetBtn.text=Reset to Defaults
62+
ApplicationOptionsPanel.startupWhatsNewCheckbox.text=Display What's New Page on startup
63+
ApplicationOptionsPanel.startupWhatsNewCheckbox.actionCommand=<ApplicationOptionsPanel.startupWelcomeCheckbox.text>

CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/WhatsNewViewPane.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import au.gov.asd.tac.constellation.functionality.CorePluginRegistry;
1919
import au.gov.asd.tac.constellation.functionality.browser.OpenInBrowserPlugin;
2020
import au.gov.asd.tac.constellation.plugins.PluginExecution;
21+
import au.gov.asd.tac.constellation.preferences.ApplicationPreferenceKeys;
2122
import au.gov.asd.tac.constellation.security.ConstellationSecurityManager;
2223
import au.gov.asd.tac.constellation.utilities.BrandingUtilities;
2324
import au.gov.asd.tac.constellation.utilities.font.FontUtilities;
@@ -28,12 +29,17 @@
2829
import java.util.Collection;
2930
import java.util.Collections;
3031
import java.util.Date;
32+
import java.util.prefs.PreferenceChangeEvent;
33+
import java.util.prefs.PreferenceChangeListener;
34+
import java.util.prefs.Preferences;
3135
import javafx.application.Platform;
36+
import javafx.beans.value.ChangeListener;
3237
import javafx.beans.value.ObservableValue;
3338
import javafx.concurrent.Worker;
3439
import javafx.geometry.Insets;
3540
import javafx.geometry.Orientation;
3641
import javafx.geometry.Pos;
42+
import javafx.scene.control.CheckBox;
3743
import javafx.scene.control.SplitPane;
3844
import javafx.scene.image.Image;
3945
import javafx.scene.image.ImageView;
@@ -49,6 +55,7 @@
4955
import org.openide.util.Exceptions;
5056
import org.openide.util.HelpCtx;
5157
import org.openide.util.Lookup;
58+
import org.openide.util.NbPreferences;
5259
import org.w3c.dom.Document;
5360
import org.w3c.dom.Element;
5461
import org.w3c.dom.NodeList;
@@ -156,6 +163,31 @@ public WhatsNewViewPane() {
156163
rightVBox.setAlignment(Pos.TOP_CENTER);
157164
rightVBox.setMaxWidth(600);
158165
rightVBox.setMinWidth(400);
166+
167+
// Create a checkbox to change users preference regarding showing the Tutorial Page on startup
168+
final Preferences prefs = NbPreferences.forModule(ApplicationPreferenceKeys.class);
169+
final CheckBox showOnStartUpCheckBox = new CheckBox("Show on Startup");
170+
rightVBox.getChildren().add(showOnStartUpCheckBox);
171+
rightVBox.setAlignment(Pos.TOP_RIGHT);
172+
rightVBox.setBackground(new Background(new BackgroundFill(Color.valueOf("#333333"), CornerRadii.EMPTY, Insets.EMPTY)));
173+
rightVBox.paddingProperty().set(new Insets(5, 5, 5, 5));
174+
showOnStartUpCheckBox.selectedProperty().addListener(new ChangeListener<Boolean>() {
175+
@Override
176+
public void changed(ObservableValue<? extends Boolean> ov,
177+
Boolean oldVal, Boolean newVal) {
178+
prefs.putBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, newVal);
179+
}
180+
});
181+
showOnStartUpCheckBox.setSelected(prefs.getBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP_DEFAULT));
182+
183+
// Create a preferenceListener in order to identify when user preference is changed
184+
// Keeps tutorial page and options tutorial selections in-sync when both are open
185+
prefs.addPreferenceChangeListener(new PreferenceChangeListener() {
186+
@Override
187+
public void preferenceChange(PreferenceChangeEvent evt) {
188+
showOnStartUpCheckBox.setSelected(prefs.getBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, showOnStartUpCheckBox.isSelected()));
189+
}
190+
});
159191

160192
//Create images for Left VBox
161193
final ImageView menuImage = new ImageView(new Image(WhatsNewTopComponent.class.getResourceAsStream(MENU_IMAGE)));

0 commit comments

Comments
 (0)