Browse Source
Merge in DESIGN/design from release/10.0 to research/10.0 * commit '09dde1f6c0d61d2094b5662609133844e65f100f': (1007 commits) 删去多余的导包 REPORT-24268 增强公式编辑器插件问题 回滚代码, 现有逻辑不支持功能 判断还是要加上,可能在JWorkBook对象初始化之前,这边的逻辑就先开始了 回滚代码, 现有逻辑不支持功能 经过Hugh老哥提醒,使用注解的方式避免重复的判断 存在空指针异常的可能性,增加一个判断语句 REPORT-37020 参数面板,一个一个添加参数,面板长度不会自适应,撤销就会自适应显示了 1. 为添加单个参数组件和添加单个参数组件+添加查询按钮的方法都加上了设置中心Panel高度的逻辑 REPORT-37020 参数面板,一个一个添加参数,面板长度不会自适应,撤销就会自适应显示了 1. 为添加单个参数组件和添加单个参数组件+添加查询按钮的方法都加上了设置中心Panel高度的逻辑 REPORT-36306 linux设计器改成跳转到平台的插件管理 REPORT-37473 多层嵌套的tab模板,如果进行增加删除tab,无法点击删除 REPORT-37487 数据列右侧属性面板高级部分功能出现问题 右侧面板,显示值为空时,重置为 =$$$ 双击数据源高级中,不会重置。 REPORT-37588【frm设计界面支持缩放】多tab模版,右击tab显示提示,位置不对 REPORT-37473 多层嵌套的tab模板,如果进行增加删除tab,无法点击删除 CHART-14983 根据数据类型调整箱型图数据点提示面板内容 REPORT-37289 处理下npe CHART-15112 刻度单位调整 CHART-15056 使用LinkedHashMap保证条件属性顺序 REPORT-37289 【10.0.9冒烟】frm模板tab,在设计器内进行多次来回点击切换,发现会偶然的点击失效或卡顿 CHART-15112 时间轴英文环境少单位 REPORT-37460 && REPORT-37526 【frm设计界面支持缩放】模板放大后,点击报表块编辑,双击才能生效,缩小模板100%,单击就可以 ...research/10.0
919 changed files with 35897 additions and 9594 deletions
@ -0,0 +1,81 @@
|
||||
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel |
||||
|
||||
plugins { |
||||
id 'java' |
||||
id 'java-library' |
||||
id 'com.fr.common' version '1.0-SNAPSHOT' |
||||
} |
||||
|
||||
// 模块参数 |
||||
ext { |
||||
frVersion = "" |
||||
outputPath = "build" |
||||
ignoreTestFailureSetting = true |
||||
languageLevelSetting = 1.8 |
||||
} |
||||
|
||||
applyGlobalConfigPathIfExist() |
||||
|
||||
if (versions.frVersion) { |
||||
frVersion = versions.frVersion |
||||
} |
||||
def frDevVersion = "DEV" + frVersion |
||||
|
||||
dependencies { |
||||
api project(':designer-base') |
||||
api project(':designer-chart') |
||||
api project(':designer-form') |
||||
api project(':designer-realize') |
||||
} |
||||
|
||||
allprojects { |
||||
apply plugin: 'java' |
||||
apply plugin: 'java-library' |
||||
apply plugin: 'idea' |
||||
|
||||
group 'com.fr.design' |
||||
version frDevVersion |
||||
sourceCompatibility = languageLevelSetting |
||||
targetCompatibility = languageLevelSetting |
||||
|
||||
tasks.withType(JavaCompile) { |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
repositories { |
||||
mavenLocal() |
||||
} |
||||
|
||||
idea { |
||||
module { |
||||
inheritOutputDirs = false |
||||
outputDir = file(outputPath +"/classes") |
||||
testOutputDir = file(outputPath +"/test-classes") |
||||
languageLevel = new IdeaLanguageLevel(sourceCompatibility) |
||||
targetBytecodeVersion = targetCompatibility |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
implementation 'com.fr.third:jxbrowser:6.23' |
||||
implementation 'com.fr.third:jxbrowser-mac:6.23' |
||||
implementation 'com.fr.third:jxbrowser-win64:6.23' |
||||
implementation 'com.fr.third.server:servlet-api:3.0' |
||||
implementation 'org.swingexplorer:swexpl:2.0.1' |
||||
implementation 'org.swingexplorer:swag:1.0' |
||||
implementation 'net.java.dev.jna:jna:5.4.0' |
||||
implementation 'org.apache.tomcat:tomcat-catalina:8.5.32' |
||||
implementation 'io.socket:socket.io-client:0.7.0' |
||||
implementation 'com.fr.third:fine-third:' + frVersion |
||||
implementation 'com.fr.core:fine-core:' + frDevVersion |
||||
implementation 'com.fr.activator:fine-activator:' + frVersion |
||||
implementation 'com.fr.datasource:fine-datasource:' + frVersion |
||||
implementation 'com.fr.decision:fine-decision:' + frVersion |
||||
implementation 'com.fr.schedule:fine-schedule:' + frVersion |
||||
implementation 'com.fr.report:fine-report-engine:' + frDevVersion |
||||
testImplementation 'org.easymock:easymock:3.5.1' |
||||
testImplementation 'org.powermock:powermock-module-junit4:1.7.1' |
||||
testImplementation 'org.powermock:powermock-api-easymock:1.7.1' |
||||
testImplementation 'junit:junit:4.12' |
||||
} |
||||
} |
@ -0,0 +1,59 @@
|
||||
package com.fr.common.detect; |
||||
|
||||
import com.fr.concurrent.NamedThreadFactory; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.module.ModuleContext; |
||||
import com.fr.web.WebSocketConfig; |
||||
|
||||
import java.net.Socket; |
||||
import java.util.concurrent.ExecutorService; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/10 |
||||
*/ |
||||
public class CommonPortDetector { |
||||
|
||||
private static final CommonPortDetector INSTANCE = new CommonPortDetector(); |
||||
private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); |
||||
|
||||
public static CommonPortDetector getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
public void execute() { |
||||
service.submit(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
detectTomcatPort(); |
||||
detectWebSocketPort(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void detectTomcatPort() { |
||||
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); |
||||
if (checkPort(port)) { |
||||
FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port); |
||||
} |
||||
} |
||||
|
||||
private void detectWebSocketPort() { |
||||
Integer[] ports = WebSocketConfig.getInstance().getPort(); |
||||
for (int port : ports) { |
||||
if (checkPort(port)) { |
||||
FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private boolean checkPort(int port) { |
||||
try (Socket socket = new Socket("localhost", port)) { |
||||
return true; |
||||
} catch (Exception e) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.common.report; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/27 |
||||
*/ |
||||
public enum ReportState { |
||||
|
||||
STOP("stop"), ACTIVE("active"); |
||||
|
||||
private String value; |
||||
|
||||
ReportState(String value) { |
||||
this.value = value; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return this.value; |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.BugNeedMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class BugNeedAction extends UpdateAction { |
||||
public BugNeedAction() { |
||||
this.setMenuKeySet(BugAndNeed); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(BugNeedMark.class); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet BugAndNeed = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_BugAndNeed"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.TechSupportMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class TechSupportAction extends UpdateAction { |
||||
public TechSupportAction() { |
||||
this.setMenuKeySet(TechSupport); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/support.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(TechSupportMark.class); |
||||
String str=localeMark.getValue(); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet TechSupport = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_TechSupport"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.plugin.injectable.PluginModule; |
||||
|
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
@SuppressWarnings({"rawtypes", "unchecked"}) |
||||
public abstract class ClipboardFilter { |
||||
|
||||
public static <T> T cut(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T copy(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T paste(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import java.awt.datatransfer.Clipboard; |
||||
import java.awt.datatransfer.ClipboardOwner; |
||||
import java.awt.datatransfer.DataFlavor; |
||||
import java.awt.datatransfer.FlavorListener; |
||||
import java.awt.datatransfer.Transferable; |
||||
import java.awt.datatransfer.UnsupportedFlavorException; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/11 |
||||
**/ |
||||
public class DesignerClipboard extends Clipboard { |
||||
|
||||
private Clipboard clipboard; |
||||
|
||||
public DesignerClipboard(Clipboard clipboard) { |
||||
super(clipboard.getName()); |
||||
this.clipboard = clipboard; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { |
||||
//处理 contents/owner
|
||||
Transferable filtered = ClipboardFilter.copy(contents); |
||||
clipboard.setContents(filtered, owner); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized Transferable getContents(Object requestor) { |
||||
Transferable contents = clipboard.getContents(requestor); |
||||
//处理 contents
|
||||
Transferable filtered = ClipboardFilter.paste(contents); |
||||
return filtered; |
||||
} |
||||
|
||||
@Override |
||||
public DataFlavor[] getAvailableDataFlavors() { |
||||
return clipboard.getAvailableDataFlavors(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isDataFlavorAvailable(DataFlavor flavor) { |
||||
return clipboard.isDataFlavorAvailable(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public Object getData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { |
||||
return clipboard.getData(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void addFlavorListener(FlavorListener listener) { |
||||
clipboard.addFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void removeFlavorListener(FlavorListener listener) { |
||||
clipboard.removeFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized FlavorListener[] getFlavorListeners() { |
||||
return clipboard.getFlavorListeners(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.dialog.BasicPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public abstract class AbstractCellElementPropertyPane extends BasicPane implements CellElementPropertyComponent { |
||||
@Override |
||||
public JPanel toPanel() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(TargetComponent tc) { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* 单元格属性配置面板接口 |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public interface CellElementPropertyComponent { |
||||
|
||||
/** |
||||
* 判断当前编辑的对象是否显示当前实现 |
||||
* @param tc |
||||
* @return |
||||
*/ |
||||
boolean accept(TargetComponent tc); |
||||
|
||||
/** |
||||
* 加载数据 |
||||
* @param tc |
||||
*/ |
||||
void populate(TargetComponent tc); |
||||
|
||||
/** |
||||
* 返回当前属性面板,默认返回this |
||||
* @return |
||||
*/ |
||||
JPanel toPanel(); |
||||
|
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import com.fr.data.TableDataSource; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/4/27 |
||||
*/ |
||||
public abstract class BasicTableDataUtils { |
||||
private static final String SEPARATOR = "-"; |
||||
|
||||
private static final int LEN = 2; |
||||
|
||||
|
||||
public static boolean checkName(String name) { |
||||
if (isInValidName(name)) { |
||||
FineJOptionPane.showMessageDialog(null, |
||||
Toolkit.i18nText("Fine-Design_Basic_DataSet_Rename_Warning", name), |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
FineJOptionPane.WARNING_MESSAGE); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static boolean isInValidName(String name) { |
||||
String[] values = name.split("\\."); |
||||
if (values.length == LEN) { |
||||
return (StringUtils.isNotEmpty(values[0]) && StringUtils.isNotEmpty(values[1])) |
||||
|| (StringUtils.isEmpty(values[0]) && StringUtils.isNotEmpty(values[1])); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) { |
||||
if (isCover) { |
||||
return srcName + SEPARATOR + tdName; |
||||
} |
||||
if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称
|
||||
tdName = srcName + SEPARATOR + tdName; |
||||
} |
||||
int i = 0; |
||||
while (tds.getTableData(tdName) != null) { |
||||
i++;//如果拼上名字后依然已经存在就加编号
|
||||
tdName += i; |
||||
} |
||||
return tdName; |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
package com.fr.design.dialog; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
|
||||
import javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JTextArea; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Font; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/1/8 |
||||
*/ |
||||
public abstract class ErrorDialog extends JDialog implements ActionListener { |
||||
|
||||
private UIButton okButton; |
||||
private UIButton restartButton; |
||||
|
||||
|
||||
public ErrorDialog(Frame parent, String message, String title, String detail) { |
||||
super(parent, true); |
||||
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||
UILabel boldFontLabel = new UILabel(message); |
||||
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us")); |
||||
Font font = FRFont.getInstance("Dialog", Font.BOLD, 20); |
||||
boldFontLabel.setFont(font); |
||||
messagePane.add(boldFontLabel); |
||||
messagePane.add(label); |
||||
northPane.add(messagePane); |
||||
|
||||
JTextArea area = new JTextArea(detail); |
||||
area.setPreferredSize(new Dimension(400, 100)); |
||||
area.setEnabled(true); |
||||
area.setEditable(false); |
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message")); |
||||
centerPane.add(detailLabel, BorderLayout.NORTH); |
||||
centerPane.add(area, BorderLayout.CENTER); |
||||
|
||||
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
||||
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Ok")); |
||||
okButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
okEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(okButton); |
||||
restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Restart")); |
||||
restartButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
restartEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(restartButton); |
||||
controlPane.add(buttonPane, BorderLayout.EAST); |
||||
southPane.add(controlPane); |
||||
|
||||
this.setTitle(title); |
||||
this.setResizable(false); |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
this.add(southPane, BorderLayout.SOUTH); |
||||
this.setSize(new Dimension(600, 500)); |
||||
GUICoreUtils.centerWindow(this); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
dispose(); |
||||
} |
||||
|
||||
protected abstract void okEvent(); |
||||
|
||||
protected abstract void restartEvent(); |
||||
|
||||
} |
@ -0,0 +1,294 @@
|
||||
package com.fr.design.dialog; |
||||
|
||||
import com.fr.invoke.Reflect; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.Icon; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JOptionPane; |
||||
import java.awt.Component; |
||||
import java.awt.HeadlessException; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Joe |
||||
* @version 10.0 |
||||
* Created by Joe on 12/5/2019 |
||||
*/ |
||||
public class FineJOptionPane extends JOptionPane { |
||||
|
||||
public final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") }; |
||||
public final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") }; |
||||
public final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; |
||||
public final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; |
||||
|
||||
//选项类型optionType 和 选项字符串数组 一一对应
|
||||
private final static Map<Integer, String[]> OPTION_MAP = new HashMap<>(); |
||||
|
||||
static { |
||||
OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT); |
||||
OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO); |
||||
OPTION_MAP.put(YES_NO_CANCEL_OPTION, OPTION_YES_NO_CANCEL); |
||||
OPTION_MAP.put(OK_CANCEL_OPTION, OPTION_OK_CANCEL); |
||||
} |
||||
|
||||
private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"); |
||||
private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"); |
||||
private final static String INPUT_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"); |
||||
|
||||
/** |
||||
* 使用默认 标题 和 消息类型 的消息提示弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static void showMessageDialog(Component parentComponent, Object message) |
||||
throws HeadlessException { |
||||
showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE, |
||||
INFORMATION_MESSAGE); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 Icon 的消息提示弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param messageType 消息类型 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static void showMessageDialog(Component parentComponent, Object message, |
||||
String title, int messageType) |
||||
throws HeadlessException { |
||||
showMessageDialog(parentComponent, message, title, messageType, null); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 选项类型、选项 和 初始选项 的消息提示弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param messageType 消息类型 |
||||
* @param icon 图标 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static void showMessageDialog(Component parentComponent, Object message, |
||||
String title, int messageType, Icon icon) |
||||
throws HeadlessException { |
||||
showMessageDialog(parentComponent, message, title, DEFAULT_OPTION, |
||||
messageType, icon, OPTION_DEFAULT, null); |
||||
} |
||||
|
||||
/** |
||||
* 自定义的消息提示弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param optionType 选项类型 |
||||
* @param messageType 消息类型 |
||||
* @param icon 图标 |
||||
* @param options 选项 |
||||
* @param initialValue 初始选项 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static void showMessageDialog(Component parentComponent, Object message, |
||||
String title, int optionType, int messageType, |
||||
Icon icon, Object[] options, Object initialValue) |
||||
throws HeadlessException { |
||||
showOptionDialog(parentComponent, message, title, optionType, |
||||
messageType, icon, options, initialValue); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 标题 和 选项类型 的确认弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static int showConfirmDialog(Component parentComponent, Object message) |
||||
throws HeadlessException { |
||||
return showConfirmDialog(parentComponent, message, |
||||
CONFIRM_DIALOG_TITLE, |
||||
YES_NO_CANCEL_OPTION); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 消息类型 的确认弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param optionType 选项类型 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static int showConfirmDialog(Component parentComponent, Object message, |
||||
String title, int optionType) throws HeadlessException { |
||||
return showConfirmDialog(parentComponent, message, title, optionType, |
||||
QUESTION_MESSAGE); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 Icon 的确认弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param optionType 选项类型 |
||||
* @param messageType 消息类型 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static int showConfirmDialog(Component parentComponent, Object message, |
||||
String title, int optionType, int messageType) |
||||
throws HeadlessException { |
||||
return showConfirmDialog(parentComponent, message, title, optionType, |
||||
messageType, null); |
||||
} |
||||
|
||||
/** |
||||
* 根据 选项类型 获取对应 选项 ,且使用默认 初始选项 的确认弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param optionType 选项类型 |
||||
* @param messageType 消息类型 |
||||
* @param icon 图标 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static int showConfirmDialog(Component parentComponent, Object message, |
||||
String title, int optionType, int messageType, Icon icon) |
||||
throws HeadlessException { |
||||
String[] options = OPTION_MAP.get(optionType); |
||||
return showConfirmDialog(parentComponent, message, title, optionType, |
||||
messageType, icon, options, options[0]); |
||||
} |
||||
|
||||
/** |
||||
* 自定义的确认弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 具体的提示消息 |
||||
* @param title 标题 |
||||
* @param optionType 选项类型 |
||||
* @param messageType 消息类型 |
||||
* @param icon 图标 |
||||
* @param options 选项 |
||||
* @param initialValue 初始选项 |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static int showConfirmDialog(Component parentComponent, Object message, |
||||
String title, int optionType, int messageType, Icon icon, |
||||
Object[] options, Object initialValue) |
||||
throws HeadlessException { |
||||
return showOptionDialog(parentComponent, message, title, optionType, |
||||
messageType, icon, options, initialValue); |
||||
} |
||||
|
||||
/** |
||||
* 指定消息内容的输入弹出框 |
||||
* @param message 消息内容 |
||||
* @return |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static String showInputDialog(Object message) |
||||
throws HeadlessException { |
||||
return showInputDialog(null, message); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 标题 和 消息类型 的输入弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 消息内容 |
||||
* @return |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static String showInputDialog(Component parentComponent, |
||||
Object message) throws HeadlessException { |
||||
return showInputDialog(parentComponent, message, INPUT_DIALOG_TITLE, QUESTION_MESSAGE); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 标题、消息类型、Icon 和 选项 的输入弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 消息类型 |
||||
* @param initialSelectionValue 初始选项 |
||||
* @return |
||||
*/ |
||||
public static String showInputDialog(Component parentComponent, Object message, |
||||
Object initialSelectionValue) { |
||||
return (String)showInputDialog(parentComponent, message, |
||||
INPUT_DIALOG_TITLE, QUESTION_MESSAGE, null, null, |
||||
initialSelectionValue); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 父容器、消息内容 和 初始选项 的输入弹出框 |
||||
* @param message 消息内容 |
||||
* @param initialSelectionValue 初始选项 |
||||
* @return |
||||
*/ |
||||
public static String showInputDialog(Object message, Object initialSelectionValue) { |
||||
return showInputDialog(null, message, initialSelectionValue); |
||||
} |
||||
|
||||
/** |
||||
* 使用默认 Icon、选项 和 初始选项 的输入弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 消息内容 |
||||
* @param title 标题 |
||||
* @param messageType 消息类型 |
||||
* @return |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static String showInputDialog(Component parentComponent, |
||||
Object message, String title, int messageType) |
||||
throws HeadlessException { |
||||
return (String)showInputDialog(parentComponent, message, title, |
||||
messageType, null, null, null); |
||||
} |
||||
|
||||
/** |
||||
* 自定义的输入弹出框 |
||||
* @param parentComponent 父容器 |
||||
* @param message 消息内容 |
||||
* @param title 标题 |
||||
* @param messageType 消息类型 |
||||
* @param icon 图标 |
||||
* @param selectionValues 选项 |
||||
* @param initialSelectionValue 初始选项 |
||||
* @return |
||||
* @throws HeadlessException |
||||
*/ |
||||
public static Object showInputDialog(Component parentComponent, |
||||
Object message, String title, int messageType, Icon icon, |
||||
Object[] selectionValues, Object initialSelectionValue) |
||||
throws HeadlessException { |
||||
JOptionPane pane = new JOptionPane(message, messageType, |
||||
OK_CANCEL_OPTION, icon, |
||||
OPTION_OK_CANCEL, null); |
||||
|
||||
pane.setWantsInput(true); |
||||
pane.setSelectionValues(selectionValues); |
||||
pane.setInitialSelectionValue(initialSelectionValue); |
||||
pane.setComponentOrientation(((parentComponent == null) ? |
||||
getRootFrame() : parentComponent).getComponentOrientation()); |
||||
|
||||
int style = Reflect.on(JOptionPane.class).call("styleFromMessageType", messageType).get(); |
||||
JDialog dialog = Reflect.on(pane).call("createDialog", parentComponent, title, style).get(); |
||||
|
||||
pane.selectInitialValue(); |
||||
dialog.show(); |
||||
dialog.dispose(); |
||||
|
||||
//点击取消按钮,返回null
|
||||
if (StringUtils.equals((String) pane.getValue(), OPTION_OK_CANCEL[1])) |
||||
return null; |
||||
|
||||
Object value = pane.getInputValue(); |
||||
if (value == UNINITIALIZED_VALUE) { |
||||
return null; |
||||
} |
||||
return value; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,98 @@
|
||||
package com.fr.design.dialog; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/1/8 |
||||
*/ |
||||
public abstract class TipDialog extends JDialog implements ActionListener { |
||||
|
||||
private UIButton endButton; |
||||
private UIButton cancelButton; |
||||
|
||||
public TipDialog(Frame parent, String type, String tip, String endText, String cancelText) { |
||||
super(parent, true); |
||||
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel iconPane = new JPanel(); |
||||
UILabel iconLabel = new UILabel(); |
||||
iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error2.png")); |
||||
iconPane.add(iconLabel); |
||||
iconPane.setPreferredSize(new Dimension(50, 50)); |
||||
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
UILabel tipLabel = new UILabel(tip); |
||||
tipPane.add(tipLabel); |
||||
northPane.add(iconPane, BorderLayout.WEST); |
||||
northPane.add(tipPane, BorderLayout.CENTER); |
||||
|
||||
JTextPane area = new JTextPane(); |
||||
UILabel typeLabel = new UILabel(type); |
||||
area.insertComponent(typeLabel); |
||||
if (StringUtils.isNotEmpty(type)) { |
||||
UILabel logoIconLabel = new UILabel(); |
||||
logoIconLabel.setIcon(IOUtils.readIcon("com/fr/base/images/oem/logo.png")); |
||||
area.insertComponent(logoIconLabel); |
||||
} |
||||
area.setPreferredSize(new Dimension(400, 100)); |
||||
area.setEnabled(true); |
||||
area.setEditable(false); |
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
centerPane.add(area); |
||||
|
||||
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
||||
endButton = new UIButton(endText); |
||||
endButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
endEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(endButton); |
||||
cancelButton = new UIButton(cancelText); |
||||
cancelButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
cancelEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(cancelButton); |
||||
controlPane.add(buttonPane, BorderLayout.EAST); |
||||
southPane.add(controlPane); |
||||
|
||||
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Error_Tittle")); |
||||
this.setResizable(false); |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
this.add(southPane, BorderLayout.SOUTH); |
||||
this.setSize(new Dimension(600, 500)); |
||||
GUICoreUtils.centerWindow(this); |
||||
|
||||
} |
||||
|
||||
protected abstract void endEvent(); |
||||
|
||||
protected abstract void cancelEvent(); |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
dispose(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.fr.design.event; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/19 |
||||
*/ |
||||
public interface RemoveListener { |
||||
|
||||
void doRemoveAction(); |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.event; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public interface StateChangeListener { |
||||
public void stateChange(); |
||||
} |
@ -1,233 +0,0 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import javafx.application.Platform; |
||||
import javafx.beans.property.BooleanProperty; |
||||
import javafx.beans.property.SimpleBooleanProperty; |
||||
import javafx.beans.value.ChangeListener; |
||||
import javafx.beans.value.ObservableValue; |
||||
import javafx.concurrent.Worker; |
||||
import javafx.embed.swing.JFXPanel; |
||||
import javafx.event.ActionEvent; |
||||
import javafx.event.EventHandler; |
||||
import javafx.scene.Group; |
||||
import javafx.scene.Node; |
||||
import javafx.scene.Scene; |
||||
import javafx.scene.control.ButtonBuilder; |
||||
import javafx.scene.control.LabelBuilder; |
||||
import javafx.scene.input.MouseEvent; |
||||
import javafx.scene.layout.BorderPane; |
||||
import javafx.scene.layout.HBox; |
||||
import javafx.scene.layout.HBoxBuilder; |
||||
import javafx.scene.paint.Color; |
||||
import javafx.scene.web.WebEngine; |
||||
import javafx.scene.web.WebEvent; |
||||
import javafx.scene.web.WebView; |
||||
import javafx.stage.Modality; |
||||
import javafx.stage.Screen; |
||||
import javafx.stage.Stage; |
||||
import javafx.stage.StageStyle; |
||||
import javafx.stage.WindowEvent; |
||||
import javafx.util.Callback; |
||||
import netscape.javascript.JSObject; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.SwingUtilities; |
||||
import java.awt.Toolkit; |
||||
|
||||
/** |
||||
* Created by zhaohehe on 16/7/28. |
||||
*/ |
||||
public class QQLoginWebPane extends JFXPanel { |
||||
|
||||
private WebEngine webEngine; |
||||
private String url; |
||||
|
||||
private static JSObject window; |
||||
|
||||
private static int DEFAULT_PRIMARYSTAGE_WIDTH = 100; |
||||
private static int DEFAULT_PRIMARYSTAGE_HEIGHT = 100; |
||||
|
||||
private static int DEFAULT_CONFIRM_WIDTH = 450; |
||||
private static int DEFAULT_CONFIRM_HEIGHT = 160; |
||||
private static int DEFAULT_OFFEST = 20; |
||||
|
||||
class Delta { |
||||
double x, y; |
||||
} |
||||
|
||||
public QQLoginWebPane(final String installHome) { |
||||
Platform.setImplicitExit(false); |
||||
Platform.runLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
BorderPane root = new BorderPane(); |
||||
Scene scene = new Scene(root); |
||||
QQLoginWebPane.this.setScene(scene); |
||||
final WebView webView = new WebView(); |
||||
webEngine = webView.getEngine(); |
||||
url = "file:///" + installHome + "/scripts/qqLogin.html"; |
||||
webEngine.load(url); |
||||
|
||||
final Stage primaryStage = new Stage(); |
||||
|
||||
HBox layout = new HBox(); |
||||
try { |
||||
primaryStage.initStyle(StageStyle.TRANSPARENT); |
||||
primaryStage.setScene(new Scene(layout)); |
||||
webView.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); |
||||
primaryStage.initStyle(StageStyle.UTILITY); |
||||
primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT)); |
||||
primaryStage.setX(0); |
||||
primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT); |
||||
primaryStage.show(); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
} |
||||
webEngine.setConfirmHandler(new Callback<String, Boolean>() { |
||||
@Override |
||||
public Boolean call(String msg) { |
||||
Boolean confirmed = confirm(primaryStage, msg, webView); |
||||
return confirmed; |
||||
} |
||||
}); |
||||
configWebEngine(); |
||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
||||
root.setCenter(webView); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void configWebEngine() { |
||||
|
||||
webEngine.locationProperty().addListener(new ChangeListener<String>() { |
||||
@Override |
||||
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) { |
||||
disableLink(webEngine); |
||||
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
|
||||
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { |
||||
return; |
||||
} |
||||
LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue); |
||||
} |
||||
}); |
||||
|
||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
||||
@Override |
||||
public void handle(WebEvent<String> event) { |
||||
showAlert(event.getData()); |
||||
} |
||||
}); |
||||
|
||||
webEngine.getLoadWorker().stateProperty().addListener( |
||||
new ChangeListener<Worker.State>() { |
||||
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) { |
||||
if (newState == Worker.State.SUCCEEDED) { |
||||
window = (JSObject) webEngine.executeScript("window"); |
||||
window.setMember("QQLoginHelper", LoginWebBridge.getHelper()); |
||||
} |
||||
} |
||||
} |
||||
); |
||||
} |
||||
|
||||
private void showAlert(final String message) { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
JOptionPane.showMessageDialog(QQLoginWebPane.this, message); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void disableLink(final WebEngine eng) { |
||||
try { |
||||
// webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转,
|
||||
// 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页
|
||||
Platform.runLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
eng.executeScript("location.reload()"); |
||||
LoginWebBridge.getHelper().closeQQWindow(); |
||||
} |
||||
}); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
private Boolean confirm(final Stage parent, String msg, final WebView webView) { |
||||
final BooleanProperty confirmationResult = new SimpleBooleanProperty(); |
||||
// initialize the confirmation dialog
|
||||
final Stage dialog = new Stage(StageStyle.UTILITY); |
||||
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST); |
||||
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST); |
||||
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); |
||||
dialog.setWidth(DEFAULT_CONFIRM_WIDTH); |
||||
dialog.setIconified(false); |
||||
dialog.initOwner(parent); |
||||
dialog.initModality(Modality.WINDOW_MODAL); |
||||
dialog.setScene( |
||||
new Scene( |
||||
HBoxBuilder.create().styleClass("modal-dialog").children( |
||||
LabelBuilder.create().text(msg).build(), |
||||
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Switch_Account")).defaultButton(true).onAction(new EventHandler<ActionEvent>() { |
||||
@Override |
||||
public void handle(ActionEvent actionEvent) { |
||||
// take action and close the dialog.
|
||||
confirmationResult.set(true); |
||||
webView.getEngine().reload(); |
||||
dialog.close(); |
||||
} |
||||
}).build(), |
||||
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Cancel")).cancelButton(true).onAction(new EventHandler<ActionEvent>() { |
||||
@Override |
||||
public void handle(ActionEvent actionEvent) { |
||||
// abort action and close the dialog.
|
||||
confirmationResult.set(false); |
||||
dialog.close(); |
||||
} |
||||
}).build() |
||||
).build() |
||||
, Color.TRANSPARENT |
||||
) |
||||
); |
||||
configDrag(dialog); |
||||
// style and show the dialog.
|
||||
dialog.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); |
||||
dialog.setOnCloseRequest(new EventHandler<WindowEvent>() { |
||||
@Override |
||||
public void handle(WindowEvent event) { |
||||
event.consume(); |
||||
dialog.close(); |
||||
} |
||||
}); |
||||
dialog.showAndWait(); |
||||
return confirmationResult.get(); |
||||
} |
||||
|
||||
private void configDrag(final Stage dialog) { |
||||
// allow the dialog to be dragged around.
|
||||
final Node root = dialog.getScene().getRoot(); |
||||
final Delta dragDelta = new Delta(); |
||||
|
||||
root.setOnMousePressed(new EventHandler<MouseEvent>() { |
||||
@Override |
||||
public void handle(MouseEvent mouseEvent) { |
||||
// record a delta distance for the drag and drop operation.
|
||||
dragDelta.x = dialog.getX() - mouseEvent.getScreenX(); |
||||
dragDelta.y = dialog.getY() - mouseEvent.getScreenY(); |
||||
} |
||||
}); |
||||
root.setOnMouseDragged(new EventHandler<MouseEvent>() { |
||||
@Override |
||||
public void handle(MouseEvent mouseEvent) { |
||||
dialog.setX(mouseEvent.getScreenX() + dragDelta.x); |
||||
dialog.setY(mouseEvent.getScreenY() + dragDelta.y); |
||||
} |
||||
}); |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,57 @@
|
||||
package com.fr.design.formula; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* @author Joe |
||||
* @version 10.0 |
||||
* Created by Joe on 10/30/2019 |
||||
*/ |
||||
public enum FormulaConstants { |
||||
|
||||
PAGE_NUMBER("$$page_number", "Page_Number"), |
||||
TOTAL_PAGE_NUMBER("$$totalPage_number", "Total_Page_Number"), |
||||
FINE_USERNAME("$fine_username", "Fine_Username"), |
||||
FINE_ROLE("$fine_role", "Fine_Role"), |
||||
FINE_POSITION("$fine_position", "Fine_Position"), |
||||
NULL("NULL", "Null"), |
||||
NOFILTER("NOFILTER", "No_Filter"), |
||||
REPORT_NAME("reportName", "Report_Name"), |
||||
FORMLET_NAME("formletName", "Formlet_Name"), |
||||
SERVLET_URL("servletURL", "Servlet_URL"), |
||||
SERVER_SCHEMA("serverSchema", "Server_Schema"), |
||||
SERVER_NAME("serverName", "Server_Name"), |
||||
SERVER_PORT("serverPort", "Server_Port"), |
||||
SERVER_URL("serverURL", "Server_URL"), |
||||
CONTEXT_PATH("contextPath", "Context_Path"), |
||||
SESSION_ID("sessionID", "SessionID"); |
||||
|
||||
private String key; |
||||
private String value; |
||||
private static final String KEY_PREFIX = "Fine-Design_CurReport_Variable_"; |
||||
|
||||
private FormulaConstants(String key, String value) { |
||||
this.key = key; |
||||
this.value = KEY_PREFIX + value; |
||||
} |
||||
|
||||
public String getKey() { |
||||
return key; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public static String getValueByKey(String key) { |
||||
for (FormulaConstants formulaConstant : values()) { |
||||
if (formulaConstant.getKey().equals(key)) { |
||||
return formulaConstant.getValue(); |
||||
} |
||||
} |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue