diff --git a/diylc/diylc-swing/pom.xml b/diylc/diylc-swing/pom.xml
index 5c2c12d9..67ce10f2 100644
--- a/diylc/diylc-swing/pom.xml
+++ b/diylc/diylc-swing/pom.xml
@@ -836,7 +836,7 @@
-
+
@@ -1027,22 +1027,22 @@
-
+
-
-
+
-
-
+
@@ -1150,7 +1150,7 @@
-
+
diff --git a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPane.java b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPane.java
index 53b1c326..2e75b355 100644
--- a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPane.java
+++ b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPane.java
@@ -13,6 +13,8 @@ import org.diylc.swing.ISwingUI;
import org.diylc.utils.FileUtils;
import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
import java.awt.*;
import java.util.List;
import java.util.Objects;
@@ -26,6 +28,7 @@ public class ChatbotPane extends JPanel {
public static final String ME = "Me: ";
public static final String AI_ASSISTANT = "AI Assistant: ";
public static final String FREE_TIER = "Free";
+ public static final String GET_PREMIUM_URL = "www.diy-fever.com/get-premium";
public static Font DEFAULT_FONT = new Font("Square721 BT", Font.PLAIN, 12);
private static final Font MONOSPACED_FONT = new Font("Monospaced", Font.PLAIN, 12);
@@ -35,7 +38,10 @@ public class ChatbotPane extends JPanel {
"", MONOSPACED_FONT.getFamily(),
+ ".temporary { color: #555555; }" +
+ "a { color: #C678DD; text-decoration: none; }" + // Purple link color
+ "a:hover { color: #E06C75; text-decoration: underline; }" + // Red hover color
+ "", MONOSPACED_FONT.getFamily(),
MONOSPACED_FONT.getSize(), TERMINAL_FG.getRed(), TERMINAL_FG.getGreen(),
TERMINAL_FG.getBlue(), TERMINAL_BG.getRed(), TERMINAL_BG.getGreen(), TERMINAL_BG.getBlue());
private static final Color PROMPT_BG = new Color(60, 60, 60); // Slightly brighter than TERMINAL_BG
@@ -245,13 +251,25 @@ public class ChatbotPane extends JPanel {
} else {
if (subscriptionInfo != null) {
getPremiumButton().setVisible(FREE_TIER.equals(subscriptionInfo.getTier()));
- appendSection(ChatbotService.SYSTEM,
- "Your are currently subscribed to the '" + subscriptionInfo.getTier() + "' tier, expiring on " + subscriptionInfo.getEndDate() + ", with " + subscriptionInfo.getRemainingCredits() + " credits remaining.");
+ String subscriptionInfoText = "Your are currently subscribed to the '" + subscriptionInfo.getTier() + "' tier, expiring on " + subscriptionInfo.getEndDate() + ", with " + subscriptionInfo.getRemainingCredits() + " credits remaining.";
+
+ if (FREE_TIER.equals(subscriptionInfo.getTier())) {
+ subscriptionInfoText +=
+ " To subscribe to the Premium tier, unlock advanced AI models and virtually limitless usage, visit " + GET_PREMIUM_URL + ".";
+ }
+ appendSection(ChatbotService.SYSTEM, subscriptionInfoText);
}
fetchChatHistory();
getAskButton().setEnabled(true);
getClearButton().setEnabled(true);
}
+
+ // Scroll to the end of the chat pane
+ SwingUtilities.invokeLater(() -> {
+ JScrollPane scrollPane = (JScrollPane) getChatEditorPane().getParent().getParent();
+ JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
+ verticalScrollBar.setValue(verticalScrollBar.getMaximum());
+ });
}
private void fetchChatHistory() {
@@ -278,6 +296,22 @@ public class ChatbotPane extends JPanel {
chatEditorPane.setContentType("text/html");
chatEditorPane.setText(HTML_STYLE + "");
+ chatEditorPane.addHyperlinkListener(new HyperlinkListener() {
+
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent hle) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
+ System.out.println(hle.getURL());
+ Desktop desktop = Desktop.getDesktop();
+ try {
+ desktop.browse(hle.getURL().toURI());
+ } catch (Exception ex) {
+ LOG.error("Could not open link: " + hle.getURL(), ex);
+ }
+ }
+ }
+ });
+
refreshChat(null);
}
return chatEditorPane;
diff --git a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPlugin.java b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPlugin.java
index 8720c095..644bfb0f 100644
--- a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPlugin.java
+++ b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/chatbot/ChatbotPlugin.java
@@ -58,10 +58,12 @@ public class ChatbotPlugin implements IPlugIn {
switch (eventType) {
case FILE_STATUS_CHANGED:
case PROJECT_LOADED:
+ getChatbotPane().refreshChat(null);
+ break;
case CLOUD_LOGGED_IN:
case CLOUD_LOGGED_OUT:
SubscriptionEntity subscriptionInfo = null;
- if (params.length > 0) {
+ if (params.length > 0 && params[0] instanceof SubscriptionEntity) {
subscriptionInfo = (SubscriptionEntity) params[0];
}
getChatbotPane().refreshChat(subscriptionInfo);
diff --git a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/CloudPlugIn.java b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/CloudPlugIn.java
index 7f91b674..c3cae366 100644
--- a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/CloudPlugIn.java
+++ b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/CloudPlugIn.java
@@ -1,225 +1,225 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
-package org.diylc.swing.plugins.cloud;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.ListIterator;
-import javax.imageio.ImageIO;
-import javax.swing.AbstractAction;
-import org.apache.log4j.Logger;
-import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
-import org.diylc.plugins.cloud.service.CloudService;
-import org.diylc.swingframework.ButtonDialog;
-
-import org.diylc.common.EventType;
-import org.diylc.common.IPlugIn;
-import org.diylc.common.IPlugInPort;
-import org.diylc.common.ITask;
-import org.diylc.core.IView;
-import org.diylc.plugins.cloud.service.CloudException;
-import org.diylc.presenter.Presenter;
-import org.diylc.swing.ISwingUI;
-import org.diylc.swing.gui.DialogFactory;
-import org.diylc.swing.gui.DummyView;
-import org.diylc.utils.IconLoader;
-import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
-import org.diylc.swing.plugins.cloud.view.LoginDialog;
-import org.diylc.swing.plugins.cloud.view.UploadDialog;
-import org.diylc.swing.plugins.cloud.view.UserEditDialog;
-import org.diylc.swing.plugins.cloud.view.browser.CloudBrowserFrame;
-import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
-import org.diylc.swing.plugins.file.FileFilterEnum;
-import org.diylc.swing.plugins.cloud.actions.*;
-
-public class CloudPlugIn implements IPlugIn {
-
- private static final String ONLINE_TITLE = "Cloud";
-
- private final static Logger LOG = Logger.getLogger(CloudPlugIn.class);
-
- private ISwingUI swingUI;
- private IPlugInPort plugInPort;
- private IPlugInPort thumbnailPresenter;
- private ThumbnailGenerator thumbnailGenerator;
- private CloudService cloudService;
-
- private LibraryAction libraryAction;
- private LoginAction loginAction;
- private LogOutAction logOutAction;
- private CreateAccountAction createAccountAction;
- private ManageAccountAction manageAccountAction;
- private UploadAction uploadAction;
- private ChangePasswordAction changePasswordAction;
- private ManageProjectsAction manageProjectsAction;
-
- private CloudBrowserFrame cloudBrowser;
-
- public CloudPlugIn(ISwingUI swingUI) {
- super();
-
- this.swingUI = swingUI;
- this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
- this.thumbnailGenerator = new ThumbnailGenerator(thumbnailPresenter);
-
- // Initialize actions
- this.libraryAction = new LibraryAction(this);
- this.loginAction = new LoginAction(this);
- this.logOutAction = new LogOutAction(this);
- this.createAccountAction = new CreateAccountAction(this);
- this.manageAccountAction = new ManageAccountAction(this);
- this.uploadAction = new UploadAction(this);
- this.changePasswordAction = new ChangePasswordAction(this);
- this.manageProjectsAction = new ManageProjectsAction(this);
-
- swingUI.injectMenuAction(getLibraryAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(null, ONLINE_TITLE);
- swingUI.injectMenuAction(getLoginAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(getCreateAccountAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(null, ONLINE_TITLE);
- swingUI.injectMenuAction(getUploadAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(getManageProjectsAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(null, ONLINE_TITLE);
- swingUI.injectMenuAction(getManageAccountAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(getChangePasswordAction(), ONLINE_TITLE);
- swingUI.injectMenuAction(getLogOutAction(), ONLINE_TITLE);
-
- // default state
- getUploadAction().setEnabled(false);
- getManageProjectsAction().setEnabled(false);
- getManageAccountAction().setEnabled(false);
- getChangePasswordAction().setEnabled(false);
- getLogOutAction().setEnabled(false);
- }
-
- @Override
- public void connect(IPlugInPort plugInPort) {
- this.plugInPort = plugInPort;
- this.cloudService = plugInPort.getCloudService();
- }
-
- public CloudBrowserFrame getCloudBrowser() {
- if (cloudBrowser == null) {
- cloudBrowser = new CloudBrowserFrame(swingUI, plugInPort);
- }
- return cloudBrowser;
- }
-
- public UploadManagerFrame createUploadManagerFrame() {
- return new UploadManagerFrame(swingUI, plugInPort);
- }
-
- public LibraryAction getLibraryAction() {
- return libraryAction;
- }
-
- public LoginAction getLoginAction() {
- return loginAction;
- }
-
- public LogOutAction getLogOutAction() {
- return logOutAction;
- }
-
- public CreateAccountAction getCreateAccountAction() {
- return createAccountAction;
- }
-
- public ManageAccountAction getManageAccountAction() {
- return manageAccountAction;
- }
-
- public UploadAction getUploadAction() {
- return uploadAction;
- }
-
- public ChangePasswordAction getChangePasswordAction() {
- return changePasswordAction;
- }
-
- public ManageProjectsAction getManageProjectsAction() {
- return manageProjectsAction;
- }
-
- @Override
- public EnumSet getSubscribedEventTypes() {
- return EnumSet.of(EventType.CLOUD_LOGGED_IN, EventType.CLOUD_LOGGED_OUT);
- }
-
- @Override
- public void processMessage(EventType eventType, Object... params) {
- switch (eventType) {
- case CLOUD_LOGGED_IN:
- loggedIn();
- break;
- case CLOUD_LOGGED_OUT:
- loggedOut();
- break;
- }
- }
-
- public void loggedIn() {
- getLoginAction().setEnabled(false);
- getCreateAccountAction().setEnabled(false);
-
- getLogOutAction().setEnabled(true);
- getManageAccountAction().setEnabled(true);
- getUploadAction().setEnabled(true);
- getManageProjectsAction().setEnabled(true);
- getChangePasswordAction().setEnabled(true);
- }
-
- public void loggedOut() {
- getLoginAction().setEnabled(true);
- getCreateAccountAction().setEnabled(true);
-
- getLogOutAction().setEnabled(false);
- getManageAccountAction().setEnabled(false);
- getUploadAction().setEnabled(false);
- getManageProjectsAction().setEnabled(false);
- getChangePasswordAction().setEnabled(false);
- }
-
- // Getters for action classes
- public ISwingUI getSwingUI() {
- return swingUI;
- }
-
- public IPlugInPort getPlugInPort() {
- return plugInPort;
- }
-
- public IPlugInPort getThumbnailPresenter() {
- return thumbnailPresenter;
- }
-
- public ThumbnailGenerator getThumbnailGenerator() {
- return thumbnailGenerator;
- }
-
- public CloudService getCloudService() {
- return cloudService;
- }
-}
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
+package org.diylc.swing.plugins.cloud;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.ListIterator;
+import javax.imageio.ImageIO;
+import javax.swing.AbstractAction;
+import org.apache.log4j.Logger;
+import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
+import org.diylc.plugins.cloud.service.CloudService;
+import org.diylc.swingframework.ButtonDialog;
+
+import org.diylc.common.EventType;
+import org.diylc.common.IPlugIn;
+import org.diylc.common.IPlugInPort;
+import org.diylc.common.ITask;
+import org.diylc.core.IView;
+import org.diylc.plugins.cloud.service.CloudException;
+import org.diylc.presenter.Presenter;
+import org.diylc.swing.ISwingUI;
+import org.diylc.swing.gui.DialogFactory;
+import org.diylc.swing.gui.DummyView;
+import org.diylc.utils.IconLoader;
+import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
+import org.diylc.swing.plugins.cloud.view.LoginDialog;
+import org.diylc.swing.plugins.cloud.view.UploadDialog;
+import org.diylc.swing.plugins.cloud.view.UserEditDialog;
+import org.diylc.swing.plugins.cloud.view.browser.CloudBrowserFrame;
+import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
+import org.diylc.swing.plugins.file.FileFilterEnum;
+import org.diylc.swing.plugins.cloud.actions.*;
+
+public class CloudPlugIn implements IPlugIn {
+
+ private static final String ONLINE_TITLE = "Cloud";
+
+ private final static Logger LOG = Logger.getLogger(CloudPlugIn.class);
+
+ private ISwingUI swingUI;
+ private IPlugInPort plugInPort;
+ private IPlugInPort thumbnailPresenter;
+ private ThumbnailGenerator thumbnailGenerator;
+ private CloudService cloudService;
+
+ private LibraryAction libraryAction;
+ private LoginAction loginAction;
+ private LogOutAction logOutAction;
+ private CreateAccountAction createAccountAction;
+ private ManageAccountAction manageAccountAction;
+ private UploadAction uploadAction;
+ private ChangePasswordAction changePasswordAction;
+ private ManageProjectsAction manageProjectsAction;
+
+ private CloudBrowserFrame cloudBrowser;
+
+ public CloudPlugIn(ISwingUI swingUI) {
+ super();
+
+ this.swingUI = swingUI;
+ this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
+ this.thumbnailGenerator = new ThumbnailGenerator(thumbnailPresenter);
+
+ // Initialize actions
+ this.libraryAction = new LibraryAction(this);
+ this.loginAction = new LoginAction(this);
+ this.logOutAction = new LogOutAction(this);
+ this.createAccountAction = new CreateAccountAction(this);
+ this.manageAccountAction = new ManageAccountAction(this);
+ this.uploadAction = new UploadAction(this);
+ this.changePasswordAction = new ChangePasswordAction(this);
+ this.manageProjectsAction = new ManageProjectsAction(this);
+
+ swingUI.injectMenuAction(getLibraryAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(null, ONLINE_TITLE);
+ swingUI.injectMenuAction(getLoginAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(getCreateAccountAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(null, ONLINE_TITLE);
+ swingUI.injectMenuAction(getUploadAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(getManageProjectsAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(null, ONLINE_TITLE);
+ swingUI.injectMenuAction(getManageAccountAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(getChangePasswordAction(), ONLINE_TITLE);
+ swingUI.injectMenuAction(getLogOutAction(), ONLINE_TITLE);
+
+ // default state
+ getUploadAction().setEnabled(false);
+ getManageProjectsAction().setEnabled(false);
+ getManageAccountAction().setEnabled(false);
+ getChangePasswordAction().setEnabled(false);
+ getLogOutAction().setEnabled(false);
+ }
+
+ @Override
+ public void connect(IPlugInPort plugInPort) {
+ this.plugInPort = plugInPort;
+ this.cloudService = plugInPort.getCloudService();
+ }
+
+ public CloudBrowserFrame getCloudBrowser() {
+ if (cloudBrowser == null) {
+ cloudBrowser = new CloudBrowserFrame(swingUI, plugInPort);
+ }
+ return cloudBrowser;
+ }
+
+ public UploadManagerFrame createUploadManagerFrame() {
+ return new UploadManagerFrame(swingUI, plugInPort);
+ }
+
+ public LibraryAction getLibraryAction() {
+ return libraryAction;
+ }
+
+ public LoginAction getLoginAction() {
+ return loginAction;
+ }
+
+ public LogOutAction getLogOutAction() {
+ return logOutAction;
+ }
+
+ public CreateAccountAction getCreateAccountAction() {
+ return createAccountAction;
+ }
+
+ public ManageAccountAction getManageAccountAction() {
+ return manageAccountAction;
+ }
+
+ public UploadAction getUploadAction() {
+ return uploadAction;
+ }
+
+ public ChangePasswordAction getChangePasswordAction() {
+ return changePasswordAction;
+ }
+
+ public ManageProjectsAction getManageProjectsAction() {
+ return manageProjectsAction;
+ }
+
+ @Override
+ public EnumSet getSubscribedEventTypes() {
+ return EnumSet.of(EventType.CLOUD_LOGGED_IN, EventType.CLOUD_LOGGED_OUT);
+ }
+
+ @Override
+ public void processMessage(EventType eventType, Object... params) {
+ switch (eventType) {
+ case CLOUD_LOGGED_IN:
+ loggedIn();
+ break;
+ case CLOUD_LOGGED_OUT:
+ loggedOut();
+ break;
+ }
+ }
+
+ public void loggedIn() {
+ getLoginAction().setEnabled(false);
+ getCreateAccountAction().setEnabled(false);
+
+ getLogOutAction().setEnabled(true);
+ getManageAccountAction().setEnabled(true);
+ getUploadAction().setEnabled(true);
+ getManageProjectsAction().setEnabled(true);
+ getChangePasswordAction().setEnabled(true);
+ }
+
+ public void loggedOut() {
+ getLoginAction().setEnabled(true);
+ getCreateAccountAction().setEnabled(true);
+
+ getLogOutAction().setEnabled(false);
+ getManageAccountAction().setEnabled(false);
+ getUploadAction().setEnabled(false);
+ getManageProjectsAction().setEnabled(false);
+ getChangePasswordAction().setEnabled(false);
+ }
+
+ // Getters for action classes
+ public ISwingUI getSwingUI() {
+ return swingUI;
+ }
+
+ public IPlugInPort getPlugInPort() {
+ return plugInPort;
+ }
+
+ public IPlugInPort getThumbnailPresenter() {
+ return thumbnailPresenter;
+ }
+
+ public ThumbnailGenerator getThumbnailGenerator() {
+ return thumbnailGenerator;
+ }
+
+ public CloudService getCloudService() {
+ return cloudService;
+ }
+}
diff --git a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/view/UserEditDialog.java b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/view/UserEditDialog.java
index fb4e3f7a..3eec7366 100644
--- a/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/view/UserEditDialog.java
+++ b/diylc/diylc-swing/src/main/java/org/diylc/swing/plugins/cloud/view/UserEditDialog.java
@@ -1,345 +1,345 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
-package org.diylc.swing.plugins.cloud.view;
-
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-import org.diylc.swingframework.ButtonDialog;
-
-import org.diylc.plugins.cloud.model.UserEntity;
-import org.diylc.swing.gui.components.HTMLTextArea;
-
-public class UserEditDialog extends ButtonDialog {
-
- private static final long serialVersionUID = 1L;
-
- private JPanel mainPanel;
-
- private JTextField userNameField;
- private JPasswordField passwordField;
- private JPasswordField confirmPasswordField;
- private JTextField emailField;
- private JTextField websiteField;
- private JTextArea bioArea;
- private JScrollPane bioPane;
-
- private String userName;
- private String password;
- private String email;
- private String website;
- private String bio;
-
- private UserEntity existingEntity;
-
- public UserEditDialog(JFrame owner, UserEntity existingEntity) {
- super(owner, existingEntity == null ? "New Account" : "Manage Account", new String[] {OK, CANCEL});
-
- this.existingEntity = existingEntity;
-
- setMinimumSize(new Dimension(240, 32));
- layoutGui();
- refreshState();
- }
-
- public String getUserName() {
- return userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getWebsite() {
- return website;
- }
-
- public String getBio() {
- return bio;
- }
-
- @Override
- protected JComponent getMainComponent() {
- if (mainPanel == null) {
- mainPanel = new JPanel(new GridBagLayout());
- mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(4, 2, 2, 2);
-
- gbc.gridx = 0;
-
- gbc.gridy = 0;
- mainPanel.add(new JLabel("User Name:"), gbc);
-
- if (existingEntity == null) {
- gbc.gridy = 1;
- mainPanel.add(new JLabel("Password:"), gbc);
-
- gbc.gridy = 2;
- mainPanel.add(new JLabel("Confirm Password:"), gbc);
- }
-
- gbc.gridy = 3;
- mainPanel.add(new JLabel("eMail:"), gbc);
-
- gbc.gridy = 4;
- mainPanel.add(new JLabel("Website:"), gbc);
-
- gbc.gridy = 5;
- mainPanel.add(new JLabel("Short Bio:"), gbc);
-
- gbc.gridx = 1;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets = new Insets(2, 2, 2, 2);
- gbc.weightx = 1;
-
- gbc.gridy = 0;
- mainPanel.add(getUserNameField(), gbc);
-
- if (existingEntity == null) {
- gbc.gridy = 1;
- mainPanel.add(getPasswordField(), gbc);
-
- gbc.gridy = 2;
- mainPanel.add(getConfirmPasswordField(), gbc);
- }
-
- gbc.gridy = 3;
- mainPanel.add(getEmailField(), gbc);
-
- gbc.gridy = 4;
- mainPanel.add(getWebsiteField(), gbc);
-
- gbc.gridy = 5;
- gbc.fill = GridBagConstraints.BOTH;
- mainPanel.add(getBioPane(), gbc);
- }
- return mainPanel;
- }
-
- private void refreshState() {
- this.userName = getUserNameField().getText();
- String password = new String(getPasswordField().getPassword());
- String confirmPassword = new String(getConfirmPasswordField().getPassword());
- if (password.equals(confirmPassword)) {
- this.password = password;
- } else {
- this.password = null;
- }
- this.email = getEmailField().getText();
- this.website = getWebsiteField().getText();
- this.bio = getBioArea().getText();
- JButton okButton = getButton(OK);
- okButton.setEnabled(!this.userName.isEmpty()
- && !this.email.isEmpty() && this.email.contains("@")
- && (this.existingEntity != null || ((this.password != null) && (this.password.length() > 0))));
- }
-
- private JTextField getUserNameField() {
- if (userNameField == null) {
- userNameField = new JTextField();
- if (existingEntity != null) {
- userNameField.setText(existingEntity.getUsername());
- userNameField.setEditable(false);
- }
- userNameField.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return userNameField;
- }
-
- private JPasswordField getPasswordField() {
- if (passwordField == null) {
- passwordField = new JPasswordField();
- passwordField.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return passwordField;
- }
-
- private JPasswordField getConfirmPasswordField() {
- if (confirmPasswordField == null) {
- confirmPasswordField = new JPasswordField();
- confirmPasswordField.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return confirmPasswordField;
- }
-
- private JTextField getEmailField() {
- if (emailField == null) {
- emailField = new JTextField();
- if (existingEntity != null) {
- emailField.setText(existingEntity.getEmail());
- emailField.setEditable(false);
- }
- emailField.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return emailField;
- }
-
- private JTextField getWebsiteField() {
- if (websiteField == null) {
- websiteField = new JTextField();
- if (existingEntity != null)
- websiteField.setText(existingEntity.getWebsite());
- websiteField.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return websiteField;
- }
-
- private JScrollPane getBioPane() {
- if (bioPane == null) {
- bioPane = new JScrollPane(getBioArea());
- bioPane.setPreferredSize(new Dimension(192, 64));
- bioPane.setBorder(getBioArea().getBorder());
- getBioArea().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
- }
- return bioPane;
- }
-
- private JTextArea getBioArea() {
- if (bioArea == null) {
- bioArea = new HTMLTextArea();
- if (existingEntity != null)
- bioArea.setText(existingEntity.getBio());
- bioArea.setFont(getUserNameField().getFont());
- bioArea.setBorder(getUserNameField().getBorder());
- bioArea.getDocument().addDocumentListener(new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- refreshState();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- refreshState();
- }
- });
- }
- return bioArea;
- }
-}
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
+package org.diylc.swing.plugins.cloud.view;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+import org.diylc.swingframework.ButtonDialog;
+
+import org.diylc.plugins.cloud.model.UserEntity;
+import org.diylc.swing.gui.components.HTMLTextArea;
+
+public class UserEditDialog extends ButtonDialog {
+
+ private static final long serialVersionUID = 1L;
+
+ private JPanel mainPanel;
+
+ private JTextField userNameField;
+ private JPasswordField passwordField;
+ private JPasswordField confirmPasswordField;
+ private JTextField emailField;
+ private JTextField websiteField;
+ private JTextArea bioArea;
+ private JScrollPane bioPane;
+
+ private String userName;
+ private String password;
+ private String email;
+ private String website;
+ private String bio;
+
+ private UserEntity existingEntity;
+
+ public UserEditDialog(JFrame owner, UserEntity existingEntity) {
+ super(owner, existingEntity == null ? "New Account" : "Manage Account", new String[] {OK, CANCEL});
+
+ this.existingEntity = existingEntity;
+
+ setMinimumSize(new Dimension(240, 32));
+ layoutGui();
+ refreshState();
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getWebsite() {
+ return website;
+ }
+
+ public String getBio() {
+ return bio;
+ }
+
+ @Override
+ protected JComponent getMainComponent() {
+ if (mainPanel == null) {
+ mainPanel = new JPanel(new GridBagLayout());
+ mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.anchor = GridBagConstraints.NORTHWEST;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.insets = new Insets(4, 2, 2, 2);
+
+ gbc.gridx = 0;
+
+ gbc.gridy = 0;
+ mainPanel.add(new JLabel("User Name:"), gbc);
+
+ if (existingEntity == null) {
+ gbc.gridy = 1;
+ mainPanel.add(new JLabel("Password:"), gbc);
+
+ gbc.gridy = 2;
+ mainPanel.add(new JLabel("Confirm Password:"), gbc);
+ }
+
+ gbc.gridy = 3;
+ mainPanel.add(new JLabel("eMail:"), gbc);
+
+ gbc.gridy = 4;
+ mainPanel.add(new JLabel("Website:"), gbc);
+
+ gbc.gridy = 5;
+ mainPanel.add(new JLabel("Short Bio:"), gbc);
+
+ gbc.gridx = 1;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.insets = new Insets(2, 2, 2, 2);
+ gbc.weightx = 1;
+
+ gbc.gridy = 0;
+ mainPanel.add(getUserNameField(), gbc);
+
+ if (existingEntity == null) {
+ gbc.gridy = 1;
+ mainPanel.add(getPasswordField(), gbc);
+
+ gbc.gridy = 2;
+ mainPanel.add(getConfirmPasswordField(), gbc);
+ }
+
+ gbc.gridy = 3;
+ mainPanel.add(getEmailField(), gbc);
+
+ gbc.gridy = 4;
+ mainPanel.add(getWebsiteField(), gbc);
+
+ gbc.gridy = 5;
+ gbc.fill = GridBagConstraints.BOTH;
+ mainPanel.add(getBioPane(), gbc);
+ }
+ return mainPanel;
+ }
+
+ private void refreshState() {
+ this.userName = getUserNameField().getText();
+ String password = new String(getPasswordField().getPassword());
+ String confirmPassword = new String(getConfirmPasswordField().getPassword());
+ if (password.equals(confirmPassword)) {
+ this.password = password;
+ } else {
+ this.password = null;
+ }
+ this.email = getEmailField().getText();
+ this.website = getWebsiteField().getText();
+ this.bio = getBioArea().getText();
+ JButton okButton = getButton(OK);
+ okButton.setEnabled(!this.userName.isEmpty()
+ && !this.email.isEmpty() && this.email.contains("@")
+ && (this.existingEntity != null || ((this.password != null) && (this.password.length() > 0))));
+ }
+
+ private JTextField getUserNameField() {
+ if (userNameField == null) {
+ userNameField = new JTextField();
+ if (existingEntity != null) {
+ userNameField.setText(existingEntity.getUsername());
+ userNameField.setEditable(false);
+ }
+ userNameField.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return userNameField;
+ }
+
+ private JPasswordField getPasswordField() {
+ if (passwordField == null) {
+ passwordField = new JPasswordField();
+ passwordField.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return passwordField;
+ }
+
+ private JPasswordField getConfirmPasswordField() {
+ if (confirmPasswordField == null) {
+ confirmPasswordField = new JPasswordField();
+ confirmPasswordField.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return confirmPasswordField;
+ }
+
+ private JTextField getEmailField() {
+ if (emailField == null) {
+ emailField = new JTextField();
+ if (existingEntity != null) {
+ emailField.setText(existingEntity.getEmail());
+ emailField.setEditable(false);
+ }
+ emailField.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return emailField;
+ }
+
+ private JTextField getWebsiteField() {
+ if (websiteField == null) {
+ websiteField = new JTextField();
+ if (existingEntity != null)
+ websiteField.setText(existingEntity.getWebsite());
+ websiteField.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return websiteField;
+ }
+
+ private JScrollPane getBioPane() {
+ if (bioPane == null) {
+ bioPane = new JScrollPane(getBioArea());
+ bioPane.setPreferredSize(new Dimension(192, 64));
+ bioPane.setBorder(getBioArea().getBorder());
+ getBioArea().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+ }
+ return bioPane;
+ }
+
+ private JTextArea getBioArea() {
+ if (bioArea == null) {
+ bioArea = new HTMLTextArea();
+ if (existingEntity != null)
+ bioArea.setText(existingEntity.getBio());
+ bioArea.setFont(getUserNameField().getFont());
+ bioArea.setBorder(getUserNameField().getBorder());
+ bioArea.getDocument().addDocumentListener(new DocumentListener() {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ refreshState();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ refreshState();
+ }
+ });
+ }
+ return bioArea;
+ }
+}
diff --git a/knowledge/user_manual.sql b/knowledge/user_manual.sql
index 4b66268d..fa60ca36 100644
--- a/knowledge/user_manual.sql
+++ b/knowledge/user_manual.sql
@@ -235,7 +235,7 @@ INSERT INTO diylc_knowledge_base(category, section, content) VALUES ('User Manua
'DIYLC AI Assistant is an integrated feature that allows users to interact with DIY Layout Creator (DIYLC) using natural language. It functions as a chatbot powered by the OpenAI API to generate helpful responses. The AI Assistant is available only while logged into the DIYLC Cloud with an active account and requires an internet connection.
There are two subscription tiers for using the AI Assistant:
- Free Tier: Provides limited monthly usage and access to basic AI models. This option is automatically available to all registered DIYLC Cloud users.
-- Premium Tier: Offers up to 1000 requests per month using more advanced AI models. The Premium subscription is exclusively available to Patreon supporters with the "Premium AI" tier. Once you become a premium supporter, your premium status will be semi-automatically transferred to your DIYLC Cloud account. If your email used to subscribe to the premium tier is different from the email used to login to the DIYLC Cloud, please reach out to bancika@gmail.com to manually transfer your premium status.
+- Premium Tier: Offers up to 1000 requests per month using more advanced AI models. The Premium subscription can be purchased at http://www.diy-fever.com/get-premium. If your email used to subscribe to the premium tier is different from the email used to login to the DIYLC Cloud, please reach out to bancika@gmail.com to manually activate your premium status.
');
DELETE FROM diylc_knowledge_base WHERE section = 'AI Assitant/Chatbot/ChatGPT/GPT - Using the AI Assistant';