* commit '6f14124119d627cdaa8cf7b49a60fde878f8bd4a': (85 commits) 无jira任务 应用补丁的时候有一个没有删除 移到designer_base pmd REPORT-2213 设计器右上角使用qq登录后,登录界面关不掉 & 这部分的代码质量 REPORT-2335 插件管理界面以及右上角的登录界面,多次点击后,页面无法关闭 无JIRA任务 合并代码时的错误覆盖 REPORT-1885 frm跑马灯=>默认字体由textPane确定,不写死 无任务,pmd REPORT-2537 多层次部门工具栏权限细粒度设置不生效 REPORT-2483 国际化key转移;去掉空白行 无任务,冲突调整,release到dev 无JIRA任务,国际化,把release、master中的key合并到dev中 无JIRA任务,解决冲突 ct ct ct ct 1 ct REPORT-2526 tab交互改良后续--tab页签调整的视觉调整 ...master
@ -1,45 +0,0 @@ |
|||||||
package com.fr.design.beans.location; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.icon.IconPathConstants; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhouping on 2016/7/24. |
|
||||||
*/ |
|
||||||
public class WidgetForbidWindow extends JWindow { |
|
||||||
|
|
||||||
private static final int WIDTH = 150; |
|
||||||
private static final int HEIGHT = 20; |
|
||||||
|
|
||||||
private UIButton promptButton = new UIButton(Inter.getLocText("FR-Designer_Forbid_Widgets_Intersects"), BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); |
|
||||||
|
|
||||||
/** |
|
||||||
* 构造函数 |
|
||||||
*/ |
|
||||||
public WidgetForbidWindow() { |
|
||||||
this.add(promptButton); |
|
||||||
this.setSize(WIDTH, HEIGHT); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 在指定位置显示窗口, 默认将window的中心点放到指定位置上 |
|
||||||
* |
|
||||||
* @param x x坐标 |
|
||||||
* @param y y坐标 |
|
||||||
*/ |
|
||||||
public void showWindow(int x, int y) { |
|
||||||
this.setLocation(x - WIDTH / 2, y - HEIGHT / 2); |
|
||||||
this.setVisible(true); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 隐藏当前窗口 |
|
||||||
*/ |
|
||||||
public void hideWindow() { |
|
||||||
this.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,15 @@ |
|||||||
|
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
|
import com.fr.file.DatasourceManagerProvider; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by yaoh.wu on 2017/4/22. |
||||||
|
* 数据链接显示面板 |
||||||
|
*/ |
||||||
|
public interface ConnectionShowPane { |
||||||
|
void update(DatasourceManagerProvider datasourceManager); |
||||||
|
|
||||||
|
void populate(DatasourceManagerProvider datasourceManager); |
||||||
|
|
||||||
|
void setSelectedIndex(int index); |
||||||
|
} |
@ -1,32 +1,29 @@ |
|||||||
package com.fr.design.mainframe.bbs; |
package com.fr.design.extra; |
||||||
|
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.UIDialog; |
import com.fr.design.dialog.UIDialog; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.stable.StableUtils; |
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by zhaohehe on 16/7/26. |
* Created by vito on 2017/5/5. |
||||||
*/ |
*/ |
||||||
public class LoginDialog extends UIDialog { |
public class LoginDialog extends UIDialog { |
||||||
private static final Dimension DEFAULT_SHOP = new Dimension(401, 201); |
private static final Dimension DEFAULT_SHOP = new Dimension(401, 201); |
||||||
|
|
||||||
public LoginDialog(Frame frame, BasicPane pane) { |
public LoginDialog(Frame frame, Component pane) { |
||||||
super(frame); |
super(frame); |
||||||
setUndecorated(true); |
if (StableUtils.getMajorJavaVersion() == 8) { |
||||||
|
setUndecorated(true); |
||||||
|
} |
||||||
JPanel panel = (JPanel) getContentPane(); |
JPanel panel = (JPanel) getContentPane(); |
||||||
panel.setLayout(new BorderLayout()); |
panel.setLayout(new BorderLayout()); |
||||||
add(pane, BorderLayout.CENTER); |
add(pane, BorderLayout.CENTER); |
||||||
setSize(DEFAULT_SHOP); |
setSize(DEFAULT_SHOP); |
||||||
GUICoreUtils.centerWindow(this); |
GUICoreUtils.centerWindow(this); |
||||||
setResizable(false); |
setResizable(false); |
||||||
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager")); |
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
@ -1,152 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.RestartHelper; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.gui.frpane.UITabbedPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.plugin.PluginVerifyException; |
|
||||||
import com.fr.stable.StableUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.File; |
|
||||||
import java.net.HttpURLConnection; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhaohehe on 16/7/27. |
|
||||||
*/ |
|
||||||
public class LoginPane extends BasicPane { |
|
||||||
private static final String LATEST = "latest"; |
|
||||||
|
|
||||||
public LoginPane() { |
|
||||||
setLayout(new BorderLayout()); |
|
||||||
if (StableUtils.getMajorJavaVersion() == 8) { |
|
||||||
String installHome; |
|
||||||
if (StableUtils.isDebug()) { |
|
||||||
URL url = ClassLoader.getSystemResource(""); |
|
||||||
installHome = url.getPath(); |
|
||||||
addPane(installHome); |
|
||||||
} else { |
|
||||||
installHome = StableUtils.getInstallHome(); |
|
||||||
File file = new File(StableUtils.pathJoin(installHome, "scripts")); |
|
||||||
if (!file.exists()) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} else { |
|
||||||
addPane(installHome); |
|
||||||
updateShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
initTraditionalStore(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void addPane(String installHome) { |
|
||||||
LoginWebPane webPane = new LoginWebPane(new File(installHome).getAbsolutePath(),LoginPane.this); |
|
||||||
add(webPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return Inter.getLocText("FR-Designer-Plugin_Manager"); |
|
||||||
} |
|
||||||
|
|
||||||
private void downloadShopScripts() { |
|
||||||
new SwingWorker<Boolean, Void>() { |
|
||||||
@Override |
|
||||||
protected Boolean doInBackground() throws Exception { |
|
||||||
String id = "shop_scripts"; |
|
||||||
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
||||||
try { |
|
||||||
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { |
|
||||||
@Override |
|
||||||
public void process(Double integer) { |
|
||||||
} |
|
||||||
}); |
|
||||||
} catch (PluginVerifyException e) { |
|
||||||
JOptionPane.showMessageDialog(LoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
||||||
return false; |
|
||||||
} catch (Exception e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void done() { |
|
||||||
try { |
|
||||||
if (get()) { |
|
||||||
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); |
|
||||||
int rv = JOptionPane.showOptionDialog( |
|
||||||
LoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.YES_NO_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE, |
|
||||||
null, |
|
||||||
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, |
|
||||||
null |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
RestartHelper.restart(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (InterruptedException | ExecutionException e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateShopScripts() { |
|
||||||
new SwingWorker<Void, Void>() { |
|
||||||
@Override |
|
||||||
protected Void doInBackground() throws Exception { |
|
||||||
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION); |
|
||||||
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { |
|
||||||
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
LoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initTraditionalStore() { |
|
||||||
UITabbedPane tabbedPane = new UITabbedPane(); |
|
||||||
add(tabbedPane, BorderLayout.CENTER); |
|
||||||
PluginInstalledPane installedPane = new PluginInstalledPane(); |
|
||||||
tabbedPane.addTab(installedPane.tabTitle(), installedPane); |
|
||||||
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane)); |
|
||||||
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane)); |
|
||||||
} |
|
||||||
} |
|
@ -1,145 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.RestartHelper; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.plugin.PluginVerifyException; |
|
||||||
import com.fr.stable.StableUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.File; |
|
||||||
import java.net.HttpURLConnection; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhaohehe on 16/7/28. |
|
||||||
*/ |
|
||||||
public class QQLoginPane extends BasicPane { |
|
||||||
private static final String LATEST = "latest"; |
|
||||||
|
|
||||||
public QQLoginPane() { |
|
||||||
setLayout(new BorderLayout()); |
|
||||||
if (StableUtils.getMajorJavaVersion() == 8) { |
|
||||||
String installHome; |
|
||||||
if (StableUtils.isDebug()) { |
|
||||||
URL url = ClassLoader.getSystemResource(""); |
|
||||||
installHome = url.getPath(); |
|
||||||
addPane(installHome); |
|
||||||
} else { |
|
||||||
installHome = StableUtils.getInstallHome(); |
|
||||||
File file = new File(StableUtils.pathJoin(installHome, "scripts")); |
|
||||||
if (!file.exists()) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} else { |
|
||||||
addPane(installHome); |
|
||||||
updateShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void addPane(String installHome) { |
|
||||||
QQLoginWebPane webPane = new QQLoginWebPane(new File(installHome).getAbsolutePath()); |
|
||||||
add(webPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return Inter.getLocText("FR-Designer-Plugin_Manager"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void downloadShopScripts() { |
|
||||||
new SwingWorker<Boolean, Void>() { |
|
||||||
@Override |
|
||||||
protected Boolean doInBackground() throws Exception { |
|
||||||
String id = "shop_scripts"; |
|
||||||
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
||||||
try { |
|
||||||
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { |
|
||||||
@Override |
|
||||||
public void process(Double integer) { |
|
||||||
} |
|
||||||
}); |
|
||||||
} catch (PluginVerifyException e) { |
|
||||||
JOptionPane.showMessageDialog(QQLoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
||||||
return false; |
|
||||||
} catch (Exception e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void done() { |
|
||||||
|
|
||||||
try { |
|
||||||
if (get()) { |
|
||||||
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); |
|
||||||
int rv = JOptionPane.showOptionDialog( |
|
||||||
QQLoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.YES_NO_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE, |
|
||||||
null, |
|
||||||
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, |
|
||||||
null |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
RestartHelper.restart(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (InterruptedException | ExecutionException e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateShopScripts() { |
|
||||||
new SwingWorker<Void, Void>() { |
|
||||||
@Override |
|
||||||
protected Void doInBackground() throws Exception { |
|
||||||
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION); |
|
||||||
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { |
|
||||||
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
QQLoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
} |
|
@ -1,131 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.dialog.UIDialog; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.general.FRLogger; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
import org.json.JSONObject; |
|
||||||
import netscape.javascript.JSObject; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.IOException; |
|
||||||
import java.net.URI; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by lp on 2016/8/10. |
|
||||||
*/ |
|
||||||
public class QQLoginWebBridge { |
|
||||||
|
|
||||||
private static com.fr.design.extra.QQLoginWebBridge helper; |
|
||||||
private WebEngine webEngine; |
|
||||||
private static String LOGINSUCCESS = "ok"; |
|
||||||
private static String LOGINFAILED = "failed"; |
|
||||||
private UIDialog uiDialog; |
|
||||||
private UILabel uiLabel; |
|
||||||
private UILabel pluginuiLabel; |
|
||||||
private UIDialog qqDialog; |
|
||||||
private String username; |
|
||||||
|
|
||||||
|
|
||||||
private QQLoginWebBridge() { |
|
||||||
} |
|
||||||
|
|
||||||
public static com.fr.design.extra.QQLoginWebBridge getHelper() { |
|
||||||
if (helper != null) { |
|
||||||
return helper; |
|
||||||
} |
|
||||||
synchronized (com.fr.design.extra.QQLoginWebBridge.class) { |
|
||||||
if (helper == null) { |
|
||||||
helper = new com.fr.design.extra.QQLoginWebBridge(); |
|
||||||
} |
|
||||||
return helper; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void setEngine(WebEngine webEngine) { |
|
||||||
this.webEngine = webEngine; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDialogHandle(UIDialog uiDialog) { |
|
||||||
this.uiDialog = uiDialog; |
|
||||||
} |
|
||||||
|
|
||||||
public void setQQDialogHandle(UIDialog uiDialog) { |
|
||||||
this.qqDialog = uiDialog; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUILabel(UILabel uiLabel) { |
|
||||||
this.uiLabel = uiLabel; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUILabelInPlugin(UILabel uiLabel) { |
|
||||||
this.pluginuiLabel = uiLabel; |
|
||||||
} |
|
||||||
|
|
||||||
public void setLoginlabel() { |
|
||||||
username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
} |
|
||||||
|
|
||||||
private static JSObject window; |
|
||||||
|
|
||||||
public static com.fr.design.extra.QQLoginWebBridge getHelper(WebEngine webEngine) { |
|
||||||
getHelper(); |
|
||||||
helper.setEngine(webEngine); |
|
||||||
return helper; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 关闭QQ授权窗口 |
|
||||||
*/ |
|
||||||
public void closeQQWindow() { |
|
||||||
if (qqDialog != null) { |
|
||||||
qqDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
||||||
qqDialog.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 关闭父窗口 |
|
||||||
*/ |
|
||||||
public void closeParentWindow() { |
|
||||||
if (uiDialog != null) { |
|
||||||
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
||||||
uiDialog.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 获取用户信息 |
|
||||||
* @param userInfo |
|
||||||
*/ |
|
||||||
public void getLoginInfo(String userInfo) { |
|
||||||
JSONObject jo = new JSONObject(userInfo); |
|
||||||
String status = jo.get("status").toString(); |
|
||||||
if (status.equals(LOGINSUCCESS)) { |
|
||||||
String username = jo.get("username").toString(); |
|
||||||
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString()); |
|
||||||
closeQQWindow(); |
|
||||||
closeParentWindow(); |
|
||||||
pluginuiLabel.setText(username); |
|
||||||
DesignerEnvManager.getEnvManager().setBBSName(username); |
|
||||||
DesignerEnvManager.getEnvManager().setBbsUid(uid); |
|
||||||
DesignerEnvManager.getEnvManager().setInShowBBsName(username); |
|
||||||
}else if (status.equals(LOGINFAILED)){ |
|
||||||
//账号没有QQ授权
|
|
||||||
closeQQWindow(); |
|
||||||
try { |
|
||||||
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding"))); |
|
||||||
}catch (Exception exp) { |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { |
|
||||||
if (url.indexOf("qqLogin.html") > 0) { |
|
||||||
return; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,36 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by vito on 2016/9/28. |
|
||||||
*/ |
|
||||||
public class ReuseWebBridge { |
|
||||||
public static ReuseWebBridge helper; |
|
||||||
private WebEngine webEngine; |
|
||||||
|
|
||||||
public static ReuseWebBridge getHelper() { |
|
||||||
if (helper != null) { |
|
||||||
return helper; |
|
||||||
} |
|
||||||
synchronized (ReuseWebBridge.class) { |
|
||||||
if (helper == null) { |
|
||||||
helper = new ReuseWebBridge(); |
|
||||||
} |
|
||||||
return helper; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static ReuseWebBridge getHelper(WebEngine webEngine) { |
|
||||||
getHelper(); |
|
||||||
helper.setEngine(webEngine); |
|
||||||
return helper; |
|
||||||
} |
|
||||||
|
|
||||||
private ReuseWebBridge() { |
|
||||||
} |
|
||||||
|
|
||||||
public void setEngine(WebEngine webEngine) { |
|
||||||
this.webEngine = webEngine; |
|
||||||
} |
|
||||||
} |
|
@ -1,54 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import javafx.application.Platform; |
|
||||||
import javafx.embed.swing.JFXPanel; |
|
||||||
import javafx.event.EventHandler; |
|
||||||
import javafx.scene.Scene; |
|
||||||
import javafx.scene.layout.BorderPane; |
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
import javafx.scene.web.WebEvent; |
|
||||||
import javafx.scene.web.WebView; |
|
||||||
import netscape.javascript.JSObject; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by vito on 2016/9/28. |
|
||||||
*/ |
|
||||||
public class ReuseWebPane extends JFXPanel { |
|
||||||
private WebEngine webEngine; |
|
||||||
|
|
||||||
public ReuseWebPane(final String mainJs) { |
|
||||||
Platform.setImplicitExit(false); |
|
||||||
Platform.runLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
BorderPane root = new BorderPane(); |
|
||||||
Scene scene = new Scene(root); |
|
||||||
ReuseWebPane.this.setScene(scene); |
|
||||||
WebView webView = new WebView(); |
|
||||||
webEngine = webView.getEngine(); |
|
||||||
webEngine.load("file:///" + mainJs); |
|
||||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
|
||||||
@Override |
|
||||||
public void handle(WebEvent<String> event) { |
|
||||||
showAlert(event.getData()); |
|
||||||
} |
|
||||||
}); |
|
||||||
JSObject obj = (JSObject) webEngine.executeScript("window"); |
|
||||||
obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine)); |
|
||||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
|
||||||
root.setCenter(webView); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private void showAlert(final String message) { |
|
||||||
SwingUtilities.invokeLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
JOptionPane.showMessageDialog(ReuseWebPane.this, message); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
After Width: | Height: | Size: 248 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 273 B |
@ -1,112 +1,104 @@ |
|||||||
package com.fr.design.style.color; |
package com.fr.design.style.color; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.design.dialog.BasicPane; |
||||||
import java.awt.Color; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import java.awt.Dimension; |
import com.fr.general.Inter; |
||||||
|
|
||||||
import javax.swing.JColorChooser; |
import javax.swing.*; |
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.colorchooser.AbstractColorChooserPanel; |
import javax.swing.colorchooser.AbstractColorChooserPanel; |
||||||
import javax.swing.colorchooser.ColorSelectionModel; |
import javax.swing.colorchooser.ColorSelectionModel; |
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
|
import java.awt.*; |
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 颜色选择器更多颜色面板 |
* 颜色选择器更多颜色面板 |
||||||
* @author focus |
|
||||||
* |
* |
||||||
|
* @author focus |
||||||
*/ |
*/ |
||||||
public class ColorSelectDetailPane extends BasicPane{ |
public class ColorSelectDetailPane extends BasicPane { |
||||||
private static final int SELECT_PANEL_HEIGHT = 245; |
private static final int SELECT_PANEL_HEIGHT = 245; |
||||||
// Selected color
|
// Selected color
|
||||||
private Color color; |
private Color color; |
||||||
|
|
||||||
// 颜色选择器面板
|
// 颜色选择器面板
|
||||||
JColorChooser selectedPanel; |
private JColorChooser selectedPanel; |
||||||
|
|
||||||
// 最近使用颜色面板
|
// 最近使用颜色面板
|
||||||
JPanel recentUsePanel; |
private JPanel recentUsePanel; |
||||||
|
|
||||||
// 预览
|
// 预览
|
||||||
JPanel previewPanel; |
private JPanel previewPanel; |
||||||
|
|
||||||
public JColorChooser getSelectedPanel() { |
public JColorChooser getSelectedPanel() { |
||||||
return selectedPanel; |
return selectedPanel; |
||||||
} |
} |
||||||
|
|
||||||
public void setSelectedPanel(JColorChooser selectedPanel) { |
public void setSelectedPanel(JColorChooser selectedPanel) { |
||||||
this.selectedPanel = selectedPanel; |
this.selectedPanel = selectedPanel; |
||||||
} |
} |
||||||
|
|
||||||
public Color getColor() { |
public Color getColor() { |
||||||
return color; |
return color; |
||||||
} |
} |
||||||
|
|
||||||
public void setColor(Color color) { |
public void setColor(Color color) { |
||||||
this.color = color; |
this.color = color; |
||||||
} |
} |
||||||
|
|
||||||
public ColorSelectDetailPane() { |
public ColorSelectDetailPane(Color color) { |
||||||
super(); |
if (color == null) { |
||||||
} |
color = Color.white; |
||||||
|
} |
||||||
public ColorSelectDetailPane(Color color){ |
this.color = color; |
||||||
if(color == null){ |
initComponents(); |
||||||
color = Color.white; |
} |
||||||
} |
|
||||||
this.color = color; |
@Override |
||||||
initComponents(); |
protected String title4PopupWindow() { |
||||||
} |
return null; |
||||||
|
} |
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
protected void initComponents() { |
||||||
return null; |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
} |
|
||||||
|
// 颜色选择器面板
|
||||||
protected void initComponents() { |
selectedPanel = new JColorChooser(this.color); |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(), SELECT_PANEL_HEIGHT)); |
||||||
|
AbstractColorChooserPanel[] choosers = selectedPanel.getChooserPanels(); |
||||||
// 颜色选择器面板
|
for (int i = 0; i < choosers.length; i++) { |
||||||
selectedPanel = new JColorChooser(this.color); |
selectedPanel.removeChooserPanel(choosers[i]); |
||||||
selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(),SELECT_PANEL_HEIGHT)); |
} |
||||||
AbstractColorChooserPanel[] choosers = selectedPanel.getChooserPanels(); |
selectedPanel.setPreviewPanel(new JPanel()); |
||||||
for(int i=0;i<choosers.length;i++){ |
|
||||||
selectedPanel.removeChooserPanel(choosers[i]); |
AbstractColorChooserPanel swatchChooserPanel = new SwatchChooserPanel(); |
||||||
} |
AbstractColorChooserPanel customChooserPanel = new CustomChooserPanel(); |
||||||
selectedPanel.setPreviewPanel(new JPanel()); |
selectedPanel.addChooserPanel(swatchChooserPanel); |
||||||
|
selectedPanel.addChooserPanel(customChooserPanel); |
||||||
AbstractColorChooserPanel swatchChooserPanel = new SwatchChooserPanel(); |
this.add(selectedPanel, BorderLayout.NORTH); |
||||||
AbstractColorChooserPanel customChooserPanel = new CustomChooserPanel(); |
|
||||||
selectedPanel.addChooserPanel(swatchChooserPanel); |
// 最近使用面板
|
||||||
selectedPanel.addChooserPanel(customChooserPanel); |
recentUsePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Used")); |
||||||
this.add(selectedPanel, BorderLayout.NORTH); |
RecentUseColorPane recent = new RecentUseColorPane(selectedPanel); |
||||||
|
recentUsePanel.add(recent); |
||||||
// 最近使用面板
|
|
||||||
recentUsePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Used")); |
this.add(recentUsePanel, BorderLayout.CENTER); |
||||||
RecentUseColorPane recent = new RecentUseColorPane(selectedPanel); |
|
||||||
recentUsePanel.add(recent); |
selectedPanel.setPreviewPanel(new JPanel()); |
||||||
|
|
||||||
this.add(recentUsePanel,BorderLayout.CENTER); |
// 预览
|
||||||
|
previewPanel = FRGUIPaneFactory.createTitledBorderPaneCenter(Inter.getLocText("FR-Designer_Preview")); |
||||||
selectedPanel.setPreviewPanel(new JPanel()); |
final ColorChooserPreview colorChooserPreview = new ColorChooserPreview(); |
||||||
|
ColorSelectionModel model = selectedPanel.getSelectionModel(); |
||||||
// 预览
|
model.addChangeListener(new ChangeListener() { |
||||||
previewPanel = FRGUIPaneFactory.createTitledBorderPaneCenter(Inter.getLocText("FR-Designer_Preview")); |
@Override |
||||||
final ColorChooserPreview colorChooserPreview = new ColorChooserPreview(); |
public void stateChanged(ChangeEvent e) { |
||||||
ColorSelectionModel model = selectedPanel.getSelectionModel(); |
ColorSelectionModel model = (ColorSelectionModel) e.getSource(); |
||||||
model.addChangeListener(new ChangeListener() { |
colorChooserPreview.setMyColor(model.getSelectedColor()); |
||||||
@Override |
colorChooserPreview.paint(colorChooserPreview.getGraphics()); |
||||||
public void stateChanged(ChangeEvent e) { |
} |
||||||
ColorSelectionModel model = (ColorSelectionModel) e.getSource(); |
}); |
||||||
colorChooserPreview.setMyColor(model.getSelectedColor()); |
previewPanel.add(colorChooserPreview); |
||||||
colorChooserPreview.paint(colorChooserPreview.getGraphics()); |
this.add(previewPanel, BorderLayout.SOUTH); |
||||||
} |
} |
||||||
}); |
|
||||||
previewPanel.add(colorChooserPreview); |
|
||||||
this.add(previewPanel, BorderLayout.SOUTH); |
|
||||||
} |
|
||||||
} |
} |
@ -1,215 +1,205 @@ |
|||||||
package com.fr.design.style.color; |
package com.fr.design.style.color; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Cursor; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.MouseAdapter; |
|
||||||
import java.awt.event.MouseEvent; |
|
||||||
import java.util.ArrayList; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.Box; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
|
|
||||||
import com.fr.design.constants.UIConstants; |
|
||||||
import com.fr.design.border.UIRoundedBorder; |
import com.fr.design.border.UIRoundedBorder; |
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.event.ChangeEvent; |
||||||
|
import javax.swing.event.ChangeListener; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* |
|
||||||
* @author zhou |
* @author zhou |
||||||
* @since 2012-5-29上午10:39:35 |
* @since 2012-5-29上午10:39:35 |
||||||
*/ |
*/ |
||||||
public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
||||||
private static final long serialVersionUID = -8634152305687249392L; |
private static final long serialVersionUID = -8634152305687249392L; |
||||||
|
|
||||||
private Color color = null; // color
|
private Color color = null; // color
|
||||||
// color setting action.
|
// color setting action.
|
||||||
private ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<ChangeListener>(); |
private ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<ChangeListener>(); |
||||||
|
|
||||||
// 颜色选择器
|
// 颜色选择器
|
||||||
private ColorSelectDetailPane pane; |
private ColorSelectDetailPane pane; |
||||||
// 是否支持透明
|
// 是否支持透明
|
||||||
private boolean isSupportTransparent; |
private boolean isSupportTransparent; |
||||||
|
|
||||||
private final static int TRANSPANENT_WINDOW_HEIGHT = 165; |
private final static int TRANSPANENT_WINDOW_HEIGHT = 165; |
||||||
private final static int WINDWO_HEIGHT = 150; |
private final static int WINDWO_HEIGHT = 150; |
||||||
|
|
||||||
// 最近使用颜色
|
// 最近使用颜色
|
||||||
UsedColorPane usedColorPane; |
private UsedColorPane usedColorPane; |
||||||
|
|
||||||
/** |
/** |
||||||
* Constructor. |
* Constructor. |
||||||
*/ |
*/ |
||||||
public NewColorSelectPane() { |
public NewColorSelectPane() { |
||||||
this(false); |
this(false); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Constructor. |
* Constructor. |
||||||
*/ |
*/ |
||||||
public NewColorSelectPane(boolean isSupportTransparent) { |
public NewColorSelectPane(boolean isSupportTransparent) { |
||||||
this.isSupportTransparent = isSupportTransparent; |
this.isSupportTransparent = isSupportTransparent; |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
this.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); |
this.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); |
||||||
if (isSupportTransparent) { |
if (isSupportTransparent) { |
||||||
UIButton transpanrentButton = new UIButton(Inter.getLocText("FR-Designer_ChartF-Transparency")); |
UIButton transpanrentButton = new UIButton(Inter.getLocText("FR-Designer_ChartF-Transparency")); |
||||||
this.add(transpanrentButton, BorderLayout.NORTH); |
this.add(transpanrentButton, BorderLayout.NORTH); |
||||||
transpanrentButton.addActionListener(new ActionListener() { |
transpanrentButton.addActionListener(new ActionListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void actionPerformed(ActionEvent e) { |
public void actionPerformed(ActionEvent e) { |
||||||
doTransparent(); |
doTransparent(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
// center
|
// center
|
||||||
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||||
this.add(centerPane, BorderLayout.CENTER); |
this.add(centerPane, BorderLayout.CENTER); |
||||||
|
|
||||||
// 第一行
|
// 第一行
|
||||||
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
||||||
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0)); |
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0)); |
||||||
row1Pane.setPreferredSize(new Dimension(135, 16)); // 宽度为 16 * 8 + 7
|
row1Pane.setPreferredSize(new Dimension(135, 16)); // 宽度为 16 * 8 + 7
|
||||||
centerPane.add(row1Pane); |
centerPane.add(row1Pane); |
||||||
// 最近使用
|
// 最近使用
|
||||||
usedColorPane = new UsedColorPane(1, 8, 1, ColorSelectConfigManager.getInstance().getColors(), this, true, false); |
usedColorPane = new UsedColorPane(1, 8, 1, this, true, false); |
||||||
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8)); |
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8)); |
||||||
row1Pane.add(usedColorPane.getPane()); |
row1Pane.add(usedColorPane.getPane()); |
||||||
|
|
||||||
JPanel menuColorPane1 = new JPanel(); |
JPanel menuColorPane1 = new JPanel(); |
||||||
centerPane.add(menuColorPane1); |
centerPane.add(menuColorPane1); |
||||||
|
|
||||||
menuColorPane1.setLayout(new GridLayout(5, 8, 1, 1)); |
menuColorPane1.setLayout(new GridLayout(5, 8, 1, 1)); |
||||||
menuColorPane1.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); |
menuColorPane1.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); |
||||||
for (int i = 0; i < ColorFactory.MenuColors.length; i++) { |
for (int i = 0; i < ColorFactory.MenuColors.length; i++) { |
||||||
menuColorPane1.add(new ColorCell(ColorFactory.MenuColors[i], this)); |
menuColorPane1.add(new ColorCell(ColorFactory.MenuColors[i], this)); |
||||||
} |
} |
||||||
|
|
||||||
centerPane.add(Box.createVerticalStrut(1)); |
centerPane.add(Box.createVerticalStrut(1)); |
||||||
|
|
||||||
// mod by anchore 16/11/16
|
// mod by anchore 16/11/16
|
||||||
UIButton customButton = new UIButton(Inter.getLocText("FR-Designer-Basic_More_Color")); |
UIButton customButton = new UIButton(Inter.getLocText("FR-Designer-Basic_More_Color")); |
||||||
//UIButton customButton = new UIButton(Inter.getLocText(new String[]{"More", "Color"}) + "...");
|
|
||||||
|
customButton.addMouseListener(new MouseAdapter() { |
||||||
customButton.addMouseListener(new MouseAdapter() { |
@Override |
||||||
@Override |
public void mousePressed(MouseEvent e) { |
||||||
public void mousePressed(MouseEvent e) { |
customButtonPressed(); |
||||||
customButtonPressed(); |
} |
||||||
} |
}); |
||||||
}); |
customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
||||||
customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8)); |
||||||
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8)); |
centerPane1.add(customButton, BorderLayout.NORTH); |
||||||
centerPane1.add(customButton, BorderLayout.NORTH); |
centerPane.add(centerPane1); |
||||||
centerPane.add(centerPane1); |
} |
||||||
} |
|
||||||
|
|
||||||
|
/** |
||||||
|
* 添加监听 |
||||||
/** |
* |
||||||
* 添加监听 |
* @param 监听列表 Add change listener. |
||||||
* @param 监听列表 |
*/ |
||||||
* Add change listener. |
public void addChangeListener(ChangeListener changeListener) { |
||||||
*/ |
this.colorChangeListenerList.add(changeListener); |
||||||
public void addChangeListener(ChangeListener changeListener) { |
} |
||||||
this.colorChangeListenerList.add(changeListener); |
|
||||||
} |
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
@Override |
return "Color"; |
||||||
protected String title4PopupWindow() { |
} |
||||||
return "Color"; |
|
||||||
} |
/** |
||||||
|
* 获取颜色 |
||||||
/** |
* |
||||||
* 获取颜色 |
* @return 颜色 |
||||||
* @return 颜色 |
* Return the color. |
||||||
* Return the color. |
*/ |
||||||
*/ |
public Color getColor() { |
||||||
public Color getColor() { |
return color; |
||||||
return color; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 获取颜色 |
||||||
* 获取颜色 |
* |
||||||
* |
* @return 颜色 |
||||||
* @return 颜色 |
*/ |
||||||
*/ |
public Color getNotNoneColor() { |
||||||
public Color getNotNoneColor() { |
if (color == null) { |
||||||
if (color == null) { |
setColor(Color.WHITE); |
||||||
setColor(Color.WHITE); |
return Color.WHITE; |
||||||
return Color.WHITE; |
} |
||||||
} |
return color; |
||||||
return color; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* Set the color. |
||||||
* Set the color. |
* |
||||||
* |
* @param color the new color. |
||||||
* @param color |
*/ |
||||||
* the new color. |
@Override |
||||||
*/ |
public void setColor(Color color) { |
||||||
@Override |
this.color = color; |
||||||
public void setColor(Color color) { |
|
||||||
this.color = color; |
// fire color change.
|
||||||
|
if (!colorChangeListenerList.isEmpty()) { |
||||||
// fire color change.
|
ChangeEvent evt = new ChangeEvent(this); |
||||||
if (!colorChangeListenerList.isEmpty()) { |
|
||||||
ChangeEvent evt = new ChangeEvent(this); |
for (int i = 0; i < colorChangeListenerList.size(); i++) { |
||||||
|
this.colorChangeListenerList.get(i).stateChanged(evt); |
||||||
for (int i = 0; i < colorChangeListenerList.size(); i++) { |
} |
||||||
this.colorChangeListenerList.get(i).stateChanged(evt); |
} |
||||||
} |
ColorSelectConfigManager.getInstance().addToColorQueue(color); |
||||||
} |
this.repaint(); |
||||||
ColorSelectConfigManager.getInstance().addToColorQueue(color); |
} |
||||||
this.repaint(); |
|
||||||
} |
/** |
||||||
|
* 设置颜色 |
||||||
/** |
* |
||||||
* 设置颜色 |
* @param 颜色位置 |
||||||
* @param 颜色位置 |
*/ |
||||||
*/ |
@Override |
||||||
@Override |
public void colorSetted(ColorCell colorCell) { |
||||||
public void colorSetted(ColorCell colorCell) { |
colorCell.repaint(); |
||||||
colorCell.repaint(); |
} |
||||||
} |
|
||||||
|
protected void doTransparent() { |
||||||
protected void doTransparent() { |
setColor(null); |
||||||
setColor(null); |
} |
||||||
} |
|
||||||
protected void customButtonPressed() { |
protected void customButtonPressed() { |
||||||
pane = new ColorSelectDetailPane(Color.WHITE); |
pane = new ColorSelectDetailPane(Color.WHITE); |
||||||
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); |
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Dimension getPreferredSize() { |
public Dimension getPreferredSize() { |
||||||
if(isSupportTransparent){ |
if (isSupportTransparent) { |
||||||
return new Dimension(super.getPreferredSize().width, TRANSPANENT_WINDOW_HEIGHT); |
return new Dimension(super.getPreferredSize().width, TRANSPANENT_WINDOW_HEIGHT); |
||||||
} |
} |
||||||
return new Dimension(super.getPreferredSize().width, WINDWO_HEIGHT); |
return new Dimension(super.getPreferredSize().width, WINDWO_HEIGHT); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 更新最近使用颜色 |
* 更新最近使用颜色 |
||||||
* |
*/ |
||||||
*/ |
public void updateUsedColor() { |
||||||
public void updateUsedColor(){ |
usedColorPane.updateUsedColor(); |
||||||
usedColorPane.updateUsedColor(); |
} |
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
} |
@ -1,55 +1,48 @@ |
|||||||
package com.fr.design.style.color; |
package com.fr.design.style.color; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
|
|
||||||
import javax.swing.JColorChooser; |
|
||||||
import javax.swing.JPanel; |
|
||||||
|
|
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
|
||||||
public class RecentUseColorPane extends BasicPane implements ColorSelectable{ |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class RecentUseColorPane extends BasicPane implements ColorSelectable { |
||||||
|
|
||||||
JColorChooser chooser; |
private JColorChooser chooser; |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
public RecentUseColorPane() { |
|
||||||
} |
|
||||||
|
|
||||||
public RecentUseColorPane(JColorChooser chooser) { |
public RecentUseColorPane(JColorChooser chooser) { |
||||||
this.chooser = chooser; |
this.chooser = chooser; |
||||||
|
|
||||||
// center
|
// center
|
||||||
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||||
this.add(centerPane, BorderLayout.CENTER); |
this.add(centerPane, BorderLayout.CENTER); |
||||||
// 最近使用
|
// 最近使用
|
||||||
UsedColorPane pane = new UsedColorPane(2, 10, ColorSelectConfigManager.getInstance().getColors(),this); |
UsedColorPane pane = new UsedColorPane(2, 10, this); |
||||||
centerPane.add(pane.getPane()); |
centerPane.add(pane.getPane()); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 选中颜色 |
* 选中颜色 |
||||||
* |
*/ |
||||||
* @param 颜色 |
@Override |
||||||
*/ |
public void colorSetted(ColorCell color) { |
||||||
@Override |
|
||||||
public void colorSetted(ColorCell color) { |
|
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Color getColor() { |
public Color getColor() { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void setColor(Color color) { |
public void setColor(Color color) { |
||||||
chooser.getSelectionModel().setSelectedColor(color); |
chooser.getSelectionModel().setSelectedColor(color); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,119 +1,112 @@ |
|||||||
package com.fr.design.style.color; |
package com.fr.design.style.color; |
||||||
|
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.GridLayout; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
|
|
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.gui.ibutton.SpecialUIButton; |
import com.fr.design.gui.ibutton.SpecialUIButton; |
||||||
|
|
||||||
public class UsedColorPane extends BasicPane{ |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
public static final Color DEFAULT_COLOR = new Color(222,222,222); |
|
||||||
|
public class UsedColorPane extends BasicPane { |
||||||
// 最近使用面板列数
|
|
||||||
private int columns; |
// 默认显示颜色
|
||||||
// 最近使用面板行数
|
public static final Color DEFAULT_COLOR = new Color(222, 222, 222); |
||||||
private int rows; |
|
||||||
// 留白的单元格数量
|
// 最近使用面板列数
|
||||||
private int reserveCells; |
private int columns; |
||||||
// 是否需要取色器按钮
|
// 最近使用面板行数
|
||||||
private boolean needPickColorButton; |
private int rows; |
||||||
// 是否在取色时实时设定颜色
|
// 留白的单元格数量
|
||||||
private boolean setColorRealTime; |
private int reserveCells; |
||||||
// 最近使用颜色
|
// 是否需要取色器按钮
|
||||||
private Object[] colors; |
private boolean needPickColorButton; |
||||||
// 最近使用面板
|
// 是否在取色时实时设定颜色
|
||||||
private JPanel pane; |
private boolean setColorRealTime; |
||||||
|
|
||||||
private ColorSelectable selectable; |
// 最近使用面板
|
||||||
|
private JPanel pane; |
||||||
public JPanel getPane() { |
|
||||||
return pane; |
private ColorSelectable selectable; |
||||||
} |
|
||||||
|
public JPanel getPane() { |
||||||
public void setPane(JPanel pane) { |
return pane; |
||||||
this.pane = pane; |
} |
||||||
} |
|
||||||
|
public void setPane(JPanel pane) { |
||||||
public UsedColorPane(){ |
this.pane = pane; |
||||||
|
} |
||||||
} |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 构造函数 |
* 构造函数 |
||||||
* |
* |
||||||
* @param rows 行 |
* @param rows 行 |
||||||
* @param columns 列 |
* @param columns 列 |
||||||
* @param reserveCells 留白的单元格个数 |
* @param reserveCells 留白的单元格个数 |
||||||
* @param colors 最近使用的颜色 |
* @param colors 最近使用的颜色 |
||||||
* @param needPickColorButton 是否需要加上取色器按钮 |
* @param needPickColorButton 是否需要加上取色器按钮 |
||||||
* @param setColorRealTime 取色器是否实时设定颜色 |
* @param setColorRealTime 取色器是否实时设定颜色 |
||||||
*/ |
*/ |
||||||
public UsedColorPane(int rows,int columns,int reserveCells, Object[] colors, ColorSelectable selectable, boolean needPickColorButton, boolean setColorRealTime){ |
public UsedColorPane(int rows, int columns, int reserveCells, ColorSelectable selectable, boolean needPickColorButton, boolean setColorRealTime) { |
||||||
this.columns = columns; |
this.columns = columns; |
||||||
this.rows = rows; |
this.rows = rows; |
||||||
this.reserveCells = reserveCells; |
this.reserveCells = reserveCells; |
||||||
this.colors = colors; |
this.selectable = selectable; |
||||||
this.selectable = selectable; |
this.needPickColorButton = needPickColorButton; |
||||||
this.needPickColorButton = needPickColorButton; |
this.setColorRealTime = setColorRealTime; |
||||||
this.setColorRealTime = setColorRealTime; |
initialComponents(); |
||||||
initialComponents(); |
} |
||||||
} |
|
||||||
|
public UsedColorPane(int rows, int columns, ColorSelectable selectable) { |
||||||
public UsedColorPane(int rows,int columns, Object[] colors,ColorSelectable selectable){ |
this(rows, columns, 0, selectable, false, false); |
||||||
this(rows, columns, 0, colors, selectable, false, false); |
} |
||||||
} |
|
||||||
|
private void initialComponents() { |
||||||
private void initialComponents(){ |
int total = columns * rows; |
||||||
int total = columns * rows; |
JPanel panel = new JPanel(); |
||||||
JPanel panel = new JPanel(); |
panel.setLayout(new GridLayout(rows, columns, 1, 1)); |
||||||
panel.setLayout(new GridLayout(rows,columns, 1, 1)); |
panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); |
||||||
panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); |
//最近使用颜色
|
||||||
Color[] colors = ColorSelectConfigManager.getInstance().getColors(); |
Color[] colors = ColorSelectConfigManager.getInstance().getColors(); |
||||||
int size = colors.length; |
int size = colors.length; |
||||||
|
|
||||||
int i = 0; |
int i = 0; |
||||||
if (needPickColorButton) { |
if (needPickColorButton) { |
||||||
// 取色按钮
|
// 取色按钮
|
||||||
SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); |
SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); |
||||||
panel.add(pickColorButton); |
panel.add(pickColorButton); |
||||||
i++; |
i++; |
||||||
this.reserveCells += 1; |
this.reserveCells += 1; |
||||||
} |
} |
||||||
while (i < this.reserveCells) { |
while (i < this.reserveCells) { |
||||||
ColorCell cc = new ColorCell(DEFAULT_COLOR, selectable); |
ColorCell cc = new ColorCell(DEFAULT_COLOR, selectable); |
||||||
cc.setVisible(false); |
cc.setVisible(false); |
||||||
panel.add(cc); |
panel.add(cc); |
||||||
i++; |
i++; |
||||||
} |
} |
||||||
while (i < total) { |
while (i < total) { |
||||||
Color color = i < size ? colors[size-1-i]: DEFAULT_COLOR; |
Color color = i < size ? colors[size - (i - this.reserveCells) - 1] : DEFAULT_COLOR; |
||||||
panel.add(new ColorCell(color == null ? DEFAULT_COLOR : color, selectable)); |
panel.add(new ColorCell(color == null ? DEFAULT_COLOR : color, selectable)); |
||||||
i++; |
i++; |
||||||
} |
} |
||||||
this.pane = panel; |
this.pane = panel; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 更新最近使用颜色 |
* 更新最近使用颜色 |
||||||
* |
*/ |
||||||
*/ |
public void updateUsedColor() { |
||||||
public void updateUsedColor(){ |
int total = columns * rows; |
||||||
int total = columns * rows; |
Color[] colors = ColorSelectConfigManager.getInstance().getColors(); |
||||||
Color[] colors = ColorSelectConfigManager.getInstance().getColors(); |
int size = colors.length; |
||||||
int size = colors.length; |
for (int i = this.reserveCells; i < total; i++) { |
||||||
for(int i=this.reserveCells; i<total; i++){ |
ColorCell cell = (ColorCell) this.pane.getComponent(i); |
||||||
ColorCell cell = (ColorCell) this.pane.getComponent(i); |
Color color = i < size ? colors[size - (i - this.reserveCells) - 1] : DEFAULT_COLOR; |
||||||
Color color = i < size ? colors[size-1-i]: DEFAULT_COLOR; |
cell.setColor(color == null ? DEFAULT_COLOR : color); |
||||||
cell.setColor(color == null ? DEFAULT_COLOR : color); |
} |
||||||
} |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
protected String title4PopupWindow() { |
||||||
protected String title4PopupWindow() { |
return null; |
||||||
return null; |
} |
||||||
} |
|
||||||
} |
} |