summaryrefslogtreecommitdiffstats
path: root/logo/src/xlogo/gui
diff options
context:
space:
mode:
Diffstat (limited to 'logo/src/xlogo/gui')
-rw-r--r--logo/src/xlogo/gui/components/ColorStyleSelectionPanel.java10
-rw-r--r--logo/src/xlogo/gui/components/X4SGui.java7
-rw-r--r--logo/src/xlogo/gui/preferences/AbstractPanelColor.java4
-rw-r--r--logo/src/xlogo/gui/welcome/WelcomeScreen.java119
-rw-r--r--logo/src/xlogo/gui/welcome/WorkspaceSettings.java14
-rw-r--r--logo/src/xlogo/gui/welcome/settings/tabs/AbstractWorkspacePanel.java86
-rw-r--r--logo/src/xlogo/gui/welcome/settings/tabs/ContestTab.java6
-rw-r--r--logo/src/xlogo/gui/welcome/settings/tabs/SyntaxHighlightingTab.java22
-rw-r--r--logo/src/xlogo/gui/welcome/settings/tabs/WorkspaceTab.java141
9 files changed, 219 insertions, 190 deletions
diff --git a/logo/src/xlogo/gui/components/ColorStyleSelectionPanel.java b/logo/src/xlogo/gui/components/ColorStyleSelectionPanel.java
index 7d9b024..bd5e039 100644
--- a/logo/src/xlogo/gui/components/ColorStyleSelectionPanel.java
+++ b/logo/src/xlogo/gui/components/ColorStyleSelectionPanel.java
@@ -55,13 +55,13 @@ public class ColorStyleSelectionPanel {
private Integer[] intArray = new Integer[17];
private JButton bchoisir = new JButton(
Logo.messages.getString("pref.highlight.other"));
- private JComboBox<Integer> combo_couleur;
+ private JComboBox combo_couleur;
private String[] msg = {
Logo.messages.getString("style.none"),
Logo.messages.getString("style.bold"),
Logo.messages.getString("style.italic"),
Logo.messages.getString("style.underline") };
- private JComboBox<String> style = new JComboBox<>(msg);
+ private JComboBox style = new JComboBox(msg);
private JLabel titre = new JLabel();
private Color couleur_perso = Color.WHITE;
private GridBagLayout gb = new GridBagLayout();
@@ -79,7 +79,7 @@ public class ColorStyleSelectionPanel {
//titre.setFont(font);
titre.setText(title + ":");
- combo_couleur = new JComboBox<>(intArray);
+ combo_couleur = new JComboBox(intArray);
ComboBoxRenderer renderer = new ComboBoxRenderer();
combo_couleur.setRenderer(renderer);
setColorAndStyle(rgb, sty);
@@ -159,7 +159,7 @@ public class ColorStyleSelectionPanel {
DrawPanel.defaultColors[combo_couleur.getSelectedIndex()]);
}
- private class ComboBoxRenderer extends JPanel implements ListCellRenderer<Object> {
+ private class ComboBoxRenderer extends JPanel implements ListCellRenderer {
private static final long serialVersionUID = 1L;
int id = 0;
@@ -168,7 +168,7 @@ public class ColorStyleSelectionPanel {
setPreferredSize(new Dimension(50, 20));
}
- public Component getListCellRendererComponent(JList<?> list, Object value,
+ public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
// Get the selected index. (The index param isn't
// always valid, so just use the value.)
diff --git a/logo/src/xlogo/gui/components/X4SGui.java b/logo/src/xlogo/gui/components/X4SGui.java
index 9aacaae..bef236e 100644
--- a/logo/src/xlogo/gui/components/X4SGui.java
+++ b/logo/src/xlogo/gui/components/X4SGui.java
@@ -67,8 +67,11 @@ public abstract class X4SGui {
stopListenForLanguageChangeEvents();
}
- private PropertyChangeListener languageChangeListener = () -> {
- setText();
+ private PropertyChangeListener languageChangeListener = new PropertyChangeListener(){
+ @Override
+ public void propertyChanged() {
+ setText();
+ }
};
/**
diff --git a/logo/src/xlogo/gui/preferences/AbstractPanelColor.java b/logo/src/xlogo/gui/preferences/AbstractPanelColor.java
index d8b097b..0728e3d 100644
--- a/logo/src/xlogo/gui/preferences/AbstractPanelColor.java
+++ b/logo/src/xlogo/gui/preferences/AbstractPanelColor.java
@@ -47,7 +47,7 @@ public abstract class AbstractPanelColor extends JPanel implements ActionListene
// private ImageIcon[] images=new ImageIcon[17];
private Integer[] intArray = new Integer[17];
private JButton bchoisir = new JButton(Logo.messages.getString("pref.highlight.other"));
- protected JComboBox<Integer> combo_couleur;
+ protected JComboBox combo_couleur;
private Color couleur_perso = Color.WHITE;
public AbstractPanelColor(Color c) {
@@ -55,7 +55,7 @@ public abstract class AbstractPanelColor extends JPanel implements ActionListene
for (int i = 0; i < 17; i++) {
intArray[i] = new Integer(i);
}
- combo_couleur = new JComboBox<>(intArray);
+ combo_couleur = new JComboBox(intArray);
ComboBoxRenderer renderer = new ComboBoxRenderer();
combo_couleur.setRenderer(renderer);
setColorAndStyle(c);
diff --git a/logo/src/xlogo/gui/welcome/WelcomeScreen.java b/logo/src/xlogo/gui/welcome/WelcomeScreen.java
index 61f27b6..b9eb304 100644
--- a/logo/src/xlogo/gui/welcome/WelcomeScreen.java
+++ b/logo/src/xlogo/gui/welcome/WelcomeScreen.java
@@ -32,6 +32,7 @@ import javax.swing.text.JTextComponent;
import java.awt.*;
import java.io.IOException;
+import xlogo.AppSettings.AppProperty;
import xlogo.gui.components.X4SFrame;
import xlogo.interfaces.Observable.PropertyChangeListener;
import xlogo.messages.MessageKeys;
@@ -39,10 +40,10 @@ import xlogo.messages.async.dialog.DialogMessenger;
import xlogo.storage.Storable;
import xlogo.storage.WSManager;
import xlogo.storage.global.GlobalConfig;
-import xlogo.storage.global.GlobalConfig.GlobalProperty;
import xlogo.storage.workspace.WorkspaceConfig;
import xlogo.utils.Utils;
import xlogo.utils.WebPage;
+import xlogo.AppSettings;
import xlogo.Application;
/**
@@ -61,8 +62,8 @@ public class WelcomeScreen extends X4SFrame {
private JLabel workspace;
private JLabel username;
- private JComboBox<String> workspaceSelection;
- private JComboBox<String> userSelection;
+ private JComboBox workspaceSelection;
+ private JComboBox userSelection;
private JButton openWorkspaceSettingsBtn;
private JButton enterButton;
@@ -80,12 +81,13 @@ public class WelcomeScreen extends X4SFrame {
private PropertyChangeListener onWorkspaceListChangeListener;
private PropertyChangeListener onEnterWorkspaceListener;
-
+ private WSManager wsManager;
/**
*
* @param listener to be informed when the user is ready to enter the application
*/
public WelcomeScreen(ActionListener onApplicationEnterListener) {
+ wsManager = WSManager.getInstance();
this.onApplicationEnterListener = onApplicationEnterListener;
}
@@ -102,13 +104,12 @@ public class WelcomeScreen extends X4SFrame {
@Override
public void dispose() {
- try {
- WSManager.getInstance().storeAllSettings();
- }
- catch (IOException e) {
- DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
- translate("storage.could.not.store.gc"));
- }
+ //try {
+ //}
+ //catch (IOException e) {
+ // DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
+ // translate("storage.could.not.store.gc"));
+ //}
super.dispose();
}
@@ -121,8 +122,8 @@ public class WelcomeScreen extends X4SFrame {
workspace = new JLabel("Workspace");
username = new JLabel("User");
- workspaceSelection = new JComboBox<>();
- userSelection = new JComboBox<>();
+ workspaceSelection = new JComboBox();
+ userSelection = new JComboBox();
openWorkspaceSettingsBtn = new JButton("Settings");
enterButton = new JButton("Enter");
@@ -209,24 +210,31 @@ public class WelcomeScreen extends X4SFrame {
@Override
protected void initEventListeners() {
- GlobalConfig gc = WSManager.getGlobalConfig();
-
- onWorkspaceListChangeListener = () -> {
- ignoreGuiEvents = true;
- populateWorkspaceList();
- populateUserList();
- ignoreGuiEvents = false;
+ onWorkspaceListChangeListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ ignoreGuiEvents = true;
+ populateWorkspaceList();
+ populateUserList();
+ ignoreGuiEvents = false;
+ }
};
- onEnterWorkspaceListener = () -> {
- ignoreGuiEvents = true;
- populateWorkspaceList();
- populateUserList();
- ignoreGuiEvents = false;
+ onEnterWorkspaceListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ ignoreGuiEvents = true;
+ populateWorkspaceList();
+ populateUserList();
+ ignoreGuiEvents = false;
+ }
};
-
- gc.addPropertyChangeListener(GlobalProperty.CURRENT_WORKSPACE, onEnterWorkspaceListener);
- gc.addPropertyChangeListener(GlobalProperty.WORKSPACES, onWorkspaceListChangeListener);
+
+ AppSettings as = AppSettings.getInstance();
+ as.addPropertyChangeListener(AppProperty.WORKSPACE, onEnterWorkspaceListener);
+ as.addPropertyChangeListener(AppProperty.WORKSPACE_LIST, onWorkspaceListChangeListener);
workspaceSelection.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e) {
@@ -310,7 +318,7 @@ public class WelcomeScreen extends X4SFrame {
private void populateWorkspaceList() {
GlobalConfig gc = WSManager.getGlobalConfig();
String[] workspaces = gc.getAllWorkspaces();
- workspaceSelection.setModel(new DefaultComboBoxModel<>(workspaces));
+ workspaceSelection.setModel(new DefaultComboBoxModel(workspaces));
selectCurrentWorkspace();
}
@@ -331,21 +339,21 @@ public class WelcomeScreen extends X4SFrame {
} else {
users = new String[0];
}
- userSelection.setModel(new DefaultComboBoxModel<>(users));
+ userSelection.setModel(new DefaultComboBoxModel(users));
userSelection.setSelectedItem(lastUser);
enterButton.setEnabled(lastUser != null && lastUser.length() > 0);
userSelection.setEditable(isUserCreationAllowed);
}
protected void enterWorkspace(String workspaceName) {
- try {
- WSManager.getInstance().enterWorkspace(workspaceName);
+ //try {
+ wsManager.enterWorkspace(workspaceName);
populateUserList();
- }
- catch (IOException e) {
- DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
- translate("ws.settings.could.not.enter.wp") + "\n\n" + e.toString());
- }
+ //}
+ //catch (IOException e) {
+ // DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
+ // translate("ws.settings.could.not.enter.wp") + "\n\n" + e.toString());
+ //}
}
private synchronized void showWorkspaceSettings() {
@@ -411,18 +419,19 @@ public class WelcomeScreen extends X4SFrame {
}
// The following is in case the user entered a new name : Need to create user first
- WorkspaceConfig wc = WSManager.getInstance().getWorkspaceConfigInstance();
- if (!wc.existsUserLogically(username))
- WSManager.getInstance().createUser(username);
-
- try {
- WSManager.getInstance().enterUserSpace(username);
- }
- catch (IOException e) {
- DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
- translate("welcome.could.not.enter.user") + "\n" + e.toString());
- return;
+ WorkspaceConfig wc = WSManager.getWorkspaceConfig();
+ if (!wc.existsUserLogically(username)){
+ wsManager.createUser(username);
}
+
+ //try {
+ wsManager.enterUserSpace(username);
+ //}
+ //catch (IOException e) {
+ // DialogMessenger.getInstance().dispatchMessage(translate("ws.error.title"),
+ // translate("welcome.could.not.enter.user") + "\n" + e.toString());
+ // return;
+ //}
cleanupAfterEnter();
}
@@ -432,12 +441,14 @@ public class WelcomeScreen extends X4SFrame {
// TODO remove each reference to workspace settings
workspaceSettings = null;
}
- WSManager.getGlobalConfig().removePropertyChangeListener(GlobalProperty.CURRENT_WORKSPACE, onEnterWorkspaceListener);
- WSManager.getGlobalConfig().removePropertyChangeListener(GlobalProperty.WORKSPACES, onWorkspaceListChangeListener);
- try {
- WSManager.getInstance().storeAllSettings();
- }
- catch (IOException ignore) { }
+ AppSettings as = AppSettings.getInstance();
+ as.removePropertyChangeListener(AppProperty.WORKSPACE, onEnterWorkspaceListener);
+ as.removePropertyChangeListener(AppProperty.WORKSPACE_LIST, onWorkspaceListChangeListener);
+ //try {
+ wsManager.storeAllSettings();
+ wsManager.enterApplication();
+ //}
+ //catch (IOException ignore) { }
onApplicationEnterListener.actionPerformed(new ActionEvent(this, 0, null));
}
diff --git a/logo/src/xlogo/gui/welcome/WorkspaceSettings.java b/logo/src/xlogo/gui/welcome/WorkspaceSettings.java
index 39b9647..025626c 100644
--- a/logo/src/xlogo/gui/welcome/WorkspaceSettings.java
+++ b/logo/src/xlogo/gui/welcome/WorkspaceSettings.java
@@ -29,7 +29,6 @@ package xlogo.gui.welcome;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
-import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
@@ -39,7 +38,6 @@ import xlogo.gui.welcome.settings.tabs.SyntaxHighlightingTab;
import xlogo.gui.welcome.settings.tabs.ContestTab;
import xlogo.gui.welcome.settings.tabs.GlobalTab;
import xlogo.gui.welcome.settings.tabs.WorkspaceTab;
-import xlogo.messages.async.dialog.DialogMessenger;
import xlogo.storage.WSManager;
import xlogo.utils.Utils;
@@ -84,13 +82,13 @@ public class WorkspaceSettings extends X4SFrame {
@Override
public void dispose()
{
- try {
+ //try {
WSManager.getInstance().storeAllSettings();
- } catch (IOException e) {
- DialogMessenger.getInstance().dispatchMessage(
- translate("ws.error.title"),
- translate("storage.could.not.store.gc"));
- }
+ //} catch (IOException e) {
+ // DialogMessenger.getInstance().dispatchMessage(
+ // translate("ws.error.title"),
+ // translate("storage.could.not.store.gc"));
+ //}
listener.actionPerformed(null);
super.dispose();
diff --git a/logo/src/xlogo/gui/welcome/settings/tabs/AbstractWorkspacePanel.java b/logo/src/xlogo/gui/welcome/settings/tabs/AbstractWorkspacePanel.java
index 6dc6835..b0eb029 100644
--- a/logo/src/xlogo/gui/welcome/settings/tabs/AbstractWorkspacePanel.java
+++ b/logo/src/xlogo/gui/welcome/settings/tabs/AbstractWorkspacePanel.java
@@ -30,19 +30,19 @@ package xlogo.gui.welcome.settings.tabs;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
-import java.io.IOException;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
+import xlogo.AppSettings;
+import xlogo.AppSettings.AppProperty;
import xlogo.gui.components.X4SComponent;
import xlogo.interfaces.Observable.PropertyChangeListener;
import xlogo.messages.async.dialog.DialogMessenger;
import xlogo.storage.Storable;
import xlogo.storage.WSManager;
import xlogo.storage.global.GlobalConfig;
-import xlogo.storage.global.GlobalConfig.GlobalProperty;
import xlogo.storage.workspace.WorkspaceConfig;
public abstract class AbstractWorkspacePanel extends X4SComponent{
@@ -50,7 +50,7 @@ public abstract class AbstractWorkspacePanel extends X4SComponent{
private PropertyChangeListener enterWorkspaceListener;
private PropertyChangeListener workspaceListChangeListener;
- protected abstract JComboBox<String> getWorkspaceSelection();
+ protected abstract JComboBox getWorkspaceSelection();
private boolean ignoreGuiEvents = false;
@@ -72,37 +72,42 @@ public abstract class AbstractWorkspacePanel extends X4SComponent{
}
});
- enterWorkspaceListener = () -> {
- ignoreGuiEvents = true;
- if (WSManager.getWorkspaceConfig() != null){
- enableComponents();
- } else {
- disableComponents();
+ enterWorkspaceListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ ignoreGuiEvents = true;
+ if (WSManager.getWorkspaceConfig() != null){
+ enableComponents();
+ } else {
+ disableComponents();
+ }
+ selectCurrentWorkspace();
+ ignoreGuiEvents = false;
}
- selectCurrentWorkspace();
- ignoreGuiEvents = false;
};
- workspaceListChangeListener = () -> {
- ignoreGuiEvents = true;
- populateWorkspaceList();
- ignoreGuiEvents = false;
+ workspaceListChangeListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ ignoreGuiEvents = true;
+ populateWorkspaceList();
+ ignoreGuiEvents = false;
+ }
};
-
- final GlobalConfig gc = WSManager.getGlobalConfig();
-
- gc.addPropertyChangeListener(GlobalProperty.WORKSPACES, workspaceListChangeListener);
-
- gc.addPropertyChangeListener(GlobalProperty.CURRENT_WORKSPACE, enterWorkspaceListener);
+ AppSettings as = AppSettings.getInstance();
+ as.addPropertyChangeListener(AppProperty.WORKSPACE_LIST, workspaceListChangeListener);
+ as.addPropertyChangeListener(AppProperty.WORKSPACE, enterWorkspaceListener);
}
@Override
public void stopEventListeners()
{
super.stopEventListeners();
- GlobalConfig gc = WSManager.getGlobalConfig();
- gc.removePropertyChangeListener(GlobalProperty.WORKSPACES, workspaceListChangeListener);
- gc.removePropertyChangeListener(GlobalProperty.CURRENT_WORKSPACE, enterWorkspaceListener);
+ AppSettings as = AppSettings.getInstance();
+ as.removePropertyChangeListener(AppProperty.WORKSPACE_LIST, workspaceListChangeListener);
+ as.removePropertyChangeListener(AppProperty.WORKSPACE, enterWorkspaceListener);
}
protected abstract void setValues();
@@ -114,7 +119,7 @@ public abstract class AbstractWorkspacePanel extends X4SComponent{
protected void populateWorkspaceList() {
GlobalConfig gc = WSManager.getGlobalConfig();
String[] workspaces = gc.getAllWorkspaces();
- getWorkspaceSelection().setModel(new DefaultComboBoxModel<String>(workspaces));
+ getWorkspaceSelection().setModel(new DefaultComboBoxModel(workspaces));
selectCurrentWorkspace();
}
@@ -194,24 +199,19 @@ public abstract class AbstractWorkspacePanel extends X4SComponent{
}
protected void enterWorkspace(String wsName) {
- try {
- // enter workspace
- WSManager.getInstance().enterWorkspace(wsName);
- WorkspaceConfig wc = WSManager.getInstance().getWorkspaceConfigInstance();
- if (wc == null)
- {
- disableComponents();
- return;
- }
- enableComponents();
- setValues();
- } catch (IOException e) {
+ // enter workspace
+ WSManager.getInstance().enterWorkspace(wsName);
+ WorkspaceConfig wc = WSManager.getInstance().getWorkspaceConfigInstance();
+ if (wc == null)
+ {
+ disableComponents();
DialogMessenger.getInstance().dispatchMessage(
translate("ws.error.title"),
- translate("ws.settings.could.not.enter.wp") + e.toString());
- disableComponents();
+ translate("ws.settings.could.not.enter.wp"));
+ return;
}
-
+ enableComponents();
+ setValues();
}
protected void addWorkspace() {
@@ -262,15 +262,15 @@ public abstract class AbstractWorkspacePanel extends X4SComponent{
return;
}
// dir exists & wsName doesn't exist yet => fine to create WS now
- try {
+ //try {
WSManager.getInstance().createWorkspace(dir, wsName);
populateWorkspaceList();
- } catch (IOException e) {
+ /*} catch (IOException e) {
DialogMessenger.getInstance().dispatchMessage(
translate("ws.error.title"),
translate("ws.settings.could.not.create.ws"));
return;
- }
+ }*/
}
diff --git a/logo/src/xlogo/gui/welcome/settings/tabs/ContestTab.java b/logo/src/xlogo/gui/welcome/settings/tabs/ContestTab.java
index 9583de5..7b8c0db 100644
--- a/logo/src/xlogo/gui/welcome/settings/tabs/ContestTab.java
+++ b/logo/src/xlogo/gui/welcome/settings/tabs/ContestTab.java
@@ -46,7 +46,7 @@ public class ContestTab extends AbstractWorkspacePanel {
JPanel component;
JLabel workspaceLabel;
- JComboBox<String> workspaceSelection;
+ JComboBox workspaceSelection;
JLabel nOfFilesLabel;
JSpinner nOfFileSpinner;
JLabel nOfBonusFilesLabel;
@@ -58,7 +58,7 @@ public class ContestTab extends AbstractWorkspacePanel {
}
@Override
- protected JComboBox<String> getWorkspaceSelection() {
+ protected JComboBox getWorkspaceSelection() {
return workspaceSelection;
}
@@ -76,7 +76,7 @@ public class ContestTab extends AbstractWorkspacePanel {
component = new JPanel();
workspaceLabel = new JLabel();
- workspaceSelection = new JComboBox<>();
+ workspaceSelection = new JComboBox();
nOfFilesLabel = new JLabel();
nOfFileSpinner = new JSpinner(new SpinnerNumberModel(contestFiles, 0, 100, 1));
diff --git a/logo/src/xlogo/gui/welcome/settings/tabs/SyntaxHighlightingTab.java b/logo/src/xlogo/gui/welcome/settings/tabs/SyntaxHighlightingTab.java
index 025135f..1b6c27a 100644
--- a/logo/src/xlogo/gui/welcome/settings/tabs/SyntaxHighlightingTab.java
+++ b/logo/src/xlogo/gui/welcome/settings/tabs/SyntaxHighlightingTab.java
@@ -54,7 +54,7 @@ public class SyntaxHighlightingTab extends AbstractWorkspacePanel{
private JPanel component;
private JLabel workspaceLabel;
- private JComboBox<String> workspaceSelection;
+ private JComboBox workspaceSelection;
private ColorStyleSelectionPanel commentStyleSelection;
private ColorStyleSelectionPanel braceStyleSelection;
private ColorStyleSelectionPanel primitiveStyleSelection;
@@ -85,7 +85,7 @@ public class SyntaxHighlightingTab extends AbstractWorkspacePanel{
//Font font = wc.getFont();
component = new JPanel();
workspaceLabel = new JLabel();
- workspaceSelection = new JComboBox<>();
+ workspaceSelection = new JComboBox();
commentStyleSelection=new ColorStyleSelectionPanel(syntaxHighlighting.getCommentColor(), syntaxHighlighting.getCommentStyle(), translate("pref.highlight.comment"));
braceStyleSelection=new ColorStyleSelectionPanel(syntaxHighlighting.getBraceColor(), syntaxHighlighting.getBraceStyle(), translate("pref.highlight.parenthesis"));
primitiveStyleSelection=new ColorStyleSelectionPanel(syntaxHighlighting.getPrimitiveColor(), syntaxHighlighting.getPrimitiveStyle(), translate("pref.highlight.primitive"));
@@ -191,14 +191,22 @@ public class SyntaxHighlightingTab extends AbstractWorkspacePanel{
}
});
- logoLanguageChangeListener = () -> {
- updateLogoLanguage();
+ logoLanguageChangeListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ updateLogoLanguage();
+ }
};
AppSettings.getInstance().addPropertyChangeListener(AppProperty.LOGO_LANGUAGE, logoLanguageChangeListener);
- syntaxHighlightChangeListener = () -> {
- updateSyntaxHighlightingPreview();
+ syntaxHighlightChangeListener = new PropertyChangeListener(){
+
+ @Override
+ public void propertyChanged() {
+ updateSyntaxHighlightingPreview();
+ }
};
AppSettings.getInstance().addPropertyChangeListener(AppProperty.SYNTAX_HIGHLIGHTING, syntaxHighlightChangeListener);
@@ -248,7 +256,7 @@ public class SyntaxHighlightingTab extends AbstractWorkspacePanel{
}
@Override
- protected JComboBox<String> getWorkspaceSelection() {
+ protected JComboBox getWorkspaceSelection() {
return workspaceSelection;
}
diff --git a/logo/src/xlogo/gui/welcome/settings/tabs/WorkspaceTab.java b/logo/src/xlogo/gui/welcome/settings/tabs/WorkspaceTab.java
index 3651568..431bebd 100644
--- a/logo/src/xlogo/gui/welcome/settings/tabs/WorkspaceTab.java
+++ b/logo/src/xlogo/gui/welcome/settings/tabs/WorkspaceTab.java
@@ -50,32 +50,32 @@ import xlogo.storage.workspace.WorkspaceConfig;
public class WorkspaceTab extends AbstractWorkspacePanel {
- JPanel component;
+ JPanel component;
- JLabel workspaceLabel;
- JLabel wsLocationLabel;
- JLabel wsLanguageLabel;
- JLabel wsLogoLanguageLabel;
- JLabel wsBackupLabel;
- JLabel userLabel;
+ JLabel workspaceLabel;
+ JLabel wsLocationLabel;
+ JLabel wsLanguageLabel;
+ JLabel wsLogoLanguageLabel;
+ JLabel wsBackupLabel;
+ JLabel userLabel;
- JButton addWorkspaceBtn;
- JButton addUserBtn;
+ JButton addWorkspaceBtn;
+ JButton addUserBtn;
- JButton removeWorkspaceBtn;
- JButton removeUserBtn;
+ JButton removeWorkspaceBtn;
+ JButton removeUserBtn;
- JButton importWorkspaceBtn;
- JButton importUserBtn;
+ JButton importWorkspaceBtn;
+ JButton importUserBtn;
- JComboBox<String> workspaceSelection;
- JComboBox<String> userSelection;
- JLabel wsLocation;
- JFileChooser wsLocationChooser;
- JComboBox<Language> languageSelection;
- JComboBox<LogoLanguage> logoLanguageSelection;
- JComboBox<NumberOfBackups> nOfBackupsSelection;
- JCheckBox userCreatable;
+ JComboBox workspaceSelection;
+ JComboBox userSelection;
+ JLabel wsLocation;
+ JFileChooser wsLocationChooser;
+ JComboBox languageSelection;
+ JComboBox logoLanguageSelection;
+ JComboBox nOfBackupsSelection;
+ JCheckBox userCreatable;
public WorkspaceTab() {
super();
@@ -87,7 +87,7 @@ public class WorkspaceTab extends AbstractWorkspacePanel {
}
@Override
- protected JComboBox<String> getWorkspaceSelection() {
+ protected JComboBox getWorkspaceSelection() {
return workspaceSelection;
}
@@ -111,21 +111,22 @@ public class WorkspaceTab extends AbstractWorkspacePanel {
importWorkspaceBtn = new JButton("Import");
importUserBtn = new JButton("Import");
- workspaceSelection = new JComboBox<>();
- userSelection = new JComboBox<>();
+ workspaceSelection = new JComboBox();
+ userSelection = new JComboBox();
wsLocation = new JLabel();
wsLocationChooser = new JFileChooser();
- languageSelection = new JComboBox<>(Language.values());
- logoLanguageSelection = new JComboBox<>(LogoLanguage.values());
- nOfBackupsSelection = new JComboBox<>(NumberOfBackups.values());
+ languageSelection = new JComboBox(Language.values());
+ logoLanguageSelection = new JComboBox(LogoLanguage.values());
+ nOfBackupsSelection = new JComboBox(NumberOfBackups.values());
userCreatable = new JCheckBox("Allow the users to create new user accounts?");
populateWorkspaceList();
setValues();
- if (WSManager.getWorkspaceConfig() == null){
+ if (WSManager.getWorkspaceConfig() == null) {
disableComponents();
- } else {
+ }
+ else {
enableComponents();
}
}
@@ -195,41 +196,49 @@ public class WorkspaceTab extends AbstractWorkspacePanel {
.addComponent(nOfBackupsSelection))
.addGroup(groupLayout.createParallelGroup().addComponent(userCreatable)));
- groupLayout.setHorizontalGroup(groupLayout
- .createParallelGroup()
- .addGroup(
- groupLayout
- .createSequentialGroup()
- .addGroup(
- groupLayout.createParallelGroup().addComponent(workspaceLabel)
- .addComponent(userLabel).addComponent(wsLocationLabel)
- .addComponent(wsLanguageLabel).addComponent(wsLogoLanguageLabel)
- .addComponent(wsBackupLabel))
- .addGroup(
- groupLayout
- .createParallelGroup()
- .addGroup(
- groupLayout
- .createSequentialGroup()
- .addGroup(
- groupLayout.createParallelGroup()
- .addComponent(workspaceSelection)
- .addComponent(userSelection))
- .addGroup(
- groupLayout.createParallelGroup()
- .addComponent(addWorkspaceBtn)
- .addComponent(addUserBtn))
- .addGroup(
- groupLayout.createParallelGroup()
- .addComponent(removeWorkspaceBtn)
- .addComponent(removeUserBtn))
- .addGroup(
- groupLayout.createParallelGroup()
- .addComponent(importWorkspaceBtn)
- .addComponent(importUserBtn)))
- .addComponent(wsLocation)
- .addComponent(languageSelection).addComponent(logoLanguageSelection)
- .addComponent(nOfBackupsSelection))).addComponent(userCreatable));
+ groupLayout
+ .setHorizontalGroup(groupLayout
+ .createParallelGroup()
+ .addGroup(
+ groupLayout
+ .createSequentialGroup()
+ .addGroup(
+ groupLayout.createParallelGroup().addComponent(workspaceLabel)
+ .addComponent(userLabel).addComponent(wsLocationLabel)
+ .addComponent(wsLanguageLabel)
+ .addComponent(wsLogoLanguageLabel).addComponent(wsBackupLabel))
+ .addGroup(
+ groupLayout
+ .createParallelGroup()
+ .addGroup(
+ groupLayout
+ .createSequentialGroup()
+ .addGroup(
+ groupLayout
+ .createParallelGroup()
+ .addComponent(
+ workspaceSelection)
+ .addComponent(userSelection))
+ .addGroup(
+ groupLayout.createParallelGroup()
+ .addComponent(addWorkspaceBtn)
+ .addComponent(addUserBtn))
+ .addGroup(
+ groupLayout
+ .createParallelGroup()
+ .addComponent(
+ removeWorkspaceBtn)
+ .addComponent(removeUserBtn))
+ .addGroup(
+ groupLayout
+ .createParallelGroup()
+ .addComponent(
+ importWorkspaceBtn)
+ .addComponent(importUserBtn)))
+ .addComponent(wsLocation).addComponent(languageSelection)
+ .addComponent(logoLanguageSelection)
+ .addComponent(nOfBackupsSelection)))
+ .addComponent(userCreatable));
}
@Override
@@ -317,7 +326,7 @@ public class WorkspaceTab extends AbstractWorkspacePanel {
}).run();
}
});
-
+
/*
* LOGO LANGUAGE
*/
@@ -435,7 +444,7 @@ public class WorkspaceTab extends AbstractWorkspacePanel {
private void populateUserList() {
WorkspaceConfig wc = WSManager.getInstance().getWorkspaceConfigInstance();
String[] users = wc.getUserList();
- userSelection.setModel(new DefaultComboBoxModel<String>(users));
+ userSelection.setModel(new DefaultComboBoxModel(users));
//try {
//wc.enterInitialUserSpace(); // TODO maybe we still need this?
String lastUser = wc.getLastActiveUser();