mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
chatbot enhancements
This commit is contained in:
@@ -836,7 +836,7 @@
|
|||||||
<option value="-Xdock:name=DIY Layout Creator"/>
|
<option value="-Xdock:name=DIY Layout Creator"/>
|
||||||
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
|
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
|
||||||
</bundleapp>
|
</bundleapp>
|
||||||
|
|
||||||
<echo message="Creating unsigned zip for distribution..."/>
|
<echo message="Creating unsigned zip for distribution..."/>
|
||||||
<!-- Create unsigned zip for distribution -->
|
<!-- Create unsigned zip for distribution -->
|
||||||
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-x86-unsigned.zip">
|
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-x86-unsigned.zip">
|
||||||
@@ -1027,22 +1027,22 @@
|
|||||||
<delete dir="${jre.dest.osx}" />
|
<delete dir="${jre.dest.osx}" />
|
||||||
<mkdir dir="${jre.dest.osx}" />
|
<mkdir dir="${jre.dest.osx}" />
|
||||||
<mkdir dir="${project.build.directory}/downloads" />
|
<mkdir dir="${project.build.directory}/downloads" />
|
||||||
|
|
||||||
<!-- Download JRE -->
|
<!-- Download JRE -->
|
||||||
<get src="${jdk.url.osx}"
|
<get src="${jdk.url.osx}"
|
||||||
dest="${project.build.directory}/downloads/${jdk.archive.osx}"
|
dest="${project.build.directory}/downloads/${jdk.archive.osx}"
|
||||||
usetimestamp="true" />
|
usetimestamp="true" />
|
||||||
|
|
||||||
<!-- Extract JRE -->
|
<!-- Extract JRE -->
|
||||||
<untar src="${project.build.directory}/downloads/${jdk.archive.osx}"
|
<untar src="${project.build.directory}/downloads/${jdk.archive.osx}"
|
||||||
dest="${jre.dest.osx}"
|
dest="${jre.dest.osx}"
|
||||||
compression="gzip" />
|
compression="gzip" />
|
||||||
|
|
||||||
<!-- Move files up one level -->
|
<!-- Move files up one level -->
|
||||||
<move todir="${jre.dest.osx}">
|
<move todir="${jre.dest.osx}">
|
||||||
<fileset dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
|
<fileset dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
|
||||||
</move>
|
</move>
|
||||||
|
|
||||||
<!-- Remove empty top-level folder -->
|
<!-- Remove empty top-level folder -->
|
||||||
<delete dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
|
<delete dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
|
||||||
</target>
|
</target>
|
||||||
@@ -1150,7 +1150,7 @@
|
|||||||
<option value="-Xdock:name=DIY Layout Creator"/>
|
<option value="-Xdock:name=DIY Layout Creator"/>
|
||||||
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
|
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
|
||||||
</bundleapp>
|
</bundleapp>
|
||||||
|
|
||||||
<echo message="Creating unsigned zip for distribution..."/>
|
<echo message="Creating unsigned zip for distribution..."/>
|
||||||
<!-- Create unsigned zip for distribution -->
|
<!-- Create unsigned zip for distribution -->
|
||||||
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-arm-unsigned.zip">
|
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-arm-unsigned.zip">
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import org.diylc.swing.ISwingUI;
|
|||||||
import org.diylc.utils.FileUtils;
|
import org.diylc.utils.FileUtils;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.HyperlinkEvent;
|
||||||
|
import javax.swing.event.HyperlinkListener;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -26,6 +28,7 @@ public class ChatbotPane extends JPanel {
|
|||||||
public static final String ME = "Me: ";
|
public static final String ME = "Me: ";
|
||||||
public static final String AI_ASSISTANT = "AI Assistant: ";
|
public static final String AI_ASSISTANT = "AI Assistant: ";
|
||||||
public static final String FREE_TIER = "Free";
|
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);
|
public static Font DEFAULT_FONT = new Font("Square721 BT", Font.PLAIN, 12);
|
||||||
private static final Font MONOSPACED_FONT = new Font("Monospaced", Font.PLAIN, 12);
|
private static final Font MONOSPACED_FONT = new Font("Monospaced", Font.PLAIN, 12);
|
||||||
@@ -35,7 +38,10 @@ public class ChatbotPane extends JPanel {
|
|||||||
"<style>" + "body { font-family: %s; font-size: %dpt; color: rgb(%d,%d,%d); background-color: rgb(%d,%d,%d); padding: 0px; margin: 0; }" + "pre { white-space: pre-wrap; margin: 0; }" + ".user { color: #98C379; }" + // Softer green that's easier on the eyes
|
"<style>" + "body { font-family: %s; font-size: %dpt; color: rgb(%d,%d,%d); background-color: rgb(%d,%d,%d); padding: 0px; margin: 0; }" + "pre { white-space: pre-wrap; margin: 0; }" + ".user { color: #98C379; }" + // Softer green that's easier on the eyes
|
||||||
".assistant { color: #61AFEF; }" + // Lighter, more vibrant blue
|
".assistant { color: #61AFEF; }" + // Lighter, more vibrant blue
|
||||||
".system { color: #E5C07B; }" + // Warmer, muted yellow
|
".system { color: #E5C07B; }" + // Warmer, muted yellow
|
||||||
".temporary { color: #555555; }" + "</style>", 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
|
||||||
|
"</style>", MONOSPACED_FONT.getFamily(),
|
||||||
MONOSPACED_FONT.getSize(), TERMINAL_FG.getRed(), TERMINAL_FG.getGreen(),
|
MONOSPACED_FONT.getSize(), TERMINAL_FG.getRed(), TERMINAL_FG.getGreen(),
|
||||||
TERMINAL_FG.getBlue(), TERMINAL_BG.getRed(), TERMINAL_BG.getGreen(), TERMINAL_BG.getBlue());
|
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
|
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 {
|
} else {
|
||||||
if (subscriptionInfo != null) {
|
if (subscriptionInfo != null) {
|
||||||
getPremiumButton().setVisible(FREE_TIER.equals(subscriptionInfo.getTier()));
|
getPremiumButton().setVisible(FREE_TIER.equals(subscriptionInfo.getTier()));
|
||||||
appendSection(ChatbotService.SYSTEM,
|
String subscriptionInfoText = "Your are currently subscribed to the '" + subscriptionInfo.getTier() + "' tier, expiring on " + subscriptionInfo.getEndDate() + ", with " + subscriptionInfo.getRemainingCredits() + " credits remaining.";
|
||||||
"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 <a href='http://" + GET_PREMIUM_URL + "'>" + GET_PREMIUM_URL + "</a>.";
|
||||||
|
}
|
||||||
|
appendSection(ChatbotService.SYSTEM, subscriptionInfoText);
|
||||||
}
|
}
|
||||||
fetchChatHistory();
|
fetchChatHistory();
|
||||||
getAskButton().setEnabled(true);
|
getAskButton().setEnabled(true);
|
||||||
getClearButton().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() {
|
private void fetchChatHistory() {
|
||||||
@@ -278,6 +296,22 @@ public class ChatbotPane extends JPanel {
|
|||||||
chatEditorPane.setContentType("text/html");
|
chatEditorPane.setContentType("text/html");
|
||||||
chatEditorPane.setText(HTML_STYLE + "<body></body>");
|
chatEditorPane.setText(HTML_STYLE + "<body></body>");
|
||||||
|
|
||||||
|
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);
|
refreshChat(null);
|
||||||
}
|
}
|
||||||
return chatEditorPane;
|
return chatEditorPane;
|
||||||
|
|||||||
@@ -58,10 +58,12 @@ public class ChatbotPlugin implements IPlugIn {
|
|||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case FILE_STATUS_CHANGED:
|
case FILE_STATUS_CHANGED:
|
||||||
case PROJECT_LOADED:
|
case PROJECT_LOADED:
|
||||||
|
getChatbotPane().refreshChat(null);
|
||||||
|
break;
|
||||||
case CLOUD_LOGGED_IN:
|
case CLOUD_LOGGED_IN:
|
||||||
case CLOUD_LOGGED_OUT:
|
case CLOUD_LOGGED_OUT:
|
||||||
SubscriptionEntity subscriptionInfo = null;
|
SubscriptionEntity subscriptionInfo = null;
|
||||||
if (params.length > 0) {
|
if (params.length > 0 && params[0] instanceof SubscriptionEntity) {
|
||||||
subscriptionInfo = (SubscriptionEntity) params[0];
|
subscriptionInfo = (SubscriptionEntity) params[0];
|
||||||
}
|
}
|
||||||
getChatbotPane().refreshChat(subscriptionInfo);
|
getChatbotPane().refreshChat(subscriptionInfo);
|
||||||
|
|||||||
@@ -1,225 +1,225 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
DIY Layout Creator (DIYLC).
|
DIY Layout Creator (DIYLC).
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
This file is part of DIYLC.
|
This file is part of DIYLC.
|
||||||
|
|
||||||
DIYLC is free software: you can redistribute it and/or modify
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
DIYLC is distributed in the hope that it will be useful,
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package org.diylc.swing.plugins.cloud;
|
package org.diylc.swing.plugins.cloud;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||||
import org.diylc.plugins.cloud.service.CloudService;
|
import org.diylc.plugins.cloud.service.CloudService;
|
||||||
import org.diylc.swingframework.ButtonDialog;
|
import org.diylc.swingframework.ButtonDialog;
|
||||||
|
|
||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ITask;
|
import org.diylc.common.ITask;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.plugins.cloud.service.CloudException;
|
import org.diylc.plugins.cloud.service.CloudException;
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
import org.diylc.swing.ISwingUI;
|
import org.diylc.swing.ISwingUI;
|
||||||
import org.diylc.swing.gui.DialogFactory;
|
import org.diylc.swing.gui.DialogFactory;
|
||||||
import org.diylc.swing.gui.DummyView;
|
import org.diylc.swing.gui.DummyView;
|
||||||
import org.diylc.utils.IconLoader;
|
import org.diylc.utils.IconLoader;
|
||||||
import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
|
import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
|
||||||
import org.diylc.swing.plugins.cloud.view.LoginDialog;
|
import org.diylc.swing.plugins.cloud.view.LoginDialog;
|
||||||
import org.diylc.swing.plugins.cloud.view.UploadDialog;
|
import org.diylc.swing.plugins.cloud.view.UploadDialog;
|
||||||
import org.diylc.swing.plugins.cloud.view.UserEditDialog;
|
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.CloudBrowserFrame;
|
||||||
import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
|
import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
|
||||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||||
import org.diylc.swing.plugins.cloud.actions.*;
|
import org.diylc.swing.plugins.cloud.actions.*;
|
||||||
|
|
||||||
public class CloudPlugIn implements IPlugIn {
|
public class CloudPlugIn implements IPlugIn {
|
||||||
|
|
||||||
private static final String ONLINE_TITLE = "Cloud";
|
private static final String ONLINE_TITLE = "Cloud";
|
||||||
|
|
||||||
private final static Logger LOG = Logger.getLogger(CloudPlugIn.class);
|
private final static Logger LOG = Logger.getLogger(CloudPlugIn.class);
|
||||||
|
|
||||||
private ISwingUI swingUI;
|
private ISwingUI swingUI;
|
||||||
private IPlugInPort plugInPort;
|
private IPlugInPort plugInPort;
|
||||||
private IPlugInPort thumbnailPresenter;
|
private IPlugInPort thumbnailPresenter;
|
||||||
private ThumbnailGenerator thumbnailGenerator;
|
private ThumbnailGenerator thumbnailGenerator;
|
||||||
private CloudService cloudService;
|
private CloudService cloudService;
|
||||||
|
|
||||||
private LibraryAction libraryAction;
|
private LibraryAction libraryAction;
|
||||||
private LoginAction loginAction;
|
private LoginAction loginAction;
|
||||||
private LogOutAction logOutAction;
|
private LogOutAction logOutAction;
|
||||||
private CreateAccountAction createAccountAction;
|
private CreateAccountAction createAccountAction;
|
||||||
private ManageAccountAction manageAccountAction;
|
private ManageAccountAction manageAccountAction;
|
||||||
private UploadAction uploadAction;
|
private UploadAction uploadAction;
|
||||||
private ChangePasswordAction changePasswordAction;
|
private ChangePasswordAction changePasswordAction;
|
||||||
private ManageProjectsAction manageProjectsAction;
|
private ManageProjectsAction manageProjectsAction;
|
||||||
|
|
||||||
private CloudBrowserFrame cloudBrowser;
|
private CloudBrowserFrame cloudBrowser;
|
||||||
|
|
||||||
public CloudPlugIn(ISwingUI swingUI) {
|
public CloudPlugIn(ISwingUI swingUI) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.swingUI = swingUI;
|
this.swingUI = swingUI;
|
||||||
this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
|
this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
|
||||||
this.thumbnailGenerator = new ThumbnailGenerator(thumbnailPresenter);
|
this.thumbnailGenerator = new ThumbnailGenerator(thumbnailPresenter);
|
||||||
|
|
||||||
// Initialize actions
|
// Initialize actions
|
||||||
this.libraryAction = new LibraryAction(this);
|
this.libraryAction = new LibraryAction(this);
|
||||||
this.loginAction = new LoginAction(this);
|
this.loginAction = new LoginAction(this);
|
||||||
this.logOutAction = new LogOutAction(this);
|
this.logOutAction = new LogOutAction(this);
|
||||||
this.createAccountAction = new CreateAccountAction(this);
|
this.createAccountAction = new CreateAccountAction(this);
|
||||||
this.manageAccountAction = new ManageAccountAction(this);
|
this.manageAccountAction = new ManageAccountAction(this);
|
||||||
this.uploadAction = new UploadAction(this);
|
this.uploadAction = new UploadAction(this);
|
||||||
this.changePasswordAction = new ChangePasswordAction(this);
|
this.changePasswordAction = new ChangePasswordAction(this);
|
||||||
this.manageProjectsAction = new ManageProjectsAction(this);
|
this.manageProjectsAction = new ManageProjectsAction(this);
|
||||||
|
|
||||||
swingUI.injectMenuAction(getLibraryAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getLibraryAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getLoginAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getLoginAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getCreateAccountAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getCreateAccountAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getUploadAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getUploadAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getManageProjectsAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getManageProjectsAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
swingUI.injectMenuAction(null, ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getManageAccountAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getManageAccountAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getChangePasswordAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getChangePasswordAction(), ONLINE_TITLE);
|
||||||
swingUI.injectMenuAction(getLogOutAction(), ONLINE_TITLE);
|
swingUI.injectMenuAction(getLogOutAction(), ONLINE_TITLE);
|
||||||
|
|
||||||
// default state
|
// default state
|
||||||
getUploadAction().setEnabled(false);
|
getUploadAction().setEnabled(false);
|
||||||
getManageProjectsAction().setEnabled(false);
|
getManageProjectsAction().setEnabled(false);
|
||||||
getManageAccountAction().setEnabled(false);
|
getManageAccountAction().setEnabled(false);
|
||||||
getChangePasswordAction().setEnabled(false);
|
getChangePasswordAction().setEnabled(false);
|
||||||
getLogOutAction().setEnabled(false);
|
getLogOutAction().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect(IPlugInPort plugInPort) {
|
public void connect(IPlugInPort plugInPort) {
|
||||||
this.plugInPort = plugInPort;
|
this.plugInPort = plugInPort;
|
||||||
this.cloudService = plugInPort.getCloudService();
|
this.cloudService = plugInPort.getCloudService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudBrowserFrame getCloudBrowser() {
|
public CloudBrowserFrame getCloudBrowser() {
|
||||||
if (cloudBrowser == null) {
|
if (cloudBrowser == null) {
|
||||||
cloudBrowser = new CloudBrowserFrame(swingUI, plugInPort);
|
cloudBrowser = new CloudBrowserFrame(swingUI, plugInPort);
|
||||||
}
|
}
|
||||||
return cloudBrowser;
|
return cloudBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadManagerFrame createUploadManagerFrame() {
|
public UploadManagerFrame createUploadManagerFrame() {
|
||||||
return new UploadManagerFrame(swingUI, plugInPort);
|
return new UploadManagerFrame(swingUI, plugInPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LibraryAction getLibraryAction() {
|
public LibraryAction getLibraryAction() {
|
||||||
return libraryAction;
|
return libraryAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginAction getLoginAction() {
|
public LoginAction getLoginAction() {
|
||||||
return loginAction;
|
return loginAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogOutAction getLogOutAction() {
|
public LogOutAction getLogOutAction() {
|
||||||
return logOutAction;
|
return logOutAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateAccountAction getCreateAccountAction() {
|
public CreateAccountAction getCreateAccountAction() {
|
||||||
return createAccountAction;
|
return createAccountAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManageAccountAction getManageAccountAction() {
|
public ManageAccountAction getManageAccountAction() {
|
||||||
return manageAccountAction;
|
return manageAccountAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadAction getUploadAction() {
|
public UploadAction getUploadAction() {
|
||||||
return uploadAction;
|
return uploadAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChangePasswordAction getChangePasswordAction() {
|
public ChangePasswordAction getChangePasswordAction() {
|
||||||
return changePasswordAction;
|
return changePasswordAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManageProjectsAction getManageProjectsAction() {
|
public ManageProjectsAction getManageProjectsAction() {
|
||||||
return manageProjectsAction;
|
return manageProjectsAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<EventType> getSubscribedEventTypes() {
|
public EnumSet<EventType> getSubscribedEventTypes() {
|
||||||
return EnumSet.of(EventType.CLOUD_LOGGED_IN, EventType.CLOUD_LOGGED_OUT);
|
return EnumSet.of(EventType.CLOUD_LOGGED_IN, EventType.CLOUD_LOGGED_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processMessage(EventType eventType, Object... params) {
|
public void processMessage(EventType eventType, Object... params) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case CLOUD_LOGGED_IN:
|
case CLOUD_LOGGED_IN:
|
||||||
loggedIn();
|
loggedIn();
|
||||||
break;
|
break;
|
||||||
case CLOUD_LOGGED_OUT:
|
case CLOUD_LOGGED_OUT:
|
||||||
loggedOut();
|
loggedOut();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loggedIn() {
|
public void loggedIn() {
|
||||||
getLoginAction().setEnabled(false);
|
getLoginAction().setEnabled(false);
|
||||||
getCreateAccountAction().setEnabled(false);
|
getCreateAccountAction().setEnabled(false);
|
||||||
|
|
||||||
getLogOutAction().setEnabled(true);
|
getLogOutAction().setEnabled(true);
|
||||||
getManageAccountAction().setEnabled(true);
|
getManageAccountAction().setEnabled(true);
|
||||||
getUploadAction().setEnabled(true);
|
getUploadAction().setEnabled(true);
|
||||||
getManageProjectsAction().setEnabled(true);
|
getManageProjectsAction().setEnabled(true);
|
||||||
getChangePasswordAction().setEnabled(true);
|
getChangePasswordAction().setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loggedOut() {
|
public void loggedOut() {
|
||||||
getLoginAction().setEnabled(true);
|
getLoginAction().setEnabled(true);
|
||||||
getCreateAccountAction().setEnabled(true);
|
getCreateAccountAction().setEnabled(true);
|
||||||
|
|
||||||
getLogOutAction().setEnabled(false);
|
getLogOutAction().setEnabled(false);
|
||||||
getManageAccountAction().setEnabled(false);
|
getManageAccountAction().setEnabled(false);
|
||||||
getUploadAction().setEnabled(false);
|
getUploadAction().setEnabled(false);
|
||||||
getManageProjectsAction().setEnabled(false);
|
getManageProjectsAction().setEnabled(false);
|
||||||
getChangePasswordAction().setEnabled(false);
|
getChangePasswordAction().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters for action classes
|
// Getters for action classes
|
||||||
public ISwingUI getSwingUI() {
|
public ISwingUI getSwingUI() {
|
||||||
return swingUI;
|
return swingUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPlugInPort getPlugInPort() {
|
public IPlugInPort getPlugInPort() {
|
||||||
return plugInPort;
|
return plugInPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPlugInPort getThumbnailPresenter() {
|
public IPlugInPort getThumbnailPresenter() {
|
||||||
return thumbnailPresenter;
|
return thumbnailPresenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThumbnailGenerator getThumbnailGenerator() {
|
public ThumbnailGenerator getThumbnailGenerator() {
|
||||||
return thumbnailGenerator;
|
return thumbnailGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudService getCloudService() {
|
public CloudService getCloudService() {
|
||||||
return cloudService;
|
return cloudService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+345
-345
@@ -1,345 +1,345 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
DIY Layout Creator (DIYLC).
|
DIY Layout Creator (DIYLC).
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
This file is part of DIYLC.
|
This file is part of DIYLC.
|
||||||
|
|
||||||
DIYLC is free software: you can redistribute it and/or modify
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
DIYLC is distributed in the hope that it will be useful,
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package org.diylc.swing.plugins.cloud.view;
|
package org.diylc.swing.plugins.cloud.view;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JPasswordField;
|
import javax.swing.JPasswordField;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
import org.diylc.swingframework.ButtonDialog;
|
import org.diylc.swingframework.ButtonDialog;
|
||||||
|
|
||||||
import org.diylc.plugins.cloud.model.UserEntity;
|
import org.diylc.plugins.cloud.model.UserEntity;
|
||||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||||
|
|
||||||
public class UserEditDialog extends ButtonDialog {
|
public class UserEditDialog extends ButtonDialog {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
|
|
||||||
private JTextField userNameField;
|
private JTextField userNameField;
|
||||||
private JPasswordField passwordField;
|
private JPasswordField passwordField;
|
||||||
private JPasswordField confirmPasswordField;
|
private JPasswordField confirmPasswordField;
|
||||||
private JTextField emailField;
|
private JTextField emailField;
|
||||||
private JTextField websiteField;
|
private JTextField websiteField;
|
||||||
private JTextArea bioArea;
|
private JTextArea bioArea;
|
||||||
private JScrollPane bioPane;
|
private JScrollPane bioPane;
|
||||||
|
|
||||||
private String userName;
|
private String userName;
|
||||||
private String password;
|
private String password;
|
||||||
private String email;
|
private String email;
|
||||||
private String website;
|
private String website;
|
||||||
private String bio;
|
private String bio;
|
||||||
|
|
||||||
private UserEntity existingEntity;
|
private UserEntity existingEntity;
|
||||||
|
|
||||||
public UserEditDialog(JFrame owner, UserEntity existingEntity) {
|
public UserEditDialog(JFrame owner, UserEntity existingEntity) {
|
||||||
super(owner, existingEntity == null ? "New Account" : "Manage Account", new String[] {OK, CANCEL});
|
super(owner, existingEntity == null ? "New Account" : "Manage Account", new String[] {OK, CANCEL});
|
||||||
|
|
||||||
this.existingEntity = existingEntity;
|
this.existingEntity = existingEntity;
|
||||||
|
|
||||||
setMinimumSize(new Dimension(240, 32));
|
setMinimumSize(new Dimension(240, 32));
|
||||||
layoutGui();
|
layoutGui();
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWebsite() {
|
public String getWebsite() {
|
||||||
return website;
|
return website;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBio() {
|
public String getBio() {
|
||||||
return bio;
|
return bio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JComponent getMainComponent() {
|
protected JComponent getMainComponent() {
|
||||||
if (mainPanel == null) {
|
if (mainPanel == null) {
|
||||||
mainPanel = new JPanel(new GridBagLayout());
|
mainPanel = new JPanel(new GridBagLayout());
|
||||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
||||||
|
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
GridBagConstraints gbc = new GridBagConstraints();
|
||||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||||
gbc.fill = GridBagConstraints.NONE;
|
gbc.fill = GridBagConstraints.NONE;
|
||||||
gbc.insets = new Insets(4, 2, 2, 2);
|
gbc.insets = new Insets(4, 2, 2, 2);
|
||||||
|
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
|
|
||||||
gbc.gridy = 0;
|
gbc.gridy = 0;
|
||||||
mainPanel.add(new JLabel("User Name:"), gbc);
|
mainPanel.add(new JLabel("User Name:"), gbc);
|
||||||
|
|
||||||
if (existingEntity == null) {
|
if (existingEntity == null) {
|
||||||
gbc.gridy = 1;
|
gbc.gridy = 1;
|
||||||
mainPanel.add(new JLabel("Password:"), gbc);
|
mainPanel.add(new JLabel("Password:"), gbc);
|
||||||
|
|
||||||
gbc.gridy = 2;
|
gbc.gridy = 2;
|
||||||
mainPanel.add(new JLabel("Confirm Password:"), gbc);
|
mainPanel.add(new JLabel("Confirm Password:"), gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
gbc.gridy = 3;
|
gbc.gridy = 3;
|
||||||
mainPanel.add(new JLabel("eMail:"), gbc);
|
mainPanel.add(new JLabel("eMail:"), gbc);
|
||||||
|
|
||||||
gbc.gridy = 4;
|
gbc.gridy = 4;
|
||||||
mainPanel.add(new JLabel("Website:"), gbc);
|
mainPanel.add(new JLabel("Website:"), gbc);
|
||||||
|
|
||||||
gbc.gridy = 5;
|
gbc.gridy = 5;
|
||||||
mainPanel.add(new JLabel("Short Bio:"), gbc);
|
mainPanel.add(new JLabel("Short Bio:"), gbc);
|
||||||
|
|
||||||
gbc.gridx = 1;
|
gbc.gridx = 1;
|
||||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||||
gbc.insets = new Insets(2, 2, 2, 2);
|
gbc.insets = new Insets(2, 2, 2, 2);
|
||||||
gbc.weightx = 1;
|
gbc.weightx = 1;
|
||||||
|
|
||||||
gbc.gridy = 0;
|
gbc.gridy = 0;
|
||||||
mainPanel.add(getUserNameField(), gbc);
|
mainPanel.add(getUserNameField(), gbc);
|
||||||
|
|
||||||
if (existingEntity == null) {
|
if (existingEntity == null) {
|
||||||
gbc.gridy = 1;
|
gbc.gridy = 1;
|
||||||
mainPanel.add(getPasswordField(), gbc);
|
mainPanel.add(getPasswordField(), gbc);
|
||||||
|
|
||||||
gbc.gridy = 2;
|
gbc.gridy = 2;
|
||||||
mainPanel.add(getConfirmPasswordField(), gbc);
|
mainPanel.add(getConfirmPasswordField(), gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
gbc.gridy = 3;
|
gbc.gridy = 3;
|
||||||
mainPanel.add(getEmailField(), gbc);
|
mainPanel.add(getEmailField(), gbc);
|
||||||
|
|
||||||
gbc.gridy = 4;
|
gbc.gridy = 4;
|
||||||
mainPanel.add(getWebsiteField(), gbc);
|
mainPanel.add(getWebsiteField(), gbc);
|
||||||
|
|
||||||
gbc.gridy = 5;
|
gbc.gridy = 5;
|
||||||
gbc.fill = GridBagConstraints.BOTH;
|
gbc.fill = GridBagConstraints.BOTH;
|
||||||
mainPanel.add(getBioPane(), gbc);
|
mainPanel.add(getBioPane(), gbc);
|
||||||
}
|
}
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshState() {
|
private void refreshState() {
|
||||||
this.userName = getUserNameField().getText();
|
this.userName = getUserNameField().getText();
|
||||||
String password = new String(getPasswordField().getPassword());
|
String password = new String(getPasswordField().getPassword());
|
||||||
String confirmPassword = new String(getConfirmPasswordField().getPassword());
|
String confirmPassword = new String(getConfirmPasswordField().getPassword());
|
||||||
if (password.equals(confirmPassword)) {
|
if (password.equals(confirmPassword)) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
} else {
|
} else {
|
||||||
this.password = null;
|
this.password = null;
|
||||||
}
|
}
|
||||||
this.email = getEmailField().getText();
|
this.email = getEmailField().getText();
|
||||||
this.website = getWebsiteField().getText();
|
this.website = getWebsiteField().getText();
|
||||||
this.bio = getBioArea().getText();
|
this.bio = getBioArea().getText();
|
||||||
JButton okButton = getButton(OK);
|
JButton okButton = getButton(OK);
|
||||||
okButton.setEnabled(!this.userName.isEmpty()
|
okButton.setEnabled(!this.userName.isEmpty()
|
||||||
&& !this.email.isEmpty() && this.email.contains("@")
|
&& !this.email.isEmpty() && this.email.contains("@")
|
||||||
&& (this.existingEntity != null || ((this.password != null) && (this.password.length() > 0))));
|
&& (this.existingEntity != null || ((this.password != null) && (this.password.length() > 0))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JTextField getUserNameField() {
|
private JTextField getUserNameField() {
|
||||||
if (userNameField == null) {
|
if (userNameField == null) {
|
||||||
userNameField = new JTextField();
|
userNameField = new JTextField();
|
||||||
if (existingEntity != null) {
|
if (existingEntity != null) {
|
||||||
userNameField.setText(existingEntity.getUsername());
|
userNameField.setText(existingEntity.getUsername());
|
||||||
userNameField.setEditable(false);
|
userNameField.setEditable(false);
|
||||||
}
|
}
|
||||||
userNameField.getDocument().addDocumentListener(new DocumentListener() {
|
userNameField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return userNameField;
|
return userNameField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPasswordField getPasswordField() {
|
private JPasswordField getPasswordField() {
|
||||||
if (passwordField == null) {
|
if (passwordField == null) {
|
||||||
passwordField = new JPasswordField();
|
passwordField = new JPasswordField();
|
||||||
passwordField.getDocument().addDocumentListener(new DocumentListener() {
|
passwordField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return passwordField;
|
return passwordField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPasswordField getConfirmPasswordField() {
|
private JPasswordField getConfirmPasswordField() {
|
||||||
if (confirmPasswordField == null) {
|
if (confirmPasswordField == null) {
|
||||||
confirmPasswordField = new JPasswordField();
|
confirmPasswordField = new JPasswordField();
|
||||||
confirmPasswordField.getDocument().addDocumentListener(new DocumentListener() {
|
confirmPasswordField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return confirmPasswordField;
|
return confirmPasswordField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JTextField getEmailField() {
|
private JTextField getEmailField() {
|
||||||
if (emailField == null) {
|
if (emailField == null) {
|
||||||
emailField = new JTextField();
|
emailField = new JTextField();
|
||||||
if (existingEntity != null) {
|
if (existingEntity != null) {
|
||||||
emailField.setText(existingEntity.getEmail());
|
emailField.setText(existingEntity.getEmail());
|
||||||
emailField.setEditable(false);
|
emailField.setEditable(false);
|
||||||
}
|
}
|
||||||
emailField.getDocument().addDocumentListener(new DocumentListener() {
|
emailField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return emailField;
|
return emailField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JTextField getWebsiteField() {
|
private JTextField getWebsiteField() {
|
||||||
if (websiteField == null) {
|
if (websiteField == null) {
|
||||||
websiteField = new JTextField();
|
websiteField = new JTextField();
|
||||||
if (existingEntity != null)
|
if (existingEntity != null)
|
||||||
websiteField.setText(existingEntity.getWebsite());
|
websiteField.setText(existingEntity.getWebsite());
|
||||||
websiteField.getDocument().addDocumentListener(new DocumentListener() {
|
websiteField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return websiteField;
|
return websiteField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JScrollPane getBioPane() {
|
private JScrollPane getBioPane() {
|
||||||
if (bioPane == null) {
|
if (bioPane == null) {
|
||||||
bioPane = new JScrollPane(getBioArea());
|
bioPane = new JScrollPane(getBioArea());
|
||||||
bioPane.setPreferredSize(new Dimension(192, 64));
|
bioPane.setPreferredSize(new Dimension(192, 64));
|
||||||
bioPane.setBorder(getBioArea().getBorder());
|
bioPane.setBorder(getBioArea().getBorder());
|
||||||
getBioArea().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
getBioArea().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||||
}
|
}
|
||||||
return bioPane;
|
return bioPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JTextArea getBioArea() {
|
private JTextArea getBioArea() {
|
||||||
if (bioArea == null) {
|
if (bioArea == null) {
|
||||||
bioArea = new HTMLTextArea();
|
bioArea = new HTMLTextArea();
|
||||||
if (existingEntity != null)
|
if (existingEntity != null)
|
||||||
bioArea.setText(existingEntity.getBio());
|
bioArea.setText(existingEntity.getBio());
|
||||||
bioArea.setFont(getUserNameField().getFont());
|
bioArea.setFont(getUserNameField().getFont());
|
||||||
bioArea.setBorder(getUserNameField().getBorder());
|
bioArea.setBorder(getUserNameField().getBorder());
|
||||||
bioArea.getDocument().addDocumentListener(new DocumentListener() {
|
bioArea.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return bioArea;
|
return bioArea;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
'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:
|
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.
|
- 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';
|
DELETE FROM diylc_knowledge_base WHERE section = 'AI Assitant/Chatbot/ChatGPT/GPT - Using the AI Assistant';
|
||||||
|
|||||||
Reference in New Issue
Block a user