From 2386b16806690cda7fe916e45d030933e6445d1a Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 15 Oct 2018 17:21:25 +0800 Subject: [PATCH 001/187] override --- .../src/main/java/com/fr/start/fx/PrismImageLoader2.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java index 91318e8f71..99066e964e 100644 --- a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java +++ b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java @@ -108,7 +108,6 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { return 40; } - @Override public int getLoopCount() { return 0; } From c79b178e83d7b320eca82a0bfd6f51ed32d88c32 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 25 Oct 2018 16:29:06 +0800 Subject: [PATCH 002/187] =?UTF-8?q?REPORT-12030=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E6=89=93=E5=8D=B0=E6=94=AF=E6=8C=81=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=8C=87=E5=AE=9Asheet=3D>=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../printsettings/NativePrintSettingPane.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java index a000cc2096..e0e64b4e3f 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java @@ -52,7 +52,8 @@ public class NativePrintSettingPane extends JPanel { private static final String CUSTOM_PAPERSIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"); private static final PaperSize DEFAULT_PAPERSIZE = PaperSize.PAPERSIZE_A4; - private UICheckBox isShowDialogCheck; + private UICheckBox showDialogCheck; + private UICheckBox needSelectSheetCheck; // 打印需要指定 sheet private UIComboBox printerComboBox; private UIBasicSpinner copySpinner; // 份数 private UIRadioButton allPageRadioButton; @@ -83,16 +84,22 @@ public class NativePrintSettingPane extends JPanel { private void initComponents() { JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 15); + JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 12); UILabel tipDownload = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Native_Print_Need_Client")); northPane.add(tipDownload); - isShowDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); - isShowDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel tipCheck = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); - JPanel checkPane = GUICoreUtils.createFlowPane(new Component[] { - isShowDialogCheck, tipCheck}, FlowLayout.LEFT); - northPane.add(checkPane); - northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 0)); + + showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); + showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + UILabel showDialogTipCheck = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); + JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[] { + showDialogCheck, showDialogTipCheck}, FlowLayout.LEFT); + northPane.add(showDialogCheckPane); + + needSelectSheetCheck = new UICheckBox("打印需要指定 sheet"); + needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + northPane.add(needSelectSheetCheck); + + northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 15, 0)); printPane.add(northPane, BorderLayout.NORTH); @@ -114,7 +121,7 @@ public class NativePrintSettingPane extends JPanel { currentPageRadioButton.addItemListener(getPageRaidoListener()); customPageRadioButton.addItemListener(getPageRaidoListener()); doublePrintRadioButton.addItemListener(getPageRaidoListener()); - isShowDialogCheck.addItemListener(new ItemListener() { + showDialogCheck.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkEnabled(); @@ -393,7 +400,8 @@ public class NativePrintSettingPane extends JPanel { } public void populate(NativePrintAttr nativePrintAttr) { - isShowDialogCheck.setSelected(nativePrintAttr.isShowDialog()); + showDialogCheck.setSelected(nativePrintAttr.isShowDialog()); + needSelectSheetCheck.setSelected(nativePrintAttr.isNeedSelectSheet()); printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName()); copySpinner.setValue(nativePrintAttr.getCopy()); @@ -442,7 +450,8 @@ public class NativePrintSettingPane extends JPanel { } public void update(NativePrintAttr nativePrintAttr) { - nativePrintAttr.setShowDialog(isShowDialogCheck.isSelected()); + nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); + nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); if (printerComboBox.getSelectedItem() != null) { nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString()); } @@ -483,6 +492,6 @@ public class NativePrintSettingPane extends JPanel { // 刷新面板可用状态 public void checkEnabled() { - GUICoreUtils.setEnabled(centerPane, !isShowDialogCheck.isSelected()); + GUICoreUtils.setEnabled(centerPane, !showDialogCheck.isSelected()); } } From a5b6501bcf1b5f49b670e4b8246fb1ea32e4316a Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 25 Oct 2018 19:13:17 +0800 Subject: [PATCH 003/187] =?UTF-8?q?REPORT-12030=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E6=89=93=E5=8D=B0=E6=94=AF=E6=8C=81=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=8C=87=E5=AE=9Asheet=3D>=E5=A2=9E=E5=8A=A0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../printsettings/NativePrintSettingPane.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java index e0e64b4e3f..a992483132 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java @@ -90,14 +90,17 @@ public class NativePrintSettingPane extends JPanel { showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel showDialogTipCheck = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); + UILabel showDialogCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[] { - showDialogCheck, showDialogTipCheck}, FlowLayout.LEFT); + showDialogCheck, showDialogCheckTip}, FlowLayout.LEFT); northPane.add(showDialogCheckPane); - needSelectSheetCheck = new UICheckBox("打印需要指定 sheet"); - needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - northPane.add(needSelectSheetCheck); + needSelectSheetCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Need_Select_Sheet_When_Printing")); + needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + UILabel needSelectSheetCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View")); + JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[] { + needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT); + northPane.add(needSelectSheetCheckPane); northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 15, 0)); From e5a69f8c921ae10fec431a835faa5f813c2f666b Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 29 Oct 2018 17:30:49 +0800 Subject: [PATCH 004/187] =?UTF-8?q?REPORT-11714=20=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/properties/PropertyTab.java | 5 ++++ .../ParameterExpandablePaneUIProvider.java | 26 +++++++++++++++++++ ...ractParameterExpandablePaneUIProvider.java | 19 ++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/designer/properties/PropertyTab.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractParameterExpandablePaneUIProvider.java diff --git a/designer-base/src/main/java/com/fr/design/designer/properties/PropertyTab.java b/designer-base/src/main/java/com/fr/design/designer/properties/PropertyTab.java new file mode 100644 index 0000000000..2bd49a14ab --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/designer/properties/PropertyTab.java @@ -0,0 +1,5 @@ +package com.fr.design.designer.properties; + +public enum PropertyTab { + ATTR, MOBILE +} diff --git a/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java new file mode 100644 index 0000000000..c5fb252058 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java @@ -0,0 +1,26 @@ +package com.fr.design.fun; + +import com.fr.design.designer.properties.PropertyTab; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.stable.fun.mark.Mutable; + +/** + * created by hades on 18/10/16 + * 该接口支持在设计器cpt&frm参数界面的属性和移动端下添加一个UIExpandablePane(可展开面板) + */ +public interface ParameterExpandablePaneUIProvider extends Mutable { + + String XML_TAG = "ParameterExpandablePaneUIProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 如果面板不存在,则创建可展开面板并添加子容器;否则在某个tabPane下的UIExpandablePane实例中增加子容器 + * + * @param propertyTab 可展开面板放在哪个propertyTab下,例如属性或者移动端 + * @param UIExpandablePaneName 可扩展面板名称 + * @return UIExpandablePane + */ + UIExpandablePane createUIExpandablePane(PropertyTab propertyTab, String UIExpandablePaneName); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractParameterExpandablePaneUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractParameterExpandablePaneUIProvider.java new file mode 100644 index 0000000000..a357958ca9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractParameterExpandablePaneUIProvider.java @@ -0,0 +1,19 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.ParameterExpandablePaneUIProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +@API(level = ParameterExpandablePaneUIProvider.CURRENT_LEVEL) +public abstract class AbstractParameterExpandablePaneUIProvider extends AbstractProvider implements ParameterExpandablePaneUIProvider{ + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} From f4029d13b6c7b14653d72b46c1c53646d833c7dc Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 29 Oct 2018 19:41:52 +0800 Subject: [PATCH 005/187] =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=8D=E5=B0=8F?= =?UTF-8?q?=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/fun/ParameterExpandablePaneUIProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java index c5fb252058..90639cb2f2 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java @@ -18,9 +18,9 @@ public interface ParameterExpandablePaneUIProvider extends Mutable { * 如果面板不存在,则创建可展开面板并添加子容器;否则在某个tabPane下的UIExpandablePane实例中增加子容器 * * @param propertyTab 可展开面板放在哪个propertyTab下,例如属性或者移动端 - * @param UIExpandablePaneName 可扩展面板名称 + * @param uiExpandablePaneName 可扩展面板名称 * @return UIExpandablePane */ - UIExpandablePane createUIExpandablePane(PropertyTab propertyTab, String UIExpandablePaneName); + UIExpandablePane createUIExpandablePane(PropertyTab propertyTab, String uiExpandablePaneName); } From c8ca6714ae124e5302ec591400f4de70fb9b7543 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 30 Oct 2018 17:08:13 +0800 Subject: [PATCH 006/187] =?UTF-8?q?REPORT-11622=20=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E7=A7=BB=E8=87=B3=E4=BA=91=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 257 ++++++++---------- 1 file changed, 109 insertions(+), 148 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 91342b1db1..8dd130d64a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fr.design.mainframe; @@ -20,15 +20,23 @@ import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.general.http.HttpClient; +import com.fr.intelli.record.FocusPoint; +import com.fr.intelli.record.MetricException; +import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import com.fr.log.message.ParameterMessage; import com.fr.record.DBRecordXManager; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.data.DataList; +import com.fr.stable.query.restriction.RestrictionFactory; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLTools; @@ -65,7 +73,7 @@ import java.util.Map; * @date: 2015-4-8-下午5:11:46 */ public class InformationCollector implements XMLReadable, XMLWriter { - + // 24小时上传一次 private static final long DELTA = 24 * 3600 * 1000L; private static final long SEND_DELAY = 30 * 1000L; @@ -84,25 +92,27 @@ public class InformationCollector implements XMLReadable, XMLWriter { public static final String TABLE_NAME = "fr_functionrecord"; public static final String FUNC_COLUMNNAME = "func"; + public static final String COLUMN_TIME = "time"; + public static final String TABLE_FUNCTION_RECORD = "function.record"; private static InformationCollector collector; - + //启动时间与关闭时间列表 private List startStop = new ArrayList(); //上一次的发送时间 private String lastTime; private StartStopTime current = new StartStopTime(); - + public static InformationCollector getInstance(){ if (collector == null) { collector = new InformationCollector(); - + readEncodeXMLFile(collector, collector.getInfoFile()); } - + return collector; } - + private static void readEncodeXMLFile(XMLReadable xmlReadable, File xmlFile){ if (xmlFile == null || !xmlFile.exists()) { return; @@ -128,29 +138,29 @@ public class InformationCollector implements XMLReadable, XMLWriter { } } - + private static String getDecodeFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException{ InputStream encodeInputStream = new FileInputStream(xmlFile); String encodeContent = IOUtils.inputStream2String(encodeInputStream); return DesUtils.getDecString(encodeContent); } - + private long getLastTimeMillis(){ if (StringUtils.isEmpty(this.lastTime)) { return 0; } - + try { return DateUtils.string2Date(this.lastTime, true).getTime(); } catch (Exception e) { return -1; } - + } - + private byte[] getJSONContentAsByte(){ JSONObject content = new JSONObject(); - + JSONArray startStopArray = new JSONArray(); for (int i = 0; i < startStop.size(); i++) { JSONObject jo = new JSONObject(); @@ -182,7 +192,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private void sendUserInfo(){ long currentTime = new Date().getTime(); long lastTime = getLastTimeMillis(); - + if (currentTime - lastTime <= DELTA) { return; } @@ -211,135 +221,45 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - -// byte[] content = ArrayUtils.EMPTY_BYTE_ARRAY; -// Connection conn = null; -// Table table = new Table(TABLE_NAME); - -// try { -// conn = DBRecordXManager.getDB().createConnection(); -// ResultSet rs = selectAllFromLogDB(conn, table); -// -// if(rs == null){ -// return; -// } -// content = getFunctionsContentAsByte(rs); -// } catch (Exception e) { -// FRContext.getLogger().error(e.getMessage(), e); -// } finally { -// DBUtils.closeConnection(conn); -// } -// -// HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("functions.info")); -// httpClient.setContent(content); -// httpClient.setTimeout(5000); -// -// if (!httpClient.isServerAlive()) { -// return; -// } -// -// String res = httpClient.getResponseText(); -// boolean success = false; -// try { -// success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); -// } catch (JSONException e) { -// FRContext.getLogger().error(e.getMessage(), e); -// } -// //服务器返回true, 说明已经获取成功, 清空当前记录的信息 -// if (success) { -// deleteLogDB(conn, table); -// } - - } - - private void deleteLogDB(Connection conn, Table table) { - try { - conn = DBRecordXManager.getDB().createConnection(); - Delete delete = new Delete(table); - delete.execute(conn); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } finally { - DBUtils.closeConnection(conn); - } - } - - - private byte[] getFunctionsContentAsByte(ResultSet rs) throws JSONException{ - com.fr.json.JSONObject content = new com.fr.json.JSONObject(); - HashMap resultMap = new HashMap(); - - try { - while (rs.next()) { - com.fr.json.JSONObject js = new com.fr.json.JSONObject(rs.getString(FUNC_COLUMNNAME)); - Map tempMap = js.toMap(); - for (Object key : tempMap.keySet()) { - if(resultMap.containsKey(key)){ - int cacheCount = Integer.parseInt(resultMap.get(key).toString()); - int currentCount = Integer.parseInt(tempMap.get(key).toString()); - resultMap.put(key, cacheCount + currentCount); - } else { - resultMap.put(key, tempMap.get(key)); - } - } + String content = null; + try { + content = getFunctionsContentAsByte(currentTime); + } catch (JSONException e) { + e.printStackTrace(); + } + if(StringUtils.isNotEmpty(content)){ + HashMap para = new HashMap<>(); + String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", content); + HttpClient httpClient = new HttpClient(url, para, true); + httpClient.setTimeout(5000); + httpClient.asGet(); + + if (!httpClient.isServerAlive()) { + return; } - rs.close(); - } catch (SQLException e) { - //这边不记,可能还没建表 - } - - JSONArray functionArray = new JSONArray(); - for(Object key : resultMap.keySet()){ - com.fr.json.JSONObject jsonObject = new com.fr.json.JSONObject(); - jsonObject.put("point", key); - jsonObject.put("times", resultMap.get(key)); - functionArray.put(jsonObject); - } - - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - content.put("username", MarketConfig.getInstance().getBbsUsername()); - content.put("uuid", envManager.getUUID()); - content.put("functions", functionArray); - - try { - return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); - return ArrayUtils.EMPTY_BYTE_ARRAY; - } - } - - private ResultSet selectAllFromLogDB(Connection conn, Table table) { - Select select = new Select(table, DialectFactory.generateDialect(conn)); - PreparedStatement ps; - ResultSet rs; - try { - ps = select.createPreparedStatement(conn); - } catch (SQLException e) { - return null; - } - - try { - rs = ps.executeQuery(); - } catch (SQLException e) { + String res = httpClient.getResponseText(); + boolean success = false; try { - ps.close(); - } catch (SQLException e1) { - //这边不记,可能还没建表 + success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + } catch (JSONException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + //服务器返回true, 说明已经获取成功, 清空当前记录的信息 + if (success) { + deleteFunctionRecords(currentTime); } - return null; } - return rs; } - /** * 收集开始使用时间,发送信息 */ public void collectStartTime(){ this.current.setStartDate(dateToString()); - + sendUserInfoInOtherThread(); } @@ -347,9 +267,9 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv()) { return; } - + Thread sendThread = new Thread(new Runnable() { - + @Override public void run() { try { @@ -373,17 +293,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { public void collectStopTime(){ this.current.setStopDate(dateToString()); } - + private String dateToString(){ DateFormat df = FRContext.getDefaultValues().getDateTimeFormat(); return df.format(new Date()); } - + private void reset(){ this.startStop.clear(); this.lastTime = dateToString(); } - + private File getInfoFile() { return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME)); } @@ -403,10 +323,10 @@ public class InformationCollector implements XMLReadable, XMLWriter { writeEncodeContentToFile(encodeCotent, xmlFile); }catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); - } + } } - - + + /** * 将文件内容写到输出流中 */ @@ -438,10 +358,10 @@ public class InformationCollector implements XMLReadable, XMLWriter { writeStartStopList(writer); //上一次更新的时间 writeTag(XML_LAST_TIME, this.lastTime, writer); - + writer.end(); } - + private void writeStartStopList(XMLPrintWriter writer){ //启停 writer.startTAG(XML_START_STOP_LIST); @@ -450,12 +370,12 @@ public class InformationCollector implements XMLReadable, XMLWriter { } writer.end(); } - + private void writeTag(String tag, String content, XMLPrintWriter writer){ if (StringUtils.isEmpty(content)) { return; } - + writer.startTAG(tag); writer.textNode(content); writer.end(); @@ -472,17 +392,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { } } } - + private void readLastTime(XMLableReader reader){ String tmpVal; if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) { this.lastTime = tmpVal; } } - + private void readStartStopList(XMLableReader reader){ startStop.clear(); - + reader.readXMLObject(new XMLReadable() { public void readXML(XMLableReader reader) { if (XML_START_STOP.equals(reader.getTagName())) { @@ -493,9 +413,50 @@ public class InformationCollector implements XMLReadable, XMLWriter { } }); } - + + public static String getFunctionsContentAsByte(long currentTime) throws JSONException{ + com.fr.json.JSONObject content = new com.fr.json.JSONObject(); + QueryCondition condition = QueryFactory.create().addRestriction( + RestrictionFactory.lte(COLUMN_TIME, currentTime) + ); + try { + DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class, condition); + JSONArray functionArray = new JSONArray(); + if(!focusPoints.isEmpty()){ + for(FocusPoint focusPoint : focusPoints.getList()){ + com.fr.json.JSONObject jsonObject = new com.fr.json.JSONObject(); + jsonObject.put("id", focusPoint.getId()); + jsonObject.put("text", focusPoint.getText()); + jsonObject.put("source", focusPoint.getSource()); + jsonObject.put("time", focusPoint.getTime()); + jsonObject.put("title", focusPoint.getTitle()); + functionArray.put(jsonObject); + } + + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + content.put("username", MarketConfig.getInstance().getBbsUsername()); + content.put("uuid", envManager.getUUID()); + content.put("functions", functionArray); + } + } catch (MetricException e) { + e.printStackTrace(); + } + return content.toString(); + } + + private void deleteFunctionRecords(long currentTime) { + QueryCondition condition = QueryFactory.create().addRestriction( + RestrictionFactory.lte(COLUMN_TIME, currentTime) + ); + try { + MetricRegistry.getMetric().clean(condition); + }catch (Exception e){ + e.printStackTrace(); + } + } + private class StartStopTime implements XMLReadable, XMLWriter { - + private String startDate; private String stopDate; From ae572702cc139261aeea03d4f1bdf415e2173366 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 30 Oct 2018 18:39:10 +0800 Subject: [PATCH 007/187] =?UTF-8?q?REPORT-11622=20=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E7=A7=BB=E8=87=B3=E4=BA=91=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 8dd130d64a..0000c66cc4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -20,12 +20,14 @@ import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.general.http.HttpClient; +import com.fr.general.http.HttpToolbox; import com.fr.intelli.record.FocusPoint; import com.fr.intelli.record.MetricException; import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.log.message.ParameterMessage; import com.fr.record.DBRecordXManager; import com.fr.stable.ArrayUtils; @@ -225,27 +227,24 @@ public class InformationCollector implements XMLReadable, XMLWriter { try { content = getFunctionsContentAsByte(currentTime); } catch (JSONException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if(StringUtils.isNotEmpty(content)){ HashMap para = new HashMap<>(); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); para.put("token", SiteCenterToken.generateToken()); para.put("content", content); - HttpClient httpClient = new HttpClient(url, para, true); - httpClient.setTimeout(5000); - httpClient.asGet(); - - if (!httpClient.isServerAlive()) { - return; + String res = null; + try { + res = HttpToolbox.get(url, para); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - - String res = httpClient.getResponseText(); boolean success = false; try { success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } //服务器返回true, 说明已经获取成功, 清空当前记录的信息 if (success) { @@ -439,7 +438,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { content.put("functions", functionArray); } } catch (MetricException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return content.toString(); } @@ -451,7 +450,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { try { MetricRegistry.getMetric().clean(condition); }catch (Exception e){ - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } From ec5f13f510bd731a5212538cbe1bbbf26325438e Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 30 Oct 2018 20:39:29 +0800 Subject: [PATCH 008/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 109 ++++++++++-------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 0000c66cc4..00eda062de 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -96,6 +96,13 @@ public class InformationCollector implements XMLReadable, XMLWriter { public static final String FUNC_COLUMNNAME = "func"; public static final String COLUMN_TIME = "time"; public static final String TABLE_FUNCTION_RECORD = "function.record"; + private static final String ATTR_ID = "id"; + private static final String ATTR_TEXT = "text"; + private static final String ATTR_SOURCE = "source"; + private static final String ATTR_TIME = "time"; + private static final String ATTR_TITLE = "title"; + private static final String ATTR_USER_NAME = "username"; + private static final String ATTR_UUID = "uuid"; private static InformationCollector collector; @@ -219,32 +226,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { private void sendFunctionsInfo(){ long currentTime = new Date().getTime(); - long lastTime = getLastTimeMillis(); - if (currentTime - lastTime <= DELTA) { - return; - } - String content = null; - try { - content = getFunctionsContentAsByte(currentTime); - } catch (JSONException e) { + ArrayList> content = null; + try { + content = getFunctionsContentAsByte(currentTime); + } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - if(StringUtils.isNotEmpty(content)){ - HashMap para = new HashMap<>(); - String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - para.put("token", SiteCenterToken.generateToken()); - para.put("content", content); - String res = null; - try { - res = HttpToolbox.get(url, para); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - boolean success = false; - try { - success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + boolean success = false; + String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); + if(content.size() > 0){ + for(int i=0; i record) { + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", new JSONObject(record).toString()); + String res = null; + try { + res = HttpToolbox.get(url, para); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + boolean success = false; + try { + success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return success; + } + /** * 收集开始使用时间,发送信息 */ @@ -413,34 +424,34 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static String getFunctionsContentAsByte(long currentTime) throws JSONException{ - com.fr.json.JSONObject content = new com.fr.json.JSONObject(); - QueryCondition condition = QueryFactory.create().addRestriction( - RestrictionFactory.lte(COLUMN_TIME, currentTime) - ); - try { - DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class, condition); - JSONArray functionArray = new JSONArray(); - if(!focusPoints.isEmpty()){ + public static ArrayList getFunctionsContentAsByte(long currentTime) throws JSONException{ + ArrayList> records = new ArrayList>(); + QueryCondition condition = QueryFactory.create().addRestriction( + RestrictionFactory.lte(COLUMN_TIME, currentTime) + ); + try { + DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); + focusPoints.getList(); + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + String bbsUserName = MarketConfig.getInstance().getBbsUsername(); + String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ for(FocusPoint focusPoint : focusPoints.getList()){ - com.fr.json.JSONObject jsonObject = new com.fr.json.JSONObject(); - jsonObject.put("id", focusPoint.getId()); - jsonObject.put("text", focusPoint.getText()); - jsonObject.put("source", focusPoint.getSource()); - jsonObject.put("time", focusPoint.getTime()); - jsonObject.put("title", focusPoint.getTitle()); - functionArray.put(jsonObject); + Map record = new HashMap<>(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, bbsUserName); + record.put(ATTR_UUID, uuid); + records.add(record); } - - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - content.put("username", MarketConfig.getInstance().getBbsUsername()); - content.put("uuid", envManager.getUUID()); - content.put("functions", functionArray); } - } catch (MetricException e) { + } catch (MetricException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return content.toString(); + } + return records; } private void deleteFunctionRecords(long currentTime) { From bd104a381116a53f69eb2275919319dc574f26df Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 31 Oct 2018 10:08:33 +0800 Subject: [PATCH 009/187] =?UTF-8?q?REPORT-12029=20=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=9C=BA=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditReportServerParameterPane.java | 2 +- .../printsettings/NativePrintSettingPane.java | 122 +++++++++++++++--- .../NoClientPrintSettingPane.java | 2 +- .../printsettings/PageMarginSettingPane.java | 2 +- .../printsettings/PrintSettingPane.java | 14 +- 5 files changed, 119 insertions(+), 23 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java index 0dcd16296c..cf4b653a20 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java @@ -60,7 +60,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane { tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), cssPane = new WebCssPane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane()); + tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(true)); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java index a992483132..ce9f03d16d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java @@ -52,6 +52,11 @@ public class NativePrintSettingPane extends JPanel { private static final String CUSTOM_PAPERSIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"); private static final PaperSize DEFAULT_PAPERSIZE = PaperSize.PAPERSIZE_A4; + // 服务器配置面板特有的组件 + private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 + private UITextField customUrlFieldWin; + private UITextField customUrlFieldMac; + // 公共组件 private UICheckBox showDialogCheck; private UICheckBox needSelectSheetCheck; // 打印需要指定 sheet private UIComboBox printerComboBox; @@ -75,8 +80,10 @@ public class NativePrintSettingPane extends JPanel { private JPanel customPaperSizePane; private UnitFieldPane customWidthFieldPane; private UnitFieldPane customHeightFieldPane; + private boolean serverConfigMode; // 是否为服务器配置中的面板 - public NativePrintSettingPane() { + NativePrintSettingPane(boolean serverConfigMode) { + this.serverConfigMode = serverConfigMode; initComponents(); initListeners(); } @@ -84,39 +91,94 @@ public class NativePrintSettingPane extends JPanel { private void initComponents() { JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 12); + JPanel northPane = getHeaderPane(); + printPane.add(northPane, BorderLayout.NORTH); + + centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings")); + centerPane.add(getNativePrintMainSettingPane()); + + printPane.add(centerPane, BorderLayout.CENTER); + + this.setLayout(new BorderLayout()); + this.add(printPane, BorderLayout.CENTER); + } + + private JPanel getHeaderPane() { + JPanel headerPane; + UILabel tipDownload = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Native_Print_Need_Client")); - northPane.add(tipDownload); + // 打印时需要打印设置窗口 showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing")); showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); UILabel showDialogCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings")); JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[] { showDialogCheck, showDialogCheckTip}, FlowLayout.LEFT); - northPane.add(showDialogCheckPane); + // 打印需要指定 sheet needSelectSheetCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Need_Select_Sheet_When_Printing")); needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); UILabel needSelectSheetCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View")); JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[] { needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT); - northPane.add(needSelectSheetCheckPane); - northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 15, 0)); + if (isServerConfigMode()) { + headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane, getDownloadUrlSettingPane()); + headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); + } else { + headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane); + headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); + } + return headerPane; + } - printPane.add(northPane, BorderLayout.NORTH); + private JPanel createHeaderLayoutPane(Component... comps) { + // TableLayout + double p = TableLayout.PREFERRED; + double[] columnSize = {p}; - centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings")); + double[] rowSize = new double[comps.length]; + for (int i = 0; i < rowSize.length; i++) { + rowSize[i] = p; + } - UIScrollPane scrollPane = new UIScrollPane(getNativePrintMainSettingPane()); - scrollPane.setBorder(null); - scrollPane.setPreferredSize(new Dimension(600, 340)); - centerPane.add(scrollPane); + Component[][] components = new Component[rowSize.length][columnSize.length]; + for (int i = 0; i < rowSize.length; i++) { + components[i][0] = comps[i]; + } + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); + } - printPane.add(centerPane, BorderLayout.CENTER); + private JPanel getDownloadUrlSettingPane() { + defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); + JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); + downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - this.setLayout(new BorderLayout()); - this.add(printPane, BorderLayout.CENTER); + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, p}; + Component[][] components = { + {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane} + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + } + + private JPanel getCustomUrlSettingPane() { + customUrlFieldWin = new UITextField(20); + customUrlFieldMac = new UITextField(20); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {60, p}; + Component[][] components = { + {new UILabel("windows: "), customUrlFieldWin}, + {new UILabel("macOS: "), customUrlFieldMac} + }; + JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); + urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + return urlSettingPane; } private void initListeners() { @@ -399,10 +461,14 @@ public class NativePrintSettingPane extends JPanel { private JPanel getTopAlignLabelPane(String labelText) { JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelPane.add(new UILabel(labelText), BorderLayout.NORTH); + labelPane.add(new JPanel(), BorderLayout.CENTER); return labelPane; } public void populate(NativePrintAttr nativePrintAttr) { + if (isServerConfigMode()) { + serverOnlyPopulate(nativePrintAttr); + } showDialogCheck.setSelected(nativePrintAttr.isShowDialog()); needSelectSheetCheck.setSelected(nativePrintAttr.isNeedSelectSheet()); printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName()); @@ -452,12 +518,18 @@ public class NativePrintSettingPane extends JPanel { checkEnabled(); } + private void serverOnlyPopulate(NativePrintAttr nativePrintAttr) { + defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); + customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); + customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); + } + public void update(NativePrintAttr nativePrintAttr) { + if (isServerConfigMode()) { + serverOnlyUpdate(nativePrintAttr); + } nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); - if (printerComboBox.getSelectedItem() != null) { - nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString()); - } nativePrintAttr.setCopy((int)copySpinner.getValue()); // 页码 @@ -493,8 +565,22 @@ public class NativePrintSettingPane extends JPanel { nativePrintAttr.setScalePercent((int)scalePercentField.getValue()); } + private void serverOnlyUpdate(NativePrintAttr nativePrintAttr) { + if (defaultDownloadUrlCheck.isSelected()) { + nativePrintAttr.setUseDefaultDownloadUrl(true); + } else { + nativePrintAttr.setUseDefaultDownloadUrl(false); + nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); + nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); + } + } + // 刷新面板可用状态 public void checkEnabled() { GUICoreUtils.setEnabled(centerPane, !showDialogCheck.isSelected()); } + + public boolean isServerConfigMode() { + return serverConfigMode; + } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java index a61cd7a3c2..ae91271598 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java @@ -26,7 +26,7 @@ public class NoClientPrintSettingPane extends JPanel { private PageMarginSettingPane pageMarginSettingPane; private JPanel centerPane; - public NoClientPrintSettingPane() { + NoClientPrintSettingPane() { initComponents(); initListeners(); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java index a7be5cd9bc..1742a2b02a 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java @@ -19,7 +19,7 @@ public class PageMarginSettingPane extends JPanel { private UnitFieldPane marginLeftUnitFieldPane; private UnitFieldPane marginRightUnitFieldPane; - public PageMarginSettingPane() { + PageMarginSettingPane() { initComponents(); } private void initComponents() { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java index a315dab653..403cb1dd7d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java @@ -3,6 +3,7 @@ package com.fr.design.webattr.printsettings; import com.fr.base.print.PrintSettingsAttrMark; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; @@ -28,8 +29,14 @@ public class PrintSettingPane extends BasicPane { private NativePrintSettingPane nativePrintSettingPane; private CardLayout printCard; private JPanel printPane; + private boolean serverConfigMode; // 是否为服务器配置中的面板 public PrintSettingPane() { + this(false); + } + + public PrintSettingPane(boolean serverConfigMode) { + this.serverConfigMode = serverConfigMode; initComponents(); initListener(); } @@ -50,12 +57,15 @@ public class PrintSettingPane extends BasicPane { north.add(radioGroupPane); noClientPrintSettingPane = new NoClientPrintSettingPane(); - nativePrintSettingPane = new NativePrintSettingPane(); + nativePrintSettingPane = new NativePrintSettingPane(serverConfigMode); printCard = new CardLayout(); printPane = new JPanel(); printPane.setLayout(printCard); printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane); - printPane.add(nativePrintRadioButton.getText(), nativePrintSettingPane); + + UIScrollPane scrollPane = new UIScrollPane(nativePrintSettingPane); + scrollPane.setBorder(null); + printPane.add(nativePrintRadioButton.getText(), scrollPane); north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); allPanel.add(printPane, BorderLayout.CENTER); From 394d5bddb1122e4cdf382ac76eab57fe2bf049be Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 31 Oct 2018 11:46:50 +0800 Subject: [PATCH 010/187] =?UTF-8?q?content=E9=9C=80=E8=A6=81=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 00eda062de..6507620694 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -58,6 +58,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -227,11 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private void sendFunctionsInfo(){ long currentTime = new Date().getTime(); ArrayList> content = null; - try { - content = getFunctionsContentAsByte(currentTime); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + content = getFunctionsContentAsByte(currentTime); boolean success = false; String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); if(content.size() > 0){ @@ -246,19 +243,12 @@ public class InformationCollector implements XMLReadable, XMLWriter { } private boolean sendFunctionRecord(String url, Map record) { - HashMap para = new HashMap<>(); - para.put("token", SiteCenterToken.generateToken()); - para.put("content", new JSONObject(record).toString()); - String res = null; - try { - res = HttpToolbox.get(url, para); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } boolean success = false; try { + String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+URLEncoder.encode(new JSONObject(record).toString(), EncodeConstants.ENCODING_UTF_8); + String res = HttpToolbox.get(recordUrl); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return success; @@ -424,14 +414,13 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static ArrayList getFunctionsContentAsByte(long currentTime) throws JSONException{ + public static ArrayList getFunctionsContentAsByte(long currentTime){ ArrayList> records = new ArrayList>(); QueryCondition condition = QueryFactory.create().addRestriction( RestrictionFactory.lte(COLUMN_TIME, currentTime) ); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - focusPoints.getList(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); String bbsUserName = MarketConfig.getInstance().getBbsUsername(); String uuid = envManager.getUUID(); From fab057832912fd27e776d007a1ea81cdbab2f24b Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 31 Oct 2018 15:06:31 +0800 Subject: [PATCH 011/187] =?UTF-8?q?REPORT-12029=20=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=9C=BA=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE=E7=BD=AE=3D>=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E9=9D=A2=E6=9D=BF=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditReportServerParameterPane.java | 8 +- ...va => AbstractNativePrintSettingPane.java} | 86 +++--------------- .../GlobalNativePrintSettingPane.java | 91 +++++++++++++++++++ .../printsettings/PrintSettingPane.java | 12 +-- .../ReportNativePrintSettingPane.java | 18 ++++ 5 files changed, 130 insertions(+), 85 deletions(-) rename designer-realize/src/main/java/com/fr/design/webattr/printsettings/{NativePrintSettingPane.java => AbstractNativePrintSettingPane.java} (86%) create mode 100644 designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java index cf4b653a20..18d110400c 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java @@ -10,16 +10,16 @@ import com.fr.config.ServerPreferenceConfig; import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.webattr.printsettings.GlobalNativePrintSettingPane; import com.fr.design.webattr.printsettings.PrintSettingPane; - import com.fr.report.core.ReportUtils; import com.fr.report.web.WebPage; import com.fr.report.web.WebView; import com.fr.report.web.WebWrite; import com.fr.web.attr.ReportWebAttr; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; /** * Edit Report Server Parameter. @@ -60,7 +60,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane { tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), cssPane = new WebCssPane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane()); - tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(true)); + tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(new GlobalNativePrintSettingPane())); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java similarity index 86% rename from designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java rename to designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index ce9f03d16d..eac54ea73b 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UINumberField; @@ -46,16 +45,12 @@ import java.util.regex.Pattern; /** * Created by plough on 2018/3/5. */ -public class NativePrintSettingPane extends JPanel { +public abstract class AbstractNativePrintSettingPane extends JPanel { private static final int ODD_INDEX = 0; private static final int EVEN_INDEX = 1; private static final String CUSTOM_PAPERSIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"); private static final PaperSize DEFAULT_PAPERSIZE = PaperSize.PAPERSIZE_A4; - // 服务器配置面板特有的组件 - private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 - private UITextField customUrlFieldWin; - private UITextField customUrlFieldMac; // 公共组件 private UICheckBox showDialogCheck; private UICheckBox needSelectSheetCheck; // 打印需要指定 sheet @@ -80,10 +75,8 @@ public class NativePrintSettingPane extends JPanel { private JPanel customPaperSizePane; private UnitFieldPane customWidthFieldPane; private UnitFieldPane customHeightFieldPane; - private boolean serverConfigMode; // 是否为服务器配置中的面板 - NativePrintSettingPane(boolean serverConfigMode) { - this.serverConfigMode = serverConfigMode; + AbstractNativePrintSettingPane() { initComponents(); initListeners(); } @@ -104,8 +97,6 @@ public class NativePrintSettingPane extends JPanel { } private JPanel getHeaderPane() { - JPanel headerPane; - UILabel tipDownload = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Native_Print_Need_Client")); // 打印时需要打印设置窗口 @@ -122,17 +113,12 @@ public class NativePrintSettingPane extends JPanel { JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[] { needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT); - if (isServerConfigMode()) { - headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane, getDownloadUrlSettingPane()); - headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); - } else { - headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane); - headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); - } - return headerPane; + return createHeaderPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane); } - private JPanel createHeaderLayoutPane(Component... comps) { + abstract JPanel createHeaderPane(Component... comps); + + JPanel createHeaderLayoutPane(Component... comps) { // TableLayout double p = TableLayout.PREFERRED; double[] columnSize = {p}; @@ -149,37 +135,7 @@ public class NativePrintSettingPane extends JPanel { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); } - private JPanel getDownloadUrlSettingPane() { - defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); - JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); - downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, p}; - Component[][] components = { - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); - } - - private JPanel getCustomUrlSettingPane() { - customUrlFieldWin = new UITextField(20); - customUrlFieldMac = new UITextField(20); - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {60, p}; - Component[][] components = { - {new UILabel("windows: "), customUrlFieldWin}, - {new UILabel("macOS: "), customUrlFieldMac} - }; - JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - return urlSettingPane; - } private void initListeners() { allPageRadioButton.addItemListener(getPageRaidoListener()); @@ -458,7 +414,7 @@ public class NativePrintSettingPane extends JPanel { } // 返回包含一个标签的 panel,标签始终位于 panel 顶部 - private JPanel getTopAlignLabelPane(String labelText) { + JPanel getTopAlignLabelPane(String labelText) { JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelPane.add(new UILabel(labelText), BorderLayout.NORTH); labelPane.add(new JPanel(), BorderLayout.CENTER); @@ -466,9 +422,7 @@ public class NativePrintSettingPane extends JPanel { } public void populate(NativePrintAttr nativePrintAttr) { - if (isServerConfigMode()) { - serverOnlyPopulate(nativePrintAttr); - } + extraPopulate(nativePrintAttr); showDialogCheck.setSelected(nativePrintAttr.isShowDialog()); needSelectSheetCheck.setSelected(nativePrintAttr.isNeedSelectSheet()); printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName()); @@ -518,16 +472,12 @@ public class NativePrintSettingPane extends JPanel { checkEnabled(); } - private void serverOnlyPopulate(NativePrintAttr nativePrintAttr) { - defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); - customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); - customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); + protected void extraPopulate(NativePrintAttr nativePrintAttr) { + // do nothing } public void update(NativePrintAttr nativePrintAttr) { - if (isServerConfigMode()) { - serverOnlyUpdate(nativePrintAttr); - } + extraUpdate(nativePrintAttr); nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); nativePrintAttr.setCopy((int)copySpinner.getValue()); @@ -565,22 +515,12 @@ public class NativePrintSettingPane extends JPanel { nativePrintAttr.setScalePercent((int)scalePercentField.getValue()); } - private void serverOnlyUpdate(NativePrintAttr nativePrintAttr) { - if (defaultDownloadUrlCheck.isSelected()) { - nativePrintAttr.setUseDefaultDownloadUrl(true); - } else { - nativePrintAttr.setUseDefaultDownloadUrl(false); - nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); - nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); - } + protected void extraUpdate(NativePrintAttr nativePrintAttr) { + // do nothing } // 刷新面板可用状态 public void checkEnabled() { GUICoreUtils.setEnabled(centerPane, !showDialogCheck.isSelected()); } - - public boolean isServerConfigMode() { - return serverConfigMode; - } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java new file mode 100644 index 0000000000..0e2a98148d --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -0,0 +1,91 @@ +package com.fr.design.webattr.printsettings; + +import com.fr.base.print.NativePrintAttr; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.Component; + +/** + * 本地打印设置面板——全局 + * Created by plough on 2018/10/31. + */ +public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane { + // 服务器配置面板特有的组件 + private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 + private UITextField customUrlFieldWin; + private UITextField customUrlFieldMac; + + + @Override + JPanel createHeaderPane(Component... comps) { + + Component[] newComps = { + getDownloadUrlSettingPane() + }; + Component[] allComps = new Component[comps.length + newComps.length]; + System.arraycopy(comps, 0, allComps, 0, comps.length); + System.arraycopy(newComps, 0, allComps, comps.length, newComps.length); + + JPanel headerPane = createHeaderLayoutPane(allComps); + headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); + return headerPane; + } + + + @Override + protected void extraUpdate(NativePrintAttr nativePrintAttr) { + if (defaultDownloadUrlCheck.isSelected()) { + nativePrintAttr.setUseDefaultDownloadUrl(true); + } else { + nativePrintAttr.setUseDefaultDownloadUrl(false); + nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); + nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); + } + } + + @Override + protected void extraPopulate(NativePrintAttr nativePrintAttr) { + defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); + customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); + customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); + } + + private JPanel getDownloadUrlSettingPane() { + defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); + JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); + downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, p}; + Component[][] components = { + {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane} + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + } + + private JPanel getCustomUrlSettingPane() { + customUrlFieldWin = new UITextField(20); + customUrlFieldMac = new UITextField(20); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {60, p}; + Component[][] components = { + {new UILabel("windows: "), customUrlFieldWin}, + {new UILabel("macOS: "), customUrlFieldMac} + }; + JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); + urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + return urlSettingPane; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java index 403cb1dd7d..883a0801fd 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; - import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; @@ -24,19 +23,17 @@ import java.awt.event.ItemListener; public class PrintSettingPane extends BasicPane { private UIRadioButton noClientPrintRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_No_Client_Print")); private UIRadioButton nativePrintRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Native_Print")); - private NoClientPrintSettingPane noClientPrintSettingPane; - private NativePrintSettingPane nativePrintSettingPane; + private AbstractNativePrintSettingPane nativePrintSettingPane; private CardLayout printCard; private JPanel printPane; - private boolean serverConfigMode; // 是否为服务器配置中的面板 public PrintSettingPane() { - this(false); + this(new ReportNativePrintSettingPane()); } - public PrintSettingPane(boolean serverConfigMode) { - this.serverConfigMode = serverConfigMode; + public PrintSettingPane(AbstractNativePrintSettingPane nativePrintSettingPane) { + this.nativePrintSettingPane = nativePrintSettingPane; initComponents(); initListener(); } @@ -57,7 +54,6 @@ public class PrintSettingPane extends BasicPane { north.add(radioGroupPane); noClientPrintSettingPane = new NoClientPrintSettingPane(); - nativePrintSettingPane = new NativePrintSettingPane(serverConfigMode); printCard = new CardLayout(); printPane = new JPanel(); printPane.setLayout(printCard); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java new file mode 100644 index 0000000000..b94a894155 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java @@ -0,0 +1,18 @@ +package com.fr.design.webattr.printsettings; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.Component; + +/** + * 本地打印设置面板——单模版 + * Created by plough on 2018/10/31. + */ +public class ReportNativePrintSettingPane extends AbstractNativePrintSettingPane { + @Override + JPanel createHeaderPane(Component... comps) { + JPanel headerPane = createHeaderLayoutPane(comps); + headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); + return headerPane; + } +} From 02d6e3050c6020a0f2492e53245d3014ca889862 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 18:02:05 +0800 Subject: [PATCH 012/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/conf/FitAttrState.java | 76 ++++++ .../fun/FormElementCaseEditorProcessor.java | 2 +- .../fun/FormElementCaseEditorProvider.java | 2 +- ...bstractFormElementCaseEditorProcessor.java | 2 +- ...AbstractFormElementCaseEditorProvider.java | 2 +- .../menupane/BrowserFitAttrPane.java | 232 ++++++++++++++++++ .../mainframe/menupane/FitPreviewPane.java | 74 ++++++ .../mainframe/menupane/FitRadioGroup.java | 80 ++++++ .../mainframe/menupane/FontRadioGroup.java | 17 ++ .../menupane/ReportFitAttrAction.java | 107 ++++++++ .../mainframe/menupane/ReportFitAttrPane.java | 56 +++++ .../menupane/TemplateBrowserFitAttrPane.java | 77 ++++++ .../menupane/TemplateFitAttrPane.java | 55 +++++ .../fr/design/images/reportfit.preview/00.png | Bin 0 -> 745 bytes .../fr/design/images/reportfit.preview/10.png | Bin 0 -> 1643 bytes .../fr/design/images/reportfit.preview/11.png | Bin 0 -> 740 bytes .../fr/design/images/reportfit.preview/20.png | Bin 0 -> 2459 bytes .../fr/design/images/reportfit.preview/21.png | Bin 0 -> 788 bytes .../fr/design/images/reportfit.preview/30.png | Bin 0 -> 788 bytes .../images/reportfit.preview/gray/00.png | Bin 0 -> 745 bytes .../images/reportfit.preview/gray/10.png | Bin 0 -> 1507 bytes .../images/reportfit.preview/gray/11.png | Bin 0 -> 740 bytes .../images/reportfit.preview/gray/20.png | Bin 0 -> 2277 bytes .../images/reportfit.preview/gray/21.png | Bin 0 -> 782 bytes .../images/reportfit.preview/gray/30.png | Bin 0 -> 783 bytes .../design/designer/creator/XElementCase.java | 23 +- .../java/com/fr/design/mainframe/JForm.java | 5 +- .../BrowserFitAlignmentItems.java | 21 ++ .../widget/propertypane/BrowserFitEditor.java | 47 ++++ .../BrowserFitPropertyEditor.java | 45 ++++ .../widget/propertypane/BrowserFitRender.java | 10 + .../propertypane/BrowserFitWrapper.java | 9 + .../com/fr/design/mainframe/JWorkBook.java | 2 + 33 files changed, 927 insertions(+), 17 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/conf/FitAttrState.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/00.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/10.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/11.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/20.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/21.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/30.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/00.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/10.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/11.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/20.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/21.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/30.png create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java diff --git a/designer-base/src/main/java/com/fr/conf/FitAttrState.java b/designer-base/src/main/java/com/fr/conf/FitAttrState.java new file mode 100644 index 0000000000..9ad42fd6e7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/conf/FitAttrState.java @@ -0,0 +1,76 @@ +package com.fr.conf; + +import com.fr.design.designer.properties.items.Item; +import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.stable.StringUtils; + +/** + * Created by Administrator on 2016/4/13/0013. + */ +public enum FitAttrState { + DEFAULT(0) { + @Override + public String description() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Default"); + } + + }, + // 横向自适应, 纵向根据横向的比例来适配 + HORIZONTAL_FIT(1) { + @Override + public String description() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Horizontal"); + } + }, + // 双向自适应, 横纵向都是根据页面宽高来计算 + DOUBLE_FIT(2) { + @Override + public String description() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Horizontal_Vertical"); + } + }, + + NOT_FIT(3) { + @Override + public String description() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_No"); + } + }; + + + private int state; + + + FitAttrState(int state) { + this.state = state; + } + + public static FitAttrState parse(ReportFitAttrProvider attr) { + + if (attr == null) { + return DEFAULT; + } + + for (FitAttrState attrState : values()) { + if (attrState.state == attr.fitStateInPC()) { + return attrState; + } + } + + return DEFAULT; + } + + public int getState() { + return this.state; + } + + + public String description() { + return StringUtils.EMPTY; + } + + public Item propertyItem() { + return new Item(this.description(), this.getState()); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java index 21866a2c32..28d763bf71 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java @@ -1,6 +1,6 @@ package com.fr.design.fun; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.Immutable; import java.beans.PropertyDescriptor; diff --git a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java index 92a1a835f4..6a0cf7bba1 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -2,7 +2,7 @@ package com.fr.design.fun; import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditorProvider; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.Mutable; import java.beans.PropertyDescriptor; diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java index 08a5a1606f..191f513908 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java @@ -1,7 +1,7 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProcessor; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; import java.beans.PropertyDescriptor; diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index 8764eaf898..f9d3e1b173 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -3,7 +3,7 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditorProvider; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; import java.beans.PropertyDescriptor; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java new file mode 100644 index 0000000000..eeaa3047ca --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java @@ -0,0 +1,232 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.conf.FitAttrState; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.log.FineLoggerFactory; +import com.fr.main.ReportFitAttr; +import com.fr.main.ReportFitConfig; +import com.fr.report.fun.ReportFitAttrProvider; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Created by Administrator on 2016/5/5/0005. + */ +public class BrowserFitAttrPane extends BasicBeanPane { + + protected FontRadioGroup fontRadioGroup; + protected FitRadioGroup fitRadionGroup; + protected UICheckBox globalCheck; + protected FitPreviewPane fitPreviewPane; + protected ReportFitAttrProvider localFitAttr; + protected UIRadioButton defaultRadio; + protected UIRadioButton horizonRadio; + protected UIRadioButton doubleRadio; + protected UIRadioButton notFitRadio; + protected UIRadioButton fontFitRadio; + protected UIRadioButton fontNotFitRadio; + private UIButton editGlobalOps; + private JPanel borderPane; + private JPanel globalOpsPane; + private JPanel fitOpsPane; + + public BrowserFitAttrPane() { + initComponents(ReportFitConfig.getInstance().getFrmFitAttr()); + } + + protected void initComponents(ReportFitAttr globalFitAttr) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + globalOpsPane = initGlobalOpsPane(globalFitAttr); + this.add(globalOpsPane, BorderLayout.NORTH); + fitOpsPane = initFitOpsPane(); + + } + + protected void initBorderPane(String title) { + borderPane = FRGUIPaneFactory.createTitledBorderPaneCenter(title); + borderPane.add(fitOpsPane, BorderLayout.CENTER); + fitPreviewPane = new FitPreviewPane(); + borderPane.add(fitPreviewPane, BorderLayout.SOUTH); + this.add(borderPane, BorderLayout.CENTER); + } + + private JPanel initFitOpsPane() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, p, p, p, p}; + + ActionListener actionListener = getPreviewActionListener(); + + fontRadioGroup = new FontRadioGroup(); + fontFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit")); + fontFitRadio.setSelected(true); + fontNotFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_No")); + addRadioToGroup(fontRadioGroup, fontFitRadio, fontNotFitRadio); + fontRadioGroup.addActionListener(actionListener); + + fitRadionGroup = new FitRadioGroup(); + defaultRadio = new UIRadioButton(FitAttrState.DEFAULT.description()); + horizonRadio = new UIRadioButton(FitAttrState.HORIZONTAL_FIT.description()); + doubleRadio = new UIRadioButton(FitAttrState.DOUBLE_FIT.description()); + notFitRadio = new UIRadioButton(FitAttrState.NOT_FIT.description()); + addRadioToGroup(fitRadionGroup, defaultRadio, horizonRadio, doubleRadio, notFitRadio); + fitRadionGroup.addActionListener(actionListener); + + + JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(initFitComponents(), rowSize, columnSize); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + return fitOpsPane; + } + + protected Component[][] initFitComponents() { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Element")), defaultRadio, horizonRadio, doubleRadio, notFitRadio} + }; + return components; + } + + private void addRadioToGroup(ButtonGroup buttonGroup, UIRadioButton... radios) { + for (UIRadioButton radio : radios) { + buttonGroup.add(radio); + } + } + + private JPanel initGlobalOpsPane(final ReportFitAttr globalFitAttr) { + final JPanel globalOpsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + globalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Use-Global")); + globalOpsPane.add(globalCheck); + globalCheck.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boolean isLocalConfig = !globalCheck.isSelected(); + //勾选全局时,采用全局保存的自适应属性更新界面 + if (!isLocalConfig) { + ReportFitAttrProvider attr = globalFitAttr; + fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); + fitRadionGroup.selectIndexButton(attr.fitStateInPC()); + fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); + remove(BrowserFitAttrPane.this.borderPane); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Global")); + } else { + ReportFitAttrProvider attr = localFitAttr; + fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); + fitRadionGroup.selectIndexButton(attr.fitStateInPC()); + fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); + remove(BrowserFitAttrPane.this.borderPane); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + } + fontRadioGroup.setEnabled(isLocalConfig); + fitRadionGroup.setEnabled(isLocalConfig); + editGlobalOps.setVisible(!isLocalConfig); + String fitOptions = getCurrentFitOptions(); + fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); + } + }); + + editGlobalOps = new UIButton(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Edit-Global")); + editGlobalOps.setVisible(false); + editGlobalOps.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent evt) { + fontRadioGroup.setEnabled(true); + fitRadionGroup.setEnabled(true); + String fitOptions = getCurrentFitOptions(); + + fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); + } + + public void mouseEntered(MouseEvent e) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + } + }); + globalOpsPane.add(editGlobalOps); + return globalOpsPane; + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Attr-Set"); + } + + @Override + public void populateBean(ReportFitAttrProvider attr) { + if (attr == null) { + //如果为空, 就用全局的 + attr = ReportFitConfig.getInstance().getFrmFitAttr(); + populateGlobalComponents(); + } else { + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + } + this.localFitAttr = attr; + fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); + fitRadionGroup.selectIndexButton(attr.fitStateInPC()); + fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); + } + + protected void populateGlobalComponents() { + globalCheck.setSelected(true); + fontRadioGroup.setEnabled(false); + fitRadionGroup.setEnabled(false); + editGlobalOps.setVisible(true); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Global")); + } + + //有八种组合, 不过有意义的就是6种, 以此为key去缓存里找对应的预览图片 + public String getCurrentFitOptions() { + return fitRadionGroup.getSelectRadioIndex() + "" + fontRadioGroup.getSelectRadioIndex(); + } + + private ActionListener getPreviewActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String fitOptions = getCurrentFitOptions(); + fitPreviewPane.refreshPreview(fitOptions, fontRadioGroup.isEnabled()); + } + }; + } + + @Override + public ReportFitAttrProvider updateBean() { + ReportFitAttr attr = new ReportFitAttr(); + attr.setFitFont(fontRadioGroup.isFontFit()); + attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex()); + + // 直接用全局的 + if (globalCheck.isSelected()) { + updateGlobalConfig(attr); + return null; + } + this.localFitAttr = attr; + return attr; + } + + private void updateGlobalConfig(ReportFitAttr attr) { + try { + ReportFitConfig manager = ReportFitConfig.getInstance(); + manager.setFrmFitAttr(attr); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java new file mode 100644 index 0000000000..fbc12c3b3d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java @@ -0,0 +1,74 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.IOUtils; + +import javax.swing.ImageIcon; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Administrator on 2016/5/5/0005. + */ +public class FitPreviewPane extends BasicPane { + private static final String DEFAULT_FONT_TAG = "00"; + private static final String DEFAULT_TAG = "01"; + private static final String HORIZON_FONT_TAG = "10"; + private static final String HORIZON_TAG = "11"; + private static final String DOUBLE_FONT_TAG = "20"; + private static final String DOUBLE_TAG = "21"; + private static final String NOT_FONT_TAG = "30"; + private static final String NOT_TAG = "31"; + + private UILabel imageLabel; + private Map cachedPreviewImage = new HashMap(); + private Map globalCachedPreviewImage = new HashMap(); + + public FitPreviewPane() { + //初始化缓存图片, 有些无意义的组合. + initCacheImage(); + //初始化组件 + initComponents(); + } + + //默认和不自适应时,字体自适应不起效,只有6张图 + private void initCacheImage() { + globalCachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DEFAULT_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DEFAULT_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_TAG + ".png"))); + globalCachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_TAG + ".png"))); + globalCachedPreviewImage.put(NOT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(NOT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); + cachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DEFAULT_FONT_TAG + ".png"))); + cachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DEFAULT_FONT_TAG + ".png"))); + cachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_FONT_TAG + ".png"))); + cachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_TAG + ".png"))); + cachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_FONT_TAG + ".png"))); + cachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_TAG + ".png"))); + cachedPreviewImage.put(NOT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); + cachedPreviewImage.put(NOT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + imageLabel = new UILabel(); + imageLabel.setIcon(cachedPreviewImage.get(DEFAULT_TAG)); + this.add(imageLabel); + } + + public void refreshPreview(String index, boolean isEditedable) { + ImageIcon newImageIcon = isEditedable ? cachedPreviewImage.get(index) : globalCachedPreviewImage.get(index); + imageLabel.setIcon(newImageIcon); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Preview"); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java new file mode 100644 index 0000000000..e2612f794c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java @@ -0,0 +1,80 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.design.gui.ibutton.UIRadioButton; + +import javax.swing.AbstractButton; +import javax.swing.ButtonGroup; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 自适应四个按钮选项的group + *

+ * Created by Administrator on 2016/5/5/0005. + */ +public class FitRadioGroup extends ButtonGroup { + + private List radioButtons = new ArrayList(); + + @Override + public void add(AbstractButton button) { + super.add(button); + + UIRadioButton radioButton = (UIRadioButton) button; + radioButtons.add(radioButton); + } + + /** + * 设置按钮状态 + */ + public boolean isEnabled() { + return radioButtons.get(0).isEnabled(); + } + + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.setEnabled(enabled); + } + } + + /** + * 获取当前选中的按钮index + * + * @return 按钮index + */ + public int getSelectRadioIndex() { + for (int i = 0, len = radioButtons.size(); i < len; i++) { + if (radioButtons.get(i).isSelected()) { + return i; + } + } + + return 0; + } + + /** + * 选中指定index的按钮 + */ + public void selectIndexButton(int index) { + if (index < 0 || index > radioButtons.size() - 1) { + return; + } + + UIRadioButton button = radioButtons.get(index); + button.setSelected(true); + } + + /** + * 给所有的按钮加上监听 + */ + public void addActionListener(ActionListener actionListener) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.addActionListener(actionListener); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java new file mode 100644 index 0000000000..5bb7d55052 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.menupane; + +/** + * 字体的两个选项组成的group + *

+ * Created by Administrator on 2016/5/5/0005. + */ +public class FontRadioGroup extends FitRadioGroup { + + public void selectFontFit(boolean isFontFit) { + selectIndexButton(isFontFit ? 0 : 1); + } + + public boolean isFontFit() { + return getSelectRadioIndex() == 0; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java new file mode 100644 index 0000000000..3c4d977fab --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java @@ -0,0 +1,107 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.JTemplateAction; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuKeySet; +import com.fr.report.fun.FitProvider; +import com.fr.report.fun.ReportFitAttrProvider; + +import javax.swing.KeyStroke; +import java.awt.Dimension; +import java.awt.event.ActionEvent; + +/** + * Created by Administrator on 2015/7/6 0006. + */ +public class ReportFitAttrAction extends JTemplateAction { + private static final Dimension MEDIUM = new Dimension(430, 400); + private static final MenuKeySet REPORT_FIT_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Template"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Elementcase"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + public ReportFitAttrAction(JTemplate jTemplate) { + super(jTemplate); + initMenuStyle(); + } + + private void initMenuStyle() { + JTemplate jTemplate = getEditingComponent(); + if (jTemplate.isJWorkBook()) { + this.setMenuKeySet(REPORT_FIT_ATTR); + } else { + this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE); + } + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/fit.png")); + } + + /** + * Action触发事件 + * + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + final JTemplate jwb = getEditingComponent(); + if (jwb == null) { + return; + } + final FitProvider wbTpl = (FitProvider) jwb.getTarget(); + ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); + if (jwb.isJWorkBook()) { + final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); + showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); + } else { + final ReportFitAttrPane attrPane = new ReportFitAttrPane(); + showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); + } + } + + private void showReportFitDialog(ReportFitAttrProvider fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { + attrPane.populateBean(fitAttr); + UIDialog dialog = attrPane.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + wbTpl.setFitAttr(attrPane.updateBean()); + jwb.fireTargetModified(); + } + }); + dialog.setSize(MEDIUM); + dialog.setVisible(true); + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java new file mode 100644 index 0000000000..27faf6fa87 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java @@ -0,0 +1,56 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.report.fun.ReportFitAttrProvider; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; + +/** + * Created by Administrator on 2015/7/6 0006. + */ +public class ReportFitAttrPane extends BasicBeanPane { + + private BrowserFitAttrPane attrPane; + + + public ReportFitAttrPane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + attrPane = new BrowserFitAttrPane(); + this.add(attrPane); + + } + + /** + * 展示界面 + * + * @param fitAttr 自适应属性 + */ + public void populateBean(ReportFitAttrProvider fitAttr) { + attrPane.populateBean(fitAttr); + } + + /** + * 提交数据 + * + * @return 界面上的更新数据 + */ + public ReportFitAttrProvider updateBean() { + return attrPane.updateBean(); + } + + /** + * 标题 + * + * @return 标题 + */ + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Attr"); + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java new file mode 100644 index 0000000000..e37ce09a37 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java @@ -0,0 +1,77 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.log.FineLoggerFactory; +import com.fr.main.ReportFitAttr; +import com.fr.main.ReportFitConfig; +import com.fr.report.fun.ReportFitAttrProvider; + +import java.awt.Component; + +/** + * Created by 夏翔 on 2016/6/24. + */ +public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { + + public TemplateBrowserFitAttrPane() { + initComponents(ReportFitConfig.getInstance().getCptFitAttr()); + } + + + @Override + protected Component[][] initFitComponents() { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Element")), horizonRadio, doubleRadio, notFitRadio} + }; + return components; + } + + @Override + public void populateBean(ReportFitAttrProvider attr) { + //模板界面,自适应选项去掉了默认,这边的判断为了兼容之前的设置 + if (attr != null && attr.fitStateInPC() == 0) { + attr.setFitStateInPC(3); + } + ReportFitAttrProvider fitAttr = ReportFitConfig.getInstance().getCptFitAttr(); + if (attr == null) { + //如果为空, 就用全局的 + attr = fitAttr; + populateGlobalComponents(); + } else if (fitAttr.fitStateInPC() == 0) { + attr = new ReportFitAttr(); + attr.setFitStateInPC(3); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + } else { + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + } + this.localFitAttr = attr; + fontRadioGroup.selectFontFit((attr).isFitFont()); + fitRadionGroup.selectIndexButton(attr.fitStateInPC()); + fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); + } + + @Override + public ReportFitAttrProvider updateBean() { + ReportFitAttr attr = new ReportFitAttr(); + attr.setFitFont(fontRadioGroup.isFontFit()); + attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex()); + + // 直接用全局的 + if (globalCheck.isSelected()) { + updateGlobalConfig(attr); + return null; + } + this.localFitAttr = attr; + return attr; + } + + private void updateGlobalConfig(ReportFitAttr attr) { + try { + ReportFitConfig manager = ReportFitConfig.getInstance(); + manager.setCptFitAttr(attr); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java new file mode 100644 index 0000000000..675af9c541 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe.menupane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.report.fun.ReportFitAttrProvider; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; + +/** + * Created by 夏翔 on 2016/6/24. + */ +public class TemplateFitAttrPane extends BasicBeanPane { + private TemplateBrowserFitAttrPane attrPane; + + + public TemplateFitAttrPane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + attrPane = new TemplateBrowserFitAttrPane(); + this.add(attrPane); + + } + + /** + * 展示界面 + * + * @param fitAttr 自适应属性 + */ + public void populateBean(ReportFitAttrProvider fitAttr) { + attrPane.populateBean(fitAttr); + } + + + /** + * 提交数据 + * + * @return 界面上的更新数据 + */ + public ReportFitAttrProvider updateBean() { + return attrPane.updateBean(); + } + + /** + * 标题 + * + * @return 标题 + */ + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Attr"); + } +} diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/00.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/00.png new file mode 100644 index 0000000000000000000000000000000000000000..58033c96a2867f61277c7bbd00abc054caefe261 GIT binary patch literal 745 zcmeAS@N?(olHy`uVBq!ia0vp^AAooP2NRIoyR*y)NO2Z;L>4nJa0`PlBg3pY5A!ydkGr}~$MpHT-+$d# z>|I@6m;dq8oc8kNEmh0CWVMd`%eJ4Zc=lnE<-wxGbDq5@k1RbWD0_bUe2G)hM!WCk z_vrnr482&UdwCA?yC~T|5kar|xbC$}W}Rbv-?zijU;S#o|7FK#GN1ca>{?thXSQi| zp1Exr&+W^_yDxrJJF(7n_j}>=j`j-wzaJ8KNcf;`TnteP3QJ&rLD7+ z?-D(n^fvL@RrkYsKV~MM^Izwi_4T4VfBO0LS1fFAZ1^$f^yBTU=lT8JEPqRUPpDD4 zmv%03{)&|7+LEduiMK1WW?8b|F1ZL6mTEWr+MasxV20L1JCyBEZS>Jxy)1gbAUkplBJg}T`sl}WPup2ywVZMoS3 ePd;cLV0h5Ee%`3dVtmW1$*Qeu_ zYr{BBp((?VqAjf)Y-}!@j{Bj<^PF@3IscsV$NTwwpZAaVulIf4bVqwQXt&yK002O? zHZZ46&u&(MwD=}z)Too2+I7{&{TcwsC~TD&kdvpf*;I|Nx)|Xc>K7616^;eY`i6RA zHEe^ua9Ag-mv3ws9cu;vl7HC3&Z1&Qrt_h8X!wDy;Ptn4N4)~GQuTsl33(taLS@o= zXAu}l1S9cA&Z?$S{-jJfBXKW_N|`(GQ>ww*Xj}}@LN;rOC~;%@I7162<}FSUqln3? z0bAJCU-_Ow)4E%9;`rDKAqm`wjw}lqS{fD9xCgfJz=A#PpUP)Pa%bvWqRN%YdsNPI z7g_9?a@SEw6F=RFOhw9PCH-x_@jg)}CNENh1|6Mel^#05rv*S9hA3;snq)=YFx|__Sc;+BL6<@q z{Nveyg$KWVKk_$Hgc-Ooh#AQH`we$-JSg9JIk-HUCDD zjDaZVGxlAN8=ue;ufjkIKW4>$rl#8F;~H4ZbcQFg0Z*EFIP=2QZYDhk;%6bk6e4Z=dc`&+BSytii&|vjP$} z29vT&VAc2V{eF{UudkaundWeHwOuymIWV0f1Gm;JZd+!&Nlk zCRV1lnBY;$=5`kK>%VySC~?FJ-`AP}Jydc^N7e;JGiIAq(MdLOi^@1r_2wn96Fp^} z?N3&4L}0u-sO;sj)Xg)KNN7%+=4Wc0wW*7tnXdX&@w)9h35_P`%fotmW~n6CxwzuW zitI3B9hB*kD1+`uJyK&r{_gf-$j|Y;cf#9pFsEl5Vo3gTaoB=UzG<1JlxJf*6Yk1UCzqznssAAo%d%%FY--xjb>)*3i$h_UIXUDCq zcQA!WB12xjvEKJZ28+JLv>66X1!aB_wse4*uj}vjc!Yu&0VSB~?{!NXqh+W}?s=k< zuf*h7n4JCI4xR`Sk>SYK=IXY#jcYr$JmQEBjy2D;bYw$)lFKaoE&PELsjt}9-?NJJ z;BwltluFlMh=^1RiyhO`)B2x*&OSgIl)Qy){eSuEq;33{EPu2kpdO*9p|-Ac1-Mq} VKGTiaz-&GWz}CthR%v4nJa0`PlBg3pY5ZZ9qm$~?`Wbg3+ z`$_HBe`_zEZGSIxi|=WZ=MA&3vD}}2W!K)O$)BChT0XceX#V2ml3yP)txn8IwiEoF zr!V_F(bi_$?03d(uP-O>zW7h=#4^|Fcf#i_!!AVsn9tCC?xwW%5~U2FW7!;=VeV#g zRED@4=7lra`D^oyHeUNKHAiLltvRwq4!ac`KTj@ws~h+K?)=Tq#edCvmouaG+}D5B z=jLqIjnjWr`b_3qtJk)pua~p8UW{9{Y-aHR-^~?&-J1Pu((~6$=z=*IBcM5?fWA>= z$gZ8N{o?e~OWW2uPH@mXs>t5A5E2n!--4J>k2_ufM;N{^K#E54bo+YwmTNARV6m*> bG+@};xqf5sUHOZ^6w2V~>gTe~DWM4f&lND! literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/20.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/20.png new file mode 100644 index 0000000000000000000000000000000000000000..7a39d66d58a978280a5213209d03d3ef7173c188 GIT binary patch literal 2459 zcmb_eSyU3-8l^!i%$!Tf#36?qOU;VR5mGTo4F?=>$Qg%Ha4N0Lp|COwHBEjq1vMp0 zP(suG`b$l7R>+Cc2EmbX%8^U0?&`kWweG`x_|CW2{?_@P&faHVcR<>R13^Fl03dE> z3w089zOWu_-z+>Em@$UJw&R>FIvM~FllfVj0Qm*-LQ(+-bHkm948+CyMg;&Y{UiMX zloP4^5d0x)zYZ4?5jJ# zWBT4hg6|)Pc>2m8-yNl`C83YdK6S7K>n}Q2O=nN#yw1BnCkOaq1s5oJn-L_h^qiny zZW-kkKt;4P4;uRf19pmEF52{;2#_ZFn-ikHyM9f7A%HySpz*&EzTfJe~sDb^!8h5_+-EbPT_AovVDtL>F#JY<)W_F#SVMnaR_RQ#|QrN5D zZ{72)BiB8jdrI#i)i{5chP|B}4%^Mnk4!@6$1{;Bi?r0orfwR^X%=U#t4nKIQ~hDL zkINhza4#OK`oQuHz9zFi-M{DfqXsN-Fmd=c$~gXzcZ)T| zG%7<`*r5di3)u4=hf|}k6f~XJdtkw9XZ4Vs{NCsxM!79 z@K1fz=o%RQpB8^4FV}^`tq3v0Fq_qK6u62Q#~(6Zb@ z!+9miY349l-Mv^69@loRFX;KYUJ^~wr4w%05VL%Xp+NlXRVQ%Qp;|mGkZ5ai4Pv6R z%c?4_CGk$a<*PeRf^ekJh7iLkAQ6+1uo329| zV%uCmUi@L_vWiP>o3YXTR4qaJ=USH}G9@h>9~ii&6}VGe9wgM!FA@GhLc#s!{%2t- z0nJM@fDR_IN&JFB{av6WFvOT-ckHs_|7pEb`eJKyVO7VwaPIn>wKQr-m~Big%4@2u zY4=N&8iSEb4aD{(hU+$!8bKP1*YVtw&78PlEyIRi=*AdQ0yaIn#0xd0e|fEq)AV`?!MUll@OH!>4H9I zP1z9H$mcrk1K;V;Txv16uxBf1T?tWT z46eFZctd?^J9X;JS%N)tK1#5_uV1NSU>s)^NtpgG(4bs(pXmLuK1cacdO+vhXRTc-4vAV}MvZ|n&MU)ScS85-% z5qloYLe^V)<-!fu_D>d+h)g%r9oEiC!LYLSVIB($&AFM4K?~HT=uw-fZN|Bu4G#4T zAh29h36sE+5G#9!Hg8fZ%XFfi@+=k}=hN#3qLvgNzLT>>ybzL5)UO%+RH8Ghdw_B{ zS>DlnO*cKwd;xWU+@`Z)(1s>g>vL|xR|YedpNpAnQup1Rb|Kg|SDv?Cb{^j2VONw%P|ukYNqK0Ss8JMnTQk9ew@lO`K?Gxm?OnC@Wm zuGJ<2GSU0U=x_m1j%Qiw2MSu~x!oW;2ZfA5a;;M$!ffwhs@s(2jLO4A2tbhi_dX=d zh|4J^1xTSwrP%e2$c}XrOh^l9z%P zlZQ2e4+Vy;!e@n_3TII&FY7J!`cN$;&Qw-1fMmXXV{hHEn+h0Ih}Nr%D<8gO7!GVb z%}F1TmDV5j(5@5nnI7Hm5?&V0#8{wX5osK;HTx~ZjV9@5$LzE@$M2Rk_? zVDd%SWA}H?!DOtoSGRtq0#9otd9mxg1FzOlr_kJax(d`3dFk`T58?B8&aqpSjR_=n zM4~}@N%Yve_GQwYSboM#kqC5`O_0)ZYW3#dA>fyJ{fYy>ZA=&p{utUH^k1#*a{8-I g-owpAaRKlkU<8B5IWhKPg~1A72SY+1Tlpma3!q1bF#rGn literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/21.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/21.png new file mode 100644 index 0000000000000000000000000000000000000000..b8165ae99ce91d14edf2c31f6352e401cbd4ee65 GIT binary patch literal 788 zcmeAS@N?(olHy`uVBq!ia0vp^AAooP2NRIoyR*y)NO2Z;L>4nJa0`PlBg3pY5~)xf__b%0Z;z z;jIsMVqezn61?MIzEpa{1Wz?#hiuLVg+KOf;Wdk6Zr^_*SN>T+j=p?A_p;xAe*QD+ z2%UQ_-1%PGx%tZ+d|7%II9^c55HM+Cb8H4PS$LsL4k;*8&;-g<2C4%y-N0Hnq?%Z3 zt>ULw{i~193ZFKs`1{{4g0Ei8nmb=N?YyOavq+Zb619+ym)W!Y{EY2&)FbkyT$cG0 z9X7Yv<@mRv?uB zbT-`698yqEL;at)t-?2m;% znicc?mY-U;_PvF*NoBtIzO*NAtG}0Be7Ah@+^?>n;NCU2Q?%r0{_D0qXXpG)Y+VHp r4pPzp)TcAn#!osVvf|i!24;p{iRCXg2tO(Wrf3FFS3j3^P64nJa0`PlBg3pY5~)xfAI3%0Z$b z(4e-=wDzmux5sJ~Eq`~grm?5#}W+0iw311%0=Qllm`E>5ylk@M%=qEhuJD&WxB|BoxZYj|} z(O)Niy_KVrz;A2o{5Mnk>yx{C<4l)tdRJ$-v{rNdJI&?SS3RuQwOl6lxscsn%UvhS z_KNV8<;%sV=h<29J)v88yWnxv#+l5&K)p?87fg$c5Ur8Ko)+&#WBH(H-% zn+zn}f!=TgM*-MJASTpvju*i3gYYL%0g`Ft>qf*m$#&aBUf$a-ut#9ZL-z(o2Hn_w V^RIJzodu?722WQ%mvv4FO#lavMe6_n literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/00.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/00.png new file mode 100644 index 0000000000000000000000000000000000000000..cc90692cca5b0cdcbddf02d95bc0886663d88ff0 GIT binary patch literal 745 zcmeAS@N?(olHy`uVBq!ia0vp^AAooP2NRIoyR*y)NO2Z;L>4nJa0`PlBg3pY53*g3ZaI(d5|QnLDbsb`-57xd1 zDwxE4{enV7G%paOhHf@TWpEG?Yqy<;>78Hu%sGmF2qrMFept4; UtBgerm`oWwUHx3vIVCg!01R<7lmGw# literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/10.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/10.png new file mode 100644 index 0000000000000000000000000000000000000000..603b9dbcdadc9d09400ad761a042278e79707bd4 GIT binary patch literal 1507 zcma)+do&XY9LIO52y5Lq9(nW<7ng2w)i&=u+I6VLHBwkv+6ZA-V=lXNOUR+Qc};mN z?ILbkG;>h9ZM(CDSsshZ8s=4F@)(!!-#z!-^EtoY@0{QH{{Hy=&iDLop7Hhos_j(+ z002PPDOdPfomq=ARi(Au(iCsKR(3|83Wx;&)HT=R8$e;P?pjkX&dop0C+c!s0x|{# za1M>Sh}sXkiVQ=+QOHo-H5SSa0N5T4b9MGj?4J-Fh}QHpP#OMQ_22|X*ZfdhZrd-e ze%dN~GH?Ik+Us{Pv)n58ZV063tlrLD#-9}?(AZc_-9$QC-u`x;n-8;MRW3*p@Xw3* zq7t42%D*LAHZU?Wf8lPat?pLqBT4a1C8^pd0l$*vMBL;Me?R}ReZ16;E8&rc=(yO` z6-5}YR5Tnp)Phe)PF8#tbBILZ>X$n?`y8#bGaawL3J#rtQ0N@7b%GVbG!I6&Hx}1_ zu8iiYrg+z(!hMsGw7O!S<(9&UIXpnN!yV)wA5$#N>*(lM)6jW$tr(T)*5+o6IUfhZ zA;s-dVI7Cr7x9!vL)emJzE;!I(~e1B9^*fO@gEHq-@nZ4c^IzTa8#$%F@-=Nlm>D{ z>>Au~H|4a4epQ>a*p%(P7}zBPgTV`nbK&v+ge;~?I{JjnDBs*82-p8Q;(J6+b~Ze{ z_$54h>Nj5UE)YmYT7Io5wm%UBD~S9xpw3T1W_yoUG{MzNG*EV*K7Oz95)z0u8!IG=4`EwPVYN zdo0{|%v#HPwIdizq5I*2a6bz0qyYSvQ~cd>>c>Fak+PWqT9kM~{=o}8gjF;Zf9ZNq z0m11nBf48FJ5kqXnWno}djqm-kI|mi_rJMlZ0jqrrsQ8{5R`2~%ccjL@=}(FQZhTW zlypeIat?;z(w;S9J9E#tlW)dwc|Mr=`z*jWIAZ z#8T*y7p?1#5i?e*e<+Z#eb`TqN+c3-s-h%cuN(f%MpOj%*mNsUY0Ix2(}NAY$1Ur76M&52;F`{6gVB>4PG0x%23y0+o&MT&JQ0b5 zqM3B`!yj>V>7C&}@|5T0^0oECQ;i0b9Hx&z;o8Vo1Hri0^`E};G_oCV0ZoNe1|kl4 zVUolCD}xf%Pyh>U^ec3cagTjBI~zAy6*o%t zdV6(D#iG^USK%%vYmc@ORr&@fr^!q^!}>8u4mJI0VzMW8s*{k6B9(tsu_*VaGj4BR z0{tzXux~qOC>CQ@nGilvh>KoRI)rsZ?s#67?YoZDp@bgn5j~pYjZNO)AdXLy?-`;IsN!_uD zdztel-(K0h$%bS-|A*{4nJa0`PlBg3pY5WuU{{6`O4~F`|KUXt`_W$ThF#} zFrNT_8N;vYAEJRb1TdyL0oKd~9y*-Y0zCGVDU+Pjj~2XK!+AFHy<>ySaIRAjHiW z&R_F7=eqgK8(;Ub=TEwudrr@?fEVOR92#EOpWYi{dw)*+?(J(;W8&nCSMIvso6I`5 zer44<%lT>C>B)avBBx(>k6tw|r}FRQ)o*pz*MBMb_Gi)irzhL4KDV*2KR&Z~+taT~ z_tMWL{tr00ZBJcgpoHVTr(X@vD@?mCZ}Q?u@wY=l)8KDgdTX22WQ%mvv4FO#tm8D;59% literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/20.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/20.png new file mode 100644 index 0000000000000000000000000000000000000000..ac11df1caf192627d4429292bc52992ef342038c GIT binary patch literal 2277 zcmb7`dpHw(8^;%UTb>Y$*?6Bu4mszUh{|YN&WAbVOk_ioLz_@kgq)^E^fc$K867N# zXRJb^S)!bTeo1I0KoQ~Iz`pQ{(Cv<}^dJBLKY{+V9RNy!yf6qMqTPwk;W%Qn|9LFH zJTN=}3$r@sAB1(n`Ul2FwquV00KoHBD07#Xk%dAf$1%@+DIxnsP(jaRF$v{>T~s)1 z1fp^z!Ut1T&5}uLJ*DjCa`lX=jN-hR3rus)R!mklHGMUzyDR?ALbcS0irw>74pCj< z0wD*neSEbbpU9v7@+HRlu8u7~oIr3^vZlZNsCE9Z3Bpw@1O)Xos7+0g>+MngQK66- zf5n63b#-;Kv$KPPgQ<#m z91b@yIEcwleyp%AOb^a;y1SdMY&Sw1ww|J=O^+VM=h;xGggAWvl)Ab)gTW}Y5AyeK z2Kr1xen~t97(b20swM|215;iOSXfvjM_W2eYJjUVNF>q%w1D&?P0h&2Xj;j}#s>Nr zAO{9VM@OGwzx@a@H1LBcw+wwo;S&vtD#Me?y7jYap7}0*_(1cKM zc5**`uxw|>2S;R2+LQ6H$}re+Ky3i_uHR~C6}Fte^Ij3_sA9HDmNyHblKX6Qbo43J zXK_uh{6>d%=(%&UzP7cQlzCgwO1UL-UZM0ICkOA}j|xED4PrP-tBNqYixD?+#A0PC5vkf{A9qS9pp` zXt`A7*6dne%6<5zx@Mkt)zBei+Y(qdY|){!volhyTFZE(TpcLiD%HqcvOx7#lLqb# z9B64*TOk$jQZEXKuade09a^|tZgcYvEt*+cfkUUEThN&8n-iyyU}`T8oQ&Cd3>fI+ z7GHq+4`v?hvSOkAUQ?1jt0 zL4Qj4cs84&Vq#KrEq=o}Ke)0X(3z=Z!=a@F$+$QovGu<6<9%}1Rge+SkDMEV_C6V} z?5&MRJwQC+oHcc)uu%2)z2VhbEyFR;-m0k0Ys8wl)eSc{H`HEbVl3)MX%(QX=fGGq1(4Au`c;dG1YOsynC<=`P1&u{438rlLgG1%9ZS z%UeuTvQq`-SnI{c?1v?N(~{(CU!=9tAmk+a;VZuJeJF7R&u%n#xu@jhTvy((XBgs4 zcjvFH`|G9V2W8gqf(0t(DaUSiTQ4;Iq7%}e5js;d5>=c1#H)?gIc_>5`tLsJt*2ubtB18xtQ zUW#MglP8gf>vl@5N8j4FYgVo1xSuGk%dtX}eJ^Ml!ly4- z()#8o^J6K%<3>i{i<7yRW`fEU#l*$zRALJlW0@h7QU3160#;f-Du{J6J*SEfR~;{K z8PMJp^>Qxw=VrZ2N-#HMATu>Pfqu5|fK+@1g|Oylmdh_$sT`aqk(z^of~p+P*2Sur zY|Ew_5vP%0Fql36xm-~cB0j}f;DlLjFaOat=6cnoB&oGuF6m~y4?fiFVh>SaN7|U~ zrL!Ir+AmEX6@P9b)1*!6lz8r5UP$b|H01-SHr4MIi|;FeIwwoygIA=UHQhOR#O1H2Ym#T9=Dfes z!y)-BP2rH{c!^S?^*o4rTnM4{8#g6Uz(pKx|(~oG>Pm14nJa0`PlBg3pY5~)xf|%$>>%P0 zm>m&&{fK-{=B~Y5Gp8tQ>0tR_X{&zGCpq`gW2>V-45v@I#6D%wE4y{qS3AnQD%&mj z$+GyL39FY<1`BT!n`83=K@$!sFjF~00K#;;pa5a^E^vf0f$AVkuolM)0y;0Y<$kaF zmmmLX?HkkQ-xRO-hwuG)HRtapt#>in?#qnqRNi%-t)Jd_x5_;BIM$47TWvCcPs{&42QS$>*#lQU+e zRn8Tk+`c|8>*4C>-NsM$KHKw5>(9wKtLwj%P5a(#TK%DBbK-Z){_pQCiu-^8=61OH z&Y>SJHRt9W{V{!+q=u`W#48ziG3zx@FMTr#wNX~oA>$8 z-dw*XK*SLm`M6^o8c0}zV)j?}pcza@e+VTov`k*eXm|Ez1TZZ#c)I$ztaD0e0sve@ BO2hyF literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/30.png b/designer-base/src/main/resources/com/fr/design/images/reportfit.preview/gray/30.png new file mode 100644 index 0000000000000000000000000000000000000000..c6f452a8a00f8e18900a3da1a0ac32a38dda4a80 GIT binary patch literal 783 zcmeAS@N?(olHy`uVBq!ia0vp^AAooP2NRIoyR*y)NO2Z;L>4nJa0`PlBg3pY5~)xs#an%0Z+d zPRU0!JXT!vDhY$A+)o|NkDn z*Y(PtW= z+x_qJ3wN#CU1u8`Q}gTj_AVjooHu(OD!22`-hcV!mgo9l)Lg zs{(lrsG&`%d0nn_`h#s(eQTq&<||%)yI3^uaY%8Qo%d!}-QRQV`}682J1n$H zjKkxmOxNG~dHtzBp%y7|?tLqi+uts3+gdB4_46nf$dS;{wmG-S?G)Fp%vsxV|0)zb zVE~6cSRUaYpre(+5d+r+RL~2KBc$kp27%)RvUCfWK!b*4-4BnJJ$Cmx$=_sD!)d^v YePAu;$(*Doz{Jep>FVdQ&MBb@09bBFjsO4v literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 1797ce9fbd..a9e655e5b2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.*; import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; +import com.fr.design.mainframe.widget.propertypane.BrowserFitPropertyEditor; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.FormProvider; @@ -22,8 +23,8 @@ import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.stable.fun.FitProvider; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.report.fun.FitProvider; +import com.fr.report.fun.ReportFitAttrProvider; import javax.swing.*; import java.awt.*; @@ -104,19 +105,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme new CRPropertyDescriptor("toolBars", this.data.getClass()).setEditorClass(ElementCaseToolBarEditor.class) .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + + }; CRPropertyDescriptor[] extraTableEditor = getExtraTableEditor(); - return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraTableEditor); + return ArrayUtils.addAll(propertyTableEditor, extraTableEditor); } + public CRPropertyDescriptor[] getExtraTableEditor(){ CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); - FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); - if (processor == null) { - return extraTableEditor; - } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - FitProvider wbTpl = (FitProvider) designer.getTarget(); + FitProvider wbTpl = designer.getTarget(); ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); ElementCaseEditor editor = this.toData(); //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) @@ -128,11 +128,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; } ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; - PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); + BrowserFitPropertyEditor browserFitPropertyEditor = new BrowserFitPropertyEditor(); + CRPropertyDescriptor extraEditor = browserFitPropertyEditor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); if (editor.getReportFitAttr() == null) { - editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); + editor.setReportFitInPc(browserFitPropertyEditor.getFitStateInPC(fitAttr)); } - return (CRPropertyDescriptor[]) ArrayUtils.addAll(extraTableEditor, extraEditor); + return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {extraEditor}); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 2fb5febd3c..b755edec73 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -36,6 +36,7 @@ import com.fr.design.mainframe.actions.FormMobileAttrAction; import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; +import com.fr.design.mainframe.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -503,9 +504,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, new ShortCut[0]); + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java new file mode 100644 index 0000000000..ca6fd2ca14 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java @@ -0,0 +1,21 @@ +package com.fr.design.mainframe.widget.propertypane; + +import com.fr.conf.FitAttrState; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.designer.properties.items.ItemProvider; + +public class BrowserFitAlignmentItems implements ItemProvider { + + private static Item[] VALUE_ITEMS = { + FitAttrState.HORIZONTAL_FIT.propertyItem(), + FitAttrState.DOUBLE_FIT.propertyItem(), + FitAttrState.NOT_FIT.propertyItem(), + }; + + @Override + public Item[] getItems() { + return VALUE_ITEMS; + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java new file mode 100644 index 0000000000..4b3a7488ac --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java @@ -0,0 +1,47 @@ +package com.fr.design.mainframe.widget.propertypane; + +import com.fr.design.designer.properties.items.Item; +import com.fr.design.designer.properties.items.ItemProvider; +import com.fr.design.mainframe.widget.editors.ComboEditor; + +import java.util.Vector; + +public class BrowserFitEditor extends ComboEditor { + public BrowserFitEditor() { + this(new BrowserFitAlignmentItems()); + } + + public BrowserFitEditor(ItemProvider provider) { + this(provider.getItems()); + } + + public BrowserFitEditor(Item[] items) { + super(items); + } + + public BrowserFitEditor(Vector items) { + super(items); + } + + @Override + public Object getValue() { + Item item = (Item) comboBox.getSelectedItem(); + return item.getValue(); + } + + @Override + public void setValue(Object value) { + Item item = new Item("", value); + comboBox.setSelectedItem(item); + } + + /** + * 是否立即刷新 + * + * @return 是或者否 + */ + @Override + public boolean refreshInTime() { + return false; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java new file mode 100644 index 0000000000..1ffa7a0e1b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java @@ -0,0 +1,45 @@ +package com.fr.design.mainframe.widget.propertypane; + +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.form.util.XCreatorConstants; +import com.fr.main.ReportFitConfig; +import com.fr.report.fun.ReportFitAttrProvider; + +import java.beans.IntrospectionException; + +/** + * Created by zhouping on 2015/9/10. + */ +public class BrowserFitPropertyEditor { + + /** + * 生成属性表 + * + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + public CRPropertyDescriptor createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { + if (getFitStateInPC(reportFitAttr) == 0) { + return null; + } + try { + CRPropertyDescriptor propertyDescriptors = new CRPropertyDescriptor("fitStateInPC", temp).setEditorClass(BrowserFitEditor.class) + .setRendererClass(BrowserFitRender.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-In-Web")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + return propertyDescriptors; + } catch (IntrospectionException e) { + return null; + } + } + + public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { + if (fitAttrProvider != null) { + return fitAttrProvider.fitStateInPC(); + } + return ReportFitConfig.getInstance().getFrmFitAttr().fitStateInPC(); + + } + + +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java new file mode 100644 index 0000000000..f8dce2acc1 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java @@ -0,0 +1,10 @@ +package com.fr.design.mainframe.widget.propertypane; + +import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; + +public class BrowserFitRender extends EncoderCellRenderer { + + public BrowserFitRender() { + super(new BrowserFitWrapper()); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java new file mode 100644 index 0000000000..7e1f63b8ac --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java @@ -0,0 +1,9 @@ +package com.fr.design.mainframe.widget.propertypane; + +import com.fr.design.designer.properties.ItemWrapper; + +public class BrowserFitWrapper extends ItemWrapper { + public BrowserFitWrapper() { + super(new BrowserFitAlignmentItems()); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index bfc01d0bf9..0e33e1891d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -41,6 +41,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.cell.QuickEditorRegion; +import com.fr.design.mainframe.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; @@ -698,6 +699,7 @@ public class JWorkBook extends JTemplate { new ReportWebAttrAction(this), new ReportExportAttrAction(this), new ReportParameterAction(this), + new ReportFitAttrAction(this), new ReportMobileAttrAction(this), new ReportPrintSettingAction(this), new ReportWatermarkAction(this), From c9fcaab0d0e49224e9c96bb2a9719640c9fa3efb Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 19:33:09 +0800 Subject: [PATCH 013/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=20=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/conf/FitAttrState.java | 8 +++---- .../menupane/BrowserFitAttrPane.java | 22 +++++++++--------- .../mainframe/menupane/FitPreviewPane.java | 2 +- .../menupane/ReportFitAttrAction.java | 6 ++--- .../mainframe/menupane/ReportFitAttrPane.java | 2 +- .../menupane/TemplateBrowserFitAttrPane.java | 8 +++---- .../menupane/TemplateFitAttrPane.java | 2 +- .../com/fr/design/images/reportfit/fit.png | Bin 0 -> 976 bytes .../preview}/00.png | Bin .../preview}/10.png | Bin .../preview}/11.png | Bin .../preview}/20.png | Bin .../preview}/21.png | Bin .../preview}/30.png | Bin .../preview}/gray/00.png | Bin .../preview}/gray/10.png | Bin .../preview}/gray/11.png | Bin .../preview}/gray/20.png | Bin .../preview}/gray/21.png | Bin .../preview}/gray/30.png | Bin .../java/com/fr/design/mainframe/JForm.java | 2 +- .../BrowserFitPropertyEditor.java | 2 +- 22 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit/fit.png rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/00.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/10.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/11.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/20.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/21.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/30.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/00.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/10.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/11.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/20.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/21.png (100%) rename designer-base/src/main/resources/com/fr/design/images/{reportfit.preview => reportfit/preview}/gray/30.png (100%) diff --git a/designer-base/src/main/java/com/fr/conf/FitAttrState.java b/designer-base/src/main/java/com/fr/conf/FitAttrState.java index 9ad42fd6e7..d02270db61 100644 --- a/designer-base/src/main/java/com/fr/conf/FitAttrState.java +++ b/designer-base/src/main/java/com/fr/conf/FitAttrState.java @@ -11,7 +11,7 @@ public enum FitAttrState { DEFAULT(0) { @Override public String description() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Default"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Default"); } }, @@ -19,21 +19,21 @@ public enum FitAttrState { HORIZONTAL_FIT(1) { @Override public String description() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Horizontal"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Horizontal"); } }, // 双向自适应, 横纵向都是根据页面宽高来计算 DOUBLE_FIT(2) { @Override public String description() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_Horizontal_Vertical"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Horizontal_Vertical"); } }, NOT_FIT(3) { @Override public String description() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_No"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"); } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java index eeaa3047ca..6b9db985d7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java @@ -74,9 +74,9 @@ public class BrowserFitAttrPane extends BasicBeanPane { ActionListener actionListener = getPreviewActionListener(); fontRadioGroup = new FontRadioGroup(); - fontFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit")); + fontFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit")); fontFitRadio.setSelected(true); - fontNotFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit_No")); + fontNotFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No")); addRadioToGroup(fontRadioGroup, fontFitRadio, fontNotFitRadio); fontRadioGroup.addActionListener(actionListener); @@ -96,8 +96,8 @@ public class BrowserFitAttrPane extends BasicBeanPane { protected Component[][] initFitComponents() { Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Element")), defaultRadio, horizonRadio, doubleRadio, notFitRadio} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Element")), defaultRadio, horizonRadio, doubleRadio, notFitRadio} }; return components; } @@ -110,7 +110,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { private JPanel initGlobalOpsPane(final ReportFitAttr globalFitAttr) { final JPanel globalOpsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - globalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Use-Global")); + globalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-UseGlobal")); globalOpsPane.add(globalCheck); globalCheck.addActionListener(new ActionListener() { @Override @@ -123,14 +123,14 @@ public class BrowserFitAttrPane extends BasicBeanPane { fitRadionGroup.selectIndexButton(attr.fitStateInPC()); fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); remove(BrowserFitAttrPane.this.borderPane); - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Global")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Global")); } else { ReportFitAttrProvider attr = localFitAttr; fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); fitRadionGroup.selectIndexButton(attr.fitStateInPC()); fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); remove(BrowserFitAttrPane.this.borderPane); - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local")); } fontRadioGroup.setEnabled(isLocalConfig); fitRadionGroup.setEnabled(isLocalConfig); @@ -140,7 +140,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { } }); - editGlobalOps = new UIButton(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Edit-Global")); + editGlobalOps = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-EditGlobal")); editGlobalOps.setVisible(false); editGlobalOps.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { @@ -165,7 +165,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Attr-Set"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-AttrSet"); } @Override @@ -175,7 +175,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { attr = ReportFitConfig.getInstance().getFrmFitAttr(); populateGlobalComponents(); } else { - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local")); } this.localFitAttr = attr; fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); @@ -188,7 +188,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { fontRadioGroup.setEnabled(false); fitRadionGroup.setEnabled(false); editGlobalOps.setVisible(true); - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Global")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Global")); } //有八种组合, 不过有意义的就是6种, 以此为key去缓存里找对应的预览图片 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java index fbc12c3b3d..68d268136b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java @@ -67,7 +67,7 @@ public class FitPreviewPane extends BasicPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Preview"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Preview"); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java index 3c4d977fab..fd4a4e3cfb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java @@ -28,7 +28,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Template"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Template"); } @Override @@ -44,7 +44,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Elementcase"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); } @Override @@ -67,7 +67,7 @@ public class ReportFitAttrAction extends JTemplateAction { } this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/fit.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/reportfit/fit.png")); } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java index 27faf6fa87..32de70550d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java @@ -50,7 +50,7 @@ public class ReportFitAttrPane extends BasicBeanPane { * @return 标题 */ protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Attr"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr"); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java index e37ce09a37..420306f5fd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java @@ -21,8 +21,8 @@ public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { @Override protected Component[][] initFitComponents() { Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Fit-Element")), horizonRadio, doubleRadio, notFitRadio} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Font")), fontFitRadio, null, fontNotFitRadio}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Element")), horizonRadio, doubleRadio, notFitRadio} }; return components; } @@ -41,9 +41,9 @@ public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { } else if (fitAttr.fitStateInPC() == 0) { attr = new ReportFitAttr(); attr.setFitStateInPC(3); - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local")); } else { - initBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin_Local")); + initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local")); } this.localFitAttr = attr; fontRadioGroup.selectFontFit((attr).isFitFont()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java index 675af9c541..a24140f02c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java @@ -50,6 +50,6 @@ public class TemplateFitAttrPane extends BasicBeanPane { * @return 标题 */ protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-Attr"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr"); } } diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit/fit.png b/designer-base/src/main/resources/com/fr/design/images/reportfit/fit.png new file mode 100644 index 0000000000000000000000000000000000000000..9f6dd87b94574dbce8bd0c458eeb05094d3a2f2b GIT binary patch literal 976 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&V!2%?m`@?4fDVB6cUq=Rpjs4tz5?O(Kg=CK) zUj~LMH3o);76yi2K%s^g3=E|P3=FRl7#OT(FffQ0%-I!a1C(G&@^*J&U|7|wYy{+S z7I;J!GcYg%bpde+Q)f8?1EaF1i(`n!`Pz&7y=NB+9RGM-c>gP0G~$|Szw)E16-w&Q zuUvmHS*&uZK*d*tlPUAj8$Y?w9s9>2BidNr3jx`O|%H#^k*c9Wd&yH%n08j^gw9~I6O zDmis+ZiBR|%e&@Dm3wa({(bg{yR0x*^YN+p_ea;-AM6U;KXu`ROG!rO?n-PEeUrIq z)sxLH&USaF#YBDnEcwXKYvm)ksFlDlR4s9hC`m~yNwrEYN(E93Mh1qax&~&tMn)lq zmR5$wRwjnp1{PKZ1{zXZfI*L>AvZrIGp!Q0hDdjwA3zPhARCJF(@M${i&7apa}(23 zeG}6&ld~1f^epr&bj=k44b2oPEX?A~Oca2&o9G%C=^9xmWR#Q?Sn2DRmzV2hf;0g! zP?KJMQF`Q(_ zXI25@LC@02+sWzC1cPfp=_DlS&>&BSw9K4TVBqLy implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java index 1ffa7a0e1b..3eee63f9e7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java @@ -25,7 +25,7 @@ public class BrowserFitPropertyEditor { } try { CRPropertyDescriptor propertyDescriptors = new CRPropertyDescriptor("fitStateInPC", temp).setEditorClass(BrowserFitEditor.class) - .setRendererClass(BrowserFitRender.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Fit-In-Web")) + .setRendererClass(BrowserFitRender.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-In-Web")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); return propertyDescriptors; } catch (IntrospectionException e) { From e62c6b857e78f78acc4ae36a5c13ee9167cf1c6c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 19:54:43 +0800 Subject: [PATCH 014/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reportfit/FitType.java} | 10 +++++----- .../menupane/BrowserFitAttrPane.java | 12 ++++++------ .../menupane/FitPreviewPane.java | 2 +- .../menupane/FitRadioGroup.java | 2 +- .../menupane/FontRadioGroup.java | 2 +- .../menupane/ReportFitAttrAction.java | 2 +- .../menupane/ReportFitAttrPane.java | 2 +- .../menupane/TemplateBrowserFitAttrPane.java | 2 +- .../menupane/TemplateFitAttrPane.java | 2 +- .../main/java/com/fr/design/utils/DesignUtils.java | 12 ++++++------ .../src/main/java/com/fr/design/mainframe/JForm.java | 3 +-- .../propertypane/BrowserFitAlignmentItems.java | 8 ++++---- .../main/java/com/fr/design/mainframe/JWorkBook.java | 2 +- 13 files changed, 30 insertions(+), 31 deletions(-) rename designer-base/src/main/java/com/fr/{conf/FitAttrState.java => design/reportfit/FitType.java} (88%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/BrowserFitAttrPane.java (96%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/FitPreviewPane.java (99%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/FitRadioGroup.java (97%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/FontRadioGroup.java (89%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/ReportFitAttrAction.java (98%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/ReportFitAttrPane.java (96%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/TemplateBrowserFitAttrPane.java (98%) rename designer-base/src/main/java/com/fr/design/{mainframe => reportfit}/menupane/TemplateFitAttrPane.java (96%) diff --git a/designer-base/src/main/java/com/fr/conf/FitAttrState.java b/designer-base/src/main/java/com/fr/design/reportfit/FitType.java similarity index 88% rename from designer-base/src/main/java/com/fr/conf/FitAttrState.java rename to designer-base/src/main/java/com/fr/design/reportfit/FitType.java index d02270db61..08538956c4 100644 --- a/designer-base/src/main/java/com/fr/conf/FitAttrState.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/FitType.java @@ -1,4 +1,4 @@ -package com.fr.conf; +package com.fr.design.reportfit; import com.fr.design.designer.properties.items.Item; import com.fr.report.fun.ReportFitAttrProvider; @@ -7,7 +7,7 @@ import com.fr.stable.StringUtils; /** * Created by Administrator on 2016/4/13/0013. */ -public enum FitAttrState { +public enum FitType { DEFAULT(0) { @Override public String description() { @@ -41,17 +41,17 @@ public enum FitAttrState { private int state; - FitAttrState(int state) { + FitType(int state) { this.state = state; } - public static FitAttrState parse(ReportFitAttrProvider attr) { + public static FitType parse(ReportFitAttrProvider attr) { if (attr == null) { return DEFAULT; } - for (FitAttrState attrState : values()) { + for (FitType attrState : values()) { if (attrState.state == attr.fitStateInPC()) { return attrState; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java similarity index 96% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java index 6b9db985d7..68669f316e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java @@ -1,6 +1,6 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; -import com.fr.conf.FitAttrState; +import com.fr.design.reportfit.FitType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; @@ -81,10 +81,10 @@ public class BrowserFitAttrPane extends BasicBeanPane { fontRadioGroup.addActionListener(actionListener); fitRadionGroup = new FitRadioGroup(); - defaultRadio = new UIRadioButton(FitAttrState.DEFAULT.description()); - horizonRadio = new UIRadioButton(FitAttrState.HORIZONTAL_FIT.description()); - doubleRadio = new UIRadioButton(FitAttrState.DOUBLE_FIT.description()); - notFitRadio = new UIRadioButton(FitAttrState.NOT_FIT.description()); + defaultRadio = new UIRadioButton(FitType.DEFAULT.description()); + horizonRadio = new UIRadioButton(FitType.HORIZONTAL_FIT.description()); + doubleRadio = new UIRadioButton(FitType.DOUBLE_FIT.description()); + notFitRadio = new UIRadioButton(FitType.NOT_FIT.description()); addRadioToGroup(fitRadionGroup, defaultRadio, horizonRadio, doubleRadio, notFitRadio); fitRadionGroup.addActionListener(actionListener); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java similarity index 99% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java index 68d268136b..fe6232c889 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java similarity index 97% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java index e2612f794c..363ee64f70 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FitRadioGroup.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.design.gui.ibutton.UIRadioButton; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java similarity index 89% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java index 5bb7d55052..f0c313b5cd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/FontRadioGroup.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; /** * 字体的两个选项组成的group diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java similarity index 98% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java index fd4a4e3cfb..cb64e4b098 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.base.BaseUtils; import com.fr.design.actions.JTemplateAction; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java similarity index 96% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java index 32de70550d..e0b40215e4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/ReportFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.design.beans.BasicBeanPane; import com.fr.report.fun.ReportFitAttrProvider; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java similarity index 98% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java index 420306f5fd..3b3903fa62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.design.gui.ilable.UILabel; import com.fr.log.FineLoggerFactory; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java similarity index 96% rename from designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java index a24140f02c..48238e85cf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/menupane/TemplateFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.menupane; +package com.fr.design.reportfit.menupane; import com.fr.design.beans.BasicBeanPane; import com.fr.report.fun.ReportFitAttrProvider; diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 240176eef7..77173cebb5 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -65,12 +65,12 @@ public class DesignUtils { * @return 启动了返回true */ public static boolean isStarted() { - try { - new Socket("localhost", port); - return true; - } catch (Exception exp) { - - } +// try { +// new Socket("localhost", port); +// return true; +// } catch (Exception exp) { +// +// } return false; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index a6d7e14803..5f043c6983 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -32,11 +32,10 @@ import com.fr.design.gui.xpane.FormHyperlinkGroupPane; import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; -import com.fr.design.mainframe.actions.FormMobileAttrAction; import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; -import com.fr.design.mainframe.menupane.ReportFitAttrAction; +import com.fr.design.reportfit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java index ca6fd2ca14..27669e8aba 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java @@ -1,15 +1,15 @@ package com.fr.design.mainframe.widget.propertypane; -import com.fr.conf.FitAttrState; +import com.fr.design.reportfit.FitType; import com.fr.design.designer.properties.items.Item; import com.fr.design.designer.properties.items.ItemProvider; public class BrowserFitAlignmentItems implements ItemProvider { private static Item[] VALUE_ITEMS = { - FitAttrState.HORIZONTAL_FIT.propertyItem(), - FitAttrState.DOUBLE_FIT.propertyItem(), - FitAttrState.NOT_FIT.propertyItem(), + FitType.HORIZONTAL_FIT.propertyItem(), + FitType.DOUBLE_FIT.propertyItem(), + FitType.NOT_FIT.propertyItem(), }; @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 0e33e1891d..7072c55dd2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -41,7 +41,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.cell.QuickEditorRegion; -import com.fr.design.mainframe.menupane.ReportFitAttrAction; +import com.fr.design.reportfit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; From d29f62101d61f9317f310068e90a84fd0d1bd633 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 20:01:04 +0800 Subject: [PATCH 015/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XElementCase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index a9e655e5b2..acbc78d185 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -115,6 +115,10 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public CRPropertyDescriptor[] getExtraTableEditor(){ CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); + return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {getReportFitEditor()}); + } + + private CRPropertyDescriptor getReportFitEditor() { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FitProvider wbTpl = designer.getTarget(); ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); @@ -133,7 +137,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme if (editor.getReportFitAttr() == null) { editor.setReportFitInPc(browserFitPropertyEditor.getFitStateInPC(fitAttr)); } - return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {extraEditor}); + return extraEditor; } From 4765eb247f42422b8f7a005522e778819042b858 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 31 Oct 2018 20:12:57 +0800 Subject: [PATCH 016/187] REPORT-11831 --- .../onlineupdate/ui/dialog/UpdateMainDialog.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index 3f99543a37..b8fd0db1c3 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -23,11 +23,7 @@ import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableCellRender; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableModel; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTextAreaCellRender; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.ComparatorUtils; -import com.fr.general.DateUtils; -import com.fr.general.GeneralUtils; -import com.fr.general.IOUtils; -import com.fr.general.SiteCenter; +import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; @@ -346,8 +342,14 @@ public class UpdateMainDialog extends UIDialog { initUpdateActionPane(); add(jarVersionInfoPane, BorderLayout.NORTH); - add(jarUpdateInfoPane, BorderLayout.CENTER); - add(updateActionPane, BorderLayout.SOUTH); + + //海外版本不显示更新信息 + if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)){ + add(jarUpdateInfoPane, BorderLayout.CENTER); + add(updateActionPane, BorderLayout.SOUTH); + }else { + add(updateActionPane, BorderLayout.CENTER); + } addActionListenerForUpdateBtn(); From 6dede79ce43cc3e47c3d4e2a31397093734217fb Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 20:31:25 +0800 Subject: [PATCH 017/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProvider.java | 15 ------------- ...AbstractFormElementCaseEditorProvider.java | 21 ------------------- 2 files changed, 36 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java index 6a0cf7bba1..70aeadd13a 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -2,7 +2,6 @@ package com.fr.design.fun; import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditorProvider; -import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.Mutable; import java.beans.PropertyDescriptor; @@ -18,18 +17,4 @@ public interface FormElementCaseEditorProvider extends Mutable { PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider formProvider, ElementCaseEditorProvider editor); - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr); - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index f9d3e1b173..5098894e04 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -3,7 +3,6 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditorProvider; -import com.fr.report.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; import java.beans.PropertyDescriptor; @@ -28,24 +27,4 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme return new PropertyDescriptor[0]; } - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { - return new PropertyDescriptor[0]; - } - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - @Override - public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { - return 0; - } } \ No newline at end of file From 90c9c827d76e9a116ccd5ebbadb70e90b13cec2a Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 20:34:39 +0800 Subject: [PATCH 018/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProcessor.java | 31 ------------- ...bstractFormElementCaseEditorProcessor.java | 44 ------------------- 2 files changed, 75 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java delete mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java diff --git a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java b/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java deleted file mode 100644 index 28d763bf71..0000000000 --- a/designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fr.design.fun; - -import com.fr.report.fun.ReportFitAttrProvider; -import com.fr.stable.fun.mark.Immutable; - -import java.beans.PropertyDescriptor; - -/** - * Created by Slpire on 2016/10/28. - */ -public interface FormElementCaseEditorProcessor extends Immutable { - String MARK_STRING = "PropertyEditor"; - - int CURRENT_LEVEL = 1; - - - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr); - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); -} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java deleted file mode 100644 index 191f513908..0000000000 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.FormElementCaseEditorProcessor; -import com.fr.report.fun.ReportFitAttrProvider; -import com.fr.stable.fun.mark.API; - -import java.beans.PropertyDescriptor; - -/** - * Created by zhouping on 2015/9/10. - */ -@API(level = FormElementCaseEditorProcessor.CURRENT_LEVEL) -public abstract class AbstractFormElementCaseEditorProcessor implements FormElementCaseEditorProcessor { - - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } - - - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { - return new PropertyDescriptor[0]; - } - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - @Override - public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { - return 0; - } -} \ No newline at end of file From 2a692fb92fc98446e565fda230f44bfcf231ad87 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 31 Oct 2018 20:35:03 +0800 Subject: [PATCH 019/187] =?UTF-8?q?REPORT-10591=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XElementCase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index acbc78d185..c6f3bfb02f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.FormElementCaseEditorProcessor; import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; From 8e8df98c939c90b964361495a6fc070c0ecdaffd Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 31 Oct 2018 23:13:28 +0800 Subject: [PATCH 020/187] REPORT-11831 --- .../fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index fb5db0cd4e..570042d4e4 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -23,7 +23,12 @@ import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableCellRender; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableModel; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTextAreaCellRender; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.*; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.GeneralContext; +import com.fr.general.GeneralUtils; +import com.fr.general.IOUtils; +import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; From ca58fc5a81c2529790c68405daf7740b2761d70b Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Thu, 1 Nov 2018 16:33:04 +0800 Subject: [PATCH 021/187] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8F=E5=A4=A7?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=A1=88=EF=BC=8C=E5=8F=91=E9=80=81zip?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=B0=E4=BA=91=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/InformationCollector.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 6507620694..003a482b7c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -240,6 +240,22 @@ public class InformationCollector implements XMLReadable, XMLWriter { deleteFunctionRecords(currentTime); } } +// //先将发送压缩文件这段代码注释,之后提任务 + //大数据量下发送压缩zip数据不容易丢失 +// try { +// ObjectMapper objectMapper = new ObjectMapper(); +// String contentStr = objectMapper.writeValueAsString(content); +// InputStream inputStream = new ByteArrayInputStream(contentStr.getBytes("UTF-8")); +// String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+ IOUtils.inputStream2Bytes(IOUtils.toZipIn(inputStream)); +// +// String res = HttpToolbox.get(recordUrl); +// success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); +// } catch (Exception e) { +// FineLoggerFactory.getLogger().error(e.getMessage(), e); +// } +// if (success) { +// deleteFunctionRecords(currentTime); +// } } private boolean sendFunctionRecord(String url, Map record) { From 0c07b5851256f174dc464c2e593ebc2831d5fb69 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 1 Nov 2018 16:44:09 +0800 Subject: [PATCH 022/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=85=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=20=E7=A7=BB=E9=99=A4ReportFitAttrProvider=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/reportfit/FitType.java | 4 ++-- .../menupane/BrowserFitAttrPane.java | 19 +++++++++---------- .../menupane/ReportFitAttrAction.java | 10 +++++----- .../reportfit/menupane/ReportFitAttrPane.java | 8 ++++---- .../menupane/TemplateBrowserFitAttrPane.java | 11 +++++------ .../menupane/TemplateFitAttrPane.java | 8 ++++---- .../design/designer/creator/XElementCase.java | 10 +++++----- .../BrowserFitPropertyEditor.java | 8 ++++---- 8 files changed, 38 insertions(+), 40 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/reportfit/FitType.java b/designer-base/src/main/java/com/fr/design/reportfit/FitType.java index 08538956c4..6b342240dd 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/FitType.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/FitType.java @@ -1,7 +1,7 @@ package com.fr.design.reportfit; import com.fr.design.designer.properties.items.Item; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; import com.fr.stable.StringUtils; /** @@ -45,7 +45,7 @@ public enum FitType { this.state = state; } - public static FitType parse(ReportFitAttrProvider attr) { + public static FitType parse(ReportFitAttr attr) { if (attr == null) { return DEFAULT; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java index 68669f316e..470a2101bb 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java @@ -10,9 +10,8 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.log.FineLoggerFactory; -import com.fr.main.ReportFitAttr; -import com.fr.main.ReportFitConfig; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; +import com.fr.reportfit.ReportFitConfig; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; @@ -28,13 +27,13 @@ import java.awt.event.MouseEvent; /** * Created by Administrator on 2016/5/5/0005. */ -public class BrowserFitAttrPane extends BasicBeanPane { +public class BrowserFitAttrPane extends BasicBeanPane { protected FontRadioGroup fontRadioGroup; protected FitRadioGroup fitRadionGroup; protected UICheckBox globalCheck; protected FitPreviewPane fitPreviewPane; - protected ReportFitAttrProvider localFitAttr; + protected ReportFitAttr localFitAttr; protected UIRadioButton defaultRadio; protected UIRadioButton horizonRadio; protected UIRadioButton doubleRadio; @@ -118,14 +117,14 @@ public class BrowserFitAttrPane extends BasicBeanPane { boolean isLocalConfig = !globalCheck.isSelected(); //勾选全局时,采用全局保存的自适应属性更新界面 if (!isLocalConfig) { - ReportFitAttrProvider attr = globalFitAttr; + ReportFitAttr attr = globalFitAttr; fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); fitRadionGroup.selectIndexButton(attr.fitStateInPC()); fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); remove(BrowserFitAttrPane.this.borderPane); initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Global")); } else { - ReportFitAttrProvider attr = localFitAttr; + ReportFitAttr attr = localFitAttr; fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); fitRadionGroup.selectIndexButton(attr.fitStateInPC()); fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); @@ -169,7 +168,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { } @Override - public void populateBean(ReportFitAttrProvider attr) { + public void populateBean(ReportFitAttr attr) { if (attr == null) { //如果为空, 就用全局的 attr = ReportFitConfig.getInstance().getFrmFitAttr(); @@ -178,7 +177,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local")); } this.localFitAttr = attr; - fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont()); + fontRadioGroup.selectFontFit((attr).isFitFont()); fitRadionGroup.selectIndexButton(attr.fitStateInPC()); fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); } @@ -207,7 +206,7 @@ public class BrowserFitAttrPane extends BasicBeanPane { } @Override - public ReportFitAttrProvider updateBean() { + public ReportFitAttr updateBean() { ReportFitAttr attr = new ReportFitAttr(); attr.setFitFont(fontRadioGroup.isFontFit()); attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex()); diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java index cb64e4b098..dc41879565 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java @@ -8,8 +8,8 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; -import com.fr.report.fun.FitProvider; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.FitProvider; +import com.fr.report.reportfit.ReportFitAttr; import javax.swing.KeyStroke; import java.awt.Dimension; @@ -81,7 +81,7 @@ public class ReportFitAttrAction extends JTemplateAction { return; } final FitProvider wbTpl = (FitProvider) jwb.getTarget(); - ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); + ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); if (jwb.isJWorkBook()) { final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); @@ -91,12 +91,12 @@ public class ReportFitAttrAction extends JTemplateAction { } } - private void showReportFitDialog(ReportFitAttrProvider fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { + private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { attrPane.populateBean(fitAttr); UIDialog dialog = attrPane.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { - wbTpl.setFitAttr(attrPane.updateBean()); + wbTpl.setReportFitAttr(attrPane.updateBean()); jwb.fireTargetModified(); } }); diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java index e0b40215e4..983ff21ab2 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java @@ -1,7 +1,7 @@ package com.fr.design.reportfit.menupane; import com.fr.design.beans.BasicBeanPane; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -9,7 +9,7 @@ import javax.swing.BoxLayout; /** * Created by Administrator on 2015/7/6 0006. */ -public class ReportFitAttrPane extends BasicBeanPane { +public class ReportFitAttrPane extends BasicBeanPane { private BrowserFitAttrPane attrPane; @@ -31,7 +31,7 @@ public class ReportFitAttrPane extends BasicBeanPane { * * @param fitAttr 自适应属性 */ - public void populateBean(ReportFitAttrProvider fitAttr) { + public void populateBean(ReportFitAttr fitAttr) { attrPane.populateBean(fitAttr); } @@ -40,7 +40,7 @@ public class ReportFitAttrPane extends BasicBeanPane { * * @return 界面上的更新数据 */ - public ReportFitAttrProvider updateBean() { + public ReportFitAttr updateBean() { return attrPane.updateBean(); } diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java index 3b3903fa62..de8108ace3 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java @@ -2,9 +2,8 @@ package com.fr.design.reportfit.menupane; import com.fr.design.gui.ilable.UILabel; import com.fr.log.FineLoggerFactory; -import com.fr.main.ReportFitAttr; -import com.fr.main.ReportFitConfig; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; +import com.fr.reportfit.ReportFitConfig; import java.awt.Component; @@ -28,12 +27,12 @@ public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { } @Override - public void populateBean(ReportFitAttrProvider attr) { + public void populateBean(ReportFitAttr attr) { //模板界面,自适应选项去掉了默认,这边的判断为了兼容之前的设置 if (attr != null && attr.fitStateInPC() == 0) { attr.setFitStateInPC(3); } - ReportFitAttrProvider fitAttr = ReportFitConfig.getInstance().getCptFitAttr(); + ReportFitAttr fitAttr = ReportFitConfig.getInstance().getCptFitAttr(); if (attr == null) { //如果为空, 就用全局的 attr = fitAttr; @@ -52,7 +51,7 @@ public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { } @Override - public ReportFitAttrProvider updateBean() { + public ReportFitAttr updateBean() { ReportFitAttr attr = new ReportFitAttr(); attr.setFitFont(fontRadioGroup.isFontFit()); attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex()); diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java index 48238e85cf..e78259af6f 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java @@ -1,7 +1,7 @@ package com.fr.design.reportfit.menupane; import com.fr.design.beans.BasicBeanPane; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -9,7 +9,7 @@ import javax.swing.BoxLayout; /** * Created by 夏翔 on 2016/6/24. */ -public class TemplateFitAttrPane extends BasicBeanPane { +public class TemplateFitAttrPane extends BasicBeanPane { private TemplateBrowserFitAttrPane attrPane; @@ -30,7 +30,7 @@ public class TemplateFitAttrPane extends BasicBeanPane { * * @param fitAttr 自适应属性 */ - public void populateBean(ReportFitAttrProvider fitAttr) { + public void populateBean(ReportFitAttr fitAttr) { attrPane.populateBean(fitAttr); } @@ -40,7 +40,7 @@ public class TemplateFitAttrPane extends BasicBeanPane { * * @return 界面上的更新数据 */ - public ReportFitAttrProvider updateBean() { + public ReportFitAttr updateBean() { return attrPane.updateBean(); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index c6f3bfb02f..1b30af7719 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -19,11 +19,11 @@ import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditorProvider; +import com.fr.report.reportfit.ReportFitAttr; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.report.fun.FitProvider; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.FitProvider; import javax.swing.*; import java.awt.*; @@ -120,17 +120,17 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme private CRPropertyDescriptor getReportFitEditor() { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FitProvider wbTpl = designer.getTarget(); - ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); + ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); ElementCaseEditor editor = this.toData(); //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) if (editor.getFitStateInPC() == 0) { editor.setReportFitAttr(null); } - ReportFitAttrProvider reportFit = editor.getReportFitAttr(); + ReportFitAttr reportFit = editor.getReportFitAttr(); if(fitAttr != null){ reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; } - ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; + ReportFitAttr reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; BrowserFitPropertyEditor browserFitPropertyEditor = new BrowserFitPropertyEditor(); CRPropertyDescriptor extraEditor = browserFitPropertyEditor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); if (editor.getReportFitAttr() == null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java index 3eee63f9e7..cdbc0c1a18 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java @@ -2,8 +2,8 @@ package com.fr.design.mainframe.widget.propertypane; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.form.util.XCreatorConstants; -import com.fr.main.ReportFitConfig; -import com.fr.report.fun.ReportFitAttrProvider; +import com.fr.report.reportfit.ReportFitAttr; +import com.fr.reportfit.ReportFitConfig; import java.beans.IntrospectionException; @@ -19,7 +19,7 @@ public class BrowserFitPropertyEditor { * @param reportFitAttr 传入的自适应属性 * @return 返回属性表 */ - public CRPropertyDescriptor createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { + public CRPropertyDescriptor createPropertyDescriptor(Class temp, ReportFitAttr reportFitAttr) { if (getFitStateInPC(reportFitAttr) == 0) { return null; } @@ -33,7 +33,7 @@ public class BrowserFitPropertyEditor { } } - public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { + public int getFitStateInPC(ReportFitAttr fitAttrProvider) { if (fitAttrProvider != null) { return fitAttrProvider.fitStateInPC(); } From d5de76a1944dfda3185e416201d24aacccbb3ebd Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 1 Nov 2018 11:16:09 +0800 Subject: [PATCH 023/187] =?UTF-8?q?REPORT-11520=20=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=89=93=E5=BC=80?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/AbstractHyperNorthPane.java | 22 +- .../hyperlink/ReporletHyperNorthPane.java | 184 ------- .../hyperlink/ReportletHyperNorthPane.java | 509 ++++++++++++++++++ .../hyperlink/ReportletHyperlinkPane.java | 47 +- 4 files changed, 559 insertions(+), 203 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java create mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java index cd78c17559..42f13ceed5 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java @@ -6,11 +6,14 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; - import com.fr.js.Hyperlink; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -21,10 +24,17 @@ public abstract class AbstractHyperNorthPane extends BasicB public static final int DEFAULT_H_VALUE = 400; public static final int DEFAULT_V_VALUE = 600; - private JPanel headerPane; + /** + * 链接打开方式对话框 + */ private UIComboBox targetFrameComboBox; - + /** + * 对话框高度输入框 + */ private UINumberField heightTextFiled; + /** + * 对话框宽度输入框 + */ private UINumberField widthTextFiled; @@ -35,7 +45,7 @@ public abstract class AbstractHyperNorthPane extends BasicB protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - headerPane = this.setHeaderPanel(); + JPanel headerPane = this.setHeaderPanel(); this.add(headerPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); targetFrameComboBox = new UIComboBox(getTargetFrames()); diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java deleted file mode 100644 index d35c70a822..0000000000 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.fr.design.hyperlink; - -import com.fr.design.actions.UpdateAction; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.gui.itree.filetree.ReportletPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; - -import com.fr.js.ReportletHyperlink; -import com.fr.stable.StringUtils; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. - * - * @author kunsnat - */ -public class ReporletHyperNorthPane extends AbstractHyperNorthPane { - private UITextField itemNameTextField; - private boolean needRenamePane = false; - private UITextField reportPathTextField; - private UICheckBox showParameterInterface; - private UIButton browserButton; - - // richer:参数传递方式 - private UIComboBox postComboBox; - - public ReporletHyperNorthPane(boolean needRenamePane) { - this.needRenamePane = needRenamePane; - this.inits(); - } - - public ReporletHyperNorthPane() { - this.inits(); - } - - /** - * 初始化组件 - */ - public void inits() { - super.initComponents(); - } - - @Override - protected JPanel setHeaderPanel() { - JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, TableLayout.FILL}; - // Reportlet. - JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - reportPathTextField = new UITextField(20); - reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); - - browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); - reportletNamePane.add(browserButton, BorderLayout.EAST); - browserButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - final ReportletPane reportletPane = new ReportletPane(); - reportletPane.setSelectedReportletPath(reportPathTextField.getText()); - BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReporletHyperNorthPane.this)); - - reportletDialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - reportPathTextField.setText(reportletPane.getSelectedReportletPath()); - } - }); - reportletDialog.setVisible(true); - } - }); - - Component[][] components; - if (!this.needRenamePane) { - components = new Component[][]{ - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, - }; - } else { - itemNameTextField = new UITextField(); - components = new Component[][]{ - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}, - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, - }; - } - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - headerPane.add(northPane, BorderLayout.NORTH); - return headerPane; - } - - @Override - protected String title4PopupWindow() { - return "reportlet"; - } - - @Override - protected void populateSubHyperlinkBean(ReportletHyperlink link) { - if (itemNameTextField != null) { - this.itemNameTextField.setText(link.getItemName()); - } - this.reportPathTextField.setText(link.getReportletPath()); - this.showParameterInterface.setSelected(link.isShowParameterInterface()); - this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); - } - - @Override - protected ReportletHyperlink updateSubHyperlinkBean() { - ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); - updateSubHyperlinkBean(reportletHyperlink); - - return reportletHyperlink; - } - - @Override - protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { - if (itemNameTextField != null) { - reportletHyperlink.setItemName(this.itemNameTextField.getText()); - } - reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); - reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); - reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1 ? true : false); - } - - public String getReportletName() { - return StringUtils.isBlank(this.reportPathTextField.getText()) ? StringUtils.EMPTY : this.reportPathTextField.getText().substring(1); - } - - /** - * 获取按钮焦点 - */ - public void requestButtonFocus() { - this.browserButton.requestFocus(); - JPopupMenu popup = new JPopupMenu(); - FakeTipAction tip = new FakeTipAction(); - tip.setEnabled(false); - popup.add(tip); - GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); - } - - private class FakeTipAction extends UpdateAction { - public FakeTipAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Select")); - } - - public void actionPerformed(ActionEvent e) { - //do nothing - } - } - - @Override - protected JPanel setFootPanel() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, TableLayout.FILL}; - showParameterInterface = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); - JPanel showParameterPanel = new JPanel(); - showParameterPanel.add(new UILabel()); - showParameterPanel.add(showParameterInterface); - - postComboBox = new UIComboBox(new String[]{"GET", "POST"}); - JPanel postPanel = new JPanel(); - postPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type"))); - postPanel.add(postComboBox); - Component[][] components = {{postPanel}, - {showParameterPanel}, - {new UILabel(" ")} - }; - - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java new file mode 100644 index 0000000000..5d67800b76 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -0,0 +1,509 @@ +package com.fr.design.hyperlink; + +import com.fr.base.BaseFormula; +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; +import com.fr.design.formula.VariableResolver; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UINumberField; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.ReportletPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.IOUtils; +import com.fr.js.ReportletHyperlink; +import com.fr.js.ReportletHyperlinkDialogAttr; +import com.fr.stable.FormulaProvider; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. + * + * @author kunsnat + */ +public class ReportletHyperNorthPane extends AbstractHyperNorthPane { + /** + * item name text filed + */ + private UITextField itemNameTextField; + /** + * 是否展示item name + */ + private boolean needRenamePane = false; + /** + * 参数路径输入框 + */ + private UITextField reportPathTextField; + /** + * 是否展示参数面板勾选框 + */ + private UICheckBox showParameterInterface; + /** + * 选择文件按钮 + */ + private UIButton browserButton; + + /** + * 参数传递方式下拉选择框 + */ + private UIComboBox postComboBox; + /** + * 对话框标题输入框 + */ + private JFormulaField titleFiled; + + + /** + * 对话框居中按钮 + */ + private UIRadioButton center; + /** + * 对话框位置自定义按钮 + */ + private UIRadioButton custom; + /** + * 距左 + */ + private UINumberField leftLocation; + /** + * 距上 + */ + private UINumberField topLocation; + + + public ReportletHyperNorthPane(boolean needRenamePane) { + this.needRenamePane = needRenamePane; + } + + public ReportletHyperNorthPane() { + } + + /** + * 初始化面板 + */ + @Override + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + final List dialogComponents = new ArrayList<>(); + final List othersComponents = new ArrayList<>(); + + initRenamePanel(dialogComponents, othersComponents); + initHeaderPanel(dialogComponents, othersComponents); + initTargetComboBoxPanel(dialogComponents, othersComponents); + + initTitlePanel(dialogComponents); + initDialogSizePanel(dialogComponents); + initDialogLocationPanel(dialogComponents); + + initFooterPanel(dialogComponents, othersComponents); + + initPlaceHolder(othersComponents); + + bindListener(dialogComponents, othersComponents); + + // 创建内容面板 + JPanel content = TableLayoutHelper.createTableLayoutPane(dialogComponents.toArray(new Component[dialogComponents.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); + this.add(content, BorderLayout.CENTER); + } + + + /** + * 生成最上方的配置面板 + * + * @return JPanel + */ + @Override + protected JPanel setHeaderPanel() { + + JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + // 路径输入框 + reportPathTextField = new UITextField(20); + reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); + + // 选择路径按钮 + browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select")); + browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); + reportletNamePane.add(browserButton, BorderLayout.EAST); + browserButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + final ReportletPane reportletPane = new ReportletPane(); + reportletPane.setSelectedReportletPath(reportPathTextField.getText()); + BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this)); + + reportletDialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + reportPathTextField.setText(reportletPane.getSelectedReportletPath()); + } + }); + reportletDialog.setVisible(true); + } + }); + return reportletNamePane; + } + + @Override + protected String title4PopupWindow() { + return "reportlet"; + } + + @Override + protected void populateSubHyperlinkBean(ReportletHyperlink link) { + if (itemNameTextField != null) { + this.itemNameTextField.setText(link.getItemName()); + } + this.reportPathTextField.setText(link.getReportletPath()); + this.showParameterInterface.setSelected(link.isShowParameterInterface()); + this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); + + ReportletHyperlinkDialogAttr attr = link.getAttr(); + titleFiled.setFormulaText(StringUtils.EMPTY); + leftLocation.setText(StringUtils.EMPTY); + topLocation.setText(StringUtils.EMPTY); + center.setSelected(true); + if (attr != null) { + FormulaProvider title = attr.getTitleFormula(); + String titleContent = title == null ? StringUtils.EMPTY : title.getPureContent(); + titleFiled.setFormulaText(titleContent); + boolean isCenter = attr.isCenter(); + if (!isCenter) { + int left = attr.getLeft(), top = attr.getTop(); + leftLocation.setText(Integer.toString(left)); + topLocation.setText(Integer.toString(top)); + } + center.setSelected(isCenter); + custom.setSelected(!isCenter); + } + } + + @Override + protected ReportletHyperlink updateSubHyperlinkBean() { + ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); + updateSubHyperlinkBean(reportletHyperlink); + return reportletHyperlink; + } + + @Override + protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { + if (itemNameTextField != null) { + reportletHyperlink.setItemName(this.itemNameTextField.getText()); + } + reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); + reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); + reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1); + + ReportletHyperlinkDialogAttr attr = new ReportletHyperlinkDialogAttr(); + attr.setTitleFormula(BaseFormula.createFormulaBuilder().build(titleFiled.getFormulaText())); + attr.setCenter(center.isSelected()); + if (!attr.isCenter()) { + attr.setLeft((int) leftLocation.getValue()); + attr.setTop((int) topLocation.getValue()); + } + reportletHyperlink.setAttr(attr); + + } + + public String getReportletName() { + String text = this.reportPathTextField.getText(); + return StringUtils.isBlank(text) ? StringUtils.EMPTY : text.substring(1); + } + + /** + * 获取按钮焦点 + */ + public void requestButtonFocus() { + this.browserButton.requestFocus(); + JPopupMenu popup = new JPopupMenu(); + FakeTipAction tip = new FakeTipAction(); + tip.setEnabled(false); + popup.add(tip); + GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); + } + + private class FakeTipAction extends UpdateAction { + public FakeTipAction() { + this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Select")); + } + + @Override + public void actionPerformed(ActionEvent e) { + // do nothing + } + } + + /** + * 底部面板,参数传递方式 + * + * @return JPanel + */ + @Override + protected JPanel setFootPanel() { + JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + + // 参数传递方式下拉框 + postComboBox = new UIComboBox(new String[]{"GET", "POST"}); + postComboBox.setPreferredSize(new Dimension(60, 20)); + postComboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + content.add(postComboBox); + + + showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); + + showParameterInterface.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + content.add(showParameterInterface); + return content; + } + + private void bindListener(final List dialogComponents, final List othersComponents) { + final UIComboBox targetFrameComboBox = this.getTargetFrameComboBox(); + targetFrameComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boolean show = DIALOG == targetFrameComboBox.getSelectedIndex(); + JPanel content; + List cs = show ? dialogComponents : othersComponents; + ReportletHyperNorthPane.this.removeAll(); + content = TableLayoutHelper.createTableLayoutPane(cs.toArray(new Component[cs.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); + ReportletHyperNorthPane.this.add(content, BorderLayout.CENTER); + ReportletHyperNorthPane.this.revalidate(); + ReportletHyperNorthPane.this.repaint(); + } + }); + } + + private void initPlaceHolder(List othersComponents) { + JPanel empty1 = new JPanel(); + empty1.setPreferredSize(new Dimension(20, 20)); + JPanel empty2 = new JPanel(); + empty2.setPreferredSize(new Dimension(20, 20)); + JPanel empty3 = new JPanel(); + empty3.setPreferredSize(new Dimension(20, 23)); + + othersComponents.add(new Component[]{empty1, new JPanel()}); + othersComponents.add(new Component[]{empty2, new JPanel()}); + othersComponents.add(new Component[]{empty3, new JPanel()}); + } + + private void initRenamePanel(List dialogComponents, List othersComponents) { + // 是否有重命名属性 + if (this.needRenamePane) { + itemNameTextField = new UITextField(); + Component[] renameComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}; + dialogComponents.add(renameComponents); + othersComponents.add(renameComponents); + } + } + + private void initHeaderPanel(List dialogComponents, List othersComponents) { + //最上方位置的面板 + JPanel headerPane = this.setHeaderPanel(); + Component[] headerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), headerPane}; + dialogComponents.add(headerComponents); + othersComponents.add(headerComponents); + } + + private void initTargetComboBoxPanel(List dialogComponents, List othersComponents) { + // 链接打开于 + UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames()); + this.setTargetFrameComboBox(targetFrameComboBox); + targetFrameComboBox.setEditable(true); + targetFrameComboBox.setPreferredSize(new Dimension(100, 20)); + JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + targetFramePanel.add(targetFrameComboBox); + Component[] targetComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Link_Opened_In") + ":"), targetFramePanel}; + dialogComponents.add(targetComponents); + othersComponents.add(targetComponents); + } + + private void initTitlePanel(List dialogComponents) { + // 对话框标题 + titleFiled = new JFormulaField(15); + final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + titlePanel.add(titleFiled); + Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Title") + ":"), titlePanel}; + dialogComponents.add(titleComponents); + } + + private void initDialogSizePanel(List dialogComponents) {// 对话框大小 + final JPanel sizeJPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Height") + ":"); + heightLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + sizeJPanel.add(heightLabel); + UINumberField heightTextFiled = new UINumberField(); + heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); + heightTextFiled.setPreferredSize(new Dimension(40, 20)); + sizeJPanel.add(heightTextFiled); + this.setHeightTextFiled(heightTextFiled); + UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":"); + widthLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + sizeJPanel.add(widthLabel); + UINumberField widthTextFiled = new UINumberField(); + widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); + widthTextFiled.setPreferredSize(new Dimension(40, 20)); + sizeJPanel.add(widthTextFiled); + this.setWidthTextFiled(widthTextFiled); + sizeJPanel.setVisible(true); + dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Size") + ":"), sizeJPanel}); + } + + private void initDialogLocationPanel(List dialogComponents) { + // 显示位置 + final JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + // 居中 + center = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Center")); + // 自定义 + custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom")); + + custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); + ButtonGroup group = new ButtonGroup(); + group.setSelected(center.getModel(), true); + group.add(center); + group.add(custom); + locationPanel.add(center); + locationPanel.add(custom); + + // 位置 距左 + final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left")); + leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10)); + leftLocation = new UINumberField(); + leftLocation.setPreferredSize(new Dimension(40, 20)); + // 位置 距上 + final UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Top")); + topLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + topLocation = new UINumberField(); + topLocation.setPreferredSize(new Dimension(40, 20)); + + locationPanel.add(leftLabel); + locationPanel.add(leftLocation); + locationPanel.add(topLabel); + locationPanel.add(topLocation); + leftLabel.setVisible(false); + leftLocation.setVisible(false); + topLabel.setVisible(false); + topLocation.setVisible(false); + ChangeListener actionListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean visible = custom.isSelected(); + leftLabel.setVisible(visible); + leftLocation.setVisible(visible); + topLabel.setVisible(visible); + topLocation.setVisible(visible); + } + }; + // 默认居中 + center.setSelected(true); + center.addChangeListener(actionListener); + custom.addChangeListener(actionListener); + + dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Show_Position") + ":"), locationPanel}); + } + + private void initFooterPanel(List dialogComponents, List othersComponents) { + // 最下方的配置面板 + // 参数传递方式 + Component[] footerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type") + ":"), this.setFootPanel()}; + dialogComponents.add(footerComponents); + othersComponents.add(footerComponents); + } + + /** + * 公式输入框 + */ + public class JFormulaField extends JPanel { + private UITextField formulaTextField; + + public JFormulaField(int columns) { + + formulaTextField = new UITextField(columns); + JPanel textFieldPane = new JPanel(new BorderLayout()); + textFieldPane.add(formulaTextField, BorderLayout.CENTER); + textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "..."); + formulaButton.setPreferredSize(new Dimension(24, formulaTextField.getPreferredSize().height)); + formulaButton.addActionListener(formulaButtonActionListener); + + JPanel pane = new JPanel(new BorderLayout()); + pane.add(textFieldPane, BorderLayout.CENTER); + pane.add(formulaButton, BorderLayout.EAST); + this.setLayout(new BorderLayout()); + this.add(pane, BorderLayout.NORTH); + } + + public void setFormulaText(String formulaContent) { + this.formulaTextField.setText(formulaContent); + } + + public String getFormulaText() { + + String text = formulaTextField.getText(); + if (text == null) { + text = StringUtils.EMPTY; + } + return text; + } + + /** + * 添加事件监听器 + * + * @param listener 公式文本输入框改动事件监听器 + */ + public void addListener(UIObserverListener listener) { + this.formulaTextField.registerChangeListener(listener); + } + + /** + * 取消事件监听器 + */ + public void removeListener() { + this.formulaTextField.registerChangeListener(null); + } + + private ActionListener formulaButtonActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); + valueFormula.setContent(getFormulaText()); + final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); + formulaPane.populate(valueFormula, VariableResolver.DEFAULT); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + BaseFormula valueFormula = formulaPane.update(); + setFormulaText(valueFormula.getContent()); + } + }).setVisible(true); + } + }; + } +} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java index e50360c197..532fe467c3 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java @@ -6,23 +6,30 @@ import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterReader; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.js.ReportletHyperlink; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import java.awt.BorderLayout; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.List; public class ReportletHyperlinkPane extends AbstractHyperLinkPane { - private ReporletHyperNorthPane northPane; + /** + * 超链配置面板 + */ + private ReportletHyperNorthPane northPane; + /** + * 是否继承参数勾选框 + */ private UICheckBox extendParametersCheckBox; public ReportletHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { @@ -38,22 +45,29 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane Date: Fri, 2 Nov 2018 12:26:58 +0800 Subject: [PATCH 024/187] =?UTF-8?q?REPORT-11714=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E7=94=A8=E5=9C=A8=E6=8F=92=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E5=81=9A=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/ParameterExpandablePaneUIProvider.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java index 90639cb2f2..3ca917c41f 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ParameterExpandablePaneUIProvider.java @@ -15,12 +15,17 @@ public interface ParameterExpandablePaneUIProvider extends Mutable { int CURRENT_LEVEL = 1; /** - * 如果面板不存在,则创建可展开面板并添加子容器;否则在某个tabPane下的UIExpandablePane实例中增加子容器 + * 创建可展开面板并添加子容器 * - * @param propertyTab 可展开面板放在哪个propertyTab下,例如属性或者移动端 - * @param uiExpandablePaneName 可扩展面板名称 * @return UIExpandablePane */ - UIExpandablePane createUIExpandablePane(PropertyTab propertyTab, String uiExpandablePaneName); + UIExpandablePane createUIExpandablePane(); + + /** + * 指定添加UIExpandablePane到哪个PropertyTab下,例如属性,移动端 + * + * @return PropertyTab + */ + PropertyTab addToWhichPropertyTab(); } From 005004fabaed3f86c3069ea78bd74663152c1a80 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 2 Nov 2018 12:34:19 +0800 Subject: [PATCH 025/187] =?UTF-8?q?REPORT-11714=20=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E5=BA=94=E7=9A=84=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=AD=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/parameter/RootDesignDefinePane.java | 18 ++++++++++++++++++ .../designer/mobile/ParaMobileDefinePane.java | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 75a8c61fe5..b25f167522 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -1,14 +1,17 @@ package com.fr.design.parameter; import com.fr.base.BaseUtils; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.PropertyGroupPane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.properties.PropertyTab; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -30,6 +33,7 @@ import javax.swing.Icon; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +import java.util.Set; /** * Created by ibm on 2017/8/2. @@ -63,9 +67,23 @@ public class RootDesignDefinePane extends AbstractDataModify { JPanel layoutPane = createBoundsPane(); UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); this.add(layoutExpandablePane, BorderLayout.CENTER); + this.addExtraUIExpandablePaneFromPlugin(); } + private void addExtraUIExpandablePaneFromPlugin() { + Set pluginCreators = ExtraDesignClassManager.getInstance().getArray(ParameterExpandablePaneUIProvider.XML_TAG); + JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (ParameterExpandablePaneUIProvider provider : pluginCreators) { + UIExpandablePane uiExpandablePane = provider.createUIExpandablePane(); + PropertyTab propertyTab = provider.addToWhichPropertyTab(); + if (uiExpandablePane != null && propertyTab == PropertyTab.ATTR) { + panel.add(uiExpandablePane); + } + } + this.add(panel, BorderLayout.SOUTH); + } + public JPanel createBoundsPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 6b65324840..c7b2ed5981 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -1,8 +1,11 @@ package com.fr.design.widget.ui.designer.mobile; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.properties.PropertyTab; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; @@ -14,6 +17,7 @@ import com.fr.form.ui.container.WSortLayout; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.util.Set; /** * Created by plough on 2018/2/5. @@ -33,9 +37,23 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.add(getMobileWidgetListPane(), BorderLayout.CENTER); + this.addExtraUIExpandablePaneFromPlugin(); this.repaint(); } + private void addExtraUIExpandablePaneFromPlugin() { + Set pluginCreators = ExtraDesignClassManager.getInstance().getArray(ParameterExpandablePaneUIProvider.XML_TAG); + JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (ParameterExpandablePaneUIProvider provider : pluginCreators) { + UIExpandablePane uiExpandablePane = provider.createUIExpandablePane(); + PropertyTab propertyTab = provider.addToWhichPropertyTab(); + if (uiExpandablePane != null && propertyTab == PropertyTab.MOBILE) { + panel.add(uiExpandablePane); + } + } + this.add(panel, BorderLayout.SOUTH); + } + // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); From 2af35bcb35a7c37d6e50aa1321d80708e5d7fc79 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sun, 4 Nov 2018 23:05:43 +0800 Subject: [PATCH 026/187] =?UTF-8?q?=E6=97=A0=E4=BB=BB=E5=8A=A1=EF=BC=8Cfin?= =?UTF-8?q?dbugs=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 2 -- .../fr/design/gui/itree/filetree/FileNodeComparator.java | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 61d071e00a..7f2fcd2cfe 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -303,8 +303,6 @@ public class TemplateTreePane extends JPanel implements FileOperations { private boolean deleteNodes(Collection nodes) { - boolean isLocal = WorkContext.getCurrent().isLocal(); - boolean success = true; for (ExpandMutableTreeNode treeNode : nodes) { Object node = treeNode.getUserObject(); diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java index f963d80d14..9c9533bd4a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -3,13 +3,15 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.FRContext; import com.fr.file.filetree.FileNode; +import java.io.Serializable; +import java.util.Arrays; import java.util.Comparator; /** * FileTreeNode compare... * Directory is in the first. and normal file the in the last. */ -public class FileNodeComparator implements Comparator { +public class FileNodeComparator implements Comparator, Serializable { /** * 正序还是倒序 */ @@ -46,7 +48,7 @@ public class FileNodeComparator implements Comparator { public FileNodeComparator(boolean reverse, String[] types) { this.isReverse = reverse; - this.supportTypes = types; + this.supportTypes = Arrays.copyOf(types, types.length); } /** From 39d79d3f9eb186d2b6398bef6f64aa7e8af148d4 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 6 Nov 2018 09:11:01 +0800 Subject: [PATCH 027/187] =?UTF-8?q?REPORT-10591=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8C=85=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/{reportfit => report/fit}/FitType.java | 4 ++-- .../fit}/menupane/BrowserFitAttrPane.java | 8 ++++---- .../fit}/menupane/FitPreviewPane.java | 2 +- .../{reportfit => report/fit}/menupane/FitRadioGroup.java | 2 +- .../fit}/menupane/FontRadioGroup.java | 2 +- .../fit}/menupane/ReportFitAttrAction.java | 6 +++--- .../fit}/menupane/ReportFitAttrPane.java | 4 ++-- .../fit}/menupane/TemplateBrowserFitAttrPane.java | 6 +++--- .../fit}/menupane/TemplateFitAttrPane.java | 4 ++-- .../java/com/fr/design/designer/creator/XElementCase.java | 4 ++-- .../src/main/java/com/fr/design/mainframe/JForm.java | 2 +- .../widget/propertypane/BrowserFitAlignmentItems.java | 2 +- .../widget/propertypane/BrowserFitPropertyEditor.java | 4 ++-- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/FitType.java (95%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/BrowserFitAttrPane.java (98%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/FitPreviewPane.java (99%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/FitRadioGroup.java (97%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/FontRadioGroup.java (88%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/ReportFitAttrAction.java (96%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/ReportFitAttrPane.java (92%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/TemplateBrowserFitAttrPane.java (95%) rename designer-base/src/main/java/com/fr/design/{reportfit => report/fit}/menupane/TemplateFitAttrPane.java (92%) diff --git a/designer-base/src/main/java/com/fr/design/reportfit/FitType.java b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java similarity index 95% rename from designer-base/src/main/java/com/fr/design/reportfit/FitType.java rename to designer-base/src/main/java/com/fr/design/report/fit/FitType.java index 6b342240dd..00aceb6eb1 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/FitType.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java @@ -1,7 +1,7 @@ -package com.fr.design.reportfit; +package com.fr.design.report.fit; import com.fr.design.designer.properties.items.Item; -import com.fr.report.reportfit.ReportFitAttr; +import com.fr.report.fit.ReportFitAttr; import com.fr.stable.StringUtils; /** diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java similarity index 98% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java index 470a2101bb..da495c54d4 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java @@ -1,6 +1,6 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; -import com.fr.design.reportfit.FitType; +import com.fr.design.report.fit.FitType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; @@ -10,8 +10,8 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.log.FineLoggerFactory; -import com.fr.report.reportfit.ReportFitAttr; -import com.fr.reportfit.ReportFitConfig; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FitPreviewPane.java similarity index 99% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/FitPreviewPane.java index fe6232c889..d2ae37adf5 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FitPreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FitRadioGroup.java similarity index 97% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/FitRadioGroup.java index 363ee64f70..bc06e89579 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FitRadioGroup.java @@ -1,4 +1,4 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.design.gui.ibutton.UIRadioButton; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FontRadioGroup.java similarity index 88% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/FontRadioGroup.java index f0c313b5cd..64d4f7b033 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FontRadioGroup.java @@ -1,4 +1,4 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; /** * 字体的两个选项组成的group diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java similarity index 96% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index dc41879565..57fa7bb332 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,4 +1,4 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.base.BaseUtils; import com.fr.design.actions.JTemplateAction; @@ -8,8 +8,8 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; -import com.fr.report.reportfit.FitProvider; -import com.fr.report.reportfit.ReportFitAttr; +import com.fr.report.fit.FitProvider; +import com.fr.report.fit.ReportFitAttr; import javax.swing.KeyStroke; import java.awt.Dimension; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java similarity index 92% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java index 983ff21ab2..55e11e9fd2 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java @@ -1,7 +1,7 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.design.beans.BasicBeanPane; -import com.fr.report.reportfit.ReportFitAttr; +import com.fr.report.fit.ReportFitAttr; import javax.swing.BorderFactory; import javax.swing.BoxLayout; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java similarity index 95% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java index de8108ace3..664fa2471d 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java @@ -1,9 +1,9 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.design.gui.ilable.UILabel; import com.fr.log.FineLoggerFactory; -import com.fr.report.reportfit.ReportFitAttr; -import com.fr.reportfit.ReportFitConfig; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import java.awt.Component; diff --git a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java similarity index 92% rename from designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java rename to designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java index e78259af6f..01b3196f5d 100644 --- a/designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java @@ -1,7 +1,7 @@ -package com.fr.design.reportfit.menupane; +package com.fr.design.report.fit.menupane; import com.fr.design.beans.BasicBeanPane; -import com.fr.report.reportfit.ReportFitAttr; +import com.fr.report.fit.ReportFitAttr; import javax.swing.BorderFactory; import javax.swing.BoxLayout; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 1b30af7719..da36cd8ba5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -19,11 +19,11 @@ import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditorProvider; -import com.fr.report.reportfit.ReportFitAttr; +import com.fr.report.fit.ReportFitAttr; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.report.reportfit.FitProvider; +import com.fr.report.fit.FitProvider; import javax.swing.*; import java.awt.*; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 5f043c6983..f6dfdba524 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -35,7 +35,7 @@ import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; -import com.fr.design.reportfit.menupane.ReportFitAttrAction; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java index 27669e8aba..e14cb121f4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe.widget.propertypane; -import com.fr.design.reportfit.FitType; +import com.fr.design.report.fit.FitType; import com.fr.design.designer.properties.items.Item; import com.fr.design.designer.properties.items.ItemProvider; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java index cdbc0c1a18..473422c446 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java @@ -2,8 +2,8 @@ package com.fr.design.mainframe.widget.propertypane; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.form.util.XCreatorConstants; -import com.fr.report.reportfit.ReportFitAttr; -import com.fr.reportfit.ReportFitConfig; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import java.beans.IntrospectionException; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 7072c55dd2..e8f5bc5f72 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -41,7 +41,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.cell.QuickEditorRegion; -import com.fr.design.reportfit.menupane.ReportFitAttrAction; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; From 6f734d800c9529eb3e2635b86e9d83550558e464 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 6 Nov 2018 09:31:36 +0800 Subject: [PATCH 028/187] =?UTF-8?q?REPORT-11737=20=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E4=B8=AD=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=E6=94=B9?= =?UTF-8?q?=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/webattr/EditToolBar.java | 87 ++++++++++++++----- 1 file changed, 66 insertions(+), 21 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index c550374c63..10aa47be70 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -30,6 +30,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Background; +import com.fr.report.web.button.Email; import com.fr.report.web.button.Export; import com.fr.report.web.button.write.AppendColumnRow; import com.fr.report.web.button.write.Submit; @@ -74,6 +75,14 @@ public class EditToolBar extends BasicPane { private Background background = null; private UICheckBox defaultCheckBox; + private static final String EMAIL = "email"; + private static final String CUSTOM = "custom"; + private static final String EXPORT = "export"; + private static final String NONE = "none"; + private static final String EDIT_EXCEL = "editexcel"; + private static final String APPEND_COUNT = "appendcount"; + private static final String SUBMIT = "submit"; + private ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (lastButton != null) { @@ -333,7 +342,8 @@ public class EditToolBar extends BasicPane { private JPanel centerPane; private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, isPopup, isVerify, failSubmit, isCurSheet, excelImClean, - excelImCover, excelImAppend, excelImCust; + excelImCover, excelImAppend, excelImCust, + customConsignee, consigneeByDepartment, consigneeByRole; private UIBasicSpinner count; private Widget widget; private UITextField nameField; @@ -392,17 +402,17 @@ public class EditToolBar extends BasicPane { centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); card = new CardLayout(); centerPane.setLayout(card); - centerPane.add("custom", getCustomPane()); - centerPane.add("export", getExport()); - centerPane.add("none", none); - // centerPane.add("editexcel", editExcel); - centerPane.add(getCpane(), "appendcount"); - centerPane.add(getSubmitPane(), "submit"); - - Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); - for (ExtraButtonToolBarProvider provider : extraButtonSet) { - provider.updateCenterPane(centerPane); - } + centerPane.add(CUSTOM, getCustomPane()); + centerPane.add(EXPORT, getExport()); + centerPane.add(EMAIL, getEmail()); + centerPane.add(NONE, none); + centerPane.add(getCpane(), APPEND_COUNT); + centerPane.add(getSubmitPane(), SUBMIT); + + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.updateCenterPane(centerPane); + } this.add(centerPane, BorderLayout.CENTER); } @@ -446,6 +456,22 @@ public class EditToolBar extends BasicPane { return export; } + private JPanel getEmail() { + JPanel email = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + customConsignee = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Consignee")); + consigneeByDepartment = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Consignee_By_Department")); + consigneeByRole = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Consignee_By_Role")); + email.add(customConsignee); + email.add(Box.createVerticalStrut(2)); + email.add(consigneeByDepartment); + email.add(Box.createVerticalStrut(2)); + email.add(consigneeByRole); + email.add(Box.createVerticalStrut(2)); + + email.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Form_Button_Property"), null)); + return email; + } + private JPanel getCpane() { JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); @@ -514,13 +540,15 @@ public class EditToolBar extends BasicPane { populateSubmit(); } else if (widget instanceof CustomToolBarButton) { populateCustomToolBarButton(); + } else if (widget instanceof Email) { + populateEmail(); } - Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); - for (ExtraButtonToolBarProvider provider : extraButtonSet) { - provider.populate(widget, card, centerPane); - } - } + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.populate(widget, card, centerPane); + } + } private void populateAppendColumnRow(){ card.show(centerPane, "appendcount"); @@ -543,6 +571,14 @@ public class EditToolBar extends BasicPane { } } + private void populateEmail(){ + card.show(centerPane, EMAIL); + Email email = (Email) widget; + this.customConsignee.setSelected(email.isCustomConsignee()); + this.consigneeByDepartment.setSelected(email.isConsigneeByDepartment()); + this.consigneeByRole.setSelected(email.isConsigneeByRole()); + } + private void populateCustomToolBarButton(){ card.show(centerPane, "custom"); CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget; @@ -584,15 +620,17 @@ public class EditToolBar extends BasicPane { updateSubmit(); } else if (widget instanceof CustomToolBarButton) { ((CustomToolBarButton) widget).setJSImpl(this.javaScriptPane.updateBean()); + } else if (widget instanceof Email) { + updateEmail(); } if (widget instanceof Button) { updateDefault(); } - Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); - for (ExtraButtonToolBarProvider provider : extraButtonSet) { - provider.update(widget); - } + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.update(widget); + } return widget; } @@ -625,6 +663,13 @@ public class EditToolBar extends BasicPane { } } } + + private void updateEmail(){ + Email email = ((Email) widget); + email.setCustomConsignee(this.customConsignee.isSelected()); + email.setConsigneeByDepartment(this.consigneeByDepartment.isSelected()); + email.setConsigneeByRole(this.consigneeByRole.isSelected()); + } } } From 725a6389fbbd9faf4b8ee2fa6ffa49f4684f4367 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 6 Nov 2018 09:41:25 +0800 Subject: [PATCH 029/187] =?UTF-8?q?REPORT-12034=20=E9=9B=B6=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E9=92=88=E5=BC=8F=E6=89=93=E5=8D=B0=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/gui/GUICoreUtils.java | 24 ++++++++++++ .../AbstractNativePrintSettingPane.java | 19 ---------- .../GlobalNativePrintSettingPane.java | 2 +- .../NoClientPrintSettingPane.java | 38 +++++++++++-------- .../ReportNativePrintSettingPane.java | 4 +- 5 files changed, 50 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 1a79fe22cf..fb8b07be86 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -18,6 +18,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.EditTextField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; @@ -891,4 +893,26 @@ public abstract class GUICoreUtils{ panel.add(dynamicPaneWrapper, BorderLayout.CENTER); return panel; } + + /** + * 创建一个单列垂直布局的 TableLayout 面板 + * @param comps 组件数组 + * @return 布局完成后的面板 + */ + public static JPanel createHeaderLayoutPane(Component... comps) { + // TableLayout + double p = TableLayout.PREFERRED; + double[] columnSize = {p}; + + double[] rowSize = new double[comps.length]; + for (int i = 0; i < rowSize.length; i++) { + rowSize[i] = p; + } + + Component[][] components = new Component[rowSize.length][columnSize.length]; + for (int i = 0; i < rowSize.length; i++) { + components[i][0] = comps[i]; + } + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); + } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index eac54ea73b..9ba0180997 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -118,25 +118,6 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { abstract JPanel createHeaderPane(Component... comps); - JPanel createHeaderLayoutPane(Component... comps) { - // TableLayout - double p = TableLayout.PREFERRED; - double[] columnSize = {p}; - - double[] rowSize = new double[comps.length]; - for (int i = 0; i < rowSize.length; i++) { - rowSize[i] = p; - } - - Component[][] components = new Component[rowSize.length][columnSize.length]; - for (int i = 0; i < rowSize.length; i++) { - components[i][0] = comps[i]; - } - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - } - - - private void initListeners() { allPageRadioButton.addItemListener(getPageRaidoListener()); currentPageRadioButton.addItemListener(getPageRaidoListener()); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 0e2a98148d..82a4ff3f2d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -33,7 +33,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane System.arraycopy(comps, 0, allComps, 0, comps.length); System.arraycopy(newComps, 0, allComps, comps.length, newComps.length); - JPanel headerPane = createHeaderLayoutPane(allComps); + JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); return headerPane; } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java index ae91271598..c0816d165c 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java @@ -12,6 +12,7 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -22,6 +23,7 @@ import java.awt.event.ItemListener; public class NoClientPrintSettingPane extends JPanel { private UICheckBox setMarginWhenPrintCheck; private UICheckBox ieQuietPrintCheck; + private UICheckBox needlePrinterOptimizeCheck; private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置 private PageMarginSettingPane pageMarginSettingPane; private JPanel centerPane; @@ -34,7 +36,7 @@ public class NoClientPrintSettingPane extends JPanel { private void initComponents() { JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - printPane.add(createNorthPane(), BorderLayout.NORTH); + printPane.add(createHeaderPane(), BorderLayout.NORTH); initCenterPane(); printPane.add(centerPane, BorderLayout.CENTER); @@ -63,27 +65,29 @@ public class NoClientPrintSettingPane extends JPanel { centerPane.add(panel); } - private JPanel createNorthPane() { + private JPanel createHeaderPane() { setMarginWhenPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Set_Margin_When_Printing")); - setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 20)); - UILabel tipLabel = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin")); + setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + UILabel marginTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin")); + JPanel setMarginWhenPrintPane = GUICoreUtils.createFlowPane(new Component[] { + setMarginWhenPrintCheck, marginTip}, FlowLayout.LEFT); + ieQuietPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_No_Print_Settings_In_IE")); - ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 12, 10, 0)); + ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - // TableLayout - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {180, p}; - Component[][] components = { - {setMarginWhenPrintCheck, tipLabel}, - {ieQuietPrintCheck, null} - }; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - northPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + needlePrinterOptimizeCheck = new UICheckBox("针式打印优化"); + needlePrinterOptimizeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + UILabel needleTip = GUICoreUtils.createTipLabel("提示:将文字字体替换为黑体以优化打印效果。"); + JPanel needlePrinterOptimizePane = GUICoreUtils.createFlowPane(new Component[] { + needlePrinterOptimizeCheck, needleTip}, FlowLayout.LEFT); - return northPane; + JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(setMarginWhenPrintPane, ieQuietPrintCheck, needlePrinterOptimizePane); + headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); + return headerPane; } + + private void initListeners() { setMarginWhenPrintCheck.addItemListener(new ItemListener() { @Override @@ -103,6 +107,7 @@ public class NoClientPrintSettingPane extends JPanel { public void populate(NoClientPrintAttr noClientPrintAttr) { setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint()); ieQuietPrintCheck.setSelected(noClientPrintAttr.isIeQuietPrint()); + needlePrinterOptimizeCheck.setSelected(noClientPrintAttr.isNeedlePrinterOptimize()); inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting()); pageMarginSettingPane.populate(noClientPrintAttr.getMargin()); } @@ -110,6 +115,7 @@ public class NoClientPrintSettingPane extends JPanel { public void update(NoClientPrintAttr noClientPrintAttr) { noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected()); noClientPrintAttr.setIeQuietPrint(ieQuietPrintCheck.isSelected()); + noClientPrintAttr.setNeedlePrinterOptimize(needlePrinterOptimizeCheck.isSelected()); noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean()); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java index b94a894155..87853a7a38 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java @@ -1,5 +1,7 @@ package com.fr.design.webattr.printsettings; +import com.fr.design.utils.gui.GUICoreUtils; + import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; @@ -11,7 +13,7 @@ import java.awt.Component; public class ReportNativePrintSettingPane extends AbstractNativePrintSettingPane { @Override JPanel createHeaderPane(Component... comps) { - JPanel headerPane = createHeaderLayoutPane(comps); + JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(comps); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); return headerPane; } From eeac22489409951dd5c4a77ecea22d4dd399060d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 6 Nov 2018 11:29:22 +0800 Subject: [PATCH 030/187] =?UTF-8?q?REPORT-12034=20=E9=9B=B6=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E9=92=88=E5=BC=8F=E6=89=93=E5=8D=B0=E4=BC=98?= =?UTF-8?q?=E5=8C=96=3D>=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/NoClientPrintSettingPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java index c0816d165c..a5ed35a697 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java @@ -75,9 +75,9 @@ public class NoClientPrintSettingPane extends JPanel { ieQuietPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_No_Print_Settings_In_IE")); ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - needlePrinterOptimizeCheck = new UICheckBox("针式打印优化"); + needlePrinterOptimizeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Needle_Printer_Optimize")); needlePrinterOptimizeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - UILabel needleTip = GUICoreUtils.createTipLabel("提示:将文字字体替换为黑体以优化打印效果。"); + UILabel needleTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Needle_Printer_Optimize_Tip")); JPanel needlePrinterOptimizePane = GUICoreUtils.createFlowPane(new Component[] { needlePrinterOptimizeCheck, needleTip}, FlowLayout.LEFT); From 9cd1ac9230d1e130e490384e6ae3953744a930a9 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 6 Nov 2018 11:30:09 +0800 Subject: [PATCH 031/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/webattr/EditToolBar.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 10aa47be70..2f27766263 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -65,6 +65,14 @@ import java.util.Set; public class EditToolBar extends BasicPane { + private static final String EMAIL = "email"; + private static final String CUSTOM = "custom"; + private static final String EXPORT = "export"; + private static final String NONE = "none"; + private static final String EDIT_EXCEL = "editexcel"; + private static final String APPEND_COUNT = "appendcount"; + private static final String SUBMIT = "submit"; + private JWorkBook jwb; private JList list; private DefaultListModel listModel; @@ -75,14 +83,6 @@ public class EditToolBar extends BasicPane { private Background background = null; private UICheckBox defaultCheckBox; - private static final String EMAIL = "email"; - private static final String CUSTOM = "custom"; - private static final String EXPORT = "export"; - private static final String NONE = "none"; - private static final String EDIT_EXCEL = "editexcel"; - private static final String APPEND_COUNT = "appendcount"; - private static final String SUBMIT = "submit"; - private ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (lastButton != null) { From 12b13eba2194e03f5704a50ffcbcfa84739ddd68 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 7 Nov 2018 12:52:34 +0800 Subject: [PATCH 032/187] update --- .../fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index 551d5d3dbb..ef97271866 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -23,7 +23,12 @@ import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableCellRender; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableModel; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTextAreaCellRender; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.*; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.GeneralContext; +import com.fr.general.GeneralUtils; +import com.fr.general.IOUtils; +import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; From 358a4bf4dfdbad50346de3ccbd017dc1dead5e66 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 7 Nov 2018 12:52:50 +0800 Subject: [PATCH 033/187] 1 --- .../fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java index 680d3190dc..4cfda16ec7 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java @@ -1,6 +1,6 @@ package com.fr.design.onlineupdate.ui.dialog; -import com.fr.base.FRContext; +import com.fr.base.F RContext; import com.fr.design.RestartHelper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; From 61c76f593daafb63eb27ed4cfa404d47d82dc70c Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 7 Nov 2018 12:53:18 +0800 Subject: [PATCH 034/187] update --- .../fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java index 4cfda16ec7..680d3190dc 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java @@ -1,6 +1,6 @@ package com.fr.design.onlineupdate.ui.dialog; -import com.fr.base.F RContext; +import com.fr.base.FRContext; import com.fr.design.RestartHelper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; From 69b56064780d2b2860dfd88c4c54bad695c2aa0e Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 8 Nov 2018 10:44:33 +0800 Subject: [PATCH 035/187] =?UTF-8?q?REPORT-11612=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=3D>=E5=9F=BA=E7=A1=80=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractTemplateServerSettingPane.java | 91 +++++++++++++++++++ .../printsettings/ReportPrintSettingPane.java | 65 +++---------- 2 files changed, 103 insertions(+), 53 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java diff --git a/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java new file mode 100644 index 0000000000..46c1036107 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java @@ -0,0 +1,91 @@ +package com.fr.design.dialog; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * 封装了"为该模版单独设置、采用服务器设置"选项功能的设置面板 + * Created by plough on 2018/11/7. + */ +public abstract class AbstractTemplateServerSettingPane extends BasicPane { + private static final String[] CHOOSEITEM = new String[] { + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") + }; + + protected static final int SINGLE_SET = 0; + protected static final int SERVER_SET = 1; + + protected UIComboBox chooseComboBox; + private JPanel contentPane; + + protected AbstractTemplateServerSettingPane() { + initComponents(); + } + + private void initComponents() { + chooseComboBox = new UIComboBox(CHOOSEITEM); + chooseComboBox.addItemListener(itemListener); + UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set") + ":"); + JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { + belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0); + buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); + + this.setLayout(new BorderLayout()); + this.add(buttonPane, BorderLayout.NORTH); + this.contentPane = getContentPane(); + this.add(contentPane, BorderLayout.CENTER); + } + + /** + * 包含设置项的主面板 + */ + protected abstract JPanel getContentPane(); + + private ItemListener itemListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (isUsingServerSettings()) { + populateServerSettings(); + setSettingPaneEnabled(false); + } else { + setSettingPaneEnabled(true); + } + } + } + }; + + private void setSettingPaneEnabled(boolean enabled) { + // GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层 + GUICoreUtils.setEnabled(contentPane, enabled); + if (enabled) { + checkContentPaneEnabled(); + } + } + + protected boolean isUsingServerSettings() { + return chooseComboBox.getSelectedIndex() == SERVER_SET; + } + + /** + * 整个配置面板设置为可用后,可能还需要检测面板中部分区域的可用性 + */ + protected void checkContentPaneEnabled() { + // do nothing + } + + /** + * 读取服务器配置并 populate 到主面板中 + */ + protected abstract void populateServerSettings(); +} diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java index 22bd3693a3..014b20cb34 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java @@ -1,77 +1,36 @@ package com.fr.design.webattr.printsettings; import com.fr.base.print.PrintSettingsAttrMark; -import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.utils.gui.GUICoreUtils; - +import com.fr.design.dialog.AbstractTemplateServerSettingPane; import com.fr.report.core.ReportUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; /** * 模版->打印设置 * Created by plough on 2018/3/6. */ -public class ReportPrintSettingPane extends BasicPane { - private static final String[] CHOOSEITEM = new String[] { - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") - }; - private static final int SINGLE_SET = 0; - private static final int SERVER_SET = 1; +public class ReportPrintSettingPane extends AbstractTemplateServerSettingPane { - private UIComboBox chooseComboBox; private PrintSettingPane printSettingPane; public ReportPrintSettingPane() { - initComponents(); - } - - private void initComponents() { - chooseComboBox = new UIComboBox(CHOOSEITEM); - chooseComboBox.addItemListener(itemListener); - UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set") + ":"); - JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { - belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0); - buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); - - printSettingPane = new PrintSettingPane(); - this.setLayout(new BorderLayout()); - this.add(buttonPane, BorderLayout.NORTH); - this.add(printSettingPane, BorderLayout.CENTER); } - private ItemListener itemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (chooseComboBox.getSelectedIndex() == 0) { - setSettingPaneEnabled(true); - } else { - populateServerSettings(); - setSettingPaneEnabled(false); - } - } + @Override + protected JPanel getContentPane() { + if (printSettingPane == null) { + printSettingPane = new PrintSettingPane(); } - }; + return printSettingPane; + } - private void setSettingPaneEnabled(boolean enabled) { - // GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层 - GUICoreUtils.setEnabled(printSettingPane, enabled); - if (enabled) { - printSettingPane.checkEnabled(); - } + @Override + protected void checkContentPaneEnabled() { + printSettingPane.checkEnabled(); } - private void populateServerSettings() { + protected void populateServerSettings() { PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig(); printSettingPane.populate(printSettings); } From 2b56fd924aff6b7775faf535f1a80352a2f46a21 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 8 Nov 2018 11:01:18 +0800 Subject: [PATCH 036/187] =?UTF-8?q?REPORT-11612=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=3D>=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/report/WatermarkSettingPane.java | 52 +++++++++++++++++++ .../fr/design/mainframe/FormDesignerUI.java | 6 ++- .../AccessibleBodyWatermarkEditor.java | 5 +- .../FRAbsoluteBodyLayoutDefinePane.java | 3 +- .../layout/FRFitLayoutDefinePane.java | 2 +- .../actions/report/ReportWatermarkAction.java | 6 +-- .../printsettings/ReportPrintSettingPane.java | 2 +- .../src/main/java/com/fr/grid/GridUI.java | 2 +- .../main/java/com/fr/poly/PolyDesignUI.java | 2 +- 9 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java new file mode 100644 index 0000000000..e5f54ed678 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -0,0 +1,52 @@ +package com.fr.design.report; + +import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.design.dialog.AbstractTemplateServerSettingPane; +import com.fr.report.core.ReportUtils; + +import javax.swing.JPanel; + +/** + * Created by plough on 2018/11/7. + */ +public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { + private WatermarkPane watermarkPane; + + @Override + protected JPanel getContentPane() { + if (watermarkPane == null) { + watermarkPane = new WatermarkPane(); + } + return watermarkPane; + } + + @Override + protected void populateServerSettings() { + WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig(); + watermarkPane.populate(watermarkAttr); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"); + } + + public void populate(WatermarkAttr watermark) { + if (!watermark.isValid()) { + chooseComboBox.setSelectedIndex(SERVER_SET); + populateServerSettings(); + return; + } + chooseComboBox.setSelectedIndex(SINGLE_SET); + watermarkPane.populate(watermark); + } + + + public WatermarkAttr update() { + WatermarkAttr watermark = watermarkPane.update(); + if (isUsingServerSettings()) { + watermark.setValid(false); + } + return watermark; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 9ddee0b5ce..6e8419f72f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -18,6 +18,7 @@ import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; +import com.fr.form.main.parameter.FormParameterUI; import com.fr.page.WatermarkPainter; import com.fr.report.core.ReportUtils; import com.fr.stable.ArrayUtils; @@ -113,7 +114,10 @@ public class FormDesignerUI extends ComponentUI { // 绘制水印 private void paintWatermark(Graphics2D g) { - WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); + if (designer.getTarget() instanceof FormParameterUI) { // cpt 的参数面板 + return; + } + WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(designer.getTarget()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution()); painter.paint(g, 0, 0, designer.getArea().getBounds()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java index a0567bad1d..f15292ed19 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.renderer.WatermarkRenderer; import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper; import com.fr.design.report.WatermarkPane; +import com.fr.design.report.WatermarkSettingPane; import com.fr.intelli.record.Focus; import com.fr.intelli.record.Original; import com.fr.record.analyzer.EnableMetrics; @@ -20,7 +21,7 @@ import java.awt.*; @EnableMetrics public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor { - private WatermarkPane watermarkPane; + private WatermarkSettingPane watermarkPane; public AccessibleBodyWatermarkEditor() { super(new WatermarkWrapper()); @@ -34,7 +35,7 @@ public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor { @Override protected void showEditorPane() { if (watermarkPane == null) { - watermarkPane = new WatermarkPane(); + watermarkPane = new WatermarkSettingPane(); watermarkPane.setPreferredSize(new Dimension(600, 400)); } BasicDialog dlg = watermarkPane.showWindow(SwingUtilities.getWindowAncestor(this)); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 04c33f35b8..bd29cb5ccb 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -107,8 +107,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { layoutCombox.setSelectedIndex(1); borderStyleEditor.setValue(ob.getBorderStyle()); boundPane.populate(); - watermarkEditor.setValue(ReportUtils.getWatermarkFromAttrMarkFile(getCurrentIOFile())); - + watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); } public WAbsoluteBodyLayout updateSubPane() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 35c8ddee97..0f3e0aba0a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -151,7 +151,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { adaptComboBox.setSelectedIndex(ob.getCompState()); componentIntervel.setValue(ob.getCompInterval()); stylePane.setValue(ob.getBorderStyle()); - watermarkEditor.setValue(ReportUtils.getWatermarkFromAttrMarkFile(getCurrentIOFile())); + watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); } private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java index a07df219f9..075e7c0cff 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.WatermarkPane; +import com.fr.design.report.WatermarkSettingPane; import com.fr.intelli.record.Focus; import com.fr.intelli.record.Original; import com.fr.main.impl.WorkBook; @@ -37,9 +38,8 @@ public class ReportWatermarkAction extends JWorkBookAction { return; } final WorkBook wbTpl = jwb.getTarget(); - WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(wbTpl); - - final WatermarkPane watermarkPane = new WatermarkPane(); + WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplate(wbTpl); + final WatermarkSettingPane watermarkPane = new WatermarkSettingPane(); watermarkPane.populate(watermark); watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java index 014b20cb34..88a5a679d1 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java @@ -47,7 +47,7 @@ public class ReportPrintSettingPane extends AbstractTemplateServerSettingPane { public PrintSettingsAttrMark updateBean() { PrintSettingsAttrMark printSettings = printSettingPane.updateBean(); - if (chooseComboBox.getSelectedIndex() == SERVER_SET) { + if (isUsingServerSettings()) { printSettings.setValid(false); } return printSettings; diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index f64fa08643..21cb157e1e 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -1114,7 +1114,7 @@ public class GridUI extends ComponentUI { // 绘制水印 private void paintWatermark(Graphics2D g2d, FineBook book) { - WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); + WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(book); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution); painter.paint(g2d, gridSize.width, gridSize.height); } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java b/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java index 7270f868bd..2bf55e5a07 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java @@ -109,7 +109,7 @@ public class PolyDesignUI extends ComponentUI { // 绘制水印 private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) { - WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); + WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(book); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution); painter.paint(g2d, width, height); } From 54983e915cdf228c4ee8cd7b4d6ff0e4fa769b98 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 8 Nov 2018 15:13:04 +0800 Subject: [PATCH 037/187] =?UTF-8?q?REPORT-11612=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=3D>=E8=A7=86=E8=A7=89=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=E7=A6=81=E7=94=A8=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=90=8E=E4=BB=8D=E7=84=B6=E5=8F=AF=E7=82=B9=E5=87=BB=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractTemplateServerSettingPane.java | 6 +++-- .../com/fr/design/report/WatermarkPane.java | 5 ++-- .../design/report/WatermarkSettingPane.java | 10 +++++++ .../com/fr/design/style/color/ColorCell.java | 4 +++ .../style/color/CustomChooserPanel.java | 3 ++- .../style/color/NewColorSelectPane.java | 14 +++++----- .../style/color/PickColorButtonFactory.java | 27 ++++++++++++------- .../fr/design/style/color/UsedColorPane.java | 2 +- 8 files changed, 47 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java index 46c1036107..b7a425ccab 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/AbstractTemplateServerSettingPane.java @@ -26,6 +26,7 @@ public abstract class AbstractTemplateServerSettingPane extends BasicPane { protected static final int SERVER_SET = 1; protected UIComboBox chooseComboBox; + protected JPanel buttonPane; private JPanel contentPane; protected AbstractTemplateServerSettingPane() { @@ -35,8 +36,9 @@ public abstract class AbstractTemplateServerSettingPane extends BasicPane { private void initComponents() { chooseComboBox = new UIComboBox(CHOOSEITEM); chooseComboBox.addItemListener(itemListener); - UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set") + ":"); - JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { + UILabel belowSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Blow_Set")); + belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + buttonPane = GUICoreUtils.createFlowPane(new Component[] { belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0); buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 27a9822c6c..9b9ff09503 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -13,7 +13,6 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectPane; import com.fr.design.utils.gui.GUICoreUtils; - import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; @@ -47,7 +46,7 @@ public class WatermarkPane extends BasicPane { } private void initComponents() { - this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -66,7 +65,7 @@ public class WatermarkPane extends BasicPane { // 设置 JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.add(rightPane, BorderLayout.EAST); - rightPane.add(initRightPane(), BorderLayout.CENTER); + rightPane.add(initRightPane(), BorderLayout.NORTH); } public void populate(WatermarkAttr watermark) { diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index e5f54ed678..0cc211c5f1 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -4,6 +4,7 @@ import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.design.dialog.AbstractTemplateServerSettingPane; import com.fr.report.core.ReportUtils; +import javax.swing.BorderFactory; import javax.swing.JPanel; /** @@ -12,6 +13,15 @@ import javax.swing.JPanel; public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { private WatermarkPane watermarkPane; + public WatermarkSettingPane() { + super(); + initComponents(); + } + + private void initComponents() { + buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 0, 0)); + } + @Override protected JPanel getContentPane() { if (watermarkPane == null) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java index d43de5120d..06cca51d03 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java @@ -89,6 +89,10 @@ public class ColorCell extends JComponent implements ColorSelectable { * @param 鼠标事件 */ public void processMouseEvent(MouseEvent e) { + if (!isEnabled()) { + return; + } + if (e == null || e.getID() == MouseEvent.MOUSE_RELEASED) { colorSelectable.setColor(this.getColor()); colorSelectable.colorSetted(this); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index a6c4195c29..79ecdc9461 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -9,6 +9,7 @@ import java.util.regex.Pattern; import javax.swing.ButtonGroup; import javax.swing.Icon; +import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; @@ -706,7 +707,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec mainPanel.add(hexPanel, BorderLayout.SOUTH); JPanel rightPane = new JPanel(new BorderLayout()); - SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); + JButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true); JPanel blankArea = new JPanel(); blankArea.setPreferredSize(new Dimension(100, 175)); rightPane.add(blankArea, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index fec4993221..0f5e629e28 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -31,8 +31,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { // color setting action. private ArrayList colorChangeListenerList = new ArrayList(); - // 颜色选择器 - private ColorSelectDetailPane pane; // 是否支持透明 private boolean isSupportTransparent; @@ -52,10 +50,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { /** * Constructor. */ - public NewColorSelectPane(boolean isSupportTransparent) { + NewColorSelectPane(boolean isSupportTransparent) { this.isSupportTransparent = isSupportTransparent; this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); if (isSupportTransparent) { UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); this.add(transpanrentButton, BorderLayout.NORTH); @@ -96,12 +94,13 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { // mod by anchore 16/11/16 UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addMouseListener(new MouseAdapter() { + customButton.addActionListener(new ActionListener() { @Override - public void mousePressed(MouseEvent e) { + public void actionPerformed(ActionEvent e) { customButtonPressed(); } }); + customButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8)); @@ -183,7 +182,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { } protected void customButtonPressed() { - pane = new ColorSelectDetailPane(Color.WHITE); + // 颜色选择器 + ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 47c60e94a8..67d99819d7 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -2,27 +2,32 @@ package com.fr.design.style.color; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; +import com.fr.design.gui.ibutton.UIBasicButtonUI; import javax.swing.*; import javax.swing.plaf.ButtonUI; +import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.*; /** * Created by plough on 2016/12/22. */ -public class PickColorButtonFactory { +class PickColorButtonFactory { private static int iconSize; private static final int SIZE_16 = 16; private static final int SIZE_18 = 18; private static IconType iconType; private static Image iconImage; - public static SpecialUIButton getPickColorButton(ColorSelectable colorSelectable, IconType iconType) { - return getPickColorButton(colorSelectable, iconType, false); - } - - public static SpecialUIButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { + /** + * 生成取色按钮 + * @param colorSelectable 接收取到的颜色值的对象 + * @param iconType IconType 枚举,可选择 16px 和 18px 两个尺寸 + * @param setColorRealTime 是否在取色过程中,实时更新颜色值 + * @return SpecialUIButton 屏幕取色按钮 + */ + static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; @@ -37,9 +42,9 @@ public class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addMouseListener(new MouseAdapter() { + pickColorButton.addActionListener(new ActionListener() { @Override - public void mousePressed(MouseEvent e) { + public void actionPerformed(ActionEvent e) { new ColorPicker(colorSelectable, setColorRealTime); } }); @@ -47,12 +52,14 @@ public class PickColorButtonFactory { return pickColorButton; } - // 取色器按钮使用的图标 + /** + * 取色按钮可使用的图标尺寸 + */ public enum IconType { ICON16, ICON18 } - private static class WhiteButtonUI extends ButtonUI { + private static class WhiteButtonUI extends UIBasicButtonUI { @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); diff --git a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java index e2186a90ee..a48f33c164 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java @@ -72,7 +72,7 @@ public class UsedColorPane extends BasicPane { int i = 0; if (needPickColorButton) { // 取色按钮 - SpecialUIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); + JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime); panel.add(pickColorButton); i++; this.reserveCells += 1; From ae21bf16b1dd34cc140cdf177324ae78aee04704 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 9 Nov 2018 10:26:10 +0800 Subject: [PATCH 038/187] =?UTF-8?q?REPORT-12520=20@Alex.Sung:=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=8A=9F=E8=83=BD=E7=82=B9?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=88=A0=E9=99=A4swift?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=20=E5=8E=BB=E6=8E=89=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=B9=E4=B8=BA=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E6=9C=80=E5=90=8E=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8F=91=E9=80=81=E7=BB=99=E4=BA=91=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 96 +++++++++---------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 003a482b7c..6f3c9bdea7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -226,20 +226,27 @@ public class InformationCollector implements XMLReadable, XMLWriter { } private void sendFunctionsInfo(){ - long currentTime = new Date().getTime(); - ArrayList> content = null; - content = getFunctionsContentAsByte(currentTime); - boolean success = false; - String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.size() > 0){ - for(int i=0; i> content = null; + content = getFunctionsContent(current, new Date(lastTime)); + boolean success = false; + FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); + String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); + if(content.size() > 0){ + for(int i=0; i> records = new ArrayList>(); - QueryCondition condition = QueryFactory.create().addRestriction( - RestrictionFactory.lte(COLUMN_TIME, currentTime) - ); - try { - DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - String bbsUserName = MarketConfig.getInstance().getBbsUsername(); - String uuid = envManager.getUUID(); - if(!focusPoints.isEmpty()){ - for(FocusPoint focusPoint : focusPoints.getList()){ - Map record = new HashMap<>(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, bbsUserName); - record.put(ATTR_UUID, uuid); - records.add(record); - } - } - } catch (MetricException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return records; - } - - private void deleteFunctionRecords(long currentTime) { - QueryCondition condition = QueryFactory.create().addRestriction( - RestrictionFactory.lte(COLUMN_TIME, currentTime) - ); + public static ArrayList getFunctionsContent(Date current, Date last){ + ArrayList> records = new ArrayList>(); + QueryCondition condition = QueryFactory.create() + .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) + .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { - MetricRegistry.getMetric().clean(condition); - }catch (Exception e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); + DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + String bbsUserName = MarketConfig.getInstance().getBbsUsername(); + String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ + for(FocusPoint focusPoint : focusPoints.getList()){ + Map record = new HashMap<>(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, bbsUserName); + record.put(ATTR_UUID, uuid); + records.add(record); + } + } + } catch (MetricException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + return records; } private class StartStopTime implements XMLReadable, XMLWriter { From 7deee0012c2d3336ff8282fb9507e030c5534de8 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 13 Nov 2018 11:37:00 +0800 Subject: [PATCH 039/187] =?UTF-8?q?REPORT-12582=20@Alex.Sung:AlphaFine?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=B8=B8=E7=94=A8=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84=E6=9C=AC=E5=9C=B0=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=80=83=E8=99=91?= =?UTF-8?q?=E5=88=B0=E9=87=8D=E5=90=AF=E5=9C=BA=E6=99=AF=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=88=A4=E7=A9=BA=E5=90=8E=E5=86=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/RecentSearchManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java index 0b48d7cf91..3a4a3db85d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java @@ -113,7 +113,10 @@ public class RecentSearchManager implements AlphaFineSearchProvider { */ private void initReader() { try { - indexWriter.close(); + if(indexWriter != null){ + indexWriter.close(); + } + directory = FSDirectory.open(new File(path)); indexReader = DirectoryReader.open(directory); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 3d6bd5f7e201dab07382bdb203c8c087ff44fa38 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 13 Nov 2018 11:42:36 +0800 Subject: [PATCH 040/187] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/RecentSearchManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java index 3a4a3db85d..93fb511bc3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java @@ -113,10 +113,11 @@ public class RecentSearchManager implements AlphaFineSearchProvider { */ private void initReader() { try { - if(indexWriter != null){ + if(indexWriter == null){ + directory = FSDirectory.open(new File(path)); + }else{ indexWriter.close(); } - directory = FSDirectory.open(new File(path)); indexReader = DirectoryReader.open(directory); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 61d5e7cbcd086120a5a697be1d3e0f0c90b0b675 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Thu, 15 Nov 2018 20:24:11 +0800 Subject: [PATCH 041/187] =?UTF-8?q?REPORT-9208=20[10.0]=20SAP=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/controlpane/JControlUpdatePane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java index 17e3182860..c51aeaaecc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java @@ -8,6 +8,7 @@ import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import javax.swing.JPanel; import java.awt.CardLayout; @@ -71,7 +72,11 @@ class JControlUpdatePane extends JPanel { cardPane.add(updatePanes[i], String.valueOf(i)); } card.show(cardPane, String.valueOf(i)); - updatePanes[i].populateBean(ob2Populate); + try{ + updatePanes[i].populateBean(ob2Populate); + }catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } break; } } From d51f887e499385ac7b273492f163cf446d925ff5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 16 Nov 2018 11:11:16 +0800 Subject: [PATCH 042/187] REPORT-10536 --- .../fr/design/fun/MessageObjectProvider.java | 26 +++++++++++++++++++ .../impl/AbstractMessageObjectProvider.java | 17 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java b/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java new file mode 100644 index 0000000000..09f62aa575 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java @@ -0,0 +1,26 @@ +package com.fr.design.fun; + +import com.fr.json.JSONObject; +import com.fr.stable.fun.mark.Mutable; + +import java.util.Map; + +public interface MessageObjectProvider extends Mutable { + String MARK_STRING = "MessageObjectProvider"; + + int CURRENT_LEVEL = 1; + //消息类型 + int getMessageType(); + + /** + * 需要嵌入的组件内容 + * @return + */ + Map getValueEditorItems(); + + /** + * 实现发消息 + * @param messageJo + */ + void sendMessage(JSONObject messageJo); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java new file mode 100644 index 0000000000..a926409d11 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java @@ -0,0 +1,17 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.MessageObjectProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +@API(level = MessageObjectProvider.CURRENT_LEVEL) +public abstract class AbstractMessageObjectProvider extends AbstractProvider implements MessageObjectProvider { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public String mark4Provider() { + return getClass().getName(); + } +} From a57c7c4b8113ed816fb0fbcbad9caed0e2523d01 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 16 Nov 2018 17:30:46 +0800 Subject: [PATCH 043/187] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 20 ++ .../src/main/java/com/fr/file/FILE.java | 1 + .../src/main/java/com/fr/file/MemFILE.java | 12 ++ .../actions/FormMobileAttrAction.java | 2 +- .../actions/NewFormAction.java | 2 +- .../actions/TemplateParameterAction.java | 2 +- .../EmbeddedFormExportExportAction.java | 185 ++++++++++++++++ .../java/com/fr/design/mainframe/JForm.java | 10 +- .../EmbeddedFormExportExportAction.java | 155 -------------- .../export/AbstractExcelExportAction.java | 2 +- .../file/export/AbstractExportAction.java | 196 ----------------- .../export/AbstractJWorkBookExportAction.java | 197 ++++++++++++++++++ .../actions/file/export/CSVExportAction.java | 35 ++-- .../export/EmbeddedExportExportAction.java | 18 +- .../file/export/ExcelExportAction.java | 21 +- .../actions/file/export/PDFExportAction.java | 27 ++- .../file/export/PageExcelExportAction.java | 21 +- .../export/PageToSheetExcelExportAction.java | 19 +- .../actions/file/export/SVGExportAction.java | 19 +- .../actions/file/export/TextExportAction.java | 17 +- .../actions/file/export/WordExportAction.java | 13 +- .../com/fr/design/mainframe/JWorkBook.java | 4 +- .../com/fr/design/mainframe/app/CptApp.java | 4 +- .../com/fr/design/mainframe/app/CptxApp.java | 4 +- .../com/fr/design/mainframe/app/FormApp.java | 4 +- .../com/fr/design/mainframe/app/XlsApp.java | 4 +- .../com/fr/design/mainframe/app/XlsxApp.java | 4 +- .../fr/start/module/DesignerActivator.java | 2 +- 28 files changed, 514 insertions(+), 486 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/FormMobileAttrAction.java (98%) rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/NewFormAction.java (97%) rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/TemplateParameterAction.java (98%) create mode 100644 designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java delete mode 100644 designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java new file mode 100644 index 0000000000..3423536c5a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -0,0 +1,20 @@ +package com.fr.design.actions.file.export; + +import com.fr.design.actions.JTemplateAction; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.io.exporter.DesignExportType; + +public abstract class AbstractExportAction> extends JTemplateAction { + + public AbstractExportAction(E t) { + super(t); + } + + public abstract String exportScopeName(); + + public abstract DesignExportType exportType(); + + protected abstract ChooseFileFilter getChooseFileFilter(); + +} diff --git a/designer-base/src/main/java/com/fr/file/FILE.java b/designer-base/src/main/java/com/fr/file/FILE.java index 8c1f734cf9..8907a646f6 100644 --- a/designer-base/src/main/java/com/fr/file/FILE.java +++ b/designer-base/src/main/java/com/fr/file/FILE.java @@ -55,6 +55,7 @@ public interface FILE { * @return 是否新建成功 * @throws Exception 异常 */ + @SuppressWarnings({"UnusedReturnValue"}) boolean mkfile() throws Exception; /** diff --git a/designer-base/src/main/java/com/fr/file/MemFILE.java b/designer-base/src/main/java/com/fr/file/MemFILE.java index f35151eb93..102c6b9e78 100644 --- a/designer-base/src/main/java/com/fr/file/MemFILE.java +++ b/designer-base/src/main/java/com/fr/file/MemFILE.java @@ -18,6 +18,7 @@ public class MemFILE implements FILE { * @param name 名字 * @return 新建目录 */ + @Override public boolean createFolder(String name) { return false; } @@ -27,6 +28,7 @@ public class MemFILE implements FILE { * * @return 是否存在 */ + @Override public boolean exists() { return false; } @@ -37,6 +39,7 @@ public class MemFILE implements FILE { * @return 是否新建成功 * @throws Exception 异常 */ + @Override public boolean mkfile() throws Exception { return false; } @@ -56,6 +59,7 @@ public class MemFILE implements FILE { return name; } + @Override public String getEnvFullName() { return name; } @@ -65,6 +69,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isMemFile() { return true; } @@ -74,6 +79,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isEnvFile() { return false; } @@ -88,6 +94,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isDirectory() { return false; } @@ -97,6 +104,7 @@ public class MemFILE implements FILE { * * @return 文件 */ + @Override public FILE[] listFiles() { return new FILE[0]; } @@ -106,6 +114,7 @@ public class MemFILE implements FILE { * * @return 前缀 */ + @Override public String prefix() { return FILEFactory.MEM_PREFIX; } @@ -129,6 +138,7 @@ public class MemFILE implements FILE { * * @throws Exception 异常 */ + @Override public void closeTemplate() throws Exception { } @@ -138,6 +148,7 @@ public class MemFILE implements FILE { * @return 输入流 * @throws Exception 异常 */ + @Override public InputStream asInputStream() throws Exception { return null; } @@ -148,6 +159,7 @@ public class MemFILE implements FILE { * @return 输出流 * @throws Exception 异常 */ + @Override public OutputStream asOutputStream() throws Exception { return null; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java similarity index 98% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java rename to designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index 2707e8f9b8..033ba5ea57 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java similarity index 97% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java rename to designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 9c9f7fec49..8004b739f2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java similarity index 98% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java rename to designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java index 59e08ae03b..bd747444e3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.Parameter; diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java new file mode 100644 index 0000000000..758baeab6b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -0,0 +1,185 @@ +package com.fr.design.actions.file.export; + +import com.fr.base.BaseUtils; +import com.fr.base.Parameter; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.parameter.ParameterInputPane; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.form.main.Form; +import com.fr.io.exporter.DesignExportType; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.TemplateExportOperator; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Export Embedded. + */ +public class EmbeddedFormExportExportAction extends AbstractExportAction { + + private FRProgressBar progressbar; + + public EmbeddedFormExportExportAction(JForm jwb) { + super(jwb); + this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); + } + + @Override + public String exportScopeName() { + return "FINE_FORM"; + } + + @Override + public DesignExportType exportType() { + return DesignExportType.EMBEDDED_FORM; + } + + /** + * Action触发事件 + * + * @param e 触发事件 + */ + @Override + public void actionPerformed(ActionEvent e) { + + // todo 提示保存 + JTemplate jwb = this.getEditingComponent(); + FILE source = jwb.getEditingFILE(); + + // 输入参数 + final Map parameterMap = new HashMap(); + final Form tpl = this.getEditingComponent().getTarget(); + inputParameter(parameterMap, tpl, DesignerContext.getDesignerFrame()); + + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); + fileChooserPane.setFILEFilter(this.getChooseFileFilter()); + + String fileName = source.getName(); + fileChooserPane.setFileNameTextField(fileName, ProjectConstants.FRM_SUFFIX); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), ProjectConstants.FRM_SUFFIX); + + if (isOk(saveValue)) { + startExport(source, parameterMap, fileChooserPane); + } + } + + private void startExport(FILE source, Map parameterMap, + FILEChooserPane fileChooserPane) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception e1) { + FineLoggerFactory.getLogger().error("Error In Make New File"); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + (progressbar = + new FRProgressBar( + createExportWork(source, target, parameterMap), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100) + ).start(); + } + + private boolean isOk(int saveValue) { + return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; + } + + + private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame) { + Parameter[] parameters = tpl.getParameters(); + // 检查Parameter. + if (ArrayUtils.isNotEmpty(parameters)) { + final ParameterInputPane pPane = new ParameterInputPane(parameters); + pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { + + @Override + public void doOk() { + parameterMap.putAll(pPane.update()); + } + }).setVisible(true); + } + } + + @Override + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); + } + + private SwingWorker createExportWork(FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + Thread.sleep(100); + try { + final OutputStream fileOutputStream = target.asOutputStream(); + + this.setProgress(10); + dealExporter(fileOutputStream, path, parameterMap); + this.setProgress(80); + fileOutputStream.flush(); + fileOutputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path); + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index f6dfdba524..bb6483b32a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,8 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; +import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.designer.TargetComponent; @@ -31,11 +33,8 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.xpane.FormHyperlinkGroupPane; import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; -import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; -import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -47,6 +46,7 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.preview.FormPreview; import com.fr.design.preview.MobilePreview; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -469,6 +469,7 @@ public class JForm extends JTemplate implements BaseJForm { public void setPictureElem(Elem elem, CellImage cellImage) { elem.setValue(cellImage.getImage()); } + /** * 目标菜单 * @@ -503,7 +504,7 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } @@ -932,6 +933,7 @@ public class JForm extends JTemplate implements BaseJForm { /** * 支持的预览模式 + * * @return 预览模式 */ @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java deleted file mode 100644 index 7ddb8ae8d5..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.base.Parameter; -import com.fr.design.actions.JTemplateAction; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.KeySetUtils; -import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.form.main.Form; -import com.fr.form.main.FormEmbeddedTableDataExporter; -import com.fr.log.FineLoggerFactory; - -import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.io.FileOutputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * Export Embedded. - */ -public class EmbeddedFormExportExportAction extends JTemplateAction{ - - private FRProgressBar progressbar; - /** - * Constructor - */ - public EmbeddedFormExportExportAction(JForm jwb) { - super(jwb); - this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); - } - - /** - * Action触发事件 - * - * @param e 触发事件 - * - */ - public void actionPerformed(ActionEvent e) { - JTemplate jwb = this.getEditingComponent(); - FILE editingFILE = jwb.getEditingFILE(); - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - - final Map parameterMap = new HashMap(); - final Form tpl = this.getEditingComponent().getTarget(); - inputParameter(parameterMap, tpl, designerFrame); - - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); - fileChooserPane.setFILEFilter(this.getChooseFileFilter()); - - String filenName = editingFILE.getName(); - fileChooserPane.setFileNameTextField(filenName, ProjectConstants.FRM_SUFFIX); - int saveValue = fileChooserPane.showSaveDialog(designerFrame, ProjectConstants.FRM_SUFFIX); - if (isCancel(saveValue)) { - fileChooserPane = null; - return; - } - - if (isOk(saveValue)) { - startExport(parameterMap, tpl, designerFrame, fileChooserPane); - } - } - - private void startExport(Map parameterMap, Form tpl, DesignerFrame designerFrame, - FILEChooserPane fileChooserPane){ - FILE file = fileChooserPane.getSelectedFILE(); - try { - file.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - fileChooserPane = null; - FRContext.getLogger().info("\"" + file.getName() + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exporting"), "", 0, 100)).start(); - } - - private boolean isOk(int saveValue){ - return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; - } - - private boolean isCancel(int saveValue){ - return saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; - } - - private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame){ - Parameter[] parameters = tpl.getParameters(); - if (ArrayUtils.isNotEmpty(parameters)) {// 检查Parameter. - final ParameterInputPane pPane = new ParameterInputPane(parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { - - @Override - public void doOk() { - parameterMap.putAll(pPane.update()); - } - }).setVisible(true); - } - } - - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); - } - - private SwingWorker createExportWork(FILE file, final Form tpl, final Map parameterMap) { - final String filePath = file.getPath(); - final String fileGetName = file.getName(); - - SwingWorker exportWorker = new SwingWorker() { - protected Void doInBackground() throws Exception { - Thread.sleep(100); - try { - final FileOutputStream fileOutputStream = new FileOutputStream(filePath); - - this.setProgress(10); - FormEmbeddedTableDataExporter exporter = new FormEmbeddedTableDataExporter(); - exporter.export(fileOutputStream, tpl, parameterMap); - this.setProgress(80); - fileOutputStream.close(); - this.setProgress(100); - - FRContext.getLogger().info("\"" + fileGetName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + fileGetName); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + filePath); - } - return null; - } - - public void done() { - progressbar.close(); - } - }; - return exportWorker; - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 37ab34d76b..c4718c06f8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -12,7 +12,7 @@ import com.fr.main.TemplateWorkBook; /** * Export excel. */ -public abstract class AbstractExcelExportAction extends AbstractExportAction { +public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java deleted file mode 100644 index 3cbabd5b5d..0000000000 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.actions.file.export; - -import com.fr.base.FRContext; -import com.fr.base.Parameter; -import com.fr.design.actions.JWorkBookAction; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.JWorkBook; -import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.log.FineLoggerFactory; - -import com.fr.io.exporter.AppExporter; -import com.fr.io.exporter.CSVExporter; -import com.fr.io.exporter.EmbeddedTableDataExporter; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.PDFExporterProcessor; -import com.fr.io.exporter.WordExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.page.PageSetProvider; -import com.fr.report.ReportHelper; -import com.fr.report.core.ReportUtils; -import com.fr.report.report.Report; -import com.fr.report.worksheet.WorkSheet; -import com.fr.stable.ActorConstants; -import com.fr.stable.ActorFactory; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.io.OutputStream; -import java.util.Map; - -/** - * Abstract export action. - */ -public abstract class AbstractExportAction extends JWorkBookAction { - protected AbstractExportAction(JWorkBook jwb) { - super(jwb); - } - - private FRProgressBar progressbar; - - protected WorkBook getTemplateWorkBook() { - return this.getEditingComponent().getTarget(); - } - - /** - * 执行方法 - */ - @Override - public void actionPerformed(ActionEvent e) { - JWorkBook jwb = this.getEditingComponent(); - FILE editingFILE = jwb.getEditingFILE(); - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - - // 弹出参数 - final java.util.Map parameterMap = new java.util.HashMap(); - final TemplateWorkBook tpl = getTemplateWorkBook(); - Parameter[] parameters = tpl.getParameters(); - if (parameters != null && parameters.length > 0) {// 检查Parameter. - final ParameterInputPane pPane = new ParameterInputPane( - parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { - - @Override - public void doOk() { - parameterMap.putAll(pPane.update()); - } - }).setVisible(true); - } - - // Choose a file name.... - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); - fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); - - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc - String filenName = editingFILE.getName(); - if (filenName.indexOf('.') != -1) { - filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); - } - fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); - int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); - if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { - fileChooserPane = null; - return; - } else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { - FILE file = fileChooserPane.getSelectedFILE(); - try { - file.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - fileChooserPane = null; - FRContext.getLogger().info("\"" + file.getName() + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exporting"), "", 0, 100)).start(); - } - } - - private SwingWorker createExportWork(final FILE file, final TemplateWorkBook tpl, final Map parameterMap) { - final String filePath = file.getPath(); - final String fileGetName = file.getName(); - - SwingWorker exportWorker = new SwingWorker() { - - @Override - protected Void doInBackground() throws Exception { - Thread.sleep(100); //bug 10516 - try { - OutputStream outputStream = file.asOutputStream(); - - this.setProgress(10); - dealExporter(outputStream, tpl, parameterMap); - this.setProgress(80); - outputStream.flush(); - outputStream.close(); - this.setProgress(100); - - FRContext.getLogger().info("\"" + fileGetName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + fileGetName); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + filePath, - null, 0, UIManager.getIcon("OptionPane.errorIcon")); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - return exportWorker; - } - - private void dealExporter(OutputStream outputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception { - final Exporter exporter = AbstractExportAction.this.getExporter(); - if (exporter instanceof AppExporter) { - AppExporter appExporter = (AppExporter) exporter; - if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter - || exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) { - ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 - - appExporter.export(outputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) - )); - } else { - ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果 - - PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet( - ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export(); - appExporter.export(outputStream, pageSet); - pageSet.release(); - } - } else if (exporter instanceof EmbeddedTableDataExporter) { - ((EmbeddedTableDataExporter) exporter).export(outputStream, (WorkBook) tpl, parameterMap); - } - } - - /* - * 这边判断是否有层式报表,有层式需要使用大数据量导出 - */ - protected boolean hasLayerReport(TemplateWorkBook tpl) { - if (tpl == null) { - return false; - } - for (int i = 0; i < tpl.getReportCount(); i++) { - Report r = tpl.getReport(i); - if (r instanceof WorkSheet) { - if (((WorkSheet) r).getLayerReportAttr() != null) { - return true; - } - } - } - - return false; - } - - protected abstract ChooseFileFilter getChooseFileFilter(); - - protected abstract String getDefaultExtension(); - - protected abstract Exporter getExporter(); -} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java new file mode 100644 index 0000000000..e051edb4c8 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -0,0 +1,197 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.actions.file.export; + +import com.fr.base.Parameter; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.parameter.ParameterInputPane; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.log.FineLoggerFactory; +import com.fr.main.TemplateWorkBook; +import com.fr.main.impl.WorkBook; +import com.fr.report.report.Report; +import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.TemplateExportOperator; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import javax.swing.UIManager; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Abstract export action. + */ +public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { + + private FRProgressBar progressbar; + + protected AbstractJWorkBookExportAction(JWorkBook jwb) { + super(jwb); + } + + protected WorkBook getTemplateWorkBook() { + return this.getEditingComponent().getTarget(); + } + + /** + * 执行方法 + */ + @Override + public void actionPerformed(ActionEvent e) { + + // todo 弹出提醒保存,如果没保存 + + + JWorkBook jwb = this.getEditingComponent(); + FILE source = jwb.getEditingFILE(); + + // 弹出参数 + final Map parameterMap = new HashMap<>(); + final TemplateWorkBook tpl = getTemplateWorkBook(); + Parameter[] parameters = tpl.getParameters(); + if (parameters != null && parameters.length > 0) {// 检查Parameter. + final ParameterInputPane pPane = new ParameterInputPane( + parameters); + pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + + @Override + public void doOk() { + parameterMap.putAll(pPane.update()); + } + }).setVisible(true); + } + + // file choose + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); + + // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc + String fileName = source.getName(); + if (fileName.indexOf('.') != -1) { + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + } + fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); + if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error("Error In Make New File", exp); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + (progressbar = new FRProgressBar( + createExportWork(source, target, parameterMap), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100) + ).start(); + } + } + + private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + //bug 10516 + Thread.sleep(100); + OutputStream outputStream = null; + try { + outputStream = target.asOutputStream(); + this.setProgress(10); + dealExporter(outputStream, path, parameterMap); + this.setProgress(80); + outputStream.flush(); + outputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } finally { + if (outputStream != null) { + outputStream.close(); + } + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + + /* + * 这边判断是否有层式报表,有层式需要使用大数据量导出 + */ + protected boolean hasLayerReport(TemplateWorkBook tpl) { + if (tpl == null) { + return false; + } + for (int i = 0; i < tpl.getReportCount(); i++) { + Report r = tpl.getReport(i); + if (r instanceof WorkSheet) { + if (((WorkSheet) r).getLayerReportAttr() != null) { + return true; + } + } + } + + return false; + } + + + protected abstract String getDefaultExtension(); + + public String exportScopeName() { + return "FINE_BOOK"; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 54f8ef3570..0792e3a3e8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java @@ -5,47 +5,35 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.CSVExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageCSVExporter; +import com.fr.io.exporter.DesignExportType; import com.fr.main.TemplateWorkBook; /** * Export CSV. */ -public class CSVExportAction extends AbstractExportAction { +public class CSVExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ - public CSVExportAction(JWorkBook jwb) { - super(jwb); + public CSVExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.CSV_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/csv.png")); } - - @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageCSVExporter(); - } else { - return new CSVExporter(); - } - } @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.CSV, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_CSV")); + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(FileExtension.CSV, Toolkit.i18nText("Fine-Design_Report_Export_CSV")); } @Override - protected String getDefaultExtension() { + protected String getDefaultExtension() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (hasLayerReport(tpl)) { return FileExtension.ZIP.getExtension(); @@ -53,4 +41,9 @@ public class CSVExportAction extends AbstractExportAction { return FileExtension.CSV.getExtension(); } } + + @Override + public DesignExportType exportType() { + return DesignExportType.CSV; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index b11024bf8e..a5b97b9e63 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -2,19 +2,18 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.EmbeddedTableDataExporter; -import com.fr.io.exporter.Exporter; +import com.fr.io.exporter.DesignExportType; import java.util.EnumSet; /** * Export Embedded. */ -public class EmbeddedExportExportAction extends AbstractExportAction { +public class EmbeddedExportExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -26,15 +25,10 @@ public class EmbeddedExportExportAction extends AbstractExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); } - @Override - protected Exporter getExporter() { - return new EmbeddedTableDataExporter(); - } - @Override protected ChooseFileFilter getChooseFileFilter() { return new ChooseFileFilter(EnumSet.of(FileExtension.CPTX, FileExtension.CPT), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Template(Embedded_Data)")); + Toolkit.i18nText("Fine-Design_Report_Export_Template(Embedded_Data)")); } @Override @@ -42,4 +36,8 @@ public class EmbeddedExportExportAction extends AbstractExportAction { return getEditingComponent().suffix().substring(1); } + @Override + public DesignExportType exportType() { + return DesignExportType.EMBEDDED_WORKBOOK; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java index 42684c11ce..171a68ce8d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java @@ -3,31 +3,22 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class ExcelExportAction extends AbstractExcelExportAction { /** * Constructor */ - public ExcelExportAction(JWorkBook jwb) { - super(jwb); + public ExcelExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } - + @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), false); - } else { - return new ExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } + public DesignExportType exportType() { + return DesignExportType.EXCEL; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java index 6255d1af62..e98e383d23 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java @@ -5,42 +5,39 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.web.core.reserve.PDFExporterFactory; +import com.fr.io.exporter.DesignExportType; /** * Export pdf */ -public class PDFExportAction extends AbstractExportAction { +public class PDFExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ - public PDFExportAction(JWorkBook jwb) { - super(jwb); + public PDFExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.PDF_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+"..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); } @Override - protected Exporter getExporter() { - - return PDFExporterFactory.getPDFExporter(); + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(FileExtension.PDF, Toolkit.i18nText("Fine-Design_Report_Export_PDF")); } @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.PDF, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_PDF")); + protected String getDefaultExtension() { + return FileExtension.PDF.getExtension(); } @Override - protected String getDefaultExtension() { - return FileExtension.PDF.getExtension(); + public DesignExportType exportType() { + return DesignExportType.PDF; } - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java index ae5d814d87..3f69e3ecc0 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java @@ -3,29 +3,20 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageExcelExporter; -import com.fr.io.exporter.PageExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class PageExcelExportAction extends AbstractExcelExportAction { - public PageExcelExportAction(JWorkBook jwb) { - super(jwb); + public PageExcelExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.PAGE_EXCEL_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+"..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), true); - } else { - return new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } + public DesignExportType exportType() { + return DesignExportType.PAGE_EXCEL; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java index 934c39bb7b..087093004b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java @@ -2,14 +2,11 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.PageToSheetExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class PageToSheetExcelExportAction extends AbstractExcelExportAction { @@ -22,19 +19,19 @@ public class PageToSheetExcelExportAction extends AbstractExcelExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } - @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - return new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.XLS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel")); + return new ChooseFileFilter(FileExtension.XLS, Toolkit.i18nText("Fine-Design_Report_Export_Excel")); } @Override protected String getDefaultExtension() { return FileExtension.XLS.getExtension(); } + + @Override + public DesignExportType exportType() { + return DesignExportType.PAGE_TO_SHEET_EXCEL; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java index 027158bd09..198b9cb4ec 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java @@ -5,17 +5,16 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.SVGExporter; +import com.fr.io.exporter.DesignExportType; /** * Export SVG */ -public class SVGExportAction extends AbstractExportAction { +public class SVGExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -28,18 +27,18 @@ public class SVGExportAction extends AbstractExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/svg.png")); } - @Override - protected Exporter getExporter() { - return new SVGExporter(); - } - @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.SVG, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_SVG")); + return new ChooseFileFilter(FileExtension.SVG, Toolkit.i18nText("Fine-Design_Report_Export_SVG")); } @Override protected String getDefaultExtension() { return FileExtension.SVG.getExtension(); } + + @Override + public DesignExportType exportType() { + return DesignExportType.SVG; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java index 1028d55d9b..454435f273 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java @@ -5,20 +5,17 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.TextExporter; +import com.fr.io.exporter.DesignExportType; /** * Export Text. */ -public class TextExportAction extends AbstractExportAction { - /** - * Constructor - */ +public class TextExportAction extends AbstractJWorkBookExportAction { + public TextExportAction(JWorkBook jwb) { super(jwb); this.setMenuKeySet(KeySetUtils.TEXT_EXPORT); @@ -28,13 +25,13 @@ public class TextExportAction extends AbstractExportAction { } @Override - protected Exporter getExporter() { - return new TextExporter(); + public DesignExportType exportType() { + return DesignExportType.TEXT; } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.TXT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Text")); + return new ChooseFileFilter(FileExtension.TXT, Toolkit.i18nText("Fine-Design_Report_Export_Text")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java index 803a680c52..cc042b9e41 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java @@ -5,17 +5,16 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.WordExporter; +import com.fr.io.exporter.DesignExportType; /** * Export excel. */ -public class WordExportAction extends AbstractExportAction { +public class WordExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -28,13 +27,13 @@ public class WordExportAction extends AbstractExportAction { } @Override - protected Exporter getExporter() { - return new WordExporter(); + public DesignExportType exportType() { + return DesignExportType.WORD; } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.DOC, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Word")); + return new ChooseFileFilter(FileExtension.DOC, Toolkit.i18nText("Fine-Design_Report_Export_Word")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index e8f5bc5f72..88b88282bc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -635,8 +635,8 @@ public class JWorkBook extends JTemplate { @Override public ShortCut[] shortcut4FileMenu() { boolean showWorkBookExportMenu = DesignerMode.isVcsMode() - || DesignerMode.isAuthorityEditing() - || !WorkContext.getCurrent().isLocal(); + || DesignerMode.isAuthorityEditing(); +// || !WorkContext.getCurrent().isLocal(); return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java index 72fa9aba6f..81a02fbafe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java @@ -14,7 +14,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.log.FineLoggerFactory; @@ -58,7 +58,7 @@ class CptApp extends AbstractWorkBookApp { namestyle.clear(); try { tpl.readStream(file.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java index 9350100498..7e879f4034 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java @@ -4,7 +4,7 @@ import com.fr.base.extension.FileExtension; import com.fr.base.frpx.exception.FRPackageRunTimeException; import com.fr.base.frpx.exception.InvalidWorkBookException; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.log.FineLoggerFactory; @@ -38,7 +38,7 @@ class CptxApp extends AbstractWorkBookApp { FineLoggerFactory.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms"); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index f0b93cdf2c..6dd704488d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -7,7 +7,7 @@ import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.JTemplate; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.form.main.Form; @@ -57,7 +57,7 @@ class FormApp extends AbstractAppProvider { FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("file.getName()", file.getName()) + "..."); try { tpl.readStream(file.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java index 0118a8dac0..3741f8b35d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.io.importer.ExcelReportImporter; @@ -26,7 +26,7 @@ class XlsApp extends AbstractWorkBookApp { WorkBook workbook = null; try { workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java index fe3f11e508..9d66cffb8f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.io.importer.Excel2007ReportImporter; @@ -27,7 +27,7 @@ class XlsxApp extends AbstractWorkBookApp { try { workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 80edec701d..a674e1d50b 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -42,7 +42,7 @@ import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; -import com.fr.design.mainframe.actions.NewFormAction; +import com.fr.design.actions.NewFormAction; import com.fr.design.mainframe.bbs.BBSGuestPane; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.form.FormECCompositeProvider; From a4b73b80aeb47b248977f23dc8812aff22bc0678 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 16 Nov 2018 20:32:31 +0800 Subject: [PATCH 044/187] fix --- .../EmbeddedFormExportExportAction.java | 6 +-- .../export/AbstractExcelExportAction.java | 39 +++++++++---------- .../export/AbstractJWorkBookExportAction.java | 33 ++-------------- .../actions/file/export/CSVExportAction.java | 3 +- 4 files changed, 26 insertions(+), 55 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 758baeab6b..ba0d3e2107 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -127,7 +127,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); + return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); } private SwingWorker createExportWork(FILE source, final FILE target, final Map parameterMap) { @@ -138,9 +138,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected Void doInBackground() throws Exception { Thread.sleep(100); - try { - final OutputStream fileOutputStream = target.asOutputStream(); - + try (OutputStream fileOutputStream = target.asOutputStream()) { this.setProgress(10); dealExporter(fileOutputStream, path, parameterMap); this.setProgress(80); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index c4718c06f8..38afcb545d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -4,39 +4,38 @@ package com.fr.design.actions.file.export; import com.fr.base.ExcelUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.file.filter.ChooseFileFilter; - import com.fr.main.TemplateWorkBook; +import com.fr.report.core.ReportUtils; /** * Export excel. */ public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction { - /** - * Constructor - */ - protected AbstractExcelExportAction(JWorkBook jwb) { - super(jwb); + + protected AbstractExcelExportAction(JWorkBook jwb) { + super(jwb); } @Override - protected ChooseFileFilter getChooseFileFilter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); - } else { - return new ChooseFileFilter(new String[]{"xls", "xlsx"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel")); - } + protected ChooseFileFilter getChooseFileFilter() { + TemplateWorkBook tpl = this.getTemplateWorkBook(); + if (ReportUtils.hasLayerReport4Template(tpl)) { + return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); + } else { + return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Toolkit.i18nText("Fine-Design_Report_Export_Excel")); + } } @Override - protected String getDefaultExtension() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return "zip"; - } else { - return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; - } + protected String getDefaultExtension() { + TemplateWorkBook tpl = this.getTemplateWorkBook(); + if (ReportUtils.hasLayerReport4Template(tpl)) { + return "zip"; + } else { + return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; + } } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index e051edb4c8..ae4acc9cea 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -15,8 +15,6 @@ import com.fr.file.FILEChooserPane; import com.fr.log.FineLoggerFactory; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; -import com.fr.report.report.Report; -import com.fr.report.worksheet.WorkSheet; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.exporter.TemplateExportOperator; @@ -40,6 +38,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction super(jwb); } + protected WorkBook getTemplateWorkBook() { return this.getEditingComponent().getTarget(); } @@ -50,7 +49,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction @Override public void actionPerformed(ActionEvent e) { - // todo 弹出提醒保存,如果没保存 + // todo 弹出提醒保存,如果没保存。。。 JWorkBook jwb = this.getEditingComponent(); @@ -113,9 +112,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction protected Void doInBackground() throws Exception { //bug 10516 Thread.sleep(100); - OutputStream outputStream = null; - try { - outputStream = target.asOutputStream(); + try (OutputStream outputStream = target.asOutputStream()) { this.setProgress(10); dealExporter(outputStream, path, parameterMap); this.setProgress(80); @@ -138,10 +135,6 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); - } finally { - if (outputStream != null) { - outputStream.close(); - } } return null; } @@ -169,26 +162,6 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction } } - /* - * 这边判断是否有层式报表,有层式需要使用大数据量导出 - */ - protected boolean hasLayerReport(TemplateWorkBook tpl) { - if (tpl == null) { - return false; - } - for (int i = 0; i < tpl.getReportCount(); i++) { - Report r = tpl.getReport(i); - if (r instanceof WorkSheet) { - if (((WorkSheet) r).getLayerReportAttr() != null) { - return true; - } - } - } - - return false; - } - - protected abstract String getDefaultExtension(); public String exportScopeName() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 0792e3a3e8..8ecced355c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java @@ -11,6 +11,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; import com.fr.main.TemplateWorkBook; +import com.fr.report.core.ReportUtils; /** * Export CSV. @@ -35,7 +36,7 @@ public class CSVExportAction extends AbstractJWorkBookExportAction { @Override protected String getDefaultExtension() { TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { + if (ReportUtils.hasLayerReport4Template(tpl)) { return FileExtension.ZIP.getExtension(); } else { return FileExtension.CSV.getExtension(); From 89f1c7b2f9157b273e64aba82b5f0c7872ec84b4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 10:37:45 +0800 Subject: [PATCH 045/187] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 192 ++++++++++++++++++ .../EmbeddedFormExportExportAction.java | 128 +----------- .../export/AbstractJWorkBookExportAction.java | 131 +----------- 3 files changed, 210 insertions(+), 241 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 3423536c5a..f47818687c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,20 +1,212 @@ package com.fr.design.actions.file.export; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.JTemplateAction; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.TemplateExportOperator; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import javax.swing.UIManager; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.Map; public abstract class AbstractExportAction> extends JTemplateAction { + private FRProgressBar progressbar; + public AbstractExportAction(E t) { super(t); } + /** + * 导出接口名 + * + * @return String scopeName + */ public abstract String exportScopeName(); + /** + * 导出类型 + * + * @return DesignExportType tyoe + */ public abstract DesignExportType exportType(); + /** + * 目标文件过滤器 + * + * @return ChooseFileFilter filter + */ protected abstract ChooseFileFilter getChooseFileFilter(); + /** + * 目标文件扩展名 + * + * @return String extensionName + */ + protected abstract String getDefaultExtension(); + + /** + * 处理参数 + * + * @return Map para + */ + protected abstract Map processParameter(); + + + /** + * 执行方法 + */ + @Override + public void actionPerformed(ActionEvent e) { + + if (!processNotSaved()) { + return; + } + + Map para = processParameter(); + + // 选择输入的文件 + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); + + + String fileName = getTargetFileName(); + fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); + if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error("Error In Make New File", exp); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + + progressbar = new FRProgressBar( + createExportWork(getSource(), target, para), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100); + + progressbar.start(); + } + } + + private FILE getSource() { + return this.getEditingComponent().getEditingFILE(); + } + + private String getTargetFileName() { + FILE source = getSource(); + // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc + String fileName = source.getName(); + if (fileName.indexOf('.') != -1) { + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + } + return fileName; + } + + private boolean processNotSaved() { + //当前编辑的模板 + E e = getEditingComponent(); + if (!e.isALLSaved() && !DesignerMode.isVcsMode()) { + e.stopEditing(); + int returnVal = JOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?", + ProductConstants.PRODUCT_NAME, + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE + ); + if (returnVal == JOptionPane.YES_OPTION) { + e.saveTemplate(); + FineLoggerFactory.getLogger().info( + Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", e.getEditingFILE().getName()) + ); + return true; + } else { + return false; + } + } else { + return true; + } + } + + private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + //bug 10516 + Thread.sleep(100); + try (OutputStream outputStream = target.asOutputStream()) { + this.setProgress(10); + dealExporter(outputStream, path, parameterMap); + this.setProgress(80); + outputStream.flush(); + outputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index ba0d3e2107..bce7491a79 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -3,30 +3,17 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportType; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import java.awt.event.ActionEvent; -import java.io.OutputStream; import java.util.HashMap; import java.util.Map; @@ -35,7 +22,6 @@ import java.util.Map; */ public class EmbeddedFormExportExportAction extends AbstractExportAction { - private FRProgressBar progressbar; public EmbeddedFormExportExportAction(JForm jwb) { super(jwb); @@ -50,72 +36,27 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction return "FINE_FORM"; } + @Override + protected String getDefaultExtension() { + return ProjectConstants.FRM_SUFFIX; + } + @Override public DesignExportType exportType() { return DesignExportType.EMBEDDED_FORM; } - /** - * Action触发事件 - * - * @param e 触发事件 - */ @Override - public void actionPerformed(ActionEvent e) { - - // todo 提示保存 - JTemplate jwb = this.getEditingComponent(); - FILE source = jwb.getEditingFILE(); - + protected Map processParameter() { // 输入参数 final Map parameterMap = new HashMap(); - final Form tpl = this.getEditingComponent().getTarget(); - inputParameter(parameterMap, tpl, DesignerContext.getDesignerFrame()); - - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); - fileChooserPane.setFILEFilter(this.getChooseFileFilter()); - - String fileName = source.getName(); - fileChooserPane.setFileNameTextField(fileName, ProjectConstants.FRM_SUFFIX); - int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), ProjectConstants.FRM_SUFFIX); - - if (isOk(saveValue)) { - startExport(source, parameterMap, fileChooserPane); - } - } - - private void startExport(FILE source, Map parameterMap, - FILEChooserPane fileChooserPane) { - FILE target = fileChooserPane.getSelectedFILE(); - try { - target.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = - new FRProgressBar( - createExportWork(source, target, parameterMap), - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exporting"), - StringUtils.EMPTY, - 0, - 100) - ).start(); - } - - private boolean isOk(int saveValue) { - return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; - } - + Form tpl = this.getEditingComponent().getTarget(); - private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame) { Parameter[] parameters = tpl.getParameters(); // 检查Parameter. if (ArrayUtils.isNotEmpty(parameters)) { final ParameterInputPane pPane = new ParameterInputPane(parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { + pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -123,61 +64,12 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction } }).setVisible(true); } + return parameterMap; } + @Override protected ChooseFileFilter getChooseFileFilter() { return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); } - - private SwingWorker createExportWork(FILE source, final FILE target, final Map parameterMap) { - final String path = source.getPath(); - final String name = target.getName(); - - return new SwingWorker() { - @Override - protected Void doInBackground() throws Exception { - Thread.sleep(100); - try (OutputStream fileOutputStream = target.asOutputStream()) { - this.setProgress(10); - dealExporter(fileOutputStream, path, parameterMap); - this.setProgress(80); - fileOutputStream.flush(); - fileOutputStream.close(); - this.setProgress(100); - - FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - } - - private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { - - // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 - // todo 后续想想办法 - if (WorkContext.getCurrent().isLocal()) { - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); - } else { - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); - - outputStream.write(contents); - } - } - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index ae4acc9cea..907b378a75 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -5,25 +5,12 @@ package com.fr.design.actions.file.export; import com.fr.base.Parameter; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.log.FineLoggerFactory; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; -import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import javax.swing.UIManager; -import java.awt.event.ActionEvent; -import java.io.OutputStream; import java.util.HashMap; import java.util.Map; @@ -32,7 +19,6 @@ import java.util.Map; */ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { - private FRProgressBar progressbar; protected AbstractJWorkBookExportAction(JWorkBook jwb) { super(jwb); @@ -43,128 +29,27 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction return this.getEditingComponent().getTarget(); } - /** - * 执行方法 - */ - @Override - public void actionPerformed(ActionEvent e) { - - // todo 弹出提醒保存,如果没保存。。。 - - - JWorkBook jwb = this.getEditingComponent(); - FILE source = jwb.getEditingFILE(); + public String exportScopeName() { + return "FINE_BOOK"; + } + @Override + protected Map processParameter() { // 弹出参数 final Map parameterMap = new HashMap<>(); final TemplateWorkBook tpl = getTemplateWorkBook(); Parameter[] parameters = tpl.getParameters(); - if (parameters != null && parameters.length > 0) {// 检查Parameter. + // 检查Parameter + if (parameters != null && parameters.length > 0) { final ParameterInputPane pPane = new ParameterInputPane( parameters); pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override public void doOk() { parameterMap.putAll(pPane.update()); } }).setVisible(true); } - - // file choose - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); - fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); - - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc - String fileName = source.getName(); - if (fileName.indexOf('.') != -1) { - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - } - fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); - int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); - if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { - FILE target = fileChooserPane.getSelectedFILE(); - try { - target.mkfile(); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error("Error In Make New File", exp); - } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar( - createExportWork(source, target, parameterMap), - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exporting"), - StringUtils.EMPTY, - 0, - 100) - ).start(); - } - } - - private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { - final String path = source.getPath(); - final String name = target.getName(); - - return new SwingWorker() { - - @Override - protected Void doInBackground() throws Exception { - //bug 10516 - Thread.sleep(100); - try (OutputStream outputStream = target.asOutputStream()) { - this.setProgress(10); - dealExporter(outputStream, path, parameterMap); - this.setProgress(80); - outputStream.flush(); - outputStream.close(); - this.setProgress(100); - - FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); - } catch (Exception exp) { - this.setProgress(100); - target.closeTemplate(); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, - null, - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon") - ); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - } - - private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { - - // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 - // todo 后续想想办法 - if (WorkContext.getCurrent().isLocal()) { - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); - } else { - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); - - outputStream.write(contents); - } - } - - protected abstract String getDefaultExtension(); - - public String exportScopeName() { - return "FINE_BOOK"; + return parameterMap; } } From 9b7a4882a9816d613d529dc434b1cf82ac6fdbc1 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 10:39:40 +0800 Subject: [PATCH 046/187] f --- .../actions/file/export/EmbeddedFormExportExportAction.java | 4 +++- .../actions/file/export/AbstractJWorkBookExportAction.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index bce7491a79..0056710e4c 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -17,6 +17,8 @@ import com.fr.stable.project.ProjectConstants; import java.util.HashMap; import java.util.Map; +import static com.fr.io.exporter.DesignExportScope.FINE_FORM; + /** * Export Embedded. */ @@ -33,7 +35,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override public String exportScopeName() { - return "FINE_FORM"; + return FINE_FORM.toString(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index 907b378a75..63362e5d41 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -14,6 +14,8 @@ import com.fr.main.impl.WorkBook; import java.util.HashMap; import java.util.Map; +import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; + /** * Abstract export action. */ @@ -30,7 +32,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction } public String exportScopeName() { - return "FINE_BOOK"; + return FINE_BOOK.toString(); } @Override From c396d3469f57b0bd217847c7cd25ee0050b3e604 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 19 Nov 2018 15:02:39 +0800 Subject: [PATCH 047/187] =?UTF-8?q?REPORT-10535=09=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=80=82=E9=85=8D=E5=8A=9F=E8=83=BD=E2=80=94=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AFTAB=E7=BB=84=E4=BB=B6=E5=A4=9A=E6=A0=B7?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/FRGUIPaneFactory.java | 11 + .../ui/DefaultMobileStyleDefinePane.java | 97 ++++++++ .../mobile/ui/DownMenuStyleDefinePane.java | 174 ++++++++++++++ .../design/mainframe/mobile/ui/LinePane.java | 108 +++++++++ .../ui/MobileTemplateStyleDefinePane.java | 219 ++++++++++++++++++ .../mobile/ui/SliderStyleDefinePane.java | 150 ++++++++++++ .../ui/StyleDefinePaneWithSelectConf.java | 113 +++++++++ .../mobile/ui/TabIconConfigPane.java | 172 ++++++++++++++ .../ui/TemplateStyleDefinePaneFactory.java | 55 +++++ .../mobile/ui/UpMenuStyleDefinePane.java | 211 +++++++++++++++++ .../widget/MobileTabFontConfPane.java | 143 ++++++++++++ .../mainframe/widget/UITitleSplitLine.java | 69 ++++++ .../AbstractTemplateStylePane.java | 10 + .../AccessibleTemplateStyleEditor.java | 13 +- .../accessibles/MobileTemplateStylePane.java | 113 +++++++++ .../widget/accessibles/TemplateStylePane.java | 5 +- .../accessibles/TemplateStylePreviewPane.java | 14 +- .../preview/MobileTemplatePreviewPane.java | 53 +++++ .../creator/cardlayout/XWCardTagLayout.java | 6 + .../mobile/TabMobilePropertyUI.java | 30 +++ .../layout/WCardTagLayoutDefinePane.java | 3 +- .../mobile/TabMobileWidgetDefinePane.java | 69 ++++++ 22 files changed, 1818 insertions(+), 20 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index db48cf9950..09eaad466b 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -251,6 +251,17 @@ public class FRGUIPaneFactory { return jp; } + + /** + * 创建一个靠左流式布局,流式内嵌 + * + * @return JPanel对象 + */ + public static JPanel createBoxFlowInnerContainerPane(int hgap, int vgap) { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap)); + return jp; + } /** * 创建一个靠左流式布局,流式内嵌,首元素距离左边0 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java new file mode 100644 index 0000000000..b42f1a6cee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -0,0 +1,97 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import java.awt.BasicStroke; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { + + public DefaultMobileStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + updatePreviewPane(); + } + + protected void createConfigPane() { + + } + + @Override + protected void initDefaultConfig() { + + } + + @Override + public MobileTemplateStyle updateSubStyle() { + return null; + } + + @Override + public MobileTemplateStyle updateBean() { + return new DefaultMobileTemplateStyle(); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new DefaultMobileTemplateStyle(); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + protected MobileTemplatePreviewPane createPreviewPane() { + return new DefaultStylePreviewPane(); + } + + public class DefaultStylePreviewPane extends MobileTemplatePreviewPane { + + public DefaultStylePreviewPane() { + this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + if (i == 0) { + g2d.setStroke(new BasicStroke(2.0f)); + g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); + } + g2d.translate(eachWidth, 0); + } + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java new file mode 100644 index 0000000000..b8f267e98c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -0,0 +1,174 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.base.IconManager; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.util.ArrayList; + +public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { + private LinePane splitLinePane; + private TabIconConfigPane initIconConfigPane; + private TabIconConfigPane selectIconConfigPane; + + public DownMenuStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected void createExtraConfPane(JPanel centerPane) { + UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520); + iconSplitLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(iconSplitLine); + + initIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount()); + selectIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount()); + + UILabel initIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Initial_Icon")); + UILabel selectIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Icon")); + initIconLabel.setPreferredSize(new Dimension(55, 20)); + selectIconLabel.setPreferredSize(new Dimension(55, 20)); + JPanel initIconContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initIconLabel, initIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + initIconContainPane.setPreferredSize(new Dimension(240, 50)); + selectIconContainePane.setPreferredSize(new Dimension(240, 50)); + centerPane.add(initIconContainPane); + centerPane.add(selectIconContainePane); + UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); + splitLine.setPreferredSize(new Dimension(520, 20)); + splitLinePane = new LinePane(); + splitLinePane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + centerPane.add(splitLine); + centerPane.add(splitLinePane); + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(DownMenuStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(DownMenuStyle.DEFAULT_TAB_FONT.getFont()); + this.selectColorBox.setSelectObject(DownMenuStyle.DEFAULT_SELECT_COLOR); + this.selectFontColor.setColor(DownMenuStyle.DEFAULT_SELECT_FONT_COLOR); + this.splitLinePane.populate(DownMenuStyle.DEFAULT_SPLIT_LINE); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new DownMenuStylePreviewPane(); + } + + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + DownMenuStyle downMenuStyle = (DownMenuStyle) ob; + splitLinePane.populate(downMenuStyle.getSplitLine()); + ArrayList initialIconNames = new ArrayList(); + ArrayList selectIconNames = new ArrayList(); + for (int i = 0; i < getTagLayout().getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i); + initialIconNames.add(cardSwitchButton.getInitIconName()); + selectIconNames.add(cardSwitchButton.getSelectIconName()); + } + initIconConfigPane.populate(initialIconNames); + selectIconConfigPane.populate(selectIconNames); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new DownMenuStyle(); + } + + @Override + public MobileTemplateStyle updateStyleWithSelectConf() { + DownMenuStyle downMenuStyle = new DownMenuStyle(); + downMenuStyle.setSplitLine(splitLinePane.update()); + ArrayList initialIconNames = initIconConfigPane.update(); + ArrayList selectIconNames = selectIconConfigPane.update(); + for (int i = 0; i < getTagLayout().getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i); + cardSwitchButton.setInitIconName(initialIconNames.get(i)); + cardSwitchButton.setSelectIconName(selectIconNames.get(i)); + } + return downMenuStyle; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane { + private LineDescription splitLine; + private static final String PAINT_ICON = "fund_white"; + + public DownMenuStylePreviewPane() { + this.setBackground(Color.decode("#3888EE")); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Color selectFontColor = this.getTabFontConfig().getSelectColor(); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = this.getTabFontConfig().getFont(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setFont(frFont); + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + String iconName = PAINT_ICON; + g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - 18) / 2, 6, null); + g2d.drawString(widgetName, (eachWidth - width) / 2, panelHeight / 2 + 9); + if (splitLine.getLineStyle() != 0) { + g2d.setColor(splitLine.getColor()); + + g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); + } + + g2d.translate(eachWidth, 0); + + } + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.splitLine = ((DownMenuStyle) templateStyle).getSplitLine(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java new file mode 100644 index 0000000000..fabc7ca5bf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java @@ -0,0 +1,108 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.stable.CoreConstants; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +public class LinePane extends JPanel { + private LineComboBox lineStyle; + private NewColorSelectBox lineColor; + private EventListenerList lineChangeListener = new EventListenerList(); + + public LinePane() { + init(); + } + + private void init() { + this.setLayout(new VerticalFlowLayout(FlowLayout.CENTER, 0, 10)); + this.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + UILabel lineLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); + UILabel colorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors")); + lineLabel.setPreferredSize(new Dimension(55, 20)); + colorLabel.setPreferredSize(new Dimension(55, 20)); + + lineStyle = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + lineStyle.setPreferredSize(new Dimension(152, 20)); + lineColor = new NewColorSelectBox(137); + lineStyle.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireLineStateChanged(); + } + }); + lineColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireLineStateChanged(); + } + }); + this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{lineLabel, lineStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM)); + this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{colorLabel, lineColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM)); + } + + public LineDescription update() { + LineDescription lineDescription = new LineDescription(); + lineDescription.setColor(lineColor.getSelectObject()); + lineDescription.setLineStyle(lineStyle.getSelectedLineStyle()); + return lineDescription; + } + + public void populate(LineDescription lineDescription) { + lineStyle.setSelectedLineStyle(lineDescription.getLineStyle()); + lineColor.setSelectObject(lineDescription.getColor()); + } + + + /** + * 添加监听 + * + * @param changeListener 监听列表 + */ + public void addLineChangeListener(ChangeListener changeListener) { + lineChangeListener.add(ChangeListener.class, changeListener); + } + + /** + * 移除监听 + * Removes an old ColorChangeListener. + * + * @param changeListener 监听列表 + */ + public void removeLineChangeListener(ChangeListener changeListener) { + lineChangeListener.remove(ChangeListener.class, changeListener); + } + + /** + * 颜色状态改变 + */ + public void fireLineStateChanged() { + Object[] listeners = lineChangeListener.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java new file mode 100644 index 0000000000..a1d487ab7f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -0,0 +1,219 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.dialog.AttrScrollPane; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.MobileTabFontConfPane; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane { + private UIComboBox custom; + protected NewColorSelectBox initialColorBox; + protected MobileTabFontConfPane fontConfPane; + private JPanel centerPane; + protected MobileTemplatePreviewPane previewPane; + private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; + private WCardTagLayout tagLayout; + + + public MobileTemplatePreviewPane getPreviewPane() { + return previewPane; + } + + public MobileTemplateStyleDefinePane(WCardTagLayout tagLayout) { + this.tagLayout = tagLayout; + init(); + } + + + public WCardTagLayout getTagLayout() { + return tagLayout; + } + + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + previewPane = createPreviewPane(); + previewPane.setPreferredSize(new Dimension(500, 60)); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null); + titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE)); + northPane.setBorder(titledBorder); + northPane.setPreferredSize(new Dimension(500, 83)); + northPane.add(previewPane, BorderLayout.CENTER); + this.add(northPane, BorderLayout.NORTH); + createConfigPane(); + + } + + protected void createConfigPane() { + JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null); + titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE)); + configPane.setBorder(titledBorder); + centerPane = createCenterPane(); + custom = new UIComboBox(TAB_STYLES); + custom.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean isCustom = custom.getSelectedIndex() == 1; + centerPane.setVisible(isCustom); + updatePreviewPane(); + } + }); + centerPane.setVisible(false); + custom.setPreferredSize(new Dimension(157, 20)); + final JPanel scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + BasicScrollPane basicScrollPane = new AttrScrollPane() { + @Override + protected JPanel createContentPane() { + return scrollPanel; + } + }; + configPane.add(basicScrollPane, BorderLayout.CENTER); + this.add(configPane, BorderLayout.CENTER); + + JPanel outPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + outPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20)); + UILabel tabStyleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Style")); + tabStyleLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabStyleLabel, custom}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel.setPreferredSize(new Dimension(200, 20)); + outPanel.add(jPanel); + scrollPanel.add(outPanel, BorderLayout.NORTH); + + UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520); + backgroundSplit.setPreferredSize(new Dimension(520, 20)); + centerPane.add(backgroundSplit); + + centerPane.add(createBackgroundConfPane()); + + UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520); + fontSplit.setPreferredSize(new Dimension(520, 20)); + centerPane.add(fontSplit); + + centerPane.add(createFontConfPane()); + + createExtraConfPane(centerPane); + + scrollPanel.add(centerPane, BorderLayout.CENTER); + initDefaultConfig(); + } + + protected JPanel createCenterPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + return panel; + } + + protected JPanel createBackgroundConfPane() { + initialColorBox = new NewColorSelectBox(137); + initialColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel fillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")); + fillLabel.setPreferredSize(new Dimension(55, 20)); + JPanel boxFlowPane = FRGUIPaneFactory.createBoxFlowInnerContainerPane(10, 0); + boxFlowPane.add(fillLabel); + boxFlowPane.add(initialColorBox); + initialColorBox.setPreferredSize(new Dimension(157, 20)); + boxFlowPane.setPreferredSize(new Dimension(500, 20)); + boxFlowPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + return boxFlowPane; + } + + protected JPanel createFontConfPane() { + fontConfPane = new MobileTabFontConfPane(); + fontConfPane.addFontChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char")); + initCharLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel3 = FRGUIPaneFactory.createBoxFlowInnerContainerPane(5, 0); + jPanel3.add(initCharLabel); + jPanel3.add(fontConfPane); + jPanel3.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + return jPanel3; + } + + + protected void createExtraConfPane(JPanel centerPane) { + + } + + protected abstract void initDefaultConfig(); + + protected abstract MobileTemplatePreviewPane createPreviewPane(); + + @Override + public void populateBean(MobileTemplateStyle ob) { + centerPane.setVisible(ob.isCustom()); + custom.setSelectedItem(ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") : + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")); + initialColorBox.setSelectObject(ob.getInitialColor()); + fontConfPane.populate(ob.getTabFontConfig().getFont()); + updatePreviewPane(); + } + + + @Override + public MobileTemplateStyle updateBean() { + if (custom.getSelectedIndex() == 0) { + return getDefaultTemplateStyle(); + } + MobileTemplateStyle ob = updateSubStyle(); + ob.setCustom(custom.getSelectedIndex() == 1); + ob.setInitialColor(initialColorBox.getSelectObject()); + TabFontConfig config = ob.getTabFontConfig(); + config.setFont(fontConfPane.update()); + return ob; + } + + protected abstract MobileTemplateStyle getDefaultTemplateStyle(); + + public void updatePreviewPane() { + previewPane.populateConfig(updateBean()); + previewPane.setBackground(previewPane.getInitialColor()); + previewPane.repaint(); + } + + public abstract MobileTemplateStyle updateSubStyle(); + + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java new file mode 100644 index 0000000000..4765edc52f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -0,0 +1,150 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { + private NewColorSelectBox initDotColor; + private NewColorSelectBox selectDotColor; + + + public SliderStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + SliderStyle sliderStyle = (SliderStyle) ob; + initDotColor.setSelectObject(sliderStyle.getInitDotColor()); + selectDotColor.setSelectObject(sliderStyle.getSelectDotColor()); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new SliderStyle(); + } + + @Override + public MobileTemplateStyle updateSubStyle() { + SliderStyle sliderStyle = new SliderStyle(); + sliderStyle.setInitDotColor(initDotColor.getSelectObject()); + sliderStyle.setSelectDotColor(selectDotColor.getSelectObject()); + return sliderStyle; + } + + + protected void createExtraConfPane(JPanel centerPane) { + UITitleSplitLine dotIndicator = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Dot_Indicator"), 520); + dotIndicator.setPreferredSize(new Dimension(520, 20)); + centerPane.add(dotIndicator); + initDotColor = new NewColorSelectBox(137); + initDotColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + selectDotColor = new NewColorSelectBox(137); + selectDotColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill")); + + UILabel selectColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill")); + initColor.setPreferredSize(new Dimension(55, 20)); + selectColor.setPreferredSize(new Dimension(55, 20)); + JPanel initDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initColor, initDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + initDotColorPane.setPreferredSize(new Dimension(240, 20)); + selectDotColorPane.setPreferredSize(new Dimension(240, 20)); + centerPane.add(initDotColorPane); + centerPane.add(selectDotColorPane); + + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(SliderStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(SliderStyle.DEFAULT_TAB_FONT.getFont()); + initDotColor.setSelectObject(SliderStyle.DEFAULT_INITIAL_DOT_COLOR); + selectDotColor.setSelectObject(SliderStyle.DEFAULT_SELECT_DOT_COLOR); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new SliderStylePreviewPane(); + } + + + @Override + protected String title4PopupWindow() { + return null; + } + + + public class SliderStylePreviewPane extends MobileTemplatePreviewPane { + private Color initDotColor; + private Color selectDotColor; + + public SliderStylePreviewPane() { + + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = this.getTabFontConfig().getFont(); + g2d.setFont(frFont); + g2d.setColor(frFont.getForeground()); + g2d.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Title"), 10, 18); + WCardTagLayout cardTagLayout = SliderStyleDefinePane.this.getTagLayout(); + g2d.translate(10, 25); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + if (i == 0) { + g2d.setColor(selectDotColor); + g2d.fillOval(0, 0, 6, 6); + g2d.translate(9, 0); + continue; + } + g2d.setColor(initDotColor); + g2d.fillOval(0, 0, 6, 6); + g2d.translate(9, 0); + } + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.initDotColor = ((SliderStyle) templateStyle).getInitDotColor(); + this.selectDotColor = ((SliderStyle) templateStyle).getSelectDotColor(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java new file mode 100644 index 0000000000..9096fc9571 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java @@ -0,0 +1,113 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.MobileTabFontConfPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; + +public abstract class StyleDefinePaneWithSelectConf extends MobileTemplateStyleDefinePane { + + protected NewColorSelectBox selectColorBox; + protected UIColorButton selectFontColor; + + public StyleDefinePaneWithSelectConf(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected JPanel createBackgroundConfPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + initialColorBox = new NewColorSelectBox(137); + initialColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + + selectColorBox = new NewColorSelectBox(137); + selectColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill")); + UILabel selectFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill")); + initFillLabel.setPreferredSize(new Dimension(55, 20)); + selectFillLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initFillLabel, initialColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectFillLabel, selectColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel2.setPreferredSize(new Dimension(240, 20)); + jPanel3.setPreferredSize(new Dimension(240, 20)); + panel.add(jPanel2); + panel.add(jPanel3); + return panel; + } + + protected JPanel createFontConfPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + fontConfPane = new MobileTabFontConfPane(); + fontConfPane.addFontChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + selectFontColor = new UIColorButton(); + selectFontColor.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + + updatePreviewPane(); + } + }); + UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char")); + initCharLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initCharLabel, fontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel3.setPreferredSize(new Dimension(500, 20)); + + UILabel selectCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char")); + selectCharLabel.setPreferredSize(new Dimension(55, 20)); + selectFontColor.setPreferredSize(new Dimension(20, 20)); + JPanel jPanel4 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectCharLabel, selectFontColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel jPanel5 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + jPanel5.setPreferredSize(new Dimension(500, 20)); + jPanel5.add(jPanel4); + panel.add(jPanel3); + panel.add(jPanel5); + return panel; + } + + @Override + public MobileTemplateStyle updateSubStyle() { + MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf(); + mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject()); + mobileTemplateStyle.getTabFontConfig().setSelectColor(selectFontColor.getColor()); + return mobileTemplateStyle; + } + + protected abstract MobileTemplateStyle updateStyleWithSelectConf(); + + @Override + public void populateBean(MobileTemplateStyle mobileTemplateStyle) { + super.populateBean(mobileTemplateStyle); + selectColorBox.setSelectObject(mobileTemplateStyle.getSelectColor()); + selectFontColor.setColor(mobileTemplateStyle.getTabFontConfig().getSelectColor()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java new file mode 100644 index 0000000000..6f424e19e0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java @@ -0,0 +1,172 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.base.IconManager; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.web.CustomIconPane; +import com.fr.form.ui.WidgetInfoConfig; +import com.fr.general.ComparatorUtils; +import com.fr.stable.Constants; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; + +public class TabIconConfigPane extends JPanel { + private UIButton editIconButton; + private String curIconName; + private IconButton selectIconButton; + private ArrayList iconButtons = new ArrayList(); + + public TabIconConfigPane(int count) { + initComp(count); + } + + public void initComp(int count) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + editIconButton.setPreferredSize(new Dimension(62, 20)); + panel.add(editIconButton); + editIconButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final CustomIconPane cip = new CustomIconPane(); + BasicDialog editDialog = cip.showWindow(DesignerContext.getDesignerFrame()); + editDialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + curIconName = cip.update(); + setShowIconImage(); + TabIconConfigPane.this.repaint(); + } + }); + editDialog.setVisible(true); + } + }); + editIconButton.setEnabled(false); + this.add(panel, BorderLayout.CENTER); + + JPanel northPane = new JPanel(); + northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + for (int i = 0; i < count; i++) { + IconButton iconButton = new IconButton(""); + northPane.add(iconButton); + iconButtons.add(iconButton); + } + this.add(northPane, BorderLayout.NORTH); + } + + public void setShowIconImage() { + selectIconButton.setIconName(curIconName); + } + + public void populate(ArrayList iconArr) { + for (int i = 0; i < iconButtons.size(); i++) { + iconButtons.get(i).setIconName(iconArr.get(i)); + } + } + + public ArrayList update() { + ArrayList iconNames = new ArrayList(); + for (int i = 0; i < iconButtons.size(); i++) { + iconNames.add(iconButtons.get(i).getIconName()); + } + return iconNames; + } + + + private class IconButton extends JToggleButton implements ActionListener { + private String iconName; + private Image iconImage = null; + private static final int ICON_BUTTON_SIZE = 20; + private static final int ICON_X = 2; + private static final int ICON_Y = 2; + + public IconButton(String name) { + this.iconName = name; + this.addActionListener(this); + this.setBackground(Color.WHITE); + this.setCursor(new Cursor(Cursor.HAND_CURSOR)); + this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); + } + + @Override + public void updateUI() { + setUI(new BasicButtonUI() { + public void paint(Graphics g, JComponent c) { + super.paint(g, c); + } + }); + } + + public String getIconName() { + return iconName; + } + + public void setIconName(String iconName) { + this.iconName = iconName; + this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2d = (Graphics2D) g; + // carl:这里缩放显示 16 × 16 + if (iconImage != null) { + g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); + } + if (this.iconName != null && ComparatorUtils.equals(this, selectIconButton)) { + g2d.setPaint(Color.decode("#419BF9")); + } else { + g2d.setPaint(Color.decode("#D9DADD")); + } + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, 20, 20), Constants.LINE_MEDIUM); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE); + } + + public void actionPerformed(ActionEvent evt) { + selectIconButton = this; + editIconButton.setEnabled(true); + TabIconConfigPane.this.repaint();// repaint + } + + @Override + public void addChangeListener(ChangeListener changeListener) { + this.changeListener = changeListener; + } + + private void fireChagneListener() { + if (this.changeListener != null) { + ChangeEvent evt = new ChangeEvent(this); + this.changeListener.stateChanged(evt); + } + } + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java new file mode 100644 index 0000000000..3f923707d8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +public class TemplateStyleDefinePaneFactory { + private static Map defineMap = new HashMap(); + + static { + defineMap.put(DefaultMobileTemplateStyle.STYLE_NAME, new StyleDefinePaneUI(DefaultMobileStyleDefinePane.class)); + defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class)); + defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class)); + defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class)); + } + + public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { + StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); + Class> clazz = styleDefinePaneUI.getaClass(); + if (clazz == null) { + } + BasicBeanPane quickPane = null; + try { + quickPane = Reflect.on(clazz).create(tagLayout).get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return quickPane; + } + + private static class StyleDefinePaneUI { + private Class> aClass; + + public StyleDefinePaneUI(Class> aClass) { + this.aClass = aClass; + } + + public Class> getaClass() { + return aClass; + } + + public void setaClass(Class> aClass) { + this.aClass = aClass; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java new file mode 100644 index 0000000000..41265faefe --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -0,0 +1,211 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { + private UIRadioButton gapFix; + private UIRadioButton titleWidthFix; + private LinePane bottomBorderPane; + private LinePane underLinePane; + + public UpMenuStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected JPanel createCenterPane() { + JPanel panel = super.createCenterPane(); + UILabel displayGap = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Display_Gap")); + displayGap.setPreferredSize(new Dimension(55, 20)); + gapFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Gap_Fix")); + titleWidthFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Title_Width_Fix")); + ButtonGroup buttonGroup = new ButtonGroup(); + titleWidthFix.setSelected(true); + buttonGroup.add(gapFix); + gapFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + titleWidthFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + buttonGroup.add(titleWidthFix); + gapFix.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + titleWidthFix.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + + + JPanel flowLeft = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + flowLeft.add(gapFix); + flowLeft.add(titleWidthFix); + JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{displayGap, flowLeft}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20)); + centerPane.setPreferredSize(new Dimension(500, 20)); + JPanel outerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + outerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0)); + outerPane.add(centerPane, BorderLayout.CENTER); + panel.add(outerPane); + return panel; + } + + protected void createExtraConfPane(JPanel centerPane) { + bottomBorderPane = new LinePane(); + underLinePane = new LinePane(); + bottomBorderPane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + underLinePane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UITitleSplitLine titleSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); + titleSplitLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(titleSplitLine); + centerPane.add(bottomBorderPane); + UITitleSplitLine titleUnderLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Under_Line"), 520); + titleUnderLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(titleUnderLine); + centerPane.add(underLinePane); + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(UpMenuStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(UpMenuStyle.DEFAULT_TAB_FONT.getFont()); + this.selectColorBox.setSelectObject(UpMenuStyle.DEFAULT_SELECT_COLOR); + this.selectFontColor.setColor(UpMenuStyle.DEFAULT_SELECT_FONT_COLOR); + this.bottomBorderPane.populate(UpMenuStyle.DEFAULT_BOTTOM_BORDER); + this.underLinePane.populate(UpMenuStyle.DEFAULT_UNDER_LINE); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new UpMenuStylePreviewPane(); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + UpMenuStyle style = (UpMenuStyle) ob; + gapFix.setSelected(style.isGapFix()); + titleWidthFix.setSelected(style.isTitleWidthFix()); + bottomBorderPane.populate(style.getBottomBorder()); + underLinePane.populate(style.getUnderline()); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new UpMenuStyle(); + } + + + @Override + public MobileTemplateStyle updateStyleWithSelectConf() { + UpMenuStyle style = new UpMenuStyle(); + style.setGapFix(gapFix.isSelected()); + style.setTitleWidthFix(titleWidthFix.isSelected()); + style.setBottomBorder(bottomBorderPane.update()); + style.setUnderline(underLinePane.update()); + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + public class UpMenuStylePreviewPane extends MobileTemplatePreviewPane { + private LineDescription bottomBorder; + private LineDescription underLine; + private boolean isGapFix; + + public UpMenuStylePreviewPane() { + this.setBackground(Color.WHITE); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Color selectFontColor = this.getTabFontConfig().getSelectColor(); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + if (i == 0) { + g2d.setColor(this.underLine.getColor()); + g2d.setStroke(new BasicStroke(2.0f)); + int underLineX = this.isGapFix ? (eachWidth - width) / 2 : 0; + int underLineWidth = this.isGapFix ? width : eachWidth; + g2d.drawLine(underLineX, panelHeight - 1, underLineX + underLineWidth, panelHeight - 1); + } + if (bottomBorder.getLineStyle() != 0) { + g2d.setColor(bottomBorder.getColor()); + g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); + } + g2d.translate(eachWidth, 0); + } + + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.bottomBorder = ((UpMenuStyle) templateStyle).getBottomBorder(); + this.underLine = ((UpMenuStyle) templateStyle).getUnderline(); + this.isGapFix = ((UpMenuStyle) templateStyle).isGapFix(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java new file mode 100644 index 0000000000..3c17d3b9be --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java @@ -0,0 +1,143 @@ +package com.fr.design.mainframe.widget; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.general.FRFont; + +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +public class MobileTabFontConfPane extends JPanel { + private EventListenerList fontChangeListener = new EventListenerList(); + private UIComboBox fontFamily; + private UIComboBox fontSize; + private UIToggleButton bold; + private UIColorButton color; + private UIToggleButton italic; + private final static Icon[] ITALIC_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")}; + private final static Icon[] BOLD_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; + + + public MobileTabFontConfPane() { + super(); + init(); + } + + private void init() { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + fontFamily = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + Vector integerList = new Vector(); + for (int i = 1; i < 100; i++) { + integerList.add(i); + } + fontFamily.setPreferredSize(new Dimension(152, 20)); + fontSize = new UIComboBox(integerList); + color = new UIColorButton(); + bold = new UIToggleButton(BOLD_ICONS, true); + italic = new UIToggleButton(ITALIC_ICONS, true); + fontFamily.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireFontStateChanged(); + } + }); + fontSize.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireFontStateChanged(); + } + }); + bold.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + italic.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + color.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + this.add(fontFamily); + this.add(fontSize); + this.add(color); + this.add(bold); + this.add(italic); + + } + + public FRFont update() { + String family = (String) fontFamily.getSelectedItem(); + int size = (int) fontSize.getSelectedItem(); + int style = Font.PLAIN; + style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN; + style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN; + FRFont frFont = FRFont.getInstance(family, style, size, color.getColor()); + return frFont; + } + + public void populate(FRFont frFont) { + fontFamily.setSelectedItem(frFont.getFamily()); + fontSize.setSelectedItem(frFont.getSize()); + color.setColor(frFont.getForeground()); + bold.setSelected(frFont.isBold()); + italic.setSelected(frFont.isItalic()); + + } + + + /** + * 添加监听 + * + * @param changeListener 监听列表 + */ + public void addFontChangeListener(ChangeListener changeListener) { + fontChangeListener.add(ChangeListener.class, changeListener); + } + + /** + * 移除监听 + * Removes an old ColorChangeListener. + * + * @param changeListener 监听列表 + */ + public void removeFontChangeListener(ChangeListener changeListener) { + fontChangeListener.remove(ChangeListener.class, changeListener); + } + + /** + * 颜色状态改变 + */ + public void fireFontStateChanged() { + Object[] listeners = fontChangeListener.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java new file mode 100644 index 0000000000..afd1a2c961 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java @@ -0,0 +1,69 @@ +package com.fr.design.mainframe.widget; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +public class UITitleSplitLine extends JPanel { + private static final Color LINE_COLOR = Color.decode("#E0E0E1"); + private static final Color TITLE_COLOR = Color.decode("#333334"); + private static final FRFont TITLE_FONT = FRFont.getInstance("PingFangSC-Regular", 0, 12.0F); + + private Color color; + private UILabel label; + private int width; + private static final int OFFSETX = 10; + private static final int OFFSET = 3; + + + public UITitleSplitLine(String title, int width) { + this(title, LINE_COLOR, width); + } + + public UITitleSplitLine(String title, Color color, int width) { + super(); + this.color = color; + this.width = width; + this.label = new UILabel(title); + } + + public void paint(Graphics g) { + super.paint(g); + Dimension size = label.getPreferredSize(); + int labelH = size.height; + g.setColor(color); + g.drawLine(0, labelH / 2, OFFSETX, labelH / 2); + g.drawLine(OFFSETX + size.width + OFFSET * 2, labelH / 2, width, labelH / 2); + g.translate(OFFSETX + OFFSET, 0); + label.setFont(TITLE_FONT); + label.setForeground(TITLE_COLOR); + label.setSize(size.width, size.height); + label.paint(g); + g.translate(-OFFSETX - OFFSET, 0); + } + + + public static void main(String[] args) { +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// JPanel myPanel = new JPanel(); +// myPanel.setLayout(new BorderLayout()); +// JPanel Panel = new JPanel(); +// Panel.setBackground(Color.blue); +// myPanel.add(new UITitleSplitLine("基本", 223), BorderLayout.CENTER); +// content.add(myPanel, BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(439, 400); +// jf.setVisible(true); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java new file mode 100644 index 0000000000..482b2cebcd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java @@ -0,0 +1,10 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.dialog.BasicPane; + +public abstract class AbstractTemplateStylePane extends BasicPane { + + public abstract void populate(T ob); + + public abstract T update(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java index 9e32a4d46a..195a92e8a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.widget.accessibles; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.general.cardtag.TemplateStyle; import com.fr.design.mainframe.widget.wrappers.TemplateStyleWrapper; import javax.swing.SwingUtilities; @@ -15,18 +14,16 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); - private TemplateStylePane stylePane; + private AbstractTemplateStylePane stylePane; - public AccessibleTemplateStyleEditor() { + public AccessibleTemplateStyleEditor(AbstractTemplateStylePane stylePane) { super(new TemplateStyleWrapper()); + this.stylePane = stylePane; } @Override protected void showEditorPane() { - if (stylePane == null) { - stylePane = new TemplateStylePane(); - stylePane.setPreferredSize(DEFAULT_DIMENSION); - } + stylePane.setPreferredSize(DEFAULT_DIMENSION); BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); dlg.addDialogActionListener(new DialogActionAdapter() { @@ -36,7 +33,7 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { fireStateChanged(); } }); - stylePane.populate((TemplateStyle) getValue()); + stylePane.populate(getValue()); dlg.setVisible(true); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java new file mode 100644 index 0000000000..f88221a42b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -0,0 +1,113 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MobileTemplateStylePane extends AbstractTemplateStylePane { + private static final List STYLE_LIST = new ArrayList(); + static { + STYLE_LIST.add(DefaultMobileTemplateStyle.STYLE_NAME); + STYLE_LIST.add(UpMenuStyle.STYLE_NAME); + STYLE_LIST.add(DownMenuStyle.STYLE_NAME); + STYLE_LIST.add(SliderStyle.STYLE_NAME); + } + + private DefaultListModel listModel; + private JList styleList; + private Map> map = new HashMap<>(); + private JPanel right; + private CardLayout card; + public MobileTemplateStylePane(WCardTagLayout tagLayout){ + init(tagLayout); + } + + public void init(WCardTagLayout tagLayout){ + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + listModel = new DefaultListModel(); + card = new CardLayout(); + right = FRGUIPaneFactory.createCardLayout_S_Pane(); + right.setLayout(card); + for(String style : STYLE_LIST){ + listModel.addElement(style); + BasicBeanPane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style, tagLayout); + map.put(style, styleBasicBeanPane); + right.add(style, styleBasicBeanPane); + } + styleList = new JList(listModel); + styleList.setCellRenderer(render); + + JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + westPane.add(styleList, BorderLayout.CENTER); + westPane.setPreferredSize(new Dimension(100, 500)); + + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setPreferredSize(new Dimension(500, 500)); + attrConfPane.add(right, BorderLayout.CENTER); + centerPane.add(attrConfPane, BorderLayout.CENTER); + styleList.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + String selectedValue = (String)styleList.getSelectedValue(); + card.show(right, selectedValue); + } + }); + this.add(westPane, BorderLayout.WEST); + this.add(centerPane, BorderLayout.CENTER); + } + public static ListCellRenderer render = new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof MobileTemplateStyle) { + MobileTemplateStyle l = (MobileTemplateStyle) value; + this.setText(l.toString()); + } + return this; + } + }; + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"); + } + + public void populate(MobileTemplateStyle templateStyle) { + for(int i = 0; i< listModel.getSize(); i++){ + if((listModel.getElementAt(i)).equals(templateStyle.getStyle())){ + styleList.setSelectedIndex(i); + map.get(templateStyle.getStyle()).populateBean(templateStyle); + card.show(right, templateStyle.getStyle()); + return; + } + } + styleList.setSelectedIndex(0); + } + + public MobileTemplateStyle update() { + return map.get(styleList.getSelectedValue()).updateBean(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java index fdd6cbb32c..6374a19c54 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java @@ -21,16 +21,17 @@ import javax.swing.ListCellRenderer; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Created by kerry on 2017/11/23. */ -public class TemplateStylePane extends BasicPane { +public class TemplateStylePane extends AbstractTemplateStylePane { private DefaultListModel listModel; private JList styleList; - private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle()); + private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle(), new Rectangle(0, 50, 540, 400)); public TemplateStylePane(){ init(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java index 0f684006ae..1e47d30890 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java @@ -1,26 +1,23 @@ package com.fr.design.mainframe.widget.accessibles; -import com.fr.base.BaseUtils; import com.fr.general.cardtag.TemplateStyle; import javax.swing.JPanel; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; +import java.awt.Rectangle; /** * Created by kerry on 2017/12/11. */ public class TemplateStylePreviewPane extends JPanel { - private static final int WIDTH = 540; - private static final int HEIGHT = 400; - private static final int OFFSETY = 50; - + private Rectangle rectangle; private TemplateStyle templateStyle; - public TemplateStylePreviewPane(TemplateStyle templateStyle){ + public TemplateStylePreviewPane(TemplateStyle templateStyle, Rectangle rectangle){ this.templateStyle = templateStyle; + this.rectangle = rectangle; } public void repaint (TemplateStyle templateStyle){ @@ -32,7 +29,6 @@ public class TemplateStylePreviewPane extends JPanel { public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g.create(); - Image image = BaseUtils.readImage(templateStyle.getPreview()); - g2d.drawImage(image, 0, OFFSETY, WIDTH, HEIGHT, null); + templateStyle.paintPreview(g2d, rectangle); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java new file mode 100644 index 0000000000..d5ddbb6b9f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java @@ -0,0 +1,53 @@ +package com.fr.design.mainframe.widget.preview; + +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + +import javax.swing.JPanel; +import java.awt.Color; + +public abstract class MobileTemplatePreviewPane extends JPanel { + private Color initialColor; + private Color selectColor; + private TabFontConfig tabFontConfig = new TabFontConfig(); + + public Color getInitialColor() { + return initialColor; + } + + public void setInitialColor(Color initialColor) { + this.initialColor = initialColor; + } + + public Color getSelectColor() { + return selectColor; + } + + public void setSelectColor(Color selectColor) { + this.selectColor = selectColor; + } + + public TabFontConfig getTabFontConfig() { + return tabFontConfig; + } + + public void setTabFontConfig(TabFontConfig tabFontConfig) { + this.tabFontConfig = tabFontConfig; + } + + public MobileTemplatePreviewPane(){ + + } + + public void populateConfig(MobileTemplateStyle templateStyle){ + this.setInitialColor(templateStyle.getInitialColor()); + this.setBackground(templateStyle.getInitialColor()); + this.setSelectColor(templateStyle.getSelectColor()); + this.setTabFontConfig(templateStyle.getTabFontConfig()); + } + + public void repaint (){ + super.repaint(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index f0d155f7af..1b9d2690e6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -16,9 +16,11 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWHorizontalBoxLayout; import com.fr.design.designer.creator.XWidgetCreator; +import com.fr.design.designer.properties.mobile.TabMobilePropertyUI; import com.fr.design.form.layout.FRFlowLayout; import com.fr.design.form.layout.FRHorizontalLayout; import com.fr.design.form.layout.FRVerticalLayout; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.EditingMouseListener; @@ -328,6 +330,10 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { return ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION); } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{ new TabMobilePropertyUI(this)}; + } /** * data属性改变触发其他操作 diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java new file mode 100644 index 0000000000..8ebdbd7694 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java @@ -0,0 +1,30 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.TabMobileWidgetDefinePane; + +public class TabMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + private XCreator xCreator; + + public TabMobilePropertyUI(XCreator xCreator){ + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new TabMobileWidgetDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index ee021d2604..d1e68baf39 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; +import com.fr.design.mainframe.widget.accessibles.TemplateStylePane; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WTabDisplayPosition; @@ -51,7 +52,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify this.setLayout(FRGUIPaneFactory.createBorderLayout()); backgroundEditor = new AccessibleTabPaneBackgroundEditor(); - templateStyleEditor = new AccessibleTemplateStyleEditor(); + templateStyleEditor = new AccessibleTemplateStyleEditor(new TemplateStylePane()); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p, p, p}; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java new file mode 100644 index 0000000000..f6d94da06c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -0,0 +1,69 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; +import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { + private XCreator xCreator; + private AccessibleTemplateStyleEditor templateStyleEditor; + private AttributeChangeListener changeListener; + + public TabMobileWidgetDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + this.changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + } + /** + * 后台初始化所有事件. + */ + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template")); + templateStyleEditor = new AccessibleTemplateStyleEditor(new MobileTemplateStylePane((WCardTagLayout) xCreator.toData())); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{label, templateStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + this.add(jPanel, BorderLayout.CENTER); + } + + @Override + public void populate(FormDesigner designer) { + templateStyleEditor.setValue(((WCardTagLayout)xCreator.toData()).getMobileTemplateStyle()); + // 数据 populate 完成后,再设置监听 + this.bindListeners2Widgets(); + this.addAttributeChangeListener(changeListener); + } + + @Override + public void update() { + ((WCardTagLayout)xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 + + } +} From 99242e5060002378775df3f2078084b284475ae3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:07:44 +0800 Subject: [PATCH 048/187] =?UTF-8?q?file=20choose=20pane=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=A4=9A=E4=B8=AA=E6=9C=AC=E5=9C=B0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 3 +- .../java/com/fr/file/FILEChooserPane.java | 306 +++++++++++++----- 2 files changed, 219 insertions(+), 90 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index f47818687c..933ff02e32 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -80,7 +80,7 @@ public abstract class AbstractExportAction> extends JT Map para = processParameter(); // 选择输入的文件 - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + FILEChooserPane fileChooserPane = FILEChooserPane.getMultiEnvInstance(true, false); fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); @@ -96,7 +96,6 @@ public abstract class AbstractExportAction> extends JT } FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - progressbar = new FRProgressBar( createExportWork(getSource(), target, para), DesignerContext.getDesignerFrame(), diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index f3f9c7d285..fc4a5dfea0 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -7,6 +7,8 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; +import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; @@ -15,6 +17,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.DefaultCompletionFilter; import com.fr.design.gui.itextfield.UIAutoCompletionField; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -85,6 +88,7 @@ import java.awt.event.WindowEvent; import java.io.File; import java.util.ArrayList; import java.util.EnumSet; +import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -176,6 +180,28 @@ public class FILEChooserPane extends BasicPane { return INSTANCE; } + public static FILEChooserPane getMultiEnvInstance(boolean showLoc, boolean showWebReport, FILEFilter filter) { + INSTANCE.showEnv = true; + INSTANCE.showLoc = showLoc; + INSTANCE.showWebReport = showWebReport; + // 替换掉 PlaceListModel + INSTANCE.setMultiPlaceListModel(); + INSTANCE.removeAllFilter(); + INSTANCE.addChooseFILEFilter(filter, 0); + return INSTANCE; + } + + public static FILEChooserPane getMultiEnvInstance(boolean showLoc, boolean showWebReport) { + INSTANCE.showEnv = true; + INSTANCE.showLoc = showLoc; + INSTANCE.showWebReport = showWebReport; + // 替换掉 PlaceListModel + INSTANCE.setMultiPlaceListModel(); + INSTANCE.removeAllFilter(); + return INSTANCE; + } + + /** * @param showEnv * @param filter @@ -912,96 +938,10 @@ public class FILEChooserPane extends BasicPane { return dialogName(); } - private class PlaceListModel extends AbstractListModel { - private FileNodeFILE envFILE; - private FileNodeFILE webReportFILE; - private List filesOfSystem = new ArrayList(); - - PlaceListModel() { - if (FILEChooserPane.this.showEnv) { - envFILE = new FileNodeFILE(new FileNode(ProjectConstants.REPORTLETS_NAME, true)) { - @Override - public String getName() { - return getEnvProjectName(); - } - }; - } - if (FILEChooserPane.this.showWebReport) { - webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); - } - if (FILEChooserPane.this.showLoc) { - - - if (WindowsDetector.detect(true)) { - // windows下展示桌面 - File[] desktop = FileSystemView.getFileSystemView().getRoots(); - if (desktop != null) { - for (int i = 0; i < desktop.length; i++) { - if (desktop[i].exists()) { - filesOfSystem.add(new FileFILE(desktop[i])); - } - } - } - } else { - // *nix下展示家目录 - filesOfSystem.add(new FileFILE(FileSystemView.getFileSystemView().getDefaultDirectory())); - } - - // C, D, E等盘符 - File[] roots = File.listRoots(); - if (roots != null) { - for (int i = 0; i < roots.length; i++) { - if (roots[i].exists()) { - filesOfSystem.add(new FileFILE(roots[i])); - } - } - } - } - } - - @Override - public FILE getElementAt(int index) { - int n = FILEChooserPane.this.showEnv ? 1 : 0; - int n2 = FILEChooserPane.this.showWebReport ? 1 : 0; - - if (index < n) { - return envFILE; - } else if (index < n + n2) { - return webReportFILE; - } else if (index < n + n2 + filesOfSystem.size()) { - return filesOfSystem.get(index - n - n2); - } - throw new IndexOutOfBoundsException(); - } - - @Override - public int getSize() { - if (FILEChooserPane.this.showEnv && FILEChooserPane.this.showWebReport) { - return 2 + filesOfSystem.size(); - } else if (FILEChooserPane.this.showEnv || FILEChooserPane.this.showWebReport) { - return 1 + filesOfSystem.size(); - } else { - return filesOfSystem.size(); - } - } - - private void setCD(final FILE lastDirectory) { - for (int i = 0; i < this.getSize(); i++) { - FILE file = this.getElementAt(i); - if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix())) { - setCurrentDirectory(lastDirectory); - return; - } - } - setCurrentDirectory(this.getElementAt(0)); - } - } - - private void setPlaceListModel() { + private void setPlaceListModel(AbstractPlaceListModel model) { if (placesList == null) { return; } - PlaceListModel model = new PlaceListModel(); placesList.setModel(model); String lastDirectoryPath = DesignerEnvManager.getEnvManager().getDialogCurrentDirectory(); String prefix = DesignerEnvManager.getEnvManager().getCurrentDirectoryPrefix(); @@ -1023,6 +963,20 @@ public class FILEChooserPane extends BasicPane { } } + private void setPlaceListModel() { + if (placesList == null) { + return; + } + setPlaceListModel(new PlaceListModel()); + } + + private void setMultiPlaceListModel() { + if (placesList == null) { + return; + } + setPlaceListModel(new MultiLocalEnvPlaceListModel()); + } + /* * 选中文件 */ @@ -1052,7 +1006,7 @@ public class FILEChooserPane extends BasicPane { if (ComparatorUtils.equals(dir.prefix(), FILEFactory.ENV_PREFIX) || dir.prefix().endsWith(FILEFactory.WEBREPORT_PREFIX)) { placesList.setSelectedIndex(0); } else if (ComparatorUtils.equals(dir.prefix(), FILEFactory.FILE_PREFIX)) { - PlaceListModel defaultListModel = (PlaceListModel) placesList.getModel(); + AbstractPlaceListModel defaultListModel = (AbstractPlaceListModel) placesList.getModel(); for (int i = 0; i < defaultListModel.getSize(); i++) { if (defaultListModel.getElementAt(i) instanceof FileFILE) { FileFILE popDir = (FileFILE) defaultListModel.getElementAt(i); @@ -1108,6 +1062,182 @@ public class FILEChooserPane extends BasicPane { } } + private abstract class AbstractPlaceListModel extends AbstractListModel { + + protected List filesOfSystem = new ArrayList(); + + protected void processSystemFile() { + if (WindowsDetector.detect(true)) { + // windows下展示桌面 + File[] desktop = FileSystemView.getFileSystemView().getRoots(); + if (desktop != null) { + for (int i = 0; i < desktop.length; i++) { + if (desktop[i].exists()) { + filesOfSystem.add(new FileFILE(desktop[i])); + } + } + } + } else { + // *nix下展示家目录 + filesOfSystem.add(new FileFILE(FileSystemView.getFileSystemView().getDefaultDirectory())); + } + + // C, D, E等盘符 + File[] roots = File.listRoots(); + if (roots != null) { + for (int i = 0; i < roots.length; i++) { + if (roots[i].exists()) { + filesOfSystem.add(new FileFILE(roots[i])); + } + } + } + } + + protected void setCD(final FILE lastDirectory) { + for (int i = 0; i < this.getSize(); i++) { + FILE file = this.getElementAt(i); + if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix())) { + setCurrentDirectory(lastDirectory); + return; + } + } + setCurrentDirectory(this.getElementAt(0)); + } + } + + private class PlaceListModel extends AbstractPlaceListModel { + private FileNodeFILE envFILE; + private FileNodeFILE webReportFILE; + + PlaceListModel() { + if (FILEChooserPane.this.showEnv) { + envFILE = new FileNodeFILE(new FileNode(ProjectConstants.REPORTLETS_NAME, true)) { + @Override + public String getName() { + return getEnvProjectName(); + } + }; + } + if (FILEChooserPane.this.showWebReport) { + webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); + } + if (FILEChooserPane.this.showLoc) { + processSystemFile(); + } + } + + @Override + public FILE getElementAt(int index) { + int n = FILEChooserPane.this.showEnv ? 1 : 0; + int n2 = FILEChooserPane.this.showWebReport ? 1 : 0; + + if (index < n) { + return envFILE; + } else if (index < n + n2) { + return webReportFILE; + } else if (index < n + n2 + filesOfSystem.size()) { + return filesOfSystem.get(index - n - n2); + } + throw new IndexOutOfBoundsException(); + } + + @Override + public int getSize() { + if (FILEChooserPane.this.showEnv && FILEChooserPane.this.showWebReport) { + return 2 + filesOfSystem.size(); + } else if (FILEChooserPane.this.showEnv || FILEChooserPane.this.showWebReport) { + return 1 + filesOfSystem.size(); + } else { + return filesOfSystem.size(); + } + } + + } + + private class MultiLocalEnvPlaceListModel extends AbstractPlaceListModel { + + private List envFiles = new ArrayList(); + private FileNodeFILE webReportFILE; + + MultiLocalEnvPlaceListModel() { + Iterator iterator = DesignerEnvManager.getEnvManager().getEnvNameIterator(); + + while (iterator.hasNext()) { + final String envName = iterator.next(); + DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); + if (info.getType() == DesignerWorkspaceType.Local) { + FileFILE fileFILE = + new FileFILE(new File(info.getPath() + CoreConstants.SEPARATOR + ProjectConstants.REPORTLETS_NAME)) { + @Override + public String getName() { + return envName; + } + }; + if (fileFILE.exists() && fileFILE.isDirectory()) { + envFiles.add(fileFILE); + } + } + } + + if (FILEChooserPane.this.showWebReport) { + webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); + } + if (FILEChooserPane.this.showLoc) { + processSystemFile(); + } + } + + @Override + public FILE getElementAt(int index) { + int envCount = envFiles.size(); + int webReportCount = FILEChooserPane.this.showWebReport ? 1 : 0; + + if (index < envCount) { + return envFiles.get(index); + } else if (index < envCount + webReportCount) { + return webReportFILE; + } else if (index < envCount + webReportCount + filesOfSystem.size()) { + return filesOfSystem.get(index - envCount - webReportCount); + } + throw new IndexOutOfBoundsException(); + } + + @Override + public int getSize() { + int webReportCount = FILEChooserPane.this.showWebReport ? 1 : 0; + return envFiles.size() + filesOfSystem.size() + webReportCount; + } + + private class FileFILE extends com.fr.file.FileFILE { + + public FileFILE(File file) { + super(file); + } + + @Override + public Icon getIcon() { + if (ComparatorUtils.equals(getTotalName(), ProjectConstants.REPORTLETS_NAME)) { + return BaseUtils.readIcon("/com/fr/base/images/oem/logo.png"); + } else { + return FileTreeIcon.getIcon(new File(this.getPath()), false); + } + } + + @Override + public FILE[] listFiles() { + FILE[] fileFILES = super.listFiles(); + + List results = new ArrayList<>(); + + for (FILE fileFILE : fileFILES) { + results.add(new FileFILE(new File(fileFILE.getPath()))); + } + + return results.toArray(new FILE[results.size()]); + } + } + } + /* * 上面的LocationButtonPane */ From 76b881ea2f020a0098cd81352b95be308347e9ce Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:35:37 +0800 Subject: [PATCH 049/187] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/AbstractExportAction.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 933ff02e32..cbe3a1aea0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -6,6 +6,7 @@ import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; @@ -170,6 +171,19 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + + + } catch (RemoteDesignPermissionDeniedException exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); } catch (Exception exp) { this.setProgress(100); target.closeTemplate(); From dad20400fa3f6acba5de1cd0e85f8d94a8b6d6f8 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:42:25 +0800 Subject: [PATCH 050/187] =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExcelExportAction.java | 2 +- ...ookExportAction.java => AbstractWorkBookExportAction.java} | 4 ++-- .../com/fr/design/actions/file/export/CSVExportAction.java | 2 +- .../actions/file/export/EmbeddedExportExportAction.java | 2 +- .../com/fr/design/actions/file/export/PDFExportAction.java | 2 +- .../com/fr/design/actions/file/export/SVGExportAction.java | 2 +- .../com/fr/design/actions/file/export/TextExportAction.java | 2 +- .../com/fr/design/actions/file/export/WordExportAction.java | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename designer-realize/src/main/java/com/fr/design/actions/file/export/{AbstractJWorkBookExportAction.java => AbstractWorkBookExportAction.java} (90%) diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 38afcb545d..44c32637bb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -13,7 +13,7 @@ import com.fr.report.core.ReportUtils; /** * Export excel. */ -public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction { +public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAction { protected AbstractExcelExportAction(JWorkBook jwb) { super(jwb); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java similarity index 90% rename from designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java rename to designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java index 63362e5d41..bfec887440 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java @@ -19,10 +19,10 @@ import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; /** * Abstract export action. */ -public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { +public abstract class AbstractWorkBookExportAction extends AbstractExportAction { - protected AbstractJWorkBookExportAction(JWorkBook jwb) { + protected AbstractWorkBookExportAction(JWorkBook jwb) { super(jwb); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 8ecced355c..cc6bdaf392 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java @@ -16,7 +16,7 @@ import com.fr.report.core.ReportUtils; /** * Export CSV. */ -public class CSVExportAction extends AbstractJWorkBookExportAction { +public class CSVExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index a5b97b9e63..9944142b72 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -13,7 +13,7 @@ import java.util.EnumSet; /** * Export Embedded. */ -public class EmbeddedExportExportAction extends AbstractJWorkBookExportAction { +public class EmbeddedExportExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java index e98e383d23..e6fc6b5406 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export pdf */ -public class PDFExportAction extends AbstractJWorkBookExportAction { +public class PDFExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java index 198b9cb4ec..4a7862e9d4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export SVG */ -public class SVGExportAction extends AbstractJWorkBookExportAction { +public class SVGExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java index 454435f273..ff3debb49a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export Text. */ -public class TextExportAction extends AbstractJWorkBookExportAction { +public class TextExportAction extends AbstractWorkBookExportAction { public TextExportAction(JWorkBook jwb) { super(jwb); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java index cc042b9e41..9e1a919848 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export excel. */ -public class WordExportAction extends AbstractJWorkBookExportAction { +public class WordExportAction extends AbstractWorkBookExportAction { /** * Constructor */ From 197a34a26cae1fe7c4a1100eca8896d3264a73ce Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:47:52 +0800 Subject: [PATCH 051/187] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 21 +++++----------- .../com/fr/design/mainframe/JWorkBook.java | 24 +++++++++---------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index bb6483b32a..381472d38f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,9 +5,9 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; -import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; +import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; @@ -118,7 +118,6 @@ public class JForm extends JTemplate implements BaseJForm { @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 - return; } @Override @@ -152,7 +151,6 @@ public class JForm extends JTemplate implements BaseJForm { @Override public void setJTemplateResolution(int resolution) { - return; } @Override @@ -195,7 +193,6 @@ public class JForm extends JTemplate implements BaseJForm { } public void setAuthorityMode(boolean isUpMode) { - return; } public int getToolBarHeight() { @@ -208,7 +205,7 @@ public class JForm extends JTemplate implements BaseJForm { * @return 菜单数组 */ public ShortCut[] shortcut4FileMenu() { - return (ShortCut[]) ArrayUtils.addAll( + return ArrayUtils.addAll( super.shortcut4FileMenu(), DesignerMode.isVcsMode() ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); @@ -226,7 +223,6 @@ public class JForm extends JTemplate implements BaseJForm { * 取消格式 */ public void cancelFormat() { - return; } /** @@ -292,30 +288,25 @@ public class JForm extends JTemplate implements BaseJForm { * 去除选择 */ public void removeTemplateSelection() { - return; } public void setSheetCovered(boolean isCovered) { - return; } /** * 刷新容器 */ public void refreshContainer() { - return; } /** * 去除参数面板选择 */ public void removeParameterPaneSelection() { - return; } @Override public void setScale(int resolution) { - return; } @Override @@ -478,8 +469,8 @@ public class JForm extends JTemplate implements BaseJForm { @Override public MenuDef[] menus4Target() { return this.index == FORM_TAB ? - (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), this.formDesign.menus4Target()) : - (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), this.elementCaseDesign.menus4Target()); + ArrayUtils.addAll(super.menus4Target(), this.formDesign.menus4Target()) : + ArrayUtils.addAll(super.menus4Target(), this.elementCaseDesign.menus4Target()); } @@ -504,9 +495,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 88b88282bc..f77af4c439 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -41,7 +41,6 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.cell.QuickEditorRegion; -import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; @@ -58,6 +57,7 @@ import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; import com.fr.design.preview.WritePreview; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.selection.QuickEditor; @@ -68,7 +68,6 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; - import com.fr.general.ModuleContext; import com.fr.grid.Grid; import com.fr.grid.GridUtils; @@ -96,7 +95,9 @@ import com.fr.stable.project.ProjectConstants; import com.fr.web.controller.ViewRequestConstants; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileOutputStream; @@ -351,7 +352,7 @@ public class JWorkBook extends JTemplate { return parameterPane.getParaDesigner().getEastUpPane(); } if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) { - return ((PolyDesigner) delegate4ToolbarMenuAdapter()).getEastUpPane(); + return delegate4ToolbarMenuAdapter().getEastUpPane(); } else { ElementCasePane casePane = ((ReportComponent) delegate4ToolbarMenuAdapter()).elementCasePane; if (casePane != null) { @@ -370,7 +371,7 @@ public class JWorkBook extends JTemplate { if (((PolyDesigner) delegate4ToolbarMenuAdapter()).getSelectionType() == PolyDesigner.SelectionType.NONE) { return new JPanel(); } else { - return ((PolyDesigner) delegate4ToolbarMenuAdapter()).getEastDownPane(); + return delegate4ToolbarMenuAdapter().getEastDownPane(); } } else { ElementCasePane casePane = ((ReportComponent) delegate4ToolbarMenuAdapter()).elementCasePane; @@ -634,11 +635,10 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4FileMenu() { - boolean showWorkBookExportMenu = DesignerMode.isVcsMode() + boolean hideWorkBookExportMenu = DesignerMode.isVcsMode() || DesignerMode.isAuthorityEditing(); -// || !WorkContext.getCurrent().isLocal(); - return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), - showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} + return ArrayUtils.addAll(super.shortcut4FileMenu(), + hideWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -649,7 +649,7 @@ public class JWorkBook extends JTemplate { */ @Override public MenuDef[] menus4Target() { - return (MenuDef[]) ArrayUtils.addAll( + return ArrayUtils.addAll( super.menus4Target(), this.delegate4ToolbarMenuAdapter().menus4Target() ); } @@ -695,7 +695,7 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4TemplateMenu() { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ + return ArrayUtils.addAll(new ShortCut[]{ new ReportWebAttrAction(this), new ReportExportAttrAction(this), new ReportParameterAction(this), @@ -925,7 +925,7 @@ public class JWorkBook extends JTemplate { */ @Override public void previewMenuActionPerformed(PreviewProvider provider) { - super.previewMenuActionPerformed(provider); + super.previewMenuActionPerformed(provider); } /** From 7acfea2e3c85414186204ae604747e56a1b6df91 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:58:34 +0800 Subject: [PATCH 052/187] =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=90=8E=E7=BC=80=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/EmbeddedFormExportExportAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 0056710e4c..6f57422768 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -12,7 +12,6 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportType; import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; import java.util.HashMap; import java.util.Map; @@ -40,7 +39,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected String getDefaultExtension() { - return ProjectConstants.FRM_SUFFIX; + return getEditingComponent().suffix().substring(1); } @Override From 8a78af67907265a383f928ea13402e89998a6c85 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 16:10:56 +0800 Subject: [PATCH 053/187] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExportAction.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index cbe3a1aea0..0105d7f958 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -14,6 +14,7 @@ import com.fr.io.exporter.DesignExportType; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; +import com.fr.third.jodd.io.FileNameUtil; import com.fr.workspace.WorkContext; import com.fr.workspace.server.exporter.TemplateExportOperator; @@ -115,12 +116,8 @@ public abstract class AbstractExportAction> extends JT private String getTargetFileName() { FILE source = getSource(); - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc String fileName = source.getName(); - if (fileName.indexOf('.') != -1) { - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - } - return fileName; + return FileNameUtil.removeExtension(fileName); } private boolean processNotSaved() { From 8722af6cbf9995a779b5a84c5ff06e5785fc5340 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 19 Nov 2018 16:34:22 +0800 Subject: [PATCH 054/187] =?UTF-8?q?REPORT-12391=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=AB=AF=E5=8F=A3=E5=8F=B7=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=3D>=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GlobalNativePrintSettingPane.java | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 82a4ff3f2d..4b30458e65 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -3,35 +3,39 @@ package com.fr.design.webattr.printsettings; import com.fr.base.print.NativePrintAttr; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UIIntNumberField; +import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; +import com.sun.jna.Native; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; +import java.awt.FlowLayout; /** * 本地打印设置面板——全局 * Created by plough on 2018/10/31. */ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane { + private static final int PRINT_PORT_FIELD_COLUMNS = 8; + // 服务器配置面板特有的组件 private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 private UITextField customUrlFieldWin; private UITextField customUrlFieldMac; + private UINumberField printPortField; // 打印软件端口号 @Override JPanel createHeaderPane(Component... comps) { - - Component[] newComps = { - getDownloadUrlSettingPane() - }; - Component[] allComps = new Component[comps.length + newComps.length]; + Component[] allComps = new Component[comps.length + 1]; System.arraycopy(comps, 0, allComps, 0, comps.length); - System.arraycopy(newComps, 0, allComps, comps.length, newComps.length); + allComps[comps.length] = getExtraSettingPane(); JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); @@ -48,6 +52,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); } + nativePrintAttr.setPrintPort((int) printPortField.getValue()); } @Override @@ -55,21 +60,43 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); + printPortField.setValue(nativePrintAttr.getPrintPort()); } - private JPanel getDownloadUrlSettingPane() { + // 服务器配置中,特有的设置面板 + private JPanel getExtraSettingPane() { + // 软件下载地址 defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + JPanel downloadTipPane = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "); + downloadTipPane.setBorder(BorderFactory.createEmptyBorder(0, 0, -6, 0)); + + // 打印软件端口号 + UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port") + ": "); + JPanel printPortFiledPane = getPrintPortFieldPane(); // TableLayout double p = TableLayout.PREFERRED; - double[] rowSize = {p}; + double[] rowSize = {p, p}; double[] columnSize = {p, p}; Component[][] components = { - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane} + { + downloadTipPane, downloadUrlSettingCheckPane + }, { + printPortTip, printPortFiledPane + } }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + } + + private JPanel getPrintPortFieldPane() { + printPortField = new UIIntNumberField(); + printPortField.setMaxValue(NativePrintAttr.MAX_PRINT_PORT_VALUE); + printPortField.setColumns(PRINT_PORT_FIELD_COLUMNS); + JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + panel.add(printPortField); + return panel; } private JPanel getCustomUrlSettingPane() { @@ -85,7 +112,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane {new UILabel("macOS: "), customUrlFieldMac} }; JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); return urlSettingPane; } } From 9306bb26b13add61188c936e18630c6340fba444 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 19 Nov 2018 16:35:53 +0800 Subject: [PATCH 055/187] =?UTF-8?q?REPORT-12391=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=AB=AF=E5=8F=A3=E5=8F=B7=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/GlobalNativePrintSettingPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 4b30458e65..7b3643899a 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -10,12 +10,10 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import com.sun.jna.Native; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; -import java.awt.FlowLayout; /** * 本地打印设置面板——全局 From 1516847f4958eab30cecedc30f77c6c3fd46d613 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 19 Nov 2018 16:41:29 +0800 Subject: [PATCH 056/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/FRGUIPaneFactory.java | 11 -------- .../ui/MobileTemplateStyleDefinePane.java | 8 +++--- .../widget/MobileTabFontConfPane.java | 5 ++-- .../mainframe/widget/UITitleSplitLine.java | 25 +++---------------- .../com/fr/design/utils/gui/GUICoreUtils.java | 12 +++++++++ 5 files changed, 22 insertions(+), 39 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index 09eaad466b..db48cf9950 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -251,17 +251,6 @@ public class FRGUIPaneFactory { return jp; } - - /** - * 创建一个靠左流式布局,流式内嵌 - * - * @return JPanel对象 - */ - public static JPanel createBoxFlowInnerContainerPane(int hgap, int vgap) { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap)); - return jp; - } /** * 创建一个靠左流式布局,流式内嵌,首元素距离左边0 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index a1d487ab7f..ae55b79719 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -34,13 +34,13 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane { + private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; private UIComboBox custom; protected NewColorSelectBox initialColorBox; protected MobileTabFontConfPane fontConfPane; private JPanel centerPane; protected MobileTemplatePreviewPane previewPane; - private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; private WCardTagLayout tagLayout; @@ -142,7 +142,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Mon, 19 Nov 2018 19:46:04 +0800 Subject: [PATCH 057/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 4 ++- .../mobile/ui/DownMenuStyleDefinePane.java | 35 ++++++++++++++----- .../ui/MobileTemplateStyleDefinePane.java | 13 ++++--- .../mobile/ui/SliderStyleDefinePane.java | 33 ++++++++++++----- .../mobile/ui/UpMenuStyleDefinePane.java | 17 +++++++-- 5 files changed, 74 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index b42f1a6cee..d397c8d529 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -80,11 +80,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); g2d.setFont(frFont); + int fontHeight = fm.getHeight(); + int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String widgetName = cardSwitchButton.getText(); int width = fm.stringWidth(widgetName); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index b8f267e98c..a0184c9a84 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -5,6 +5,7 @@ import com.fr.base.IconManager; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; @@ -15,15 +16,18 @@ import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.LineDescription; import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Stroke; import java.util.ArrayList; public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -36,6 +40,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } protected void createExtraConfPane(JPanel centerPane) { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520); iconSplitLine.setPreferredSize(new Dimension(520, 20)); centerPane.add(iconSplitLine); @@ -51,8 +57,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); initIconContainPane.setPreferredSize(new Dimension(240, 50)); selectIconContainePane.setPreferredSize(new Dimension(240, 50)); - centerPane.add(initIconContainPane); - centerPane.add(selectIconContainePane); + panel.add(initIconContainPane); + panel.add(selectIconContainePane); UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); splitLine.setPreferredSize(new Dimension(520, 20)); splitLinePane = new LinePane(); @@ -62,6 +68,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { updatePreviewPane(); } }); + centerPane.add(panel); centerPane.add(splitLine); centerPane.add(splitLinePane); } @@ -122,8 +129,10 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane { - private LineDescription splitLine; + private static final int ICON_OFFSET = 16; + private static final int GAP = 6; private static final String PAINT_ICON = "fund_white"; + private LineDescription splitLine; public DownMenuStylePreviewPane() { this.setBackground(Color.decode("#3888EE")); @@ -145,21 +154,31 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + int fontHeight = fm.getHeight(); + int ascent = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { - g2d.setFont(frFont); + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String widgetName = cardSwitchButton.getText(); int width = fm.stringWidth(widgetName); + if(i == 0){ + Color oldColor = g2d.getColor(); + g2d.setColor(this.getSelectColor()); + g2d.fillRect(0, 0 ,eachWidth, panelHeight); + g2d.setColor(oldColor); + } String iconName = PAINT_ICON; - g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - 18) / 2, 6, null); - g2d.drawString(widgetName, (eachWidth - width) / 2, panelHeight / 2 + 9); + g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); + Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { g2d.setColor(splitLine.getColor()); - + g2d.setStroke(GraphHelper.getStroke(splitLine.getLineStyle())); g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); } - + g2d.setStroke(oldStroke); g2d.translate(eachWidth, 0); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index ae55b79719..9f5809f927 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -142,13 +142,12 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Mon, 19 Nov 2018 20:07:29 +0800 Subject: [PATCH 058/187] =?UTF-8?q?REPORT-12593=2010.0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E6=A1=86=E5=A4=B1=E6=95=88=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E7=9A=84=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E9=82=A3=E4=B8=AAcheckbox=E7=9A=84?= =?UTF-8?q?=E5=80=BC=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE=E7=9A=84=E8=A2=AB?= =?UTF-8?q?set=E5=88=B0CellGUIAttr=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=80=BC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=A2=ABwrite=E5=88=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/cell/settingpane/CellOtherSetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 814a4ebeca..4ac2aab9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -427,7 +427,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preview"))) { + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } From 84dd9246f0fec0aa879ce00a7edc5c1cb48c96c9 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Nov 2018 10:06:12 +0800 Subject: [PATCH 059/187] =?UTF-8?q?REPORT-10535=20=E7=95=8C=E9=9D=A2ui?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/MobileTemplateStylePane.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index f88221a42b..98309819d1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -26,12 +26,12 @@ import java.util.List; import java.util.Map; public class MobileTemplateStylePane extends AbstractTemplateStylePane { - private static final List STYLE_LIST = new ArrayList(); + private static final List STYLE_LIST = new ArrayList(); static { - STYLE_LIST.add(DefaultMobileTemplateStyle.STYLE_NAME); - STYLE_LIST.add(UpMenuStyle.STYLE_NAME); - STYLE_LIST.add(DownMenuStyle.STYLE_NAME); - STYLE_LIST.add(SliderStyle.STYLE_NAME); + STYLE_LIST.add(new DefaultMobileTemplateStyle()); + STYLE_LIST.add(new UpMenuStyle()); + STYLE_LIST.add(new DownMenuStyle()); + STYLE_LIST.add(new SliderStyle()); } private DefaultListModel listModel; @@ -49,11 +49,11 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style, tagLayout); - map.put(style, styleBasicBeanPane); - right.add(style, styleBasicBeanPane); + for(MobileTemplateStyle style : STYLE_LIST){ + listModel.addElement(style.toString()); + BasicBeanPane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style.getStyle(), tagLayout); + map.put(style.toString(), styleBasicBeanPane); + right.add(style.toString(), styleBasicBeanPane); } styleList = new JList(listModel); styleList.setCellRenderer(render); @@ -97,10 +97,10 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane Date: Tue, 20 Nov 2018 10:15:42 +0800 Subject: [PATCH 060/187] =?UTF-8?q?REPORT-12788=20=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=92=8C=E5=85=AC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/ReportletHyperNorthPane.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index 5d67800b76..c1ebb62322 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -23,6 +23,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlinkDialogAttr; +import com.fr.stable.CommonUtils; import com.fr.stable.FormulaProvider; import com.fr.stable.StringUtils; @@ -191,8 +192,13 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 20 Nov 2018 10:44:50 +0800 Subject: [PATCH 061/187] =?UTF-8?q?=E9=99=90=E5=88=B6=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/hyperlink/ReportletHyperNorthPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index c1ebb62322..d6a50a84c9 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -370,6 +370,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 20 Nov 2018 11:31:36 +0800 Subject: [PATCH 062/187] =?UTF-8?q?REPORT-12622=20=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=94=AF=E6=8C=81=E6=89=AB=E7=A0=81=20ui?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetMobilePaneFactory.java | 3 + .../widget/ui/mobile/ScanCodeMobilePane.java | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java index 8b9afc3f22..5d995ddad2 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java @@ -4,7 +4,9 @@ import com.fr.base.FRContext; import com.fr.design.ExtraDesignClassManager; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; +import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; import java.util.HashMap; @@ -18,6 +20,7 @@ public class WidgetMobilePaneFactory { static { mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); + mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class); mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java new file mode 100644 index 0000000000..8fd0fc88cc --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -0,0 +1,64 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.base.mobile.MobileScanCodeAttr; +import com.fr.base.mobile.ScanCodeState; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.Widget; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +public class ScanCodeMobilePane extends WidgetMobilePane { + + private UICheckBox appScanCodeCheck; + + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(getMobileSettingPane(), BorderLayout.NORTH); + } + + private UIExpandablePane getMobileSettingPane() { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true); + appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + panel.add(appScanCodeCheck); + final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panelWrapper.add(panel, BorderLayout.NORTH); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper); + } + + @Override + public void populate(Widget widget) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); + ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); + appScanCodeCheck.setSelected(scanCodeState2boolean(scanCodeState)); + } + + @Override + public void update(Widget widget) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); + mobileScanCodeAttr.setScanCodeState(boolean2ScanCodeState(appScanCodeCheck.isSelected())); + } + + private ScanCodeState boolean2ScanCodeState(boolean scanCodeCheck) { + if (scanCodeCheck) { + return ScanCodeState.SUPPORT_SCAN_CODE; + } else { + return ScanCodeState.NOT_SUPPORT_SCAN_CODE; + } + } + + private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { + if (scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE) { + return true; + } else { + return false; + } + } +} From 90fbfa525daa762e063a4332da9b5b8ce782e1e0 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 20 Nov 2018 12:34:58 +0800 Subject: [PATCH 063/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AASB?= =?UTF-8?q?=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index 8fd0fc88cc..586501e7bc 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -55,10 +55,6 @@ public class ScanCodeMobilePane extends WidgetMobilePane { } private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { - if (scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE) { - return true; - } else { - return false; - } + return scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE; } } From 695aea46b367e73e9c355e61d86fc5ee7a61602d Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 20 Nov 2018 13:55:00 +0800 Subject: [PATCH 064/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9enum=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/mobile/ScanCodeMobilePane.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index 586501e7bc..e9c798ec95 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -37,24 +37,14 @@ public class ScanCodeMobilePane extends WidgetMobilePane { public void populate(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); - appScanCodeCheck.setSelected(scanCodeState2boolean(scanCodeState)); + appScanCodeCheck.setSelected(scanCodeState.getState()); } @Override public void update(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - mobileScanCodeAttr.setScanCodeState(boolean2ScanCodeState(appScanCodeCheck.isSelected())); + mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected())); } - private ScanCodeState boolean2ScanCodeState(boolean scanCodeCheck) { - if (scanCodeCheck) { - return ScanCodeState.SUPPORT_SCAN_CODE; - } else { - return ScanCodeState.NOT_SUPPORT_SCAN_CODE; - } - } - private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { - return scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE; - } } From bf21ec926a5cb098fcc9ec6601ffd840684be608 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Nov 2018 17:55:34 +0800 Subject: [PATCH 065/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/MobileTemplateStylePane.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 98309819d1..73a8935dca 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -4,11 +4,8 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; import com.fr.form.ui.container.cardlayout.WCardTagLayout; -import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; -import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; -import com.fr.general.cardtag.mobile.SliderStyle; -import com.fr.general.cardtag.mobile.UpMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyleType; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -26,12 +23,12 @@ import java.util.List; import java.util.Map; public class MobileTemplateStylePane extends AbstractTemplateStylePane { - private static final List STYLE_LIST = new ArrayList(); + private static final List STYLE_LIST = new ArrayList(); static { - STYLE_LIST.add(new DefaultMobileTemplateStyle()); - STYLE_LIST.add(new UpMenuStyle()); - STYLE_LIST.add(new DownMenuStyle()); - STYLE_LIST.add(new SliderStyle()); + STYLE_LIST.add(MobileTemplateStyleType.DEFAULT_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.UP_MENU_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.DOWN_MENU_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.SLIDER_STYLE); } private DefaultListModel listModel; @@ -49,11 +46,11 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style.getStyle(), tagLayout); - map.put(style.toString(), styleBasicBeanPane); - right.add(style.toString(), styleBasicBeanPane); + map.put(style.getDisplayName(), styleBasicBeanPane); + right.add(style.getDisplayName(), styleBasicBeanPane); } styleList = new JList(listModel); styleList.setCellRenderer(render); @@ -97,7 +94,9 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane Date: Tue, 20 Nov 2018 19:08:47 +0800 Subject: [PATCH 066/187] =?UTF-8?q?module=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/module/DesignerActivator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index a674e1d50b..18b1eeab16 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -6,6 +6,7 @@ import com.fr.base.MultiFieldParameter; import com.fr.base.process.ProcessOperator; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.actions.NewFormAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.actions.insert.cell.ChartCellAction; @@ -42,7 +43,6 @@ import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; -import com.fr.design.actions.NewFormAction; import com.fr.design.mainframe.bbs.BBSGuestPane; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.form.FormECCompositeProvider; @@ -57,9 +57,9 @@ import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; +import com.fr.form.module.FormBaseActivator; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.WidgetInfoConfig; -import com.fr.general.ModuleContext; import com.fr.general.xml.GeneralXMLTools; import com.fr.js.EmailJavaScript; import com.fr.js.JavaScriptImpl; @@ -89,6 +89,7 @@ import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; +import com.fr.report.module.ReportBaseActivator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; @@ -100,7 +101,7 @@ import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.start.BBSGuestPaneProvider; import com.fr.xml.ReportXMLUtils; -import java.awt.*; +import java.awt.Image; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; @@ -108,8 +109,6 @@ import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static com.fr.stable.module.Module.ENGINE_MODULE; - /** * Created by juhaoyu on 2018/1/31. * 触发原来的DesignerModule的启动 @@ -152,7 +151,7 @@ public class DesignerActivator extends Activator { } } - private static void designerModuleStart() { + private void designerModuleStart() { StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class); ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); @@ -264,8 +263,9 @@ public class DesignerActivator extends Activator { * kunsnat: 一些模块信息 必须跟随设计器启动, * 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息 */ - private static void justStartModules4Engine() { - ModuleContext.startModule(ENGINE_MODULE); + private void justStartModules4Engine() { + startSub(ReportBaseActivator.class); + startSub(FormBaseActivator.class); } private static void justStartModules4Designer() { From 04011dbce2d4292f4df313936fae6aa14fbc9849 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 20 Nov 2018 20:33:53 +0800 Subject: [PATCH 067/187] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/module/DesignerActivator.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 18b1eeab16..010435fbf2 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -57,7 +57,6 @@ import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; -import com.fr.form.module.FormBaseActivator; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.xml.GeneralXMLTools; @@ -89,7 +88,6 @@ import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; -import com.fr.report.module.ReportBaseActivator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; @@ -158,7 +156,6 @@ public class DesignerActivator extends Activator { ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); - justStartModules4Engine(); justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); @@ -259,14 +256,6 @@ public class DesignerActivator extends Activator { }; } - /** - * kunsnat: 一些模块信息 必须跟随设计器启动, - * 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息 - */ - private void justStartModules4Engine() { - startSub(ReportBaseActivator.class); - startSub(FormBaseActivator.class); - } private static void justStartModules4Designer() { formDesignerRegister(); From 9a602342961e0d15f50f7244ef39670396a7375e Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 10:33:35 +0800 Subject: [PATCH 068/187] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExportAction.java | 7 ++++--- .../file/export/EmbeddedFormExportExportAction.java | 8 ++++---- .../actions/file/export/AbstractWorkBookExportAction.java | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 0105d7f958..4d9c976ce9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -9,6 +9,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; +import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; import com.fr.log.FineLoggerFactory; @@ -38,7 +39,7 @@ public abstract class AbstractExportAction> extends JT * * @return String scopeName */ - public abstract String exportScopeName(); + public abstract ExporterKey exportKey(); /** * 导出类型 @@ -209,11 +210,11 @@ public abstract class AbstractExportAction> extends JT // todo 后续想想办法 if (WorkContext.getCurrent().isLocal()) { WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); + .export(exportKey(), exportType(), outputStream, path, para); } else { byte[] contents = WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); + .export(exportKey(), exportType(), null, path, para); outputStream.write(contents); } diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 6f57422768..cd5c29ced4 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -8,16 +8,16 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; +import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; +import com.fr.io.exporter.DesignExportScope; import com.fr.io.exporter.DesignExportType; import com.fr.stable.ArrayUtils; import java.util.HashMap; import java.util.Map; -import static com.fr.io.exporter.DesignExportScope.FINE_FORM; - /** * Export Embedded. */ @@ -33,8 +33,8 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction } @Override - public String exportScopeName() { - return FINE_FORM.toString(); + public ExporterKey exportKey() { + return DesignExportScope.FINE_FORM; } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java index bfec887440..22a4118208 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java @@ -8,14 +8,14 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.parameter.ParameterInputPane; +import com.fr.io.exporter.ExporterKey; +import com.fr.io.exporter.DesignExportScope; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; import java.util.HashMap; import java.util.Map; -import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; - /** * Abstract export action. */ @@ -31,8 +31,8 @@ public abstract class AbstractWorkBookExportAction extends AbstractExportAction< return this.getEditingComponent().getTarget(); } - public String exportScopeName() { - return FINE_BOOK.toString(); + public ExporterKey exportKey() { + return DesignExportScope.FINE_BOOK; } @Override From 5442e99400376bf94c2718f43c39553527241229 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 11:36:42 +0800 Subject: [PATCH 069/187] file extension --- .../file/export/EmbeddedFormExportExportAction.java | 5 +++-- .../actions/file/export/AbstractExcelExportAction.java | 10 ++++++---- .../file/export/EmbeddedExportExportAction.java | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index cd5c29ced4..6d0fe9aa52 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -2,17 +2,18 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.base.extension.FileExtension; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; -import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportScope; import com.fr.io.exporter.DesignExportType; +import com.fr.io.exporter.ExporterKey; import com.fr.stable.ArrayUtils; import java.util.HashMap; @@ -71,6 +72,6 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); + return new ChooseFileFilter(FileExtension.FRM.getExtensions(), Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 44c32637bb..f51feb6b6a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -4,6 +4,7 @@ package com.fr.design.actions.file.export; import com.fr.base.ExcelUtils; +import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.file.filter.ChooseFileFilter; @@ -23,9 +24,10 @@ public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAc protected ChooseFileFilter getChooseFileFilter() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (ReportUtils.hasLayerReport4Template(tpl)) { - return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); + return new ChooseFileFilter(FileExtension.ZIP, "ZIP"); } else { - return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Toolkit.i18nText("Fine-Design_Report_Export_Excel")); + return new ChooseFileFilter(new String[]{FileExtension.XLSX.getExtension(), FileExtension.XLS.getExtension()}, + Toolkit.i18nText("Fine-Design_Report_Export_Excel")); } } @@ -33,9 +35,9 @@ public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAc protected String getDefaultExtension() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (ReportUtils.hasLayerReport4Template(tpl)) { - return "zip"; + return FileExtension.ZIP.getExtension(); } else { - return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; + return ExcelUtils.checkThirdJarSupportPOI() ? FileExtension.XLSX.getExtension() : FileExtension.XLS.getExtension(); } } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index 9944142b72..25a6da3ad2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -33,7 +33,7 @@ public class EmbeddedExportExportAction extends AbstractWorkBookExportAction { @Override protected String getDefaultExtension() { - return getEditingComponent().suffix().substring(1); + return FileExtension.CPT.getExtension(); } @Override From 1c2a3684b1c4ceb391a42f09712ea485f5bbce14 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 18:42:49 +0800 Subject: [PATCH 070/187] TinyFormulaPane --- .../hyperlink/ReportletHyperNorthPane.java | 90 ++----------------- 1 file changed, 8 insertions(+), 82 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index d6a50a84c9..c1e454f1b0 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -4,10 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.event.UIObserverListener; -import com.fr.design.formula.FormulaFactory; -import com.fr.design.formula.UIFormula; -import com.fr.design.formula.VariableResolver; +import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -20,7 +17,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlinkDialogAttr; import com.fr.stable.CommonUtils; @@ -77,7 +73,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents) { // 对话框标题 - titleFiled = new JFormulaField(15); + titleFiled = new TinyFormulaPane(); + titleFiled.getUITextField().setColumns(15); final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); titlePanel.add(titleFiled); Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Title") + ":"), titlePanel}; @@ -450,75 +447,4 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Thu, 22 Nov 2018 15:23:42 +0800 Subject: [PATCH 071/187] =?UTF-8?q?REPORT-12885=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=B8=A3=E8=B0=A2=E5=90=8D=E5=8D=95SiteCenter?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/bbs/BBSConstants.java | 34 ++++++++++++--- .../main/java/com/fr/start/SplashContext.java | 41 +++++++++++++++---- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java index bb600b1cef..5e12f224f9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java @@ -26,29 +26,51 @@ public class BBSConstants { private static Properties PROP = null; + /** + * 获取所有的感谢对象,无法获取在线使用默认 + * @return 感谢对象的数组 + */ public static String[] getAllGuest() { return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY)); } + /** + * 获取所有的链接,无法获取在线使用默认 + * @return 链接的数组 + */ public static String[] getAllLink() { return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY)); } - //加载所有用户的信息, 用户名, 论坛连接 + /** + * 获取所有的感谢对象,手动选择策略 + * @return 感谢对象的数组 + */ + public static String[] getAllGuestManual(boolean isOnline) { + String guest; + if (isOnline) { + guest = CloudCenter.getInstance().acquireUrlByKind(GUEST_KEY_ONLINE, StringUtils.EMPTY); + } else { + guest = loadAllGuestsInfo(GUEST_KEY); + } + if (StringUtils.isNotEmpty(guest)) { + return guest.split("\\|"); + } + return new String[0]; + } + private static String loadAllGuestsInfo(String key) { return loadAttribute(key, StringUtils.EMPTY); } - //加载所有用户的信息, 用户名, 论坛连接 private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { - String[] allGuests = new String[0]; String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue); if (StringUtils.isNotEmpty(guest)) { - allGuests = guest.split("\\|"); + return guest.split("\\|"); } - return allGuests; + return new String[0]; } - + //如果要定制, 直接改bbs.properties就行了 private static String loadAttribute(String key, String defaultValue) { if (PROP == null) { diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 3eb3ac1059..2e5467557c 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,6 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; + private static final int FETCH_ONLINE_MAX_TIMES = 10; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -33,7 +34,8 @@ public class SplashContext { private int loadingIndex = 0; private String[] loading = new String[]{"..", "....", "......"}; - private static final String GUEST = getRandomUser(); + private int fetchOnlineTimes = 0; + private String guest = StringUtils.EMPTY; private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); @@ -81,6 +83,7 @@ public class SplashContext { scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { + showThanks(); loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); } @@ -90,7 +93,6 @@ public class SplashContext { @Override public void on(Event event, String i18n) { - showThanks(); moduleID = i18n; loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); @@ -110,21 +112,42 @@ public class SplashContext { /** * 获取随机感谢人员 */ - private static String getRandomUser() { - String[] allGuest = BBSConstants.getAllGuest(); - if (allGuest.length == 0) { - return StringUtils.EMPTY; - } + private String getRandomUser(String[] allGuest) { int num = new Random().nextInt(allGuest.length); return StringUtils.BLANK + allGuest[num]; } /** - * 展示感谢信息 + * 尝试获取在线资源,达到尝试上限之后使用默认值 + */ + private void tryFetchOnline() { + if (StringUtils.isNotEmpty(guest)) { + return; + } + String[] allGuest; + if (fetchOnlineTimes < FETCH_ONLINE_MAX_TIMES) { + allGuest = BBSConstants.getAllGuestManual(true); + if (allGuest.length == 0) { + fetchOnlineTimes++; + return; + } + } else { + allGuest = BBSConstants.getAllGuestManual(false); + } + guest = getRandomUser(allGuest); + } + + /** + * 展示感谢信息。这里场景是优先使用在线名单, + * 甚至可以因此可以延迟几秒显示。目前是尝试 + * 获取10次在线资源,最大时间3秒 */ private void showThanks() { if (shouldShowThanks()) { - updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + GUEST); + tryFetchOnline(); + if (StringUtils.isNotEmpty(guest)) { + updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); + } } } From 95c13ac159231d83db13415f9a2d148d3ac7b714 Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 22 Nov 2018 15:52:08 +0800 Subject: [PATCH 072/187] REPORT-11842 on/ExportTypeNotFoundException.java --- .../designer/mobile/ParaMobileDefinePane.java | 159 +++++++++++++++++- 1 file changed, 158 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index c7b2ed5981..8b0aec95f5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -1,22 +1,46 @@ package com.fr.design.widget.ui.designer.mobile; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.PropertyTab; +import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WSortLayout; +import com.fr.general.ComparatorUtils; +import com.fr.general.SiteCenter; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.report.ExtraReportClassManager; +import com.fr.report.fun.LocationAttrProvider; +import com.fr.report.fun.impl.AbstractLocationAttrProvider; + import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Desktop; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URI; import java.util.Set; /** @@ -25,6 +49,8 @@ import java.util.Set; public class ParaMobileDefinePane extends MobileWidgetDefinePane { private XCreator paraCreator; private FormDesigner designer; + private Item[] items; + private UIComboBox paramLocationComboBox; private AttributeChangeListener changeListener; private MobileWidgetListPane mobileWidgetListPane; @@ -36,6 +62,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + this.add(getMobilePropertyPane(), BorderLayout.NORTH); this.add(getMobileWidgetListPane(), BorderLayout.CENTER); this.addExtraUIExpandablePaneFromPlugin(); this.repaint(); @@ -54,6 +81,121 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { this.add(panel, BorderLayout.SOUTH); } + // 手机属性 + private UIExpandablePane getMobilePropertyPane() { + paramLocationComboBox = getParamLocationComboBox(); + UILabel tipLabel = getTipLabel(); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}}; + if (ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING).size() != 0) { + tipLabel = null; + } else { + ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); + } + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, + new Component[]{tipLabel, null}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + jPanel.add(panel); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel); + } + + private Item[] getItems() { + Set pluginCreators = ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING); + Item[] items = new Item[pluginCreators.size() + 1]; + LocationAttrProvider provider = getDefaultLocationAttr(); + items[0] = new Item(provider.descriptor(), provider); + for (int i = 0; i < pluginCreators.size(); i++) { + provider = pluginCreators.iterator().next(); + items[i + 1] = new Item(provider.descriptor(), provider); + } + return items; + } + + private UILabel getTipLabel() { + UILabel tipLabel = new UILabel(); + String[] strings = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip").split("\\|"); + StringBuilder text = new StringBuilder(); + text.append("").append(strings[0]) + .append("").append(strings[1]) + .append("").append(strings[2]) + .append(""); + tipLabel.setText(text.toString()); + tipLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + try { + //todo 添加对应插件下载地址 + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("plugin.download"))); + } catch (Exception exp) { + + } + } + @Override + public void mouseEntered(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + } + @Override + public void mouseExited(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } + @Override + public void mouseMoved(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + } + }); + return tipLabel; + } + + private UIComboBox getParamLocationComboBox() { + items = getItems(); + UIComboBox paramLocationComoBox = new UIComboBox(items); + paramLocationComoBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) e.getItem()).getValue()); + } + } + }); + return paramLocationComoBox; + } + + private LocationAttrProvider getDefaultLocationAttr() { + return new AbstractLocationAttrProvider() { + @Override + public String descriptor() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"); + } + + @Override + public JSONObject createJSON() { + JSONObject jo = JSONObject.create(); + try { + jo.put("queryType", "default"); + } catch (JSONException e) { + + } + return jo; + } + }; + } + // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -85,10 +227,25 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { this.designer = designer; - // 设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); + int index = 0; + try { + LocationAttrProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); + String currentQueryType = provider.createJSON().getString("queryType"); + for (int i = 0; i < items.length; i++) { + String existedQueryType = ((LocationAttrProvider) items[i].getValue()).createJSON().getString("queryType"); + if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { + index = i; + break; + } + } + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + paramLocationComboBox.setSelectedIndex(index); + } @Override From 719ca5ac3ab2cb2f581bf8c9e2e9bcb75c719c8d Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 12:44:41 +0800 Subject: [PATCH 073/187] =?UTF-8?q?ui=E9=83=A8=E5=88=86=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/mobile/ParaMobileDefinePane.java | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 8b0aec95f5..7e0f3b940a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -22,12 +22,10 @@ import com.fr.form.ui.container.WSortLayout; import com.fr.general.ComparatorUtils; import com.fr.general.SiteCenter; import com.fr.json.JSONException; -import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.report.ExtraReportClassManager; -import com.fr.report.fun.LocationAttrProvider; -import com.fr.report.fun.impl.AbstractLocationAttrProvider; - +import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.DefaultMobileParamStyle; import javax.swing.BorderFactory; @@ -90,10 +88,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { double[] rowSize = {p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}}; - if (ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING).size() != 0) { + if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).size() != 0) { tipLabel = null; } else { - ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); + ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); } Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, @@ -107,9 +105,9 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { } private Item[] getItems() { - Set pluginCreators = ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING); + Set pluginCreators = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); Item[] items = new Item[pluginCreators.size() + 1]; - LocationAttrProvider provider = getDefaultLocationAttr(); + MobileParamStyleProvider provider = new DefaultMobileParamStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); items[0] = new Item(provider.descriptor(), provider); for (int i = 0; i < pluginCreators.size(); i++) { provider = pluginCreators.iterator().next(); @@ -120,11 +118,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { private UILabel getTipLabel() { UILabel tipLabel = new UILabel(); - String[] strings = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip").split("\\|"); StringBuilder text = new StringBuilder(); - text.append("").append(strings[0]) - .append("").append(strings[1]) - .append("").append(strings[2]) + text.append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip")) + .append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Install_Parameter_Pane_Plugin")) + .append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_To_Get_More_Style")) .append(""); tipLabel.setText(text.toString()); tipLabel.addMouseListener(new MouseAdapter() { @@ -169,33 +166,13 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) e.getItem()).getValue()); + ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) e.getItem()).getValue()); } } }); return paramLocationComoBox; } - private LocationAttrProvider getDefaultLocationAttr() { - return new AbstractLocationAttrProvider() { - @Override - public String descriptor() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"); - } - - @Override - public JSONObject createJSON() { - JSONObject jo = JSONObject.create(); - try { - jo.put("queryType", "default"); - } catch (JSONException e) { - - } - return jo; - } - }; - } - // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -232,10 +209,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { this.addAttributeChangeListener(changeListener); int index = 0; try { - LocationAttrProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); + MobileParamStyleProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); String currentQueryType = provider.createJSON().getString("queryType"); for (int i = 0; i < items.length; i++) { - String existedQueryType = ((LocationAttrProvider) items[i].getValue()).createJSON().getString("queryType"); + String existedQueryType = ((MobileParamStyleProvider) items[i].getValue()).createJSON().getString("queryType"); if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { index = i; break; From 0e099b607b3ca0b0d6de89c1788b3b101f025299 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 23 Nov 2018 15:59:17 +0800 Subject: [PATCH 074/187] =?UTF-8?q?REPORT-12771=20@plough:=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=89=93=E5=8D=B0=E6=9C=BA?= =?UTF-8?q?=E4=B8=8E=E6=89=93=E5=8D=B0=E9=A2=84=E8=A7=88=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/AbstractNativePrintSettingPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index 9ba0180997..f32e0c1153 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -461,6 +461,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { extraUpdate(nativePrintAttr); nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); + nativePrintAttr.setPrinterName((String)printerComboBox.getSelectedItem()); nativePrintAttr.setCopy((int)copySpinner.getValue()); // 页码 From c86ab83bba7795403311fba27cefe8dc7b40036a Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 15:59:27 +0800 Subject: [PATCH 075/187] =?UTF-8?q?REPORT-12877=20=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=A8=A1=E6=9D=BF=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/TemplateTreePane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 7f2fcd2cfe..88f4ee2623 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -20,9 +20,14 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.web.BrowserProvider; +import com.fr.stable.web.Device; +import com.fr.stable.web.Repository; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; +import javax.servlet.http.HttpServletRequest; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.ToolTipManager; @@ -43,6 +48,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import java.util.Map; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -377,7 +383,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || selectedTreePaths.length != 1) { + if (selectedTreePaths == null || selectedTreePaths.length == 0) { return false; } // 选中的是文件夹 From 9a240682a50545c17a19cfed21e54d6baf77d59d Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:02:03 +0800 Subject: [PATCH 076/187] =?UTF-8?q?REPORT-12877=20=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=A8=A1=E6=9D=BF=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 88f4ee2623..fe23ac416d 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -20,14 +20,9 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.stable.script.CalculatorProvider; -import com.fr.stable.web.BrowserProvider; -import com.fr.stable.web.Device; -import com.fr.stable.web.Repository; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import javax.servlet.http.HttpServletRequest; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.ToolTipManager; @@ -48,7 +43,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; -import java.util.Map; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; From 79b8564360ff0788cd0f1b731ccd511b2783838e Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:06:42 +0800 Subject: [PATCH 077/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index fe23ac416d..11f0daf63a 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -17,6 +17,7 @@ import com.fr.file.filetree.IOFileNodeFilter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; @@ -377,7 +378,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || selectedTreePaths.length == 0) { + if (selectedTreePaths == null || ArrayUtils.isEmpty(selectedTreePaths)) { return false; } // 选中的是文件夹 From 2dbbe0cdc1d1a108c9fad0e0544c7111a462717c Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:17:56 +0800 Subject: [PATCH 078/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 11f0daf63a..ed63b06cef 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -378,7 +378,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || ArrayUtils.isEmpty(selectedTreePaths)) { + if (ArrayUtils.isEmpty(selectedTreePaths)) { return false; } // 选中的是文件夹 From 7a7c43e5af799b1cc1c23af55f3197257804998c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 23 Nov 2018 17:54:54 +0800 Subject: [PATCH 079/187] =?UTF-8?q?REPORT-11832=20-=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index aed07afb03..666778610c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -34,8 +34,9 @@ public abstract class DatabaseConnectionPane Date: Tue, 27 Nov 2018 10:19:36 +0800 Subject: [PATCH 080/187] =?UTF-8?q?REPORT-12974=20pc=E7=AB=AF=E3=80=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E3=80=81=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=8B=E6=89=AB=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=8B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=89=AB=E7=A0=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XTextEditor.java | 6 ++ .../mobile/ScanCodeMobilePropertyUI.java | 32 ++++++++ .../mobile/ScanCodeMobileDefinePane.java | 76 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java index 0ba6e5fe4c..00daae7c7d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java @@ -6,7 +6,9 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.design.designer.properties.mobile.ScanCodeMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; @@ -82,4 +84,8 @@ public class XTextEditor extends XWrapperedFieldEditor { return "text_field_16.png"; } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[] {new ScanCodeMobilePropertyUI(this)}; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java new file mode 100644 index 0000000000..85011ee2b9 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java @@ -0,0 +1,32 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XTextEditor; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.ScanCodeMobileDefinePane; + +public class ScanCodeMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public ScanCodeMobilePropertyUI(XTextEditor xTextEditor) { + this.xCreator = xTextEditor; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new ScanCodeMobileDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java new file mode 100644 index 0000000000..dfa902d862 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java @@ -0,0 +1,76 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.base.mobile.MobileScanCodeAttr; +import com.fr.base.mobile.ScanCodeState; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.TextEditor; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { + + private XCreator xCreator; + private UICheckBox appScanCodeCheck; + + public ScanCodeMobileDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel mobileSettingsPane = getMobileSettingsPane(); + this.add(mobileSettingsPane, BorderLayout.NORTH); + this.repaint(); + } + + private UIExpandablePane getMobileSettingsPane() { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true); + appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + panel.add(appScanCodeCheck); + final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panelWrapper.add(panel, BorderLayout.NORTH); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper); + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void populate(FormDesigner designer) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); + ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); + appScanCodeCheck.setSelected(scanCodeState.getState()); + this.bindListeners2Widgets(); + } + + @Override + public void update() { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); + mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected())); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + +} From 775f14c46f8945e8bca18b10abdee9e412796098 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 15:15:26 +0800 Subject: [PATCH 081/187] REPORT-12635 --- .../src/main/java/com/fr/design/widget/IconDefinePane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index 69805979ba..559f91abdd 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -47,6 +47,8 @@ public class IconDefinePane extends BasicPane { curIconName = cip.update(); setShowIconImage(); IconDefinePane.this.repaint(); + //把图标信息入库 + WidgetInfoConfig.getInstance().setIconManager(WidgetInfoConfig.getInstance().getIconManager()); } }); editDialog.setVisible(true); From 0a9e59de66e1394bd2b72378acbcdffdb96414f1 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 15:21:01 +0800 Subject: [PATCH 082/187] REPORT-12635 --- .../fr/design/fun/MessageObjectProvider.java | 26 ------------------- .../impl/AbstractMessageObjectProvider.java | 17 ------------ 2 files changed, 43 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java delete mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java b/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java deleted file mode 100644 index 09f62aa575..0000000000 --- a/designer-base/src/main/java/com/fr/design/fun/MessageObjectProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.fun; - -import com.fr.json.JSONObject; -import com.fr.stable.fun.mark.Mutable; - -import java.util.Map; - -public interface MessageObjectProvider extends Mutable { - String MARK_STRING = "MessageObjectProvider"; - - int CURRENT_LEVEL = 1; - //消息类型 - int getMessageType(); - - /** - * 需要嵌入的组件内容 - * @return - */ - Map getValueEditorItems(); - - /** - * 实现发消息 - * @param messageJo - */ - void sendMessage(JSONObject messageJo); -} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java deleted file mode 100644 index a926409d11..0000000000 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMessageObjectProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.MessageObjectProvider; -import com.fr.stable.fun.impl.AbstractProvider; -import com.fr.stable.fun.mark.API; - -@API(level = MessageObjectProvider.CURRENT_LEVEL) -public abstract class AbstractMessageObjectProvider extends AbstractProvider implements MessageObjectProvider { - - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - public String mark4Provider() { - return getClass().getName(); - } -} From 732f2b973a82dc6db725a92f9c39be22359afd37 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 16:05:10 +0800 Subject: [PATCH 083/187] REPORT-12635 --- .../src/main/java/com/fr/design/widget/IconDefinePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index 559f91abdd..3f45ba7d04 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -1,5 +1,6 @@ package com.fr.design.widget; +import com.fr.base.IconManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -48,7 +49,7 @@ public class IconDefinePane extends BasicPane { setShowIconImage(); IconDefinePane.this.repaint(); //把图标信息入库 - WidgetInfoConfig.getInstance().setIconManager(WidgetInfoConfig.getInstance().getIconManager()); + WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); } }); editDialog.setVisible(true); From e99d82a97fd13a7f8977f6dbb9f4eac0af08ef04 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 16:09:13 +0800 Subject: [PATCH 084/187] REPORT-12635 --- .../src/main/java/com/fr/design/web/CustomIconPane.java | 2 ++ .../src/main/java/com/fr/design/widget/IconDefinePane.java | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 90d5874ecb..5ebf6a025f 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -283,6 +283,8 @@ public class CustomIconPane extends BasicPane { } public String update() { + //把图标信息入库 + WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); return selectedIconName; } diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index 3f45ba7d04..97ae0c66d9 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -48,8 +48,6 @@ public class IconDefinePane extends BasicPane { curIconName = cip.update(); setShowIconImage(); IconDefinePane.this.repaint(); - //把图标信息入库 - WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); } }); editDialog.setVisible(true); From 31a229baef8f6af7580ff86cd2456aab5d90bad1 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 16:09:58 +0800 Subject: [PATCH 085/187] REPORT-12635 --- .../src/main/java/com/fr/design/widget/IconDefinePane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java index 97ae0c66d9..69805979ba 100644 --- a/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java @@ -1,6 +1,5 @@ package com.fr.design.widget; -import com.fr.base.IconManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; From 4720e42ccb57c859275363659461ec0071f0cceb Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 27 Nov 2018 16:57:35 +0800 Subject: [PATCH 086/187] =?UTF-8?q?REPORT-11623=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/base/vcs/DesignerMode.java | 60 +++++++++++++++++++ .../actions/ExitAuthorityEditAction.java | 2 +- .../fr/design/actions/edit/CopyAction.java | 5 +- .../com/fr/design/actions/edit/CutAction.java | 14 ++--- .../design/base/mode/DesignModeContext.java | 42 +++++++++++++ .../com/fr/design/base/mode/DesignerMode.java | 8 +++ .../fr/design/mainframe/DesignerFrame.java | 15 ++++- .../fr/design/mainframe/DesktopCardPane.java | 54 ++++++++++------- .../com/fr/design/mainframe/JTemplate.java | 9 +++ .../src/main/java/com/fr/file/FileFILE.java | 3 +- .../main/java/com/fr/file/FileNodeFILE.java | 3 +- .../designer/beans/actions/CopyAction.java | 5 +- .../designer/beans/actions/CutAction.java | 44 +++++++------- .../com/fr/design/mainframe/FormDesigner.java | 48 ++++++++++++--- .../java/com/fr/design/mainframe/JForm.java | 7 +++ .../fr/design/mainframe/ElementCasePane.java | 39 +++++++----- .../com/fr/design/mainframe/JWorkBook.java | 7 +++ .../design/mainframe/WorkSheetDesigner.java | 9 ++- .../com/fr/design/mainframe/app/CptApp.java | 3 + .../com/fr/design/mainframe/app/CptxApp.java | 5 +- .../com/fr/design/mainframe/app/FormApp.java | 3 + .../form/FormElementCaseDesigner.java | 32 ++++++---- .../main/java/com/fr/poly/PolyDesigner.java | 7 +++ 23 files changed, 327 insertions(+), 97 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java create mode 100644 designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java create mode 100644 designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java diff --git a/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java b/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java new file mode 100644 index 0000000000..e718fe7812 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java @@ -0,0 +1,60 @@ +package com.fr.base.vcs; + +import com.fr.design.base.mode.DesignModeContext; + +/** + * 兼容 + * + * @deprecated user {@link com.fr.design.base.mode.DesignerMode} and {@link DesignModeContext} instead + */ +@Deprecated +public enum DesignerMode { + + NORMAL, + VCS, + AUTHORITY; + + + public static boolean isVcsMode() { + return DesignModeContext.isVcsMode(); + } + + + public static void setMode(DesignerMode mode) { + + switch (mode) { + case AUTHORITY: + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.AUTHORITY); + break; + case VCS: + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.VCS); + break; + case NORMAL: + default: + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + } + + + } + + public static DesignerMode getMode() { + switch (DesignModeContext.getMode()) { + case VCS: + return VCS; + case AUTHORITY: + return AUTHORITY; + case NORMAL: + default: + return NORMAL; + } + } + + /** + * 是否为权限编辑 + * + * @return 是否为权限编辑 + */ + public static boolean isAuthorityEditing() { + return DesignModeContext.isAuthorityEditing(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index 9d81481f78..44bd365a25 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -35,7 +35,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { } if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMARL); + DesignerMode.setMode(DesignerMode.NORMAL); WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java index 568b439f03..397d6ff2c1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java @@ -5,10 +5,10 @@ package com.fr.design.actions.edit; import com.fr.base.BaseUtils; import com.fr.design.actions.TemplateComponentAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; - -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -24,6 +24,7 @@ public class CopyAction extends TemplateComponentAction { this.setMnemonic('C'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); + this.setEnabled(!DesignModeContext.isBanCopyAndCut()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java index 67ffae2377..aa4fae62dc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java @@ -3,14 +3,13 @@ */ package com.fr.design.actions.edit; -import java.awt.event.KeyEvent; - -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; import com.fr.design.actions.TemplateComponentAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; +import javax.swing.KeyStroke; +import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -21,13 +20,14 @@ public class CutAction extends TemplateComponentAction { /** * Constructor */ - public CutAction(TargetComponent t) { - super(t); - + public CutAction(TargetComponent t) { + super(t); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); + this.setEnabled(!DesignModeContext.isBanCopyAndCut()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java new file mode 100644 index 0000000000..843ff4208d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java @@ -0,0 +1,42 @@ +package com.fr.design.base.mode; + +import static com.fr.design.base.mode.DesignerMode.AUTHORITY; + +public class DesignModeContext { + + private static DesignerMode mode = DesignerMode.NORMAL; + + public static void switchTo(DesignerMode mode) { + DesignModeContext.mode = mode; + } + + public static DesignerMode getMode() { + return mode; + } + + /** + * 是否是版本控制模式 + * + * @return 是否是版本控制模式 + */ + public static boolean isVcsMode() { + return mode == DesignerMode.VCS; + } + + /** + * @return 是否是禁止拷贝剪切模式 + */ + public static boolean isBanCopyAndCut() { + return mode == DesignerMode.BAN_COPY_AND_CUT; + } + + + /** + * 是否为权限编辑 + * + * @return 是否为权限编辑 + */ + public static boolean isAuthorityEditing() { + return mode == AUTHORITY; + } +} diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java new file mode 100644 index 0000000000..b0dd4baafc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java @@ -0,0 +1,8 @@ +package com.fr.design.base.mode; + +public enum DesignerMode { + NORMAL, + BAN_COPY_AND_CUT, + VCS, + AUTHORITY +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 7d9a3d749d..5c262da9de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -37,6 +37,7 @@ import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.exception.DecryptTemplateException; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; @@ -65,6 +66,7 @@ import javax.swing.JLayeredPane; import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; import java.awt.BorderLayout; @@ -223,7 +225,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void mouseReleased(MouseEvent e) { if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMARL); + DesignerMode.setMode(DesignerMode.NORMAL); WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); @@ -963,6 +965,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { openFile(tplFile); + } catch (DecryptTemplateException e) { + JOptionPane.showMessageDialog( + this, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), + UIManager.getString("OptionPane.messageDialogTitle"), + JOptionPane.WARNING_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + if (this.getSelectedJTemplate() == null) { + addAndActivateJTemplate(); + } } catch (Throwable t) { FineLoggerFactory.getLogger().error(t.getMessage(), t); addAndActivateJTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index 26dff260a8..a5f4a72ac7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -3,12 +3,14 @@ */ package com.fr.design.mainframe; -import java.awt.*; - - +import com.fr.base.iofile.attr.DesignBanCopyAttrMark; +import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.base.mode.DesignerMode; +import com.fr.design.dialog.BasicPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.dialog.BasicPane; + +import java.awt.BorderLayout; /** @@ -17,16 +19,22 @@ import com.fr.design.dialog.BasicPane; */ public class DesktopCardPane extends BasicPane implements TargetModifiedListener { - private static final long serialVersionUID = 1L; - private JTemplate component; + private static final long serialVersionUID = 1L; + private JTemplate component; - protected DesktopCardPane() { - setLayout(new BorderLayout()); - } + protected DesktopCardPane() { + setLayout(new BorderLayout()); + } - protected void showJTemplate(final JTemplate jt) { - DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); - if(component != null) { + protected void showJTemplate(final JTemplate jt) { + // 判断是否切换设计器状态到禁止拷贝剪切 + if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { + DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT); + } else { + DesignModeContext.switchTo(DesignerMode.NORMAL); + } + DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); + if (component != null) { remove(component); } add(component = jt, BorderLayout.CENTER); @@ -34,18 +42,18 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener repaint(); revalidate(); component.requestGridFocus(); - } + } - protected JTemplate getSelectedJTemplate() { - return component; - } + protected JTemplate getSelectedJTemplate() { + return component; + } - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Desktop"); - } + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Desktop"); + } - @Override - public void targetModified(TargetModifiedEvent e) { - } + @Override + public void targetModified(TargetModifiedEvent e) { + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index d14a066e53..7880d26872 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -5,6 +5,7 @@ import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.io.BaseBook; +import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; @@ -17,6 +18,7 @@ import com.fr.design.actions.edit.UndoAction; import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; @@ -104,6 +106,12 @@ public abstract class JTemplate> public JTemplate(T t, FILE file, boolean isNewFile) { super(t); + // 判断是否切换设计器状态到禁止拷贝剪切 + if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); + } else { + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + } this.template = t; this.previewType = parserPreviewProvider(t.getPreviewType()); this.editingFILE = file; @@ -117,6 +125,7 @@ public abstract class JTemplate> openTime = System.currentTimeMillis(); process.append(tic.loadProcess(t)); } + } // 刷新右侧属性面板 diff --git a/designer-base/src/main/java/com/fr/file/FileFILE.java b/designer-base/src/main/java/com/fr/file/FileFILE.java index ee92205f50..d5a9beb42e 100644 --- a/designer-base/src/main/java/com/fr/file/FileFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileFILE.java @@ -4,6 +4,7 @@ import com.fr.base.io.XMLEncryptUtils; import com.fr.design.gui.itree.filetree.FileComparator; import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.general.ComparatorUtils; +import com.fr.io.EncryptUtils; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.web.session.SessionLocalManager; @@ -185,7 +186,7 @@ public class FileFILE implements FILE { public InputStream asInputStream() throws Exception { InputStream in = new java.io.FileInputStream(file); return file.getName().endsWith(".cpt") || file.getName().endsWith(".frm") - ? XMLEncryptUtils.decodeInputStream(in) : in; + ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; } /** diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 207c51d24a..7f73fc7081 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -9,6 +9,7 @@ import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.io.EncryptUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; @@ -367,7 +368,7 @@ public class FileNodeFILE implements FILE { ); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") - ? XMLEncryptUtils.decodeInputStream(in) : in; + ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(in)) : in; } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 969f474838..a63ede4c15 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -1,11 +1,11 @@ package com.fr.design.designer.beans.actions; import com.fr.base.BaseUtils; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; - -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -19,6 +19,7 @@ public class CopyAction extends FormWidgetEditAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); setUpdateBehavior(new ComponentEnable()); + this.setEnabled(!DesignModeContext.isBanCopyAndCut()); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 3b70b0d2a3..23788df780 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -1,33 +1,33 @@ package com.fr.design.designer.beans.actions; -import java.awt.event.KeyEvent; - -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; - import com.fr.design.mainframe.FormDesigner; +import javax.swing.KeyStroke; +import java.awt.event.KeyEvent; + import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; public class CutAction extends FormWidgetEditAction { - public CutAction(FormDesigner t) { - super(t); - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); - this.setMnemonic('T'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); - this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); - this.setUpdateBehavior(new ComponentEnable()); - } - - @Override - public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { - return false; - } - return editPane.cut(); - } + public CutAction(FormDesigner t) { + super(t); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); + this.setMnemonic('T'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); + this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); + this.setUpdateBehavior(new ComponentEnable()); + this.setEnabled(!DesignModeContext.isBanCopyAndCut()); + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + FormDesigner editPane = getEditingComponent(); + if (editPane == null) { + return false; + } + return editPane.cut(); + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 82ded472ed..b313bc1433 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -5,10 +5,18 @@ import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.Painter; -import com.fr.design.designer.beans.actions.*; +import com.fr.design.designer.beans.actions.CopyAction; +import com.fr.design.designer.beans.actions.CutAction; +import com.fr.design.designer.beans.actions.FormDeleteAction; +import com.fr.design.designer.beans.actions.MoveDownAction; +import com.fr.design.designer.beans.actions.MoveToBottomAction; +import com.fr.design.designer.beans.actions.MoveToTopAction; +import com.fr.design.designer.beans.actions.MoveUpAction; +import com.fr.design.designer.beans.actions.PasteAction; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; import com.fr.design.designer.beans.events.CreatorEventListenerTable; import com.fr.design.designer.beans.events.DesignerEditListener; @@ -19,7 +27,14 @@ import com.fr.design.designer.beans.location.RootResizeDirection; import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.StateModel; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XChartEditor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.XWBorderLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -45,16 +60,27 @@ import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; - import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; -import javax.swing.*; +import javax.swing.Action; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.TransferHandler; import javax.swing.border.Border; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreePath; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationHandler; @@ -670,7 +696,7 @@ public class FormDesigner extends TargetComponent

implements TreeSelection refreshParameter(); } } else { - for( UpdateAction action : getActions()) { + for (UpdateAction action : getActions()) { action.update(); } } @@ -1343,6 +1369,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ @Override public void copy() { + if (DesignModeContext.isBanCopyAndCut()) { + return; + } selectionModel.copySelectedCreator2ClipBoard(); } @@ -1364,6 +1393,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ @Override public boolean cut() { + if (DesignModeContext.isBanCopyAndCut()) { + return false; + } selectionModel.cutSelectedCreator2ClipBoard(); return false; } @@ -1482,11 +1514,11 @@ public class FormDesigner extends TargetComponent implements TreeSelection } - public void setResolution(int resolution){ + public void setResolution(int resolution) { this.resolution = resolution; } - public int getResolution(){ + public int getResolution() { return this.resolution; } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 381472d38f..bfbe41a72a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -8,6 +8,7 @@ import com.fr.design.DesignState; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; @@ -427,6 +428,9 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public void copy() { + if (DesignModeContext.isBanCopyAndCut()) { + return; + } this.formDesign.copy(); } @@ -449,6 +453,9 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public boolean cut() { + if (DesignModeContext.isBanCopyAndCut()) { + return false; + } return this.formDesign.cut(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index df9476c716..a0437ea510 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -48,6 +48,7 @@ import com.fr.design.actions.edit.CutAction; import com.fr.design.actions.edit.PasteAction; import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; @@ -81,7 +82,6 @@ import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; import com.fr.general.ComparatorUtils; - import com.fr.grid.Grid; import com.fr.grid.GridColumn; import com.fr.grid.GridCorner; @@ -612,6 +612,11 @@ public abstract class ElementCasePane extends Tar * @return 成功返回true */ public boolean cut() { + if (DesignModeContext.isBanCopyAndCut()) { + FineLoggerFactory.getLogger().debug("Prohibit Cut"); + return false; + } + this.copy(); return this.clearAll(); @@ -621,6 +626,9 @@ public abstract class ElementCasePane extends Tar * 复制 */ public void copy() { + if (DesignModeContext.isBanCopyAndCut()) { + return; + } // p:Elements Transferable. ElementsTransferable elementsTransferable = this.transferSelection(); @@ -884,20 +892,23 @@ public abstract class ElementCasePane extends Tar // clearReportPage old values. inputMapAncestor.clear(); actionMap.clear(); - inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut"); - actionMap.put("cut", new AbstractAction() { - public void actionPerformed(ActionEvent evt) { - if (cut()) { - fireTargetModified(); + if (!DesignModeContext.isBanCopyAndCut()) { + inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut"); + actionMap.put("cut", new AbstractAction() { + public void actionPerformed(ActionEvent evt) { + if (cut()) { + fireTargetModified(); + } } - } - }); - inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy"); - actionMap.put("copy", new AbstractAction() { - public void actionPerformed(ActionEvent evt) { - copy(); - } - }); + }); + inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy"); + actionMap.put("copy", new AbstractAction() { + public void actionPerformed(ActionEvent evt) { + System.out.println("copy"); + copy(); + } + }); + } inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), "paste"); actionMap.put("paste", new AbstractAction() { public void actionPerformed(ActionEvent evt) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index f77af4c439..df4b27409d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -25,6 +25,7 @@ import com.fr.design.actions.report.ReportParameterAction; import com.fr.design.actions.report.ReportPrintSettingAction; import com.fr.design.actions.report.ReportWatermarkAction; import com.fr.design.actions.report.ReportWebAttrAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.TableDataTreePane; @@ -568,6 +569,9 @@ public class JWorkBook extends JTemplate { */ @Override public void copy() { + if (DesignModeContext.isBanCopyAndCut()) { + return; + } this.delegate4ToolbarMenuAdapter().copy(); } @@ -578,6 +582,9 @@ public class JWorkBook extends JTemplate { */ @Override public boolean cut() { + if (DesignModeContext.isBanCopyAndCut()) { + return false; + } return this.delegate4ToolbarMenuAdapter().cut(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java index 063fd29f66..c7b22d2970 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java @@ -6,6 +6,7 @@ import com.fr.design.actions.report.ReportColumnsAction; import com.fr.design.actions.report.ReportEngineAttrAction; import com.fr.design.actions.report.ReportPageAttrAction; import com.fr.design.actions.report.ReportWriteAttrAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.EditingState; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -80,6 +81,9 @@ public class WorkSheetDesigner extends ReportComponent extends TargetComponent implements Selectedable, FormECDesignerProvider{ +public class FormElementCaseDesigner extends TargetComponent implements Selectedable, FormECDesignerProvider { protected FormElementCasePaneDelegate elementCasePane; + @Override public FormElementCasePaneDelegate getEditingElementCasePane() { return elementCasePane; @@ -118,9 +118,9 @@ public class FormElementCaseDesigner Date: Tue, 27 Nov 2018 17:22:37 +0800 Subject: [PATCH 087/187] REPORT-12635 --- .../com/fr/design/web/CustomIconPane.java | 622 +++++++++--------- 1 file changed, 315 insertions(+), 307 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 5ebf6a025f..1bdad0161b 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -20,10 +20,13 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; +import com.fr.schedule.entry.Configuration; import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.ListMap; import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -39,328 +42,332 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; /** - * * carl:自定义Icon编辑 - * */ public class CustomIconPane extends BasicPane { - private String selectedIconName = null; - private ListMap iconButtonMap = null; - private JPanel iconPane = null; - private ButtonGroup bg; - private UIScrollPane jsPane; - // 老一次次去拿真麻烦 - private IconManager iconManager = null; - private UIButton removeButton; - private UIButton editButton; - - - - private static final int THE_WIDTH = 180; - private static final int HORIZONTAL_COUNT = 6; - private static final int HEIGHT_PER = 29; - private static final int GAP = 10; - - public CustomIconPane() { - this.initComponents(); - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))); - JPanel noNamePane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - centerPane.add(noNamePane, BorderLayout.CENTER); - - iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - - // 开始加图标选择按钮 - initIcons(); - - jsPane = new UIScrollPane(iconPane); - refreshIconPane(false); - jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - - jsPane.setPreferredSize(new Dimension(200,180)); - noNamePane.add(jsPane); - - DescriptionTextArea des = new DescriptionTextArea(2); - des.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1")); - centerPane.add(des, BorderLayout.SOUTH); - - this.add(centerPane, BorderLayout.CENTER); - - JPanel eastPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - - // 增加、删除、编辑按钮 - initAddButton(buttonPane); - initRemoveButton(buttonPane); - initEditButton(buttonPane); - - eastPane.add(buttonPane); - this.add(eastPane, BorderLayout.EAST); - - } - - private void initIcons() { - iconButtonMap = new ListMap(); - iconManager = WidgetInfoConfig.getInstance().getIconManager(); - bg = new ButtonGroup(); - Object[] names = iconManager.getIconNames(); - Object name = null; - for (int i = 0; i < names.length; i++) { - name = names[i]; - if (name == null || !(name instanceof String)) { - continue; - } - // carl:默认选第一个 - if (this.selectedIconName == null) { - this.selectedIconName = (String)name; - } - IconButton iconButton = new IconButton((String)name); - iconButtonMap.put(name, iconButton); - iconPane.add(iconButton); - bg.add(iconButton); - } - } - - private void initAddButton(JPanel buttonPane) { - UIButton addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); - addButton.setPreferredSize(new Dimension(80, 25)); - addButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - final EditIconDialog add = new EditIconDialog(); - add.populate(null); - add.showWindow(SwingUtilities.getWindowAncestor(CustomIconPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - Icon icon = add.update(); - if (iconManager.addIcon(icon, false)) { - IconButton iconButton = null;//初始化 - - addIcon(icon, iconButton); - - }else { - // add failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); - } - } + private String selectedIconName = null; + private ListMap iconButtonMap = null; + private JPanel iconPane = null; + private ButtonGroup bg; + private UIScrollPane jsPane; + // 老一次次去拿真麻烦 + private IconManager iconManager = null; + private UIButton removeButton; + private UIButton editButton; + + + private static final int THE_WIDTH = 180; + private static final int HORIZONTAL_COUNT = 6; + private static final int HEIGHT_PER = 29; + private static final int GAP = 10; + + public CustomIconPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))); + JPanel noNamePane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + centerPane.add(noNamePane, BorderLayout.CENTER); + + iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + // 开始加图标选择按钮 + initIcons(); + + jsPane = new UIScrollPane(iconPane); + refreshIconPane(false); + jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + + jsPane.setPreferredSize(new Dimension(200, 180)); + noNamePane.add(jsPane); + + DescriptionTextArea des = new DescriptionTextArea(2); + des.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1")); + centerPane.add(des, BorderLayout.SOUTH); + + this.add(centerPane, BorderLayout.CENTER); + + JPanel eastPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + + // 增加、删除、编辑按钮 + initAddButton(buttonPane); + initRemoveButton(buttonPane); + initEditButton(buttonPane); + + eastPane.add(buttonPane); + this.add(eastPane, BorderLayout.EAST); + + } + + private void initIcons() { + iconButtonMap = new ListMap(); + iconManager = WidgetInfoConfig.getInstance().getIconManager(); + bg = new ButtonGroup(); + Object[] names = iconManager.getIconNames(); + Object name = null; + for (int i = 0; i < names.length; i++) { + name = names[i]; + if (name == null || !(name instanceof String)) { + continue; + } + // carl:默认选第一个 + if (this.selectedIconName == null) { + this.selectedIconName = (String) name; + } + IconButton iconButton = new IconButton((String) name); + iconButtonMap.put(name, iconButton); + iconPane.add(iconButton); + bg.add(iconButton); + } + } + + private void initAddButton(JPanel buttonPane) { + UIButton addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); + addButton.setPreferredSize(new Dimension(80, 25)); + addButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final EditIconDialog add = new EditIconDialog(); + add.populate(null); + add.showWindow(SwingUtilities.getWindowAncestor(CustomIconPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + Icon icon = add.update(); + if (iconManager.addIcon(icon, false)) { + IconButton iconButton = null;//初始化 + + addIcon(icon, iconButton); + + } else { + // add failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + } + } }).setVisible(true); - } - }); - buttonPane.add(addButton); - } - - private void initRemoveButton(JPanel buttonPane) { - removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); - removeButton.setPreferredSize(new Dimension(80, 25)); - removeButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (iconManager.isSystemIcon(selectedIconName)) { - return; - } - if (iconManager.removeIcon(selectedIconName)) { - IconButton iconButton = (IconButton)iconButtonMap.get(selectedIconName); - iconPane.remove(iconButton); - iconButtonMap.remove(selectedIconName); - bg.remove(iconButton); - selectedIconName = ((IconButton)iconButtonMap.getByIndex(0)).iconName; - refreshIconPane(false); - CustomIconPane.this.validate(); - CustomIconPane.this.repaint(); - } else { - // remove failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.WARNING_MESSAGE); - } - } - }); - buttonPane.add(removeButton); - } - - private void initEditButton(JPanel buttonPane) { - editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - editButton.setPreferredSize(new Dimension(80, 25)); - editButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (iconManager.isSystemIcon(selectedIconName)) { - return; - } - Icon oldIcon = null; - try { - oldIcon= iconManager.getIcon(selectedIconName); - } catch (CloneNotSupportedException e1) { + } + }); + buttonPane.add(addButton); + } + + private void initRemoveButton(JPanel buttonPane) { + removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); + removeButton.setPreferredSize(new Dimension(80, 25)); + removeButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (iconManager.isSystemIcon(selectedIconName)) { + return; + } + if (iconManager.removeIcon(selectedIconName)) { + IconButton iconButton = (IconButton) iconButtonMap.get(selectedIconName); + iconPane.remove(iconButton); + iconButtonMap.remove(selectedIconName); + bg.remove(iconButton); + selectedIconName = ((IconButton) iconButtonMap.getByIndex(0)).iconName; + refreshIconPane(false); + CustomIconPane.this.validate(); + CustomIconPane.this.repaint(); + } else { + // remove failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.WARNING_MESSAGE); + } + } + }); + buttonPane.add(removeButton); + } + + private void initEditButton(JPanel buttonPane) { + editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + editButton.setPreferredSize(new Dimension(80, 25)); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (iconManager.isSystemIcon(selectedIconName)) { + return; + } + Icon oldIcon = null; + try { + oldIcon = iconManager.getIcon(selectedIconName); + } catch (CloneNotSupportedException e1) { // do nothing - } - if (oldIcon == null) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - "Error", - "Error", - JOptionPane.ERROR_MESSAGE); - } - - final EditIconDialog edit = new EditIconDialog(); - edit.populate(oldIcon); - edit.showWindow(DesignerContext.getDesignerFrame(), new IconDialogActionListener(oldIcon) { - @Override - public void doOk() { - iconManager.removeIcon(oldIcon.getName()); - Icon icon = edit.update(); - if (iconManager.addIcon(icon, false)) { - IconButton iconButton = (IconButton)iconButtonMap.get(oldIcon.getName()); - iconPane.remove(iconButton); - bg.remove(iconButton); - - addIcon(icon, iconButton); - - } else { - // 失败了再弄回去 - iconManager.addIcon(oldIcon, true); - // edit failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); - } - } + } + if (oldIcon == null) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + "Error", + "Error", + JOptionPane.ERROR_MESSAGE); + } + + final EditIconDialog edit = new EditIconDialog(); + edit.populate(oldIcon); + edit.showWindow(DesignerContext.getDesignerFrame(), new IconDialogActionListener(oldIcon) { + @Override + public void doOk() { + iconManager.removeIcon(oldIcon.getName()); + Icon icon = edit.update(); + if (iconManager.addIcon(icon, false)) { + IconButton iconButton = (IconButton) iconButtonMap.get(oldIcon.getName()); + iconPane.remove(iconButton); + bg.remove(iconButton); + + addIcon(icon, iconButton); + + } else { + // 失败了再弄回去 + iconManager.addIcon(oldIcon, true); + // edit failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + } + } }).setVisible(true); - } - }); - buttonPane.add(editButton); - } - - private void updateButtonPane() { - if (editButton == null || removeButton == null){ - return; - } - if (iconManager.isSystemIcon(selectedIconName)) { - editButton.setEnabled(false); + } + }); + buttonPane.add(editButton); + } + + private void updateButtonPane() { + if (editButton == null || removeButton == null) { + return; + } + if (iconManager.isSystemIcon(selectedIconName)) { + editButton.setEnabled(false); removeButton.setEnabled(false); - } else { + } else { editButton.setEnabled(true); removeButton.setEnabled(true); } - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"); - } + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"); + } /** * 添加按钮 * - * @param icon 图标 + * @param icon 图标 * @param iconButton 按钮 */ - public void addIcon(Icon icon,IconButton iconButton){ - selectedIconName = icon.getName(); - iconButton = new IconButton(icon.getName()); - iconButtonMap.put(icon.getName(), iconButton); - iconPane.add(iconButton); - bg.add(iconButton); - refreshIconPane(true); - CustomIconPane.this.validate(); - CustomIconPane.this.repaint(); - } - - public static class IconDialogActionListener extends DialogActionAdapter { - protected Icon oldIcon; - - public IconDialogActionListener(Icon oldIcon) { - this.oldIcon = oldIcon; - } - } - - public void populate(String iconName) { - if (iconName == null) { - return; - } - this.selectedIconName = iconName; + public void addIcon(Icon icon, IconButton iconButton) { + selectedIconName = icon.getName(); + iconButton = new IconButton(icon.getName()); + iconButtonMap.put(icon.getName(), iconButton); + iconPane.add(iconButton); + bg.add(iconButton); + refreshIconPane(true); + CustomIconPane.this.validate(); + CustomIconPane.this.repaint(); + } + + public static class IconDialogActionListener extends DialogActionAdapter { + protected Icon oldIcon; + + public IconDialogActionListener(Icon oldIcon) { + this.oldIcon = oldIcon; + } + } + + public void populate(String iconName) { + if (iconName == null) { + return; + } + this.selectedIconName = iconName; updateButtonPane(); - this.repaint(); - } - - public String update() { - //把图标信息入库 - WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); - return selectedIconName; - } - - // 不知道怎么动态布局,就这么傻傻的调一下大小 - private void refreshIconPane(boolean down) { - iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); - UIScrollBar jsBar = jsPane.createVerticalScrollBar(); - try { - if (down) { - // 将滚动条滚到最后 - jsBar.setValue(jsBar.getMaximum() - jsBar.getVisibleAmount()); - } else { - jsBar.setValue(0); - } - } catch (RuntimeException re) { + this.repaint(); + } + + public String update() { + //把图标信息入库 + Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { + @Override + public void run() { + WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); + } + }); + + return selectedIconName; + } + + // 不知道怎么动态布局,就这么傻傻的调一下大小 + private void refreshIconPane(boolean down) { + iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); + UIScrollBar jsBar = jsPane.createVerticalScrollBar(); + try { + if (down) { + // 将滚动条滚到最后 + jsBar.setValue(jsBar.getMaximum() - jsBar.getVisibleAmount()); + } else { + jsBar.setValue(0); + } + } catch (RuntimeException re) { return; - } - updateButtonPane(); - } - - private class IconButton extends JToggleButton implements ActionListener{ - private String iconName; - private Image iconImage = null; + } + updateButtonPane(); + } + + private class IconButton extends JToggleButton implements ActionListener { + private String iconName; + private Image iconImage = null; private static final int ICON_BUTTON_SIZE = 24; private static final int ICON_X = 4; private static final int ICON_Y = 4; - public IconButton(String name) { - this.iconName = name; - this.addActionListener(this); + + public IconButton(String name) { + this.iconName = name; + this.addActionListener(this); this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.setBorder(null); this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); this.setToolTipText(iconName); - } + } @Override public void updateUI() { - setUI(new BasicButtonUI(){ + setUI(new BasicButtonUI() { public void paint(Graphics g, JComponent c) { super.paint(g, c); } }); } - - @Override - public void paintComponent(Graphics g) { + + @Override + public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // carl:这里缩放显示 16 × 16 if (iconImage != null) { - g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); + g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); } if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) { - g2d.setPaint(Color.RED); + g2d.setPaint(Color.RED); } else { g2d.setPaint(Color.LIGHT_GRAY); } GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, IconManager.DEFAULT_ICONWIDTH + 7, - IconManager.DEFAULT_ICONHEIGHT + 7), Constants.LINE_THICK); + IconManager.DEFAULT_ICONHEIGHT + 7), Constants.LINE_THICK); } - + @Override - public Dimension getPreferredSize() { + public Dimension getPreferredSize() { return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE); } - + public void actionPerformed(ActionEvent evt) { CustomIconPane.this.selectedIconName = iconName; fireChagneListener(); - updateButtonPane(); + updateButtonPane(); CustomIconPane.this.repaint();// repaint } @Override - public void addChangeListener(ChangeListener changeListener) { + public void addChangeListener(ChangeListener changeListener) { this.changeListener = changeListener; } @@ -370,18 +377,18 @@ public class CustomIconPane extends BasicPane { this.changeListener.stateChanged(evt); } } - - } - - private static class EditIconDialog extends BasicPane { - private UITextField nameTextField; - private UILabel showImageLabel; - private Image iconImage = null; - private String oldName = null; - - protected EditIconDialog() { + + } + + private static class EditIconDialog extends BasicPane { + private UITextField nameTextField; + private UILabel showImageLabel; + private Image iconImage = null; + private String oldName = null; + + protected EditIconDialog() { init(); - } + } private void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -395,16 +402,17 @@ public class CustomIconPane extends BasicPane { nameTextField = new UITextField(20); browseButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent e) { onBrowseButtonClicked(); - } - }); + } + }); // 焦点丢失时看看名称是否已经存在 nameTextField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { // do nothing } + public void focusLost(FocusEvent e) { if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { return; @@ -421,7 +429,7 @@ public class CustomIconPane extends BasicPane { JPanel imagePane = new JPanel(); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); showImageLabel = new UILabel(); - showImageLabel.setPreferredSize(new Dimension(20,20)); + showImageLabel.setPreferredSize(new Dimension(20, 20)); imagePane.add(showImageLabel); imagePane.add(browseButton); Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; @@ -441,7 +449,7 @@ public class CustomIconPane extends BasicPane { // 将图片转化到16 × 16大小 Image image = BaseUtils.readImage(path); BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, -IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); + IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bufferedImage.createGraphics(); g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); bufferedImage.flush(); @@ -454,29 +462,29 @@ IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); } @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Add_Icon"); - } - - // 用户自定义的只有name 和 imgae两属性, path不要去管 - public void populate(Icon icon) { - if (icon == null) { - return; - } - oldName = icon.getName(); - nameTextField.setText(icon.getName()); - if (icon.getImage() != null) { - showImageLabel.setIcon(new ImageIcon(icon.getImage())); - } - iconImage = icon.getImage(); - } - - public Icon update() { - // 有一个是空,都返回null,反正不会添加的 - if (StringUtils.isBlank(nameTextField.getText()) || iconImage == null) { - return null; - } - return new Icon(nameTextField.getText(), iconImage); - } - } + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Add_Icon"); + } + + // 用户自定义的只有name 和 imgae两属性, path不要去管 + public void populate(Icon icon) { + if (icon == null) { + return; + } + oldName = icon.getName(); + nameTextField.setText(icon.getName()); + if (icon.getImage() != null) { + showImageLabel.setIcon(new ImageIcon(icon.getImage())); + } + iconImage = icon.getImage(); + } + + public Icon update() { + // 有一个是空,都返回null,反正不会添加的 + if (StringUtils.isBlank(nameTextField.getText()) || iconImage == null) { + return null; + } + return new Icon(nameTextField.getText(), iconImage); + } + } } From 3d61cbadb7224789d40c02769af12490c8aa6e22 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 27 Nov 2018 17:23:21 +0800 Subject: [PATCH 088/187] REPORT-12635 --- .../src/main/java/com/fr/design/web/CustomIconPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 1bdad0161b..658a580c06 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -20,7 +20,6 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; -import com.fr.schedule.entry.Configuration; import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.ListMap; From 550dcb715abadfee907b3091f5f0b9495601a1d6 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 27 Nov 2018 17:26:27 +0800 Subject: [PATCH 089/187] remove useless code --- .../src/main/java/com/fr/design/mainframe/ElementCasePane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index a0437ea510..96fa44c6d4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -904,7 +904,6 @@ public abstract class ElementCasePane extends Tar inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy"); actionMap.put("copy", new AbstractAction() { public void actionPerformed(ActionEvent evt) { - System.out.println("copy"); copy(); } }); From 47ab6595baf2eb0fb93ba1bcab3bd9711b8c131b Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 28 Nov 2018 10:47:51 +0800 Subject: [PATCH 090/187] f --- .../java/com/fr/base/vcs/DesignerMode.java | 57 +++++++++++++------ 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java b/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java index e718fe7812..84fcb1546a 100644 --- a/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java +++ b/designer-base/src/main/java/com/fr/base/vcs/DesignerMode.java @@ -10,33 +10,54 @@ import com.fr.design.base.mode.DesignModeContext; @Deprecated public enum DesignerMode { - NORMAL, - VCS, - AUTHORITY; + NORMAL() { + @Override + public void doSwitch() { + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + } + }, + VCS() { + @Override + public void doSwitch() { + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.VCS); + } + }, + AUTHORITY() { + @Override + public void doSwitch() { + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.AUTHORITY); + } + }; + abstract void doSwitch(); + + /** + * @return 是否时版本控制模式 + * @deprecated use {@link DesignModeContext#isVcsMode()} instead + */ + @Deprecated public static boolean isVcsMode() { return DesignModeContext.isVcsMode(); } + /** + * 切换设计器模式 + * + * @param mode mode + * @deprecated use {@link DesignModeContext#switchTo(com.fr.design.base.mode.DesignerMode)} instead + */ + @Deprecated public static void setMode(DesignerMode mode) { - - switch (mode) { - case AUTHORITY: - DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.AUTHORITY); - break; - case VCS: - DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.VCS); - break; - case NORMAL: - default: - DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); - } - - + mode.doSwitch(); } + /** + * @return 获取当前设计器模式 + * @deprecated use {@link DesignModeContext#getMode()} instead + */ + @Deprecated public static DesignerMode getMode() { switch (DesignModeContext.getMode()) { case VCS: @@ -53,7 +74,9 @@ public enum DesignerMode { * 是否为权限编辑 * * @return 是否为权限编辑 + * @deprecated use {@link DesignModeContext#isAuthorityEditing()} instead */ + @Deprecated public static boolean isAuthorityEditing() { return DesignModeContext.isAuthorityEditing(); } From 0a54a24cf43363fd85bc009b75860a2c67ddb770 Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 28 Nov 2018 14:38:59 +0800 Subject: [PATCH 091/187] =?UTF-8?q?CHART-3215=20=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/van/chart/designer/TableLayout4VanChartHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java index ed94fd15c9..da918bb792 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java @@ -37,7 +37,7 @@ public class TableLayout4VanChartHelper { public static JPanel createExpandablePaneWithTitle(String title, Component[][] components) { JPanel panel = createGapTableLayoutPane(components); - return createExpandablePaneWithTitle(title, panel); + return createExpandablePaneWithTitleTopGap(title, panel); } public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { From 01f5d14d523ca1fd8e6c14d564dceab52b6e3b00 Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 28 Nov 2018 15:48:29 +0800 Subject: [PATCH 092/187] =?UTF-8?q?CHART-3223=20&&=20CHART-3246=20&&=20CHA?= =?UTF-8?q?RT-3248=20=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/AbstractExtendedChartReportDataPane.java | 14 ++++++++------ .../chart/AbstractExtendedChartTableDataPane.java | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index 950d71e8c0..e42707a62a 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -6,6 +6,7 @@ import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import javax.swing.BorderFactory; @@ -49,16 +50,17 @@ public abstract class AbstractExtendedChartReportDataPane Date: Wed, 28 Nov 2018 16:52:31 +0800 Subject: [PATCH 093/187] =?UTF-8?q?REPORT-13034=20FR=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=8C=82=E8=BD=BD=E5=88=B0BI=EF=BC=8C=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E5=BC=82=E5=B8=B8=20REPORT-12578=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fit/menupane/BrowserFitAttrPane.java | 24 +++++++++++++------ .../menupane/TemplateBrowserFitAttrPane.java | 24 +++++++++++++------ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java index da495c54d4..ac52785635 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit.menupane; +import com.fr.config.Configuration; import com.fr.design.report.fit.FitType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; @@ -12,6 +13,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.log.FineLoggerFactory; import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitConfig; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; @@ -220,12 +223,19 @@ public class BrowserFitAttrPane extends BasicBeanPane { return attr; } - private void updateGlobalConfig(ReportFitAttr attr) { - try { - ReportFitConfig manager = ReportFitConfig.getInstance(); - manager.setFrmFitAttr(attr); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + private void updateGlobalConfig(final ReportFitAttr attr) { + + Configurations.update(new Worker() { + @Override + public void run() { + ReportFitConfig manager = ReportFitConfig.getInstance(); + manager.setFrmFitAttr(attr); + } + + @Override + public Class[] targets() { + return new Class[]{ReportFitConfig.class}; + } + }); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java index 664fa2471d..40e3188e85 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java @@ -1,9 +1,12 @@ package com.fr.design.report.fit.menupane; +import com.fr.config.Configuration; import com.fr.design.gui.ilable.UILabel; import com.fr.log.FineLoggerFactory; import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitConfig; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import java.awt.Component; @@ -65,12 +68,19 @@ public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane { return attr; } - private void updateGlobalConfig(ReportFitAttr attr) { - try { - ReportFitConfig manager = ReportFitConfig.getInstance(); - manager.setCptFitAttr(attr); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + private void updateGlobalConfig(final ReportFitAttr attr) { + + Configurations.update(new Worker() { + @Override + public void run() { + ReportFitConfig manager = ReportFitConfig.getInstance(); + manager.setCptFitAttr(attr); + } + + @Override + public Class[] targets() { + return new Class[]{ReportFitConfig.class}; + } + }); } } From 04eb804462e46e94b47c0b67f3dab42ebfe14e7b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 28 Nov 2018 16:53:49 +0800 Subject: [PATCH 094/187] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/report/fit/menupane/BrowserFitAttrPane.java | 3 +-- .../design/report/fit/menupane/TemplateBrowserFitAttrPane.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java index ac52785635..b17a0cd316 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/BrowserFitAttrPane.java @@ -1,7 +1,6 @@ package com.fr.design.report.fit.menupane; import com.fr.config.Configuration; -import com.fr.design.report.fit.FitType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; @@ -10,7 +9,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.log.FineLoggerFactory; +import com.fr.design.report.fit.FitType; import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitConfig; import com.fr.transaction.Configurations; diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java index 40e3188e85..95a876d1dd 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateBrowserFitAttrPane.java @@ -2,7 +2,6 @@ package com.fr.design.report.fit.menupane; import com.fr.config.Configuration; import com.fr.design.gui.ilable.UILabel; -import com.fr.log.FineLoggerFactory; import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitConfig; import com.fr.transaction.Configurations; From 55a6e1fbeed4ebae57676df72083fadb6772bc6f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 28 Nov 2018 17:07:12 +0800 Subject: [PATCH 095/187] =?UTF-8?q?REPORT-11623=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=8B=B7?= =?UTF-8?q?=E8=B4=9D=E5=89=AA=E5=88=87=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/edit/CopyAction.java | 5 +- .../com/fr/design/actions/edit/CutAction.java | 6 +- .../fr/design/actions/edit/PasteAction.java | 19 ++--- .../design/base/mode/DesignModeContext.java | 24 ++++++ .../com/fr/design/designer/DesignerProxy.java | 7 ++ .../fr/design/designer/TargetComponent.java | 80 ------------------- .../com/fr/design/mainframe/JTemplate.java | 3 +- .../designer/beans/actions/CopyAction.java | 5 +- .../designer/beans/actions/CutAction.java | 6 +- .../designer/beans/actions/PasteAction.java | 46 +++++------ .../java/com/fr/design/mainframe/JForm.java | 12 +-- .../fr/design/mainframe/ElementCasePane.java | 17 ++-- .../com/fr/design/mainframe/JWorkBook.java | 12 +-- .../fr/design/mainframe/ReportComponent.java | 7 +- .../design/mainframe/WorkSheetDesigner.java | 19 ++--- .../form/FormElementCaseDesigner.java | 18 ++--- .../main/java/com/fr/poly/PolyDesigner.java | 30 +------ .../java/com/fr/poly/creator/ECBlockPane.java | 39 ++++----- 18 files changed, 118 insertions(+), 237 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/designer/DesignerProxy.java diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java index 397d6ff2c1..a311773745 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java @@ -29,10 +29,7 @@ public class CopyAction extends TemplateComponentAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - TargetComponent tc = getEditingComponent(); - if (tc != null) { - tc.copy(); - } + DesignModeContext.doCopy(getEditingComponent()); return false; } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java index aa4fae62dc..9d8453f1e2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java @@ -32,10 +32,6 @@ public class CutAction extends TemplateComponentAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - TargetComponent editPane = getEditingComponent(); - if (editPane == null) { - return false; - } - return editPane.cut(); + return DesignModeContext.doPaste(getEditingComponent()); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java index 476516a79c..6c8a9a5150 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java @@ -3,14 +3,13 @@ */ package com.fr.design.actions.edit; -import java.awt.event.KeyEvent; - -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; import com.fr.design.actions.TemplateComponentAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; +import javax.swing.KeyStroke; +import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -21,9 +20,9 @@ public class PasteAction extends TemplateComponentAction { /** * Constructor */ - public PasteAction(TargetComponent t) { - super(t); - + public PasteAction(TargetComponent t) { + super(t); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); @@ -32,10 +31,6 @@ public class PasteAction extends TemplateComponentAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - TargetComponent tc = getEditingComponent(); - if (tc == null) { - return false; - } - return tc.paste(); + return DesignModeContext.doPaste(getEditingComponent()); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java index 843ff4208d..9c43f7f50a 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java @@ -1,5 +1,7 @@ package com.fr.design.base.mode; +import com.fr.design.designer.TargetComponent; + import static com.fr.design.base.mode.DesignerMode.AUTHORITY; public class DesignModeContext { @@ -39,4 +41,26 @@ public class DesignModeContext { public static boolean isAuthorityEditing() { return mode == AUTHORITY; } + + + public static void doCopy(TargetComponent principal) { + if (isBanCopyAndCut() || principal == null) { + return; + } + principal.copy(); + } + + public static boolean doPaste(TargetComponent principal) { + if (principal == null) { + return false; + } + return principal.paste(); + } + + public static boolean doCut(TargetComponent principal) { + if (isBanCopyAndCut() || principal == null) { + return false; + } + return principal.cut(); + } } diff --git a/designer-base/src/main/java/com/fr/design/designer/DesignerProxy.java b/designer-base/src/main/java/com/fr/design/designer/DesignerProxy.java new file mode 100644 index 0000000000..21aa56b1ee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/designer/DesignerProxy.java @@ -0,0 +1,7 @@ +package com.fr.design.designer; + +/** + * 暂时是空接口,标记一下模板设计时推出的代理其他 {@link TargetComponent} 的类 + */ +public interface DesignerProxy { +} diff --git a/designer-base/src/main/java/com/fr/design/designer/TargetComponent.java b/designer-base/src/main/java/com/fr/design/designer/TargetComponent.java index 348963881c..5556a66055 100644 --- a/designer-base/src/main/java/com/fr/design/designer/TargetComponent.java +++ b/designer-base/src/main/java/com/fr/design/designer/TargetComponent.java @@ -1,6 +1,5 @@ package com.fr.design.designer; -import com.fr.design.DesignState; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.mainframe.AuthorityEditPane; @@ -8,7 +7,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; -import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nullable; import javax.swing.JComponent; @@ -115,82 +113,4 @@ public abstract class TargetComponent extends JComponent { public EditingState createEditingState() { return EditingState.NULL; } - - public static final TargetComponent NULLAVOID = new TargetComponent(StringUtils.EMPTY) { - - @Override - public void copy() { - } - - @Override - public boolean paste() { - return false; - } - - @Override - public int getMenuState() { - return DesignState.WORK_SHEET; - } - - @Override - public void cancelFormat() { - return; - } - - @Override - public boolean cut() { - return false; - } - - @Override - public void stopEditing() { - } - - @Override - public AuthorityEditPane createAuthorityEditPane() { - return null; - } - - @Override - public ToolBarMenuDockPlus getToolBarMenuDockPlus() { - return null; - } - - @Override - public ToolBarDef[] toolbars4Target() { - return new ToolBarDef[0]; - } - - @Override - public MenuDef[] menus4Target() { - return new MenuDef[0]; - } - - @Override - public ShortCut[] shortcut4TemplateMenu() { - return new ShortCut[0]; - } - - @Override - public ShortCut[] shortCuts4Authority() { - return new ShortCut[0]; - - } - - @Override - public JComponent[] toolBarButton4Form() { - return new JComponent[0]; - } - - @Override - public JPanel getEastUpPane() { - return new JPanel(); - } - - @Override - public JPanel getEastDownPane() { - return new JPanel(); - } - - }; } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7880d26872..c2557a5b9c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -19,6 +19,7 @@ import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; @@ -71,7 +72,7 @@ import java.util.regex.Pattern; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, JTemplateProvider { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, JTemplateProvider, DesignerProxy { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; private FILE editingFILE = null; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index a63ede4c15..47f7e3924c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -24,10 +24,7 @@ public class CopyAction extends FormWidgetEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner tc = getEditingComponent(); - if (tc != null) { - tc.copy(); - } + DesignModeContext.doCopy(getEditingComponent()); return false; } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 23788df780..421cae2e6e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -24,10 +24,6 @@ public class CutAction extends FormWidgetEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { - return false; - } - return editPane.cut(); + return DesignModeContext.doCut(getEditingComponent()); } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index 5bffe9c660..c02295f0f0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -1,36 +1,32 @@ package com.fr.design.designer.beans.actions; -import java.awt.event.KeyEvent; - -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; - +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.mainframe.FormDesigner; +import javax.swing.KeyStroke; +import java.awt.event.KeyEvent; + import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; public class PasteAction extends FormWidgetEditAction { - public PasteAction(FormDesigner t) { - super(t); - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); - this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); - this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); - } - - @Override - public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner tc = getEditingComponent(); - if (tc == null) { - return false; - } - return tc.paste(); - } - @Override - public void update() { - this.setEnabled(true); - } + public PasteAction(FormDesigner t) { + super(t); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); + this.setMnemonic('P'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); + this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + return DesignModeContext.doPaste(getEditingComponent()); + } + + @Override + public void update() { + this.setEnabled(true); + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index bfbe41a72a..ec8020fd21 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -428,10 +428,7 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public void copy() { - if (DesignModeContext.isBanCopyAndCut()) { - return; - } - this.formDesign.copy(); + DesignModeContext.doCopy(this.formDesign); } @@ -442,7 +439,7 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public boolean paste() { - return this.formDesign.paste(); + return DesignModeContext.doPaste(this.formDesign); } @@ -453,10 +450,7 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public boolean cut() { - if (DesignModeContext.isBanCopyAndCut()) { - return false; - } - return this.formDesign.cut(); + return DesignModeContext.doCut(this.formDesign); } // //////////////////////////////////////////////////////////////////// diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 96fa44c6d4..c47b142c1c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -141,7 +141,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M */ public abstract class ElementCasePane extends TargetComponent implements Selectedable, PageAttributeGetter { - public static enum Clear { + public enum Clear { ALL, FORMATS, CONTENTS, WIDGETS } @@ -174,7 +174,7 @@ public abstract class ElementCasePane extends Tar private CellSelection formatReferencedCell = null; private CellSelection cellNeedTOFormat = null; private FormatBrushAction formatBrushAction; - ActionListener keyListener = new ActionListener() { + private ActionListener keyListener = new ActionListener() { public void actionPerformed(ActionEvent e) { if (!formatBrush.isSelected()) { DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE); @@ -188,7 +188,7 @@ public abstract class ElementCasePane extends Tar } } }; - ActionListener escKey = new ActionListener() { + private ActionListener escKey = new ActionListener() { public void actionPerformed(ActionEvent e) { cancelFormatBrush(); } @@ -519,10 +519,6 @@ public abstract class ElementCasePane extends Tar } @Override - /** - * 加下面的判断是因为聚合报表>>添加报表聚合块>>选中B1单元格>>再选中该聚合块>>再选中B1单元格,发现属性表右下侧还是现实的聚合块的属性 - * 因为这边判断selection是一个selection,所以不会触发fireSelectionChanged - */ public void setSelection(Selection selection) { if (!ComparatorUtils.equals(this.selection, selection) || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { @@ -566,7 +562,7 @@ public abstract class ElementCasePane extends Tar } Style style = cellElement.getStyle(); if (style == null) { - style = style.DEFAULT_STYLE; + style = Style.DEFAULT_STYLE; } referencedStyle[i][j] = style; @@ -583,9 +579,6 @@ public abstract class ElementCasePane extends Tar @Override - /** - * - */ public Selection getSelection() { return selection; } @@ -596,7 +589,7 @@ public abstract class ElementCasePane extends Tar * @return 是则返回true */ public boolean isSelectedOneCell() { - return (selection == null) ? false : selection.isSelectedOneCell(this); + return (selection != null) && selection.isSelectedOneCell(this); } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index df4b27409d..569f02bb6f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -569,10 +569,7 @@ public class JWorkBook extends JTemplate { */ @Override public void copy() { - if (DesignModeContext.isBanCopyAndCut()) { - return; - } - this.delegate4ToolbarMenuAdapter().copy(); + DesignModeContext.doCopy(this.delegate4ToolbarMenuAdapter()); } /** @@ -582,10 +579,7 @@ public class JWorkBook extends JTemplate { */ @Override public boolean cut() { - if (DesignModeContext.isBanCopyAndCut()) { - return false; - } - return this.delegate4ToolbarMenuAdapter().cut(); + return DesignModeContext.doCut(this.delegate4ToolbarMenuAdapter()); } /** @@ -595,7 +589,7 @@ public class JWorkBook extends JTemplate { */ @Override public boolean paste() { - return this.delegate4ToolbarMenuAdapter().paste(); + return DesignModeContext.doPaste(this.delegate4ToolbarMenuAdapter()); } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java index 1957d68bc8..0fac9c6f73 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java @@ -3,7 +3,6 @@ */ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction; @@ -11,13 +10,11 @@ import com.fr.design.actions.report.ReportBackgroundAction; import com.fr.design.actions.report.ReportFooterAction; import com.fr.design.actions.report.ReportHeaderAction; import com.fr.design.actions.report.ReportPageSetupAction; -import com.fr.design.actions.report.ReportWatermarkAction; import com.fr.design.designer.TargetComponent; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; import com.fr.design.selection.SelectableElement; import com.fr.design.selection.Selectedable; - import com.fr.report.report.TemplateReport; import javax.swing.JScrollBar; @@ -28,9 +25,11 @@ import javax.swing.JScrollBar; */ public abstract class ReportComponent extends TargetComponent implements Selectedable { protected E elementCasePane; + public E getEditingElementCasePane() { return elementCasePane; } + public ReportComponent(T t) { super(t); } @@ -39,6 +38,7 @@ public abstract class ReportComponent { +public class WorkSheetDesigner extends ReportComponent implements DesignerProxy { private static final int HUND = 100; @@ -81,23 +82,17 @@ public class WorkSheetDesigner extends ReportComponent extends TargetComponent implements Selectedable, FormECDesignerProvider { +public class FormElementCaseDesigner + + extends TargetComponent + implements Selectedable, FormECDesignerProvider, DesignerProxy { protected FormElementCasePaneDelegate elementCasePane; @Override @@ -167,10 +171,7 @@ public class FormElementCaseDesigner Date: Wed, 28 Nov 2018 17:11:43 +0800 Subject: [PATCH 096/187] f --- designer-realize/src/main/java/com/fr/poly/PolyDesigner.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index 7dcdabf795..91ecf9869d 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -167,7 +167,7 @@ public class PolyDesigner extends ReportComponent Date: Wed, 28 Nov 2018 17:27:02 +0800 Subject: [PATCH 097/187] =?UTF-8?q?REPORT-13067=20npe=20=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=8B=96=E6=8A=A5=E8=A1=A8=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XElementCase.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index da36cd8ba5..8b21f646b1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -114,6 +114,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public CRPropertyDescriptor[] getExtraTableEditor(){ CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); + if (getReportFitEditor() == null) { + return extraTableEditor; + } return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {getReportFitEditor()}); } From bb1bad75740901727228deb0cf3371561cad4d39 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 28 Nov 2018 17:31:56 +0800 Subject: [PATCH 098/187] =?UTF-8?q?REPORT-13067=20npe=20=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=8B=96=E6=8A=A5=E8=A1=A8=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XElementCase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 8b21f646b1..480412287e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -114,10 +114,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public CRPropertyDescriptor[] getExtraTableEditor(){ CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); - if (getReportFitEditor() == null) { + CRPropertyDescriptor reportFitEditor = getReportFitEditor(); + if (reportFitEditor == null) { return extraTableEditor; } - return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {getReportFitEditor()}); + return ArrayUtils.add(extraTableEditor, reportFitEditor); } private CRPropertyDescriptor getReportFitEditor() { From adf47eb70328176a6c1fab7d2efc73d7e7264847 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 29 Nov 2018 17:36:22 +0800 Subject: [PATCH 099/187] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=95=B4=E7=90=86=E5=BC=80=E6=94=BE=E6=8E=A5=E5=8F=A3=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/JavaScriptActionProvider.java | 16 ++++++++++++++-- .../impl/AbstractJavaScriptActionProvider.java | 16 ++++++++++++---- .../design/javascript/JavaScriptActionPane.java | 3 ++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java index 754bdaeb4a..5f1f1aa5aa 100644 --- a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java @@ -2,11 +2,12 @@ package com.fr.design.fun; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.mark.Mutable; /** - * Created by zack on 2015/8/14. + * 控件的事件扩展接口 */ public interface JavaScriptActionProvider extends Mutable{ @@ -14,10 +15,21 @@ public interface JavaScriptActionProvider extends Mutable{ int CURRENT_LEVEL = 1; + /** + * 事件的界面 + */ FurtherBasicBeanPane getJavaScriptActionPane(); + /** + * 这个界面在哪些类型模板设计的时候会出现 + * @see com.fr.design.mainframe.JWorkBook + * @see com.fr.design.mainframe.JForm + */ + boolean accept(JTemplate template); + + @Deprecated FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane); + @Deprecated boolean isSupportType(); - } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java index 4640eaf4fa..7f57f35a5d 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java @@ -3,6 +3,8 @@ package com.fr.design.fun.impl; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -27,10 +29,16 @@ public abstract class AbstractJavaScriptActionProvider extends AbstractProvider return getJavaScriptActionPane(); } - /** - * 判断是否是支持的类型(cpt,frm),默认是 - * @return - */ + @Override + public boolean accept(JTemplate template) { + // 这里只是为了兼容原来的isSupportType方法 + boolean result = isSupportType(); + if (result) { + return true; + } + return true; + } + @Override public boolean isSupportType(){ return true; diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java index 05208762e3..3b025ae1fa 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java @@ -7,6 +7,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.write.submit.DBManipulationPane; import com.fr.form.ui.WebContentUtils; import com.fr.js.JavaScript; @@ -45,7 +46,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { Set javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); if (javaScriptActionProviders != null) { for (JavaScriptActionProvider jsp : javaScriptActionProviders) { - if(jsp.isSupportType()){ + if(jsp.accept(DesignerContext.getDesignerFrame().getSelectedJTemplate())){ paneList.add(jsp.getJavaScriptActionPane(this)); } } From 34d8785d70fb6beb930d9f5c552eaebc292bc5e9 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 29 Nov 2018 17:55:22 +0800 Subject: [PATCH 100/187] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=95=B4=E7=90=86=E5=BC=80=E6=94=BE=E6=8E=A5=E5=8F=A3=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/fun/HyperlinkProvider.java | 31 ++++++++++++++++--- .../fun/impl/AbstractHyperlinkProvider.java | 24 ++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java b/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java index 448a120fea..9b58b96898 100644 --- a/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java @@ -1,21 +1,44 @@ package com.fr.design.fun; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.stable.fun.Level; +import com.fr.js.Hyperlink; import com.fr.stable.fun.mark.Mutable; /** * Created by zack on 2016/1/20. */ -public interface HyperlinkProvider extends Mutable { +public interface HyperlinkProvider extends Mutable { String XML_TAG = "HyperlinkProvider"; int CURRENT_LEVEL = 2; /** - * 创建一个超级连接类型 - * @return NameableCreator + * 超级链接的描述信息,如果是实现类中重载了这个方法,就不需要再实现下面的三个方法: + * @see HyperlinkProvider#text() + * @see HyperlinkProvider#target() + * @see HyperlinkProvider#appearance() + * 如果并不重载,就需要分别实现上面的三个方法,不推荐重载这个方法 + * @return 描述信息 */ NameableCreator createHyperlinkCreator(); + + /** + * 超级链接的名字 + * @return 名字 + */ + String text(); + + /** + * 超级链接的实现类 + * @return 实现类 + */ + Class target(); + + /** + * 超级链接的界面配置类 + * @return 配置类 + */ + Class> appearance(); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java index bc5d5115a8..9c74795d8e 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java @@ -1,6 +1,10 @@ package com.fr.design.fun.impl; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.stable.StringUtils; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -18,4 +22,24 @@ public abstract class AbstractHyperlinkProvider extends AbstractProvider impleme public String mark4Provider() { return getClass().getName(); } + + @Override + public NameableCreator createHyperlinkCreator() { + return new NameObjectCreator(text(), target(), appearance()); + } + + @Override + public String text() { + return StringUtils.EMPTY; + } + + @Override + public Class target() { + return null; + } + + @Override + public Class appearance() { + return null; + } } \ No newline at end of file From 8119f1fbdffc3f1f343ed6165e09adc24f1e857d Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 3 Dec 2018 10:16:18 +0800 Subject: [PATCH 101/187] =?UTF-8?q?DEC-5624=20=E3=80=9010.0.2=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=85=8D=E7=BD=AE=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/report/WatermarkPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 9b9ff09503..95e791e0f3 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -83,6 +83,7 @@ public class WatermarkPane extends BasicPane { watermark.setText(formulaPane.getUITextField().getText()); watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); watermark.setColor(colorPane.getColor()); + colorPane.updateUsedColor(); return watermark; } @@ -156,7 +157,8 @@ public class WatermarkPane extends BasicPane { } private void populateColor(Color color) { - colorPane.setColor(color); + // 颜色面板的色值只有 rgb,去掉 alpha 通道 + colorPane.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue())); colorPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { From 5e570cbbf13c0ae61f8a4a23ce659b55dc19ffcb Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 3 Dec 2018 10:36:46 +0800 Subject: [PATCH 102/187] =?UTF-8?q?DEC-5580=20=E3=80=9010.0.2=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=AD=97?= =?UTF-8?q?=E5=8F=B7=E5=8F=AF=E9=80=89=E8=8C=83=E5=9B=B4=E4=B8=8E=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=B8=8D=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/report/WatermarkPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 95e791e0f3..4b3bda6719 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -29,6 +29,11 @@ import java.awt.event.ItemListener; * Created by plough on 2018/5/15. */ public class WatermarkPane extends BasicPane { + private static final Integer[] FONT_SIZES = { + 6, 8, 9, 10, 11, 12, 13, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32, 34, + 36, 38, 40, 48, 64, 72, 128 + }; private static final int MAX_WIDTH = 160; @@ -97,7 +102,7 @@ public class WatermarkPane extends BasicPane { protected UIScrollPane initRightPane(){ formulaPane = new TinyFormulaPane(); - fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + fontSizeComboBox = new UIComboBox(FONT_SIZES); JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); From baeff898863849d052d41adbeece2abfb4a3cd75 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 3 Dec 2018 14:47:34 +0800 Subject: [PATCH 103/187] =?UTF-8?q?DEC-5580=20=E3=80=9010.0.2=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E9=AA=8C=E6=94=B6=E3=80=91=E3=80=90=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=AD=97?= =?UTF-8?q?=E5=8F=B7=E5=8F=AF=E9=80=89=E8=8C=83=E5=9B=B4=E4=B8=8E=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=B8=8D=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/style/FRFontPane.java | 7 +++++-- .../main/java/com/fr/design/report/WatermarkPane.java | 9 ++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java index 39d1f64e2b..9ce63abe37 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java @@ -37,9 +37,12 @@ import java.util.Vector; * Pane to edit Font. */ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObserver { + public static final Integer[] FONT_SIZES = { + 6, 8, 9, 10, 11, 12, 13, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32, 34, + 36, 38, 40, 48, 64, 72, 128 + }; private static final int MAX_FONT_SIZE = 100; - public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16), - new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)}; private static final Dimension BUTTON_SIZE = new Dimension(20, 18); private static final Dimension UNDER_LINE_SIZE = new Dimension(87, 20); private static final Dimension HIDE_SIZE = new Dimension(0, 0); diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 4b3bda6719..0caa7e8b6b 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -29,12 +29,6 @@ import java.awt.event.ItemListener; * Created by plough on 2018/5/15. */ public class WatermarkPane extends BasicPane { - private static final Integer[] FONT_SIZES = { - 6, 8, 9, 10, 11, 12, 13, 14, 16, - 18, 20, 22, 24, 26, 28, 30, 32, 34, - 36, 38, 40, 48, 64, 72, 128 - }; - private static final int MAX_WIDTH = 160; // 水印预览面板 @@ -102,7 +96,8 @@ public class WatermarkPane extends BasicPane { protected UIScrollPane initRightPane(){ formulaPane = new TinyFormulaPane(); - fontSizeComboBox = new UIComboBox(FONT_SIZES); + fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + fontSizeComboBox.setEditable(true); JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); From 20a39e41ed7d2fad167ce6a6e0d8993d42ea57fd Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 3 Dec 2018 20:17:54 +0800 Subject: [PATCH 104/187] =?UTF-8?q?REPORT-13215=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=94=B1=E4=BA=8E=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=99=BD=E8=89=B2=E8=92=99=E5=B1=82=E4=B8=8D=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/BaseDesigner.java | 2 ++ .../src/main/java/com/fr/start/ServerStarter.java | 13 +++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 3e466ed1f3..b1931f284f 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -64,6 +64,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { TemplateTreePane.getInstance().getTemplateFileTree().refresh(); } DesignerContext.getDesignerFrame().updateProgress(PERCENT_COMPLETE); + throw new NullPointerException(); + } diff --git a/designer-base/src/main/java/com/fr/start/ServerStarter.java b/designer-base/src/main/java/com/fr/start/ServerStarter.java index 3115730d17..6d20cf12a5 100644 --- a/designer-base/src/main/java/com/fr/start/ServerStarter.java +++ b/designer-base/src/main/java/com/fr/start/ServerStarter.java @@ -5,18 +5,11 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.utils.BrowseUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServerMonitor; import com.fr.workspace.WorkContext; -import javax.swing.JOptionPane; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -66,7 +59,11 @@ public class ServerStarter { @Override public void run() { - FineEmbedServer.start(); + try { + FineEmbedServer.start(); + } finally { + FineEmbedServerMonitor.getInstance().setComplete(); + } BrowseUtils.browser(url); } }); From 03806dcb611ba4776dd22076d5a52cd239368091 Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 3 Dec 2018 20:19:23 +0800 Subject: [PATCH 105/187] rt --- designer-base/src/main/java/com/fr/start/BaseDesigner.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index b1931f284f..6b513657bb 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -64,7 +64,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock { TemplateTreePane.getInstance().getTemplateFileTree().refresh(); } DesignerContext.getDesignerFrame().updateProgress(PERCENT_COMPLETE); - throw new NullPointerException(); } From 819da17ad5d0d94e044f875a62483079ed95598e Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 3 Dec 2018 20:19:44 +0800 Subject: [PATCH 106/187] rt --- designer-base/src/main/java/com/fr/start/BaseDesigner.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 6b513657bb..3e466ed1f3 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -64,7 +64,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock { TemplateTreePane.getInstance().getTemplateFileTree().refresh(); } DesignerContext.getDesignerFrame().updateProgress(PERCENT_COMPLETE); - } From ef07745d35dede2b4b34111828f9abbe263e563a Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 3 Dec 2018 20:20:11 +0800 Subject: [PATCH 107/187] =?UTF-8?q?REPORT-13215=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=94=B1=E4=BA=8E=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=99=BD=E8=89=B2=E8=92=99=E5=B1=82=E4=B8=8D=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/module/DesignerStartup.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 71f197ea6e..701a6936c1 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -52,9 +52,11 @@ public class DesignerStartup extends Activator { @Override public void run() { - - designer.show(args); - DesignerContext.getDesignerFrame().getProgressDialog().dispose(); + try { + designer.show(args); + } finally { + DesignerContext.getDesignerFrame().getProgressDialog().dispose(); + } } }); service.shutdown(); From 32174c596cb08c962e7bdbd6853872a648247f4f Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 4 Dec 2018 13:47:28 +0800 Subject: [PATCH 108/187] =?UTF-8?q?REPORT-10535=20=E9=AA=8C=E6=94=B6bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 11 ++++++- .../mobile/ui/DownMenuStyleDefinePane.java | 12 +++---- .../design/mainframe/mobile/ui/LinePane.java | 1 - .../ui/MobileTemplateStyleDefinePane.java | 19 +++++++++-- .../mobile/ui/SliderStyleDefinePane.java | 5 ++- .../ui/StyleDefinePaneWithSelectConf.java | 9 ++---- .../mobile/ui/TabIconConfigPane.java | 32 ++++++++++++------- .../ui/TemplateStyleDefinePaneFactory.java | 1 - .../mobile/ui/UpMenuStyleDefinePane.java | 23 ++++++------- .../com/fr/design/web/CustomIconPane.java | 7 +++- 10 files changed, 75 insertions(+), 45 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index d397c8d529..6b2ecec669 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -7,7 +7,6 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; - import java.awt.BasicStroke; import java.awt.Dimension; import java.awt.FontMetrics; @@ -44,11 +43,21 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane return new DefaultMobileTemplateStyle(); } + public MobileTemplateStyle updateConfig(){ + return new DefaultMobileTemplateStyle(); + } + + @Override protected MobileTemplateStyle getDefaultTemplateStyle() { return new DefaultMobileTemplateStyle(); } + @Override + public void populateSubStyle(MobileTemplateStyle ob) { + + } + @Override protected String title4PopupWindow() { return null; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index a0184c9a84..1a0472cbb5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.base.GraphHelper; +import com.fr.base.Icon; import com.fr.base.IconManager; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; @@ -15,7 +16,6 @@ import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.LineDescription; import com.fr.general.cardtag.mobile.MobileTemplateStyle; - import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; @@ -89,8 +89,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @Override - public void populateBean(MobileTemplateStyle ob) { - super.populateBean(ob); + public void populateSubStyle(MobileTemplateStyle ob) { + super.populateSubStyle(ob); DownMenuStyle downMenuStyle = (DownMenuStyle) ob; splitLinePane.populate(downMenuStyle.getSplitLine()); ArrayList initialIconNames = new ArrayList(); @@ -132,6 +132,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { private static final int ICON_OFFSET = 16; private static final int GAP = 6; private static final String PAINT_ICON = "fund_white"; + private static final String ICON_PATH = "/com/fr/web/images/fund_white.png"; private LineDescription splitLine; public DownMenuStylePreviewPane() { @@ -158,7 +159,6 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int fontHeight = fm.getHeight(); int ascent = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { - g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String widgetName = cardSwitchButton.getText(); @@ -169,8 +169,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { g2d.fillRect(0, 0 ,eachWidth, panelHeight); g2d.setColor(oldColor); } - String iconName = PAINT_ICON; - g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); + Icon icon = new Icon(PAINT_ICON, ICON_PATH); + g2d.drawImage(IconManager.getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java index fabc7ca5bf..57dc87e180 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java @@ -9,7 +9,6 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.style.color.NewColorSelectBox; import com.fr.general.cardtag.mobile.LineDescription; import com.fr.stable.CoreConstants; - import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index 9f5809f927..b499e18d78 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -14,10 +14,12 @@ import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.TabFontConfig; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -34,7 +36,7 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane { - private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; private UIComboBox custom; protected NewColorSelectBox initialColorBox; @@ -179,6 +181,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Tue, 4 Dec 2018 18:55:44 +0800 Subject: [PATCH 109/187] =?UTF-8?q?REPORT-13254=2010.0=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8mac=E4=B8=8D=E8=83=BD=E7=82=B9=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/start/jni/splash.dylib | Bin 57200 -> 57200 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib index 2b59ee3eb04f6377b0a8f06d9f60096a1216ee32..6ae677da37199ce7ebe825dbb5590452bdb081dd 100755 GIT binary patch delta 7366 zcmai23s_Ufww|4^F^EWlglB;81{FxaNKj({A4J811q-MMsP*`23l@%8^~4HTW2EIc zRk8M})mCk5Es9#D>OoY%YJFg>uU4#D4Qdt9`ao;Wnmx0%`rZ58{e8*W|62d7S+mxx z**j_9CvD#+ty-i=c1OZ>tT&a(TUW+&+$nsLOHmvdMs-oO-?-^~T<+*QV* z0}wJ}9el^T24T+$*=+?Iz1b+iSSW z-B)q7KSCX@@(ML*J6yB*kMSP&Fs=k&ao2E5u)8v-TLN)yNs)p34LDiZSCa^vNV~jqnn8WR%g|1|NBsw z(H-VCSz43qr@^=ejCCZ(;GDWx_Oiw`f|o`kpS5!hj_{5F%@`ZSP6qAQ8%NqNjg1>vMd4AWri1>o(!J zqES#dCp=etfxq`u$8-lg%yI~#m;m_$M{{6)C>K8+YQSc>5lJ|WV4RG*da2CbKuNXS zX4V~|)u5mrV!`a1RqvX0m@zOgXp{lMNU;Q#R+H6FrH2i53Q|YDU}>V;@z34X!Kz{I zn+6t8YLhMbxyOs3eNj|PD-`EQJRzPIssZ127&}EA+hpq^4xM)b44(L|mzUT0US!SL zJe7)yQd*{OaiF)C%#lw2El%1#AfaRXfXfbeS^3kaHDV7#OaW%RIBc30`Yssu3XiJPGAk44R^wZ6Y^ozeI~SY6U`j#_Ef83 zvOtC|KLhP?S17jb1_-LSL|0dY(^N|H0Rk%Q#XU!xEWbkx8Q{&Xc6D$EyXr;j_Xs5l()xE2 zPtNg2R4q(E%jRf3he{ZJY@%E zV{_YX1T(K?w=`Jc@6O%8Vg7+inNXM4yiAs%YH)K>i;zu)$NBr1+eqYA-55Aipngxl zKx$=avW)>xAnnSBpo4VggBWHV5CUW!khLwqgUo#m^x7w9!1%E2R;a_n62+xDDN#l~nC*?uCXM!2~2l%-~(g1$|3aAGW^|1hd*<)}B zE0N%L146mE*hlS)w+HBDrBwYsz7J|CsB^;Vq3dm?K(d+x5b!o=Zn`aOchv}$*Ox?t zpK`oX9TiqWsDFZ1pc?)mQlHsYzo2UIEud-%b)85JRf*JVwh=F=*RU}#io1#53iRWa zVk_Kl#=GHuC_WRI?3o8$Y+Dx~%myjSgwp{c`4ek`#*CB^_gZFycLlwvQr87^5V@_+ zpGbZMS!zXnu^)`RN9tRt>~tZ*<)(08x7yw%#7e^@d?qM}`yO`&#mIt%{OFcoZE%F_ z3FH(8Pr?Pkp`(8$pwe&?PB2?Eoq;?SKov&f^rfnLstO@08CC6|Dj%Zy(+@__x0^}e zxdUGaj*-nI1gq`LfsY z(JnIxs^s4nP6qz0kVT%n3&Z#pip$N*-28jE!Jy+6wT|&>Z)t(6Kfd#0E7BB@fw3U3+apSZ@h;9Z!x>_c#WxICdq1XJ2Z< zqY_fpgLq|xiu)Gtj0g_JU6qQq(oT4Z?uB(~C zk0H@8(19XgQ=* z%$LJ&66g`K9}dIjuX7gm!_^1Ee(j>d5>&$FIwDO(7`17~|_Z38G zxeo7&CTngpywTc~OR#qzJ9o6!TlXEuh2fKZEv`#R{wtMr4n(*t##7^Ga3A5H< z2jlnjh1_C%Q=iEhaAHEHq&)~PPsrfb;~NQC>I~MPcI7CzBQI=_>-XSvAr&FHF6h^r z3#k3D-#$r?203x>x1I>sA!nf}x8XcPyk{xZ=ZN~UTQabX!rvH7GA*^m;J*x^E-k)L z*~j1<-X<2}n1M>J5DytRKp6);s6Cu&d6sIqY?Bdtr6CV5AE@Uh;Nt^z+&#=22XaU7 zU}F^5fM*)7aqc)LF^HRu=O*^zM&nJ10dC*;5VyK$C8+@UDc`&HT;d7G+HX=mcl4c$ z*hOxf;IoU0FkwX>8X>;DMwIy{l1f96Br60tNMT27!VtGK3`sr0kwZZ^lKvWw{Lqzf z#JwAVBugU^Hw^mdU@s)O-wR0<&JLsCpRDHE`t%wu^89dNE$G}ZD#d@7w%D*+`x5))#3=AoteU&$NMu=BI-N17Uxa1lF+eHXKjWp-jCR}0fmenl_xM7`*zo$*<5dQva&oo%AG z#jiLLt5{t7+vpe$du4fB_vFe!$xh~ZC|+`{Az zD$QswQygaUER(-7d7DXRmiIs=qnR`@Ig-h2CX1QGOm1Vco=Ms}uwAOLHrvQm7YTQ^_U44wIqp&Iz)ACXZaLmFH8;F^D~B9V zz3{zjJDVAyhKMg+%eeSCa}@3hckQ?aoH#ApEcRhx7lgV4RqXi+hQ(fA$*|btyBSuq zb~?wf*r)dx7W-2nqyELd>_u_V^L`x02;u=Snc@O!6 z<`P?E3&BqGxF&nIo?&uqldFZ{PjTcsd1kTs*Lxu358WU(do#gsM2m&G2Dm$5@x0_c z0mG5~h@GEa1jFfcqheXG@mKjL2zXkvH}!|4qFgW+t3 zmouEta6Q9Q7{0`CA;W(O*bL_*Q@FwE$b|D5HZZ)1;XH<`7+%0|HN#&syq4h>hBq|&Bgrf?p1cY ze)-J*e<`{ZN#-Tr`Q7P%>a*^L?Z0(2U%33?>7cXIyV=k9mj&wHoF zEN^fQt7|#F?Z7Vwx}d?TG|fLd^T#FMiR`K$JU-_yjWsrTu=e<;L9MP?>u&z3Et6lh zPTI-I8!isq>abz&j>%EmItM(_pIG{@k*Rg1jlFwzrZnt-bh*y+E%S$)E(|`OAr1WF zX+hQM_N`?rB(4<|M^%H{g3~`PI{9>_ang+6O6R&Pesk;~M{wzxCGL@GT)%<68ZU9k<_h?zau^3EAB+t8u#1?%b(80yd5| hKahB7mQ+reQPsS)Ci`(gxN1?LWRW6o0-6~{>tv<9b(!5qc0v+8)vC8^SSAu& zxSKE<&^pmIfouD7Z33OrI&qakp;U0iQd$YLlJ^FeP*+8wYdP1Jb8b1!18q_khdiPr zx<`>nlavbjLSYd4Ta%Uj1efkZNB*cBubFbVTd%L&9F<$GR*!Cc=kjBarEaeee5 zA&;G1iqxQe?3^jzL{GVg3JYkHdyKG-2B-oZ)0k^>Zw0uw(tfJ0F%w|#3=6B&Ddw8g zBAfG~xK@BI`W@Yw(2hwW#Ape5_yHlwwo67!WH#Ne>MZE!Z>n~RY~-}1uT@c|=ZU~H zKR1}`fCwWW0zSerVKCoHG1nW-(@RBzz7>wz1$Jbfg*$_}#$Xv-%M`Fgi?;Ib-eB4Q z2ml-<+b)Cgd&xD-hb}fJcHy(3$~jE#5=Dq}cu@>w0+1V`B$h3Uei_T1MH@+PdW5Ao zg0}$!)06u%SC9w{psN@Fq*h#xIJ42B4MVNb{7j6rrlGPEi;G39N~GnUz7C}=ioa-? zr=P>57JN~}y;|^ITI;Dc`2bEa{|G_Ngj9o{rQO6Wlo!Ch@JXJBGfp)ar-9LEerPm5 z1`{mRb`cQ!vO$hQMdJfL=!7&#ABv6>!R(w-;hb@bGs=PCjloBVL#53#-!fQy!|8l4 z&oQ62csU14hX`KiTf*uGHXMErlyCRmd<%lP7SDK>#qEG^$hvm=+oA5#(0S*<5KNoB zyu3c`%od(0N9kHrfID}TMz!}+_~7hEX#)UD7F|9i)x#30_^F*R!6?pRis7`5gC zloQOoojQ8AcZqpdxkOa9epfk0RMvNVXLwJh?7knAxQVWiNbnj65keoz-C%clwpZdn z*e|fR5qp}K79`u7mUw$64{vc(0a4>#0r?^{HFxsC-<_NUeM^0UlapGy(%Zu%Z}Bo7 zyukRqcqqtcL((BACoWZ7`ZCG=p9&RMhe3{b&;LLz97kAiDdwB3=33fdC60s1Qt3RO z0JqWHk7fFKRu>lSRJz+I5S|PdeL_uzuz2VtrP$I}ZL00iyHH1P%q)hxw|*_!og$?M z7YQ9;wCJaaWH<<}Ld&!g%T{ZHb)w=auK05pr@3G>|2iyrc=E@|IoY;ffqjh`i)^O+ zPJ<2R-yx`6pxIPz%%esBU(8w~-wlFY*|rcR7)~;3az^ry;x(d+8~MW^{`EQ* zHpJf;$9BI4;;(@_D66-5QHL-EJ04z(Y%slS4Y`Kl-_zy}F@1gh=FlWL{H(>H@qLHe zf+dIZTO6W44fqQ+87%VWENK?|*4bk020Q&7F^gBS8&hF0E?r*tKIxQ13ge{o{s!|a z$jfeK5N>InHMC`O+xe~qh2|OSo`qG4VcCt(gSgj)_hVEBGc>d_Yp!bBN`st5;`E%x z`30C%;>M+U8O*)Z;I>{vNJBUb1uroes+4AN+Ge&qi*{@RtCbK%Y)grbWn;`WHkCc- zpdcoKqZCUbaC-n(a{;q)P#mtW5Jfsnn5m5fGcWUC(FfZWHS;e%wNlM@MC&b^>bn+~ zN-&ELv1Hp7oWus_n$g_!wy>z5zptAHqrCt|D4ZTJp8o9brw}lTHguYQh_Hxyt9|G` z{{%%Lc!d<0>0h9B0CiSq6&w@|h5)uSXawz%uI!E#Qo|!PA&V-eN5Oz)be%dfbQYsN z1+7TcPm-w34IAH5b@V<^wT!x1qJ{)Z)H@A*-%=mY#DGZQA)OfDE3Bs$xZh0=!+jdP z8qnQyBpeP6oBhSvAYa4b41h@9(3rrXsgBIOhTGt^B*9RubpRbi-f+Z^N%_}osYMm} zzA*L`tAJwFOD86r9*U2ETMg3~u~>hbUJVQsPSTfw(TX@RKibt)6BMR!Krn&k1%(X0 z0|^H5Lpb6ZqHu;AsOrSx^g-2mRE05>0#!ev%8#j@`hpXDks1YIy`(pSq7@4m!J<7) z-GW0D*~mUY6N5bkKbjF7t@J>9>o~e1xTE3$%cMnnjvfyVQ&b~(P9Fq^m^J~BibHHb z?4yNxf5;q}-VUPw77m4mq7Ezwc^lAvA@2g;iz@QHA%9A^Jt70@+XkD!P_ev7JWJ#a zVix7>jT^@Q8_`0v{i_RW)?zuVk{Pdnv08o=zJ+_+u<`Zl*#LNvfD(mDJp;Ri2JLuy zCM3(9u-Ft38|+yKdu$hL|FY^rBV<*tl;%~*dEC%YSzEim}qmDhp7PdQ$Py}Q#1!2Rg2v4Ed z>J_08gml^`vPd{f&qw;iABK{G?O6{?AFOVig2pZ&!c; zmJ=-(6MqDeH`?|gTBs0hI~lUb{V@+o><3k`oSzWuk@*6dtC49Mj8s3QJ`+z4c_C5* zm7>$xNd0fMh+d=Z1~SJWN=0TaGAof;hqfwY8W9yBvllYIHX-#88uuVI7SR@@Mj*8a znQPFt4w+tvenzGnGTG4&MW2th`N(XBmv6|$Yh=D)$Rcm_XLV|p4@Bx1q~1pAA4si7 zYCJlPL1r2U5OEKZ@ zIpQOwCcE)vS7M3F3-J;Db0Vt%Yea>T?;S6Hq}?OeHWW>$=Y6fP!KxNU%Hx|*Rvfc zRvoct!f81jA3s4TqgUcL%j|>c?1ahiY`>Q!uZ+Q+Z-H;T-)(Vx&+_rzYMJf@xM#pfI1#P3kOU)9p$AZpXZtTWyqz z?Ew3upo{f-()m_)Q>TAs-QIg!E1x-pU+l&aK8G1z0v`h%msTohsnE|;HJTkAX@sOg zrRIbD8Du$)>=$jawIRgIfymdv$J-H}sxCw}1L|~>E3pfAC*(tSV!r|8Ob;TQ_aJt( zJs}s{6InAz7jGi_5CTl~Cc*}g<_<)50v@yt9f*C1FA*mB5j&S)A{!M<>|LOS^`S&4 z3ng|z9f|#C9f{rDj>MNVbtFPz7?G8Q6JZGS&M%#bOo$+Mt`7DC;GeN7YeoOvLU?^2 zwk$$!rl6GmuJX!4Ed5bcPS*|eA0YiDR}VYGF8kgnHQY-c1j#NX*Gv3TuJ?XV-;OHN z{b8rV(-TcP?nC;cu=9JquR*i0>tauo|KR-PTwlfY(wt>nzogf@d@I)%a6RXn2s>Tb zrG}3TKGOerIv$9TPY4A^;N&NzneYWy&;P>?r7Zec%*U-O<5VOR^>(tMjDl?l^42}xFykvbA0H++$>?K^=7V z>Cy4o9n1F!#GcfO-xd3KX%VtN>>KBWLj0ULuI{exn&IbY(kGcFsplrQCZsJ;rT#AB zSnBI_983LtnB#W5b*^(P_2d(drCxMZpns_cJ0lKk>Ae(AkeYoA$D^&fPs{8ENM*kW zj_tOsAWoj=H4MXCQakKqScyk7tJ4aO*%8gI3mliz@JTr)snNH15aI`wFEw^8!*Co+ zn{x+nTfoxUDE9;m$1@o!Iwf8V!%5elCmiB<1IHB{*K%A-4^QzIl=S+P=m6=Nc?Q!xBV%-VU1;5x;ijLid8?T4(+~T=*`Mi;XG5kv9H<*N;nM5gzdg)5wSPs( z(EFF;P7WA1rTS^x!n01Fls!|ou)fM&(8-m?$6Jd3T1e(|N*xO(fRRon9K z&776txarX8qkU8}>6SH9|No_E*Cv}vv>y4sU(cBKs^h}n$5!{;ao7LJuFtQZKRtV9 z$GaZ>{&-7V zS!H@gesC@xQp&heEwtX~z>iWq20m{iv zUKPtCP19d=|IhM8*_GKIx1VT^4Iu?N`*x-3X4JjhYCTsn@wjT!UH!CzkZH$`I|%uG zE>-<#+U0Y?Wpv}8`+6NzIF1Xmjr!*}*<%0WNxP~d{#?A`+au)kwv97LREes{G=0aY xZ?&msrY%{XbubFZs^&U^WTF6HjVo=bk8J8a8tS@#I*jMA6A{s#px24(;N From 3a254445704091de7f8155751f57a17cb32cb134 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 4 Dec 2018 19:00:54 +0800 Subject: [PATCH 110/187] =?UTF-8?q?REPORT-13254=2010.0=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8mac=E4=B8=8D=E8=83=BD=E7=82=B9=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/start/jni/splash.dylib | Bin 57200 -> 57200 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib index 2b59ee3eb04f6377b0a8f06d9f60096a1216ee32..6ae677da37199ce7ebe825dbb5590452bdb081dd 100755 GIT binary patch delta 7366 zcmai23s_Ufww|4^F^EWlglB;81{FxaNKj({A4J811q-MMsP*`23l@%8^~4HTW2EIc zRk8M})mCk5Es9#D>OoY%YJFg>uU4#D4Qdt9`ao;Wnmx0%`rZ58{e8*W|62d7S+mxx z**j_9CvD#+ty-i=c1OZ>tT&a(TUW+&+$nsLOHmvdMs-oO-?-^~T<+*QV* z0}wJ}9el^T24T+$*=+?Iz1b+iSSW z-B)q7KSCX@@(ML*J6yB*kMSP&Fs=k&ao2E5u)8v-TLN)yNs)p34LDiZSCa^vNV~jqnn8WR%g|1|NBsw z(H-VCSz43qr@^=ejCCZ(;GDWx_Oiw`f|o`kpS5!hj_{5F%@`ZSP6qAQ8%NqNjg1>vMd4AWri1>o(!J zqES#dCp=etfxq`u$8-lg%yI~#m;m_$M{{6)C>K8+YQSc>5lJ|WV4RG*da2CbKuNXS zX4V~|)u5mrV!`a1RqvX0m@zOgXp{lMNU;Q#R+H6FrH2i53Q|YDU}>V;@z34X!Kz{I zn+6t8YLhMbxyOs3eNj|PD-`EQJRzPIssZ127&}EA+hpq^4xM)b44(L|mzUT0US!SL zJe7)yQd*{OaiF)C%#lw2El%1#AfaRXfXfbeS^3kaHDV7#OaW%RIBc30`Yssu3XiJPGAk44R^wZ6Y^ozeI~SY6U`j#_Ef83 zvOtC|KLhP?S17jb1_-LSL|0dY(^N|H0Rk%Q#XU!xEWbkx8Q{&Xc6D$EyXr;j_Xs5l()xE2 zPtNg2R4q(E%jRf3he{ZJY@%E zV{_YX1T(K?w=`Jc@6O%8Vg7+inNXM4yiAs%YH)K>i;zu)$NBr1+eqYA-55Aipngxl zKx$=avW)>xAnnSBpo4VggBWHV5CUW!khLwqgUo#m^x7w9!1%E2R;a_n62+xDDN#l~nC*?uCXM!2~2l%-~(g1$|3aAGW^|1hd*<)}B zE0N%L146mE*hlS)w+HBDrBwYsz7J|CsB^;Vq3dm?K(d+x5b!o=Zn`aOchv}$*Ox?t zpK`oX9TiqWsDFZ1pc?)mQlHsYzo2UIEud-%b)85JRf*JVwh=F=*RU}#io1#53iRWa zVk_Kl#=GHuC_WRI?3o8$Y+Dx~%myjSgwp{c`4ek`#*CB^_gZFycLlwvQr87^5V@_+ zpGbZMS!zXnu^)`RN9tRt>~tZ*<)(08x7yw%#7e^@d?qM}`yO`&#mIt%{OFcoZE%F_ z3FH(8Pr?Pkp`(8$pwe&?PB2?Eoq;?SKov&f^rfnLstO@08CC6|Dj%Zy(+@__x0^}e zxdUGaj*-nI1gq`LfsY z(JnIxs^s4nP6qz0kVT%n3&Z#pip$N*-28jE!Jy+6wT|&>Z)t(6Kfd#0E7BB@fw3U3+apSZ@h;9Z!x>_c#WxICdq1XJ2Z< zqY_fpgLq|xiu)Gtj0g_JU6qQq(oT4Z?uB(~C zk0H@8(19XgQ=* z%$LJ&66g`K9}dIjuX7gm!_^1Ee(j>d5>&$FIwDO(7`17~|_Z38G zxeo7&CTngpywTc~OR#qzJ9o6!TlXEuh2fKZEv`#R{wtMr4n(*t##7^Ga3A5H< z2jlnjh1_C%Q=iEhaAHEHq&)~PPsrfb;~NQC>I~MPcI7CzBQI=_>-XSvAr&FHF6h^r z3#k3D-#$r?203x>x1I>sA!nf}x8XcPyk{xZ=ZN~UTQabX!rvH7GA*^m;J*x^E-k)L z*~j1<-X<2}n1M>J5DytRKp6);s6Cu&d6sIqY?Bdtr6CV5AE@Uh;Nt^z+&#=22XaU7 zU}F^5fM*)7aqc)LF^HRu=O*^zM&nJ10dC*;5VyK$C8+@UDc`&HT;d7G+HX=mcl4c$ z*hOxf;IoU0FkwX>8X>;DMwIy{l1f96Br60tNMT27!VtGK3`sr0kwZZ^lKvWw{Lqzf z#JwAVBugU^Hw^mdU@s)O-wR0<&JLsCpRDHE`t%wu^89dNE$G}ZD#d@7w%D*+`x5))#3=AoteU&$NMu=BI-N17Uxa1lF+eHXKjWp-jCR}0fmenl_xM7`*zo$*<5dQva&oo%AG z#jiLLt5{t7+vpe$du4fB_vFe!$xh~ZC|+`{Az zD$QswQygaUER(-7d7DXRmiIs=qnR`@Ig-h2CX1QGOm1Vco=Ms}uwAOLHrvQm7YTQ^_U44wIqp&Iz)ACXZaLmFH8;F^D~B9V zz3{zjJDVAyhKMg+%eeSCa}@3hckQ?aoH#ApEcRhx7lgV4RqXi+hQ(fA$*|btyBSuq zb~?wf*r)dx7W-2nqyELd>_u_V^L`x02;u=Snc@O!6 z<`P?E3&BqGxF&nIo?&uqldFZ{PjTcsd1kTs*Lxu358WU(do#gsM2m&G2Dm$5@x0_c z0mG5~h@GEa1jFfcqheXG@mKjL2zXkvH}!|4qFgW+t3 zmouEta6Q9Q7{0`CA;W(O*bL_*Q@FwE$b|D5HZZ)1;XH<`7+%0|HN#&syq4h>hBq|&Bgrf?p1cY ze)-J*e<`{ZN#-Tr`Q7P%>a*^L?Z0(2U%33?>7cXIyV=k9mj&wHoF zEN^fQt7|#F?Z7Vwx}d?TG|fLd^T#FMiR`K$JU-_yjWsrTu=e<;L9MP?>u&z3Et6lh zPTI-I8!isq>abz&j>%EmItM(_pIG{@k*Rg1jlFwzrZnt-bh*y+E%S$)E(|`OAr1WF zX+hQM_N`?rB(4<|M^%H{g3~`PI{9>_ang+6O6R&Pesk;~M{wzxCGL@GT)%<68ZU9k<_h?zau^3EAB+t8u#1?%b(80yd5| hKahB7mQ+reQPsS)Ci`(gxN1?LWRW6o0-6~{>tv<9b(!5qc0v+8)vC8^SSAu& zxSKE<&^pmIfouD7Z33OrI&qakp;U0iQd$YLlJ^FeP*+8wYdP1Jb8b1!18q_khdiPr zx<`>nlavbjLSYd4Ta%Uj1efkZNB*cBubFbVTd%L&9F<$GR*!Cc=kjBarEaeee5 zA&;G1iqxQe?3^jzL{GVg3JYkHdyKG-2B-oZ)0k^>Zw0uw(tfJ0F%w|#3=6B&Ddw8g zBAfG~xK@BI`W@Yw(2hwW#Ape5_yHlwwo67!WH#Ne>MZE!Z>n~RY~-}1uT@c|=ZU~H zKR1}`fCwWW0zSerVKCoHG1nW-(@RBzz7>wz1$Jbfg*$_}#$Xv-%M`Fgi?;Ib-eB4Q z2ml-<+b)Cgd&xD-hb}fJcHy(3$~jE#5=Dq}cu@>w0+1V`B$h3Uei_T1MH@+PdW5Ao zg0}$!)06u%SC9w{psN@Fq*h#xIJ42B4MVNb{7j6rrlGPEi;G39N~GnUz7C}=ioa-? zr=P>57JN~}y;|^ITI;Dc`2bEa{|G_Ngj9o{rQO6Wlo!Ch@JXJBGfp)ar-9LEerPm5 z1`{mRb`cQ!vO$hQMdJfL=!7&#ABv6>!R(w-;hb@bGs=PCjloBVL#53#-!fQy!|8l4 z&oQ62csU14hX`KiTf*uGHXMErlyCRmd<%lP7SDK>#qEG^$hvm=+oA5#(0S*<5KNoB zyu3c`%od(0N9kHrfID}TMz!}+_~7hEX#)UD7F|9i)x#30_^F*R!6?pRis7`5gC zloQOoojQ8AcZqpdxkOa9epfk0RMvNVXLwJh?7knAxQVWiNbnj65keoz-C%clwpZdn z*e|fR5qp}K79`u7mUw$64{vc(0a4>#0r?^{HFxsC-<_NUeM^0UlapGy(%Zu%Z}Bo7 zyukRqcqqtcL((BACoWZ7`ZCG=p9&RMhe3{b&;LLz97kAiDdwB3=33fdC60s1Qt3RO z0JqWHk7fFKRu>lSRJz+I5S|PdeL_uzuz2VtrP$I}ZL00iyHH1P%q)hxw|*_!og$?M z7YQ9;wCJaaWH<<}Ld&!g%T{ZHb)w=auK05pr@3G>|2iyrc=E@|IoY;ffqjh`i)^O+ zPJ<2R-yx`6pxIPz%%esBU(8w~-wlFY*|rcR7)~;3az^ry;x(d+8~MW^{`EQ* zHpJf;$9BI4;;(@_D66-5QHL-EJ04z(Y%slS4Y`Kl-_zy}F@1gh=FlWL{H(>H@qLHe zf+dIZTO6W44fqQ+87%VWENK?|*4bk020Q&7F^gBS8&hF0E?r*tKIxQ13ge{o{s!|a z$jfeK5N>InHMC`O+xe~qh2|OSo`qG4VcCt(gSgj)_hVEBGc>d_Yp!bBN`st5;`E%x z`30C%;>M+U8O*)Z;I>{vNJBUb1uroes+4AN+Ge&qi*{@RtCbK%Y)grbWn;`WHkCc- zpdcoKqZCUbaC-n(a{;q)P#mtW5Jfsnn5m5fGcWUC(FfZWHS;e%wNlM@MC&b^>bn+~ zN-&ELv1Hp7oWus_n$g_!wy>z5zptAHqrCt|D4ZTJp8o9brw}lTHguYQh_Hxyt9|G` z{{%%Lc!d<0>0h9B0CiSq6&w@|h5)uSXawz%uI!E#Qo|!PA&V-eN5Oz)be%dfbQYsN z1+7TcPm-w34IAH5b@V<^wT!x1qJ{)Z)H@A*-%=mY#DGZQA)OfDE3Bs$xZh0=!+jdP z8qnQyBpeP6oBhSvAYa4b41h@9(3rrXsgBIOhTGt^B*9RubpRbi-f+Z^N%_}osYMm} zzA*L`tAJwFOD86r9*U2ETMg3~u~>hbUJVQsPSTfw(TX@RKibt)6BMR!Krn&k1%(X0 z0|^H5Lpb6ZqHu;AsOrSx^g-2mRE05>0#!ev%8#j@`hpXDks1YIy`(pSq7@4m!J<7) z-GW0D*~mUY6N5bkKbjF7t@J>9>o~e1xTE3$%cMnnjvfyVQ&b~(P9Fq^m^J~BibHHb z?4yNxf5;q}-VUPw77m4mq7Ezwc^lAvA@2g;iz@QHA%9A^Jt70@+XkD!P_ev7JWJ#a zVix7>jT^@Q8_`0v{i_RW)?zuVk{Pdnv08o=zJ+_+u<`Zl*#LNvfD(mDJp;Ri2JLuy zCM3(9u-Ft38|+yKdu$hL|FY^rBV<*tl;%~*dEC%YSzEim}qmDhp7PdQ$Py}Q#1!2Rg2v4Ed z>J_08gml^`vPd{f&qw;iABK{G?O6{?AFOVig2pZ&!c; zmJ=-(6MqDeH`?|gTBs0hI~lUb{V@+o><3k`oSzWuk@*6dtC49Mj8s3QJ`+z4c_C5* zm7>$xNd0fMh+d=Z1~SJWN=0TaGAof;hqfwY8W9yBvllYIHX-#88uuVI7SR@@Mj*8a znQPFt4w+tvenzGnGTG4&MW2th`N(XBmv6|$Yh=D)$Rcm_XLV|p4@Bx1q~1pAA4si7 zYCJlPL1r2U5OEKZ@ zIpQOwCcE)vS7M3F3-J;Db0Vt%Yea>T?;S6Hq}?OeHWW>$=Y6fP!KxNU%Hx|*Rvfc zRvoct!f81jA3s4TqgUcL%j|>c?1ahiY`>Q!uZ+Q+Z-H;T-)(Vx&+_rzYMJf@xM#pfI1#P3kOU)9p$AZpXZtTWyqz z?Ew3upo{f-()m_)Q>TAs-QIg!E1x-pU+l&aK8G1z0v`h%msTohsnE|;HJTkAX@sOg zrRIbD8Du$)>=$jawIRgIfymdv$J-H}sxCw}1L|~>E3pfAC*(tSV!r|8Ob;TQ_aJt( zJs}s{6InAz7jGi_5CTl~Cc*}g<_<)50v@yt9f*C1FA*mB5j&S)A{!M<>|LOS^`S&4 z3ng|z9f|#C9f{rDj>MNVbtFPz7?G8Q6JZGS&M%#bOo$+Mt`7DC;GeN7YeoOvLU?^2 zwk$$!rl6GmuJX!4Ed5bcPS*|eA0YiDR}VYGF8kgnHQY-c1j#NX*Gv3TuJ?XV-;OHN z{b8rV(-TcP?nC;cu=9JquR*i0>tauo|KR-PTwlfY(wt>nzogf@d@I)%a6RXn2s>Tb zrG}3TKGOerIv$9TPY4A^;N&NzneYWy&;P>?r7Zec%*U-O<5VOR^>(tMjDl?l^42}xFykvbA0H++$>?K^=7V z>Cy4o9n1F!#GcfO-xd3KX%VtN>>KBWLj0ULuI{exn&IbY(kGcFsplrQCZsJ;rT#AB zSnBI_983LtnB#W5b*^(P_2d(drCxMZpns_cJ0lKk>Ae(AkeYoA$D^&fPs{8ENM*kW zj_tOsAWoj=H4MXCQakKqScyk7tJ4aO*%8gI3mliz@JTr)snNH15aI`wFEw^8!*Co+ zn{x+nTfoxUDE9;m$1@o!Iwf8V!%5elCmiB<1IHB{*K%A-4^QzIl=S+P=m6=Nc?Q!xBV%-VU1;5x;ijLid8?T4(+~T=*`Mi;XG5kv9H<*N;nM5gzdg)5wSPs( z(EFF;P7WA1rTS^x!n01Fls!|ou)fM&(8-m?$6Jd3T1e(|N*xO(fRRon9K z&776txarX8qkU8}>6SH9|No_E*Cv}vv>y4sU(cBKs^h}n$5!{;ao7LJuFtQZKRtV9 z$GaZ>{&-7V zS!H@gesC@xQp&heEwtX~z>iWq20m{iv zUKPtCP19d=|IhM8*_GKIx1VT^4Iu?N`*x-3X4JjhYCTsn@wjT!UH!CzkZH$`I|%uG zE>-<#+U0Y?Wpv}8`+6NzIF1Xmjr!*}*<%0WNxP~d{#?A`+au)kwv97LREes{G=0aY xZ?&msrY%{XbubFZs^&U^WTF6HjVo=bk8J8a8tS@#I*jMA6A{s#px24(;N From 1c88718c6bd3cec90452c7a8e78728073eda25af Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 4 Dec 2018 19:10:32 +0800 Subject: [PATCH 111/187] =?UTF-8?q?REPORT-12584=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BC=96=E7=A0=81=E8=BD=AC=E6=8D=A2=20=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/DatabaseConnectionPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 666778610c..0f52a4c5c7 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -15,6 +15,7 @@ import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import javax.swing.*; @@ -48,7 +49,8 @@ public abstract class DatabaseConnectionPane Date: Tue, 4 Dec 2018 20:38:24 +0800 Subject: [PATCH 112/187] =?UTF-8?q?DEC-5669=20=E8=BF=9C=E7=A8=8B=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/server/FineEmbedServerActivator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 982b3633dc..2d08b286d5 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -49,7 +49,7 @@ public class FineEmbedServerActivator extends Activator { stopSpring(); stopServerActivator(); stopTomcat(); - } catch (LifecycleException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } From 04cbb4e93226441185e187711744857b6bf1eee8 Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 4 Dec 2018 21:30:46 +0800 Subject: [PATCH 113/187] =?UTF-8?q?CHART-3460=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 44 ++++++------------- .../design/chart/ChartDesignerActivator.java | 2 + .../com/fr/design/chart/ChartTypePane.java | 21 ++++++--- .../design/chart/gui/ChartWidgetOption.java | 10 +++-- .../impl/ChartHyperPoplinkPane.java | 6 +-- .../mainframe/chart/gui/ChartTypePane.java | 4 +- 6 files changed, 41 insertions(+), 46 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 154f4c0976..3a8abb56e5 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -121,12 +121,17 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return classManager; } - + static { readDefault(); readVanChart(); PluginModule.registerAgent(PluginModule.ExtraChartDesign, classManager); + } + + //安装插件,图表类型热更新。 + //不在static原因:放在static,启动过程中图表插件init也会触发(不需要) + public static void addPluginChangedListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @Override @@ -151,42 +156,21 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; - final Chart[][] allCharts = new Chart[typeName.length][]; - for (int i = 0; i < typeName.length; i++) { - String plotID = typeName[i].getPlotID(); + int index = 0; + for (ChartInternationalNameContentBean bean : typeName) { + String plotID = bean.getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); - if (ArrayUtils.isEmpty(rowChart)) { + if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); - child[i] = new ChartWidgetOption(com.fr.design.i18n.Toolkit.i18nText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); - - allCharts[i] = rowChart; + child[index] = new ChartWidgetOption(com.fr.design.i18n.Toolkit.i18nText(bean.getName()), icon, ChartEditor.class, plotID); + index++; } return child; } - - //加载所有图表图片 - private static void initAllChartsDemoImage(Chart[][] allCharts) { - - for (Chart[] rowChart : allCharts) { - if (rowChart == null) { - continue; - } - //加载初始化图表模型图片 - initChartsDemoImage(rowChart); - } - } - - private static void initChartsDemoImage(Chart[] rowChart) { - - for (Chart aRowChart : rowChart) { - //此时,为图片生成模型数据 - aRowChart.createSlotImage(); - } - } private static void readVanChart() { @@ -252,7 +236,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } - private static IndependentChartUIProvider getChartTypeInterface(String plotID) { + private IndependentChartUIProvider getChartTypeInterface(String plotID) { if (idAndPriorityMap.containsKey(plotID)) { String priority = idAndPriorityMap.get(plotID); if (chartTypeInterfaces.containsKey(priority)) { @@ -303,7 +287,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } - private static String getChartName(String plotID, IndependentChartUIProvider provider) { + private String getChartName(String plotID, IndependentChartUIProvider provider) { String name = provider.getPlotTypeTitle4PopupWindow(); if (StringUtils.isEmpty(name)) { name = ChartTypeManager.getInstance().getChartName(plotID); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index de7e5ec8a4..c3213c10ba 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -52,6 +52,8 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + + ChartTypeInterfaceManager.addPluginChangedListener(); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index b4efa05a4f..5cc3c8d50c 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -15,25 +15,32 @@ import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.license.exception.RegistEditionException; import com.fr.license.function.VT4FR; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.ListCellRenderer; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; - private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames(); private Chart[][] charts4Icon = null; { charts4Icon = new Chart[this.typeName.length][]; for (int i = 0; i < this.typeName.length; i++) { - Chart[] rowCharts = ChartTypeManager.getInstance().getChartTypes(this.typeName[i].getPlotID()); + Chart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); int rowChartsCount = rowCharts.length; charts4Icon[i] = new Chart[rowChartsCount]; for (int j = 0; j < rowChartsCount; j++) { @@ -137,7 +144,7 @@ public class ChartTypePane extends ChartCommonWizardPane { int subIndex = 0; for (int i = 0; i < typeName.length; i++) { - Chart [] charts = ChartTypeManager.getInstance().getChartTypes(typeName[i].getPlotID()); + Chart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); for (int j = 0; j < charts.length; j++) { if (charts[j].getPlot().match4GUI(plot)) { mainIndex = i; @@ -154,7 +161,7 @@ public class ChartTypePane extends ChartCommonWizardPane { public void update(Chart oldChart) { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; if(chart.getPlot() != null){ if(chart.getPlot() instanceof MapPlot && !supportMap()){ JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported")); diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index c87a7a8ed4..783bfdd6a6 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -2,11 +2,12 @@ package com.fr.design.chart.gui; import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; +import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; -import javax.swing.*; +import javax.swing.Icon; /** * 表单中 图表控件信息, 名称, class, form中通过XcreatorUtils反射类 实现XChartEditor的初始化. @@ -19,13 +20,13 @@ public class ChartWidgetOption extends WidgetOption { private String optionName; private Icon optionIcon; private Class widgetClass; - private Chart chart; + private String chartID; - public ChartWidgetOption(String optionName, Icon optionIcon, Class widgetClass, Chart chart) { + public ChartWidgetOption(String optionName, Icon optionIcon, Class widgetClass, String chartID) { this.optionName = optionName; this.optionIcon = optionIcon; this.widgetClass = widgetClass; - this.chart = chart; + this.chartID = chartID; } /** @@ -37,6 +38,7 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); + Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; widget.addChart((Chart) chart.clone()); return widget; } catch (InstantiationException e) { diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index f66bc11617..c3db9b7ef3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -15,8 +15,8 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; - -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Dimension; import java.util.HashMap; /** @@ -66,7 +66,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane Date: Wed, 5 Dec 2018 10:00:58 +0800 Subject: [PATCH 114/187] =?UTF-8?q?REPORT-13194=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java index 769ff4a60d..f205cca92f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java @@ -100,10 +100,9 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende Border border = treeCellRendererComponent.getBorder(); setBorder(border); treeCellRendererComponent.setBorder(BorderFactory.createEmptyBorder()); - //todo 可能会发生数组越界,需要处理一下 - if (getComponentCount() == 2) { - remove(1); - } + + remove((Component) this._actualTreeRenderer); + add(treeCellRendererComponent); } From dff9c1758b8c8d05783dc818bf15114e272dafe8 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 5 Dec 2018 11:33:32 +0800 Subject: [PATCH 115/187] 1 --- .../com/fr/design/web/CustomIconPane.java | 629 +++++++++--------- 1 file changed, 317 insertions(+), 312 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index edce02c7af..b85ac113d5 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -41,333 +41,337 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; /** - * * carl:自定义Icon编辑 - * */ public class CustomIconPane extends BasicPane { - private String selectedIconName = null; - private ListMap iconButtonMap = null; - private JPanel iconPane = null; - private ButtonGroup bg; - private UIScrollPane jsPane; - // 老一次次去拿真麻烦 - private IconManager iconManager = null; - private UIButton removeButton; - private UIButton editButton; - - - - private static final int THE_WIDTH = 180; - private static final int HORIZONTAL_COUNT = 6; - private static final int HEIGHT_PER = 29; - private static final int GAP = 10; - - public CustomIconPane() { - this.initComponents(); - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))); - JPanel noNamePane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - centerPane.add(noNamePane, BorderLayout.CENTER); - - iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - - // 开始加图标选择按钮 - initIcons(); - - jsPane = new UIScrollPane(iconPane); - refreshIconPane(false); - jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - - jsPane.setPreferredSize(new Dimension(200,180)); - noNamePane.add(jsPane); - - DescriptionTextArea des = new DescriptionTextArea(2); - des.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1")); - centerPane.add(des, BorderLayout.SOUTH); - - this.add(centerPane, BorderLayout.CENTER); - - JPanel eastPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - - // 增加、删除、编辑按钮 - initAddButton(buttonPane); - initRemoveButton(buttonPane); - initEditButton(buttonPane); - - eastPane.add(buttonPane); - this.add(eastPane, BorderLayout.EAST); - - } - - private void initIcons() { - iconButtonMap = new ListMap(); - iconManager = WidgetInfoConfig.getInstance().getIconManager(); - bg = new ButtonGroup(); - Object[] names = iconManager.getIconNames(); - Object name = null; - for (int i = 0; i < names.length; i++) { - name = names[i]; - if (name == null || !(name instanceof String)) { - continue; - } - // carl:默认选第一个 - if (this.selectedIconName == null) { - this.selectedIconName = (String)name; - } - IconButton iconButton = new IconButton((String)name); - iconButtonMap.put(name, iconButton); - iconPane.add(iconButton); - bg.add(iconButton); - } - } - - private void initAddButton(JPanel buttonPane) { - UIButton addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); - addButton.setPreferredSize(new Dimension(80, 25)); - addButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - final EditIconDialog add = new EditIconDialog(); - add.populate(null); - add.showWindow(SwingUtilities.getWindowAncestor(CustomIconPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - Icon icon = add.update(); - if (iconManager.addIcon(icon, false)) { - IconButton iconButton = null;//初始化 - - addIcon(icon, iconButton); - - }else { - // add failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); - } - } + private String selectedIconName = null; + private ListMap iconButtonMap = null; + private JPanel iconPane = null; + private ButtonGroup bg; + private UIScrollPane jsPane; + // 老一次次去拿真麻烦 + private IconManager iconManager = null; + private UIButton removeButton; + private UIButton editButton; + + + private static final int THE_WIDTH = 180; + private static final int HORIZONTAL_COUNT = 6; + private static final int HEIGHT_PER = 29; + private static final int GAP = 10; + + public CustomIconPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))); + JPanel noNamePane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + centerPane.add(noNamePane, BorderLayout.CENTER); + + iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + // 开始加图标选择按钮 + initIcons(); + + jsPane = new UIScrollPane(iconPane); + refreshIconPane(false); + jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + + jsPane.setPreferredSize(new Dimension(200, 180)); + noNamePane.add(jsPane); + + DescriptionTextArea des = new DescriptionTextArea(2); + des.setText(createDescriptionText()); + centerPane.add(des, BorderLayout.SOUTH); + + this.add(centerPane, BorderLayout.CENTER); + + JPanel eastPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + + // 增加、删除、编辑按钮 + initAddButton(buttonPane); + initRemoveButton(buttonPane); + initEditButton(buttonPane); + + eastPane.add(buttonPane); + this.add(eastPane, BorderLayout.EAST); + + } + + + protected String createDescriptionText(){ + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1"); + } + + private void initIcons() { + iconButtonMap = new ListMap(); + iconManager = WidgetInfoConfig.getInstance().getIconManager(); + bg = new ButtonGroup(); + Object[] names = iconManager.getIconNames(); + Object name = null; + for (int i = 0; i < names.length; i++) { + name = names[i]; + if (name == null || !(name instanceof String)) { + continue; + } + // carl:默认选第一个 + if (this.selectedIconName == null) { + this.selectedIconName = (String) name; + } + IconButton iconButton = new IconButton((String) name); + iconButtonMap.put(name, iconButton); + iconPane.add(iconButton); + bg.add(iconButton); + } + } + + private void initAddButton(JPanel buttonPane) { + UIButton addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); + addButton.setPreferredSize(new Dimension(80, 25)); + addButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final EditIconDialog add = new EditIconDialog(); + add.populate(null); + add.showWindow(SwingUtilities.getWindowAncestor(CustomIconPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + Icon icon = add.update(); + if (iconManager.addIcon(icon, false)) { + IconButton iconButton = null;//初始化 + + addIcon(icon, iconButton); + + } else { + // add failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + } + } }).setVisible(true); - } - }); - buttonPane.add(addButton); - } - - private void initRemoveButton(JPanel buttonPane) { - removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); - removeButton.setPreferredSize(new Dimension(80, 25)); - removeButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (iconManager.isSystemIcon(selectedIconName)) { - return; - } - if (iconManager.removeIcon(selectedIconName)) { - IconButton iconButton = (IconButton)iconButtonMap.get(selectedIconName); - iconPane.remove(iconButton); - iconButtonMap.remove(selectedIconName); - bg.remove(iconButton); - selectedIconName = ((IconButton)iconButtonMap.getByIndex(0)).iconName; - refreshIconPane(false); - CustomIconPane.this.validate(); - CustomIconPane.this.repaint(); - } else { - // remove failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.WARNING_MESSAGE); - } - } - }); - buttonPane.add(removeButton); - } - - private void initEditButton(JPanel buttonPane) { - editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - editButton.setPreferredSize(new Dimension(80, 25)); - editButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (iconManager.isSystemIcon(selectedIconName)) { - return; - } - Icon oldIcon = null; - try { - oldIcon= iconManager.getIcon(selectedIconName); - } catch (CloneNotSupportedException e1) { + } + }); + buttonPane.add(addButton); + } + + private void initRemoveButton(JPanel buttonPane) { + removeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); + removeButton.setPreferredSize(new Dimension(80, 25)); + removeButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (iconManager.isSystemIcon(selectedIconName)) { + return; + } + if (iconManager.removeIcon(selectedIconName)) { + IconButton iconButton = (IconButton) iconButtonMap.get(selectedIconName); + iconPane.remove(iconButton); + iconButtonMap.remove(selectedIconName); + bg.remove(iconButton); + selectedIconName = ((IconButton) iconButtonMap.getByIndex(0)).iconName; + refreshIconPane(false); + CustomIconPane.this.validate(); + CustomIconPane.this.repaint(); + } else { + // remove failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.WARNING_MESSAGE); + } + } + }); + buttonPane.add(removeButton); + } + + private void initEditButton(JPanel buttonPane) { + editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + editButton.setPreferredSize(new Dimension(80, 25)); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (iconManager.isSystemIcon(selectedIconName)) { + return; + } + Icon oldIcon = null; + try { + oldIcon = iconManager.getIcon(selectedIconName); + } catch (CloneNotSupportedException e1) { // do nothing - } - if (oldIcon == null) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - "Error", - "Error", - JOptionPane.ERROR_MESSAGE); - } - - final EditIconDialog edit = new EditIconDialog(); - edit.populate(oldIcon); - edit.showWindow(DesignerContext.getDesignerFrame(), new IconDialogActionListener(oldIcon) { - @Override - public void doOk() { - iconManager.removeIcon(oldIcon.getName()); - Icon icon = edit.update(); - if (iconManager.addIcon(icon, false)) { - IconButton iconButton = (IconButton)iconButtonMap.get(oldIcon.getName()); - iconPane.remove(iconButton); - bg.remove(iconButton); - - addIcon(icon, iconButton); - - } else { - // 失败了再弄回去 - iconManager.addIcon(oldIcon, true); - // edit failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); - } - } + } + if (oldIcon == null) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + "Error", + "Error", + JOptionPane.ERROR_MESSAGE); + } + + final EditIconDialog edit = new EditIconDialog(); + edit.populate(oldIcon); + edit.showWindow(DesignerContext.getDesignerFrame(), new IconDialogActionListener(oldIcon) { + @Override + public void doOk() { + iconManager.removeIcon(oldIcon.getName()); + Icon icon = edit.update(); + if (iconManager.addIcon(icon, false)) { + IconButton iconButton = (IconButton) iconButtonMap.get(oldIcon.getName()); + iconPane.remove(iconButton); + bg.remove(iconButton); + + addIcon(icon, iconButton); + + } else { + // 失败了再弄回去 + iconManager.addIcon(oldIcon, true); + // edit failed + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + } + } }).setVisible(true); - } - }); - buttonPane.add(editButton); - } - - private void updateButtonPane() { - if (editButton == null || removeButton == null){ - return; - } - if (iconManager.isSystemIcon(selectedIconName)) { - editButton.setEnabled(false); + } + }); + buttonPane.add(editButton); + } + + private void updateButtonPane() { + if (editButton == null || removeButton == null) { + return; + } + if (iconManager.isSystemIcon(selectedIconName)) { + editButton.setEnabled(false); removeButton.setEnabled(false); - } else { + } else { editButton.setEnabled(true); removeButton.setEnabled(true); } - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"); - } + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"); + } /** * 添加按钮 * - * @param icon 图标 + * @param icon 图标 * @param iconButton 按钮 */ - public void addIcon(Icon icon,IconButton iconButton){ - selectedIconName = icon.getName(); - iconButton = new IconButton(icon.getName()); - iconButtonMap.put(icon.getName(), iconButton); - iconPane.add(iconButton); - bg.add(iconButton); - refreshIconPane(true); - CustomIconPane.this.validate(); - CustomIconPane.this.repaint(); - } - - public static class IconDialogActionListener extends DialogActionAdapter { - protected Icon oldIcon; - - public IconDialogActionListener(Icon oldIcon) { - this.oldIcon = oldIcon; - } - } - - public void populate(String iconName) { - if (iconName == null) { - return; - } - this.selectedIconName = iconName; + public void addIcon(Icon icon, IconButton iconButton) { + selectedIconName = icon.getName(); + iconButton = new IconButton(icon.getName()); + iconButtonMap.put(icon.getName(), iconButton); + iconPane.add(iconButton); + bg.add(iconButton); + refreshIconPane(true); + CustomIconPane.this.validate(); + CustomIconPane.this.repaint(); + } + + public static class IconDialogActionListener extends DialogActionAdapter { + protected Icon oldIcon; + + public IconDialogActionListener(Icon oldIcon) { + this.oldIcon = oldIcon; + } + } + + public void populate(String iconName) { + if (iconName == null) { + return; + } + this.selectedIconName = iconName; updateButtonPane(); - this.repaint(); - } - - public String update() { - //把图标信息入库 - Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { - @Override - public void run() { - WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); - } - }); - return selectedIconName; - } - - // 不知道怎么动态布局,就这么傻傻的调一下大小 - private void refreshIconPane(boolean down) { - iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); - UIScrollBar jsBar = jsPane.createVerticalScrollBar(); - try { - if (down) { - // 将滚动条滚到最后 - jsBar.setValue(jsBar.getMaximum() - jsBar.getVisibleAmount()); - } else { - jsBar.setValue(0); - } - } catch (RuntimeException re) { + this.repaint(); + } + + public String update() { + //把图标信息入库 + Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { + @Override + public void run() { + WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); + } + }); + + return selectedIconName; + } + + // 不知道怎么动态布局,就这么傻傻的调一下大小 + private void refreshIconPane(boolean down) { + iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); + UIScrollBar jsBar = jsPane.createVerticalScrollBar(); + try { + if (down) { + // 将滚动条滚到最后 + jsBar.setValue(jsBar.getMaximum() - jsBar.getVisibleAmount()); + } else { + jsBar.setValue(0); + } + } catch (RuntimeException re) { return; - } - updateButtonPane(); - } - - private class IconButton extends JToggleButton implements ActionListener{ - private String iconName; - private Image iconImage = null; + } + updateButtonPane(); + } + + private class IconButton extends JToggleButton implements ActionListener { + private String iconName; + private Image iconImage = null; private static final int ICON_BUTTON_SIZE = 24; private static final int ICON_X = 4; private static final int ICON_Y = 4; - public IconButton(String name) { - this.iconName = name; - this.addActionListener(this); + + public IconButton(String name) { + this.iconName = name; + this.addActionListener(this); this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.setBorder(null); this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); this.setToolTipText(iconName); - } + } @Override public void updateUI() { - setUI(new BasicButtonUI(){ + setUI(new BasicButtonUI() { public void paint(Graphics g, JComponent c) { super.paint(g, c); } }); } - - @Override - public void paintComponent(Graphics g) { + + @Override + public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // carl:这里缩放显示 16 × 16 if (iconImage != null) { - g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); + g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); } if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) { - g2d.setPaint(Color.RED); + g2d.setPaint(Color.RED); } else { g2d.setPaint(Color.LIGHT_GRAY); } GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, IconManager.DEFAULT_ICONWIDTH + 7, - IconManager.DEFAULT_ICONHEIGHT + 7), Constants.LINE_THICK); + IconManager.DEFAULT_ICONHEIGHT + 7), Constants.LINE_THICK); } - + @Override - public Dimension getPreferredSize() { + public Dimension getPreferredSize() { return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE); } - + public void actionPerformed(ActionEvent evt) { CustomIconPane.this.selectedIconName = iconName; fireChagneListener(); - updateButtonPane(); + updateButtonPane(); CustomIconPane.this.repaint();// repaint } @Override - public void addChangeListener(ChangeListener changeListener) { + public void addChangeListener(ChangeListener changeListener) { this.changeListener = changeListener; } @@ -377,18 +381,18 @@ public class CustomIconPane extends BasicPane { this.changeListener.stateChanged(evt); } } - - } - - private static class EditIconDialog extends BasicPane { - private UITextField nameTextField; - private UILabel showImageLabel; - private Image iconImage = null; - private String oldName = null; - - protected EditIconDialog() { + + } + + private static class EditIconDialog extends BasicPane { + private UITextField nameTextField; + private UILabel showImageLabel; + private Image iconImage = null; + private String oldName = null; + + protected EditIconDialog() { init(); - } + } private void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -402,16 +406,17 @@ public class CustomIconPane extends BasicPane { nameTextField = new UITextField(20); browseButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent e) { onBrowseButtonClicked(); - } - }); + } + }); // 焦点丢失时看看名称是否已经存在 nameTextField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { // do nothing } + public void focusLost(FocusEvent e) { if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { return; @@ -428,7 +433,7 @@ public class CustomIconPane extends BasicPane { JPanel imagePane = new JPanel(); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); showImageLabel = new UILabel(); - showImageLabel.setPreferredSize(new Dimension(20,20)); + showImageLabel.setPreferredSize(new Dimension(20, 20)); imagePane.add(showImageLabel); imagePane.add(browseButton); Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; @@ -448,7 +453,7 @@ public class CustomIconPane extends BasicPane { // 将图片转化到16 × 16大小 Image image = BaseUtils.readImage(path); BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, -IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); + IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bufferedImage.createGraphics(); g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); bufferedImage.flush(); @@ -461,29 +466,29 @@ IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); } @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Add_Icon"); - } - - // 用户自定义的只有name 和 imgae两属性, path不要去管 - public void populate(Icon icon) { - if (icon == null) { - return; - } - oldName = icon.getName(); - nameTextField.setText(icon.getName()); - if (icon.getImage() != null) { - showImageLabel.setIcon(new ImageIcon(icon.getImage())); - } - iconImage = icon.getImage(); - } - - public Icon update() { - // 有一个是空,都返回null,反正不会添加的 - if (StringUtils.isBlank(nameTextField.getText()) || iconImage == null) { - return null; - } - return new Icon(nameTextField.getText(), iconImage); - } - } + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Add_Icon"); + } + + // 用户自定义的只有name 和 imgae两属性, path不要去管 + public void populate(Icon icon) { + if (icon == null) { + return; + } + oldName = icon.getName(); + nameTextField.setText(icon.getName()); + if (icon.getImage() != null) { + showImageLabel.setIcon(new ImageIcon(icon.getImage())); + } + iconImage = icon.getImage(); + } + + public Icon update() { + // 有一个是空,都返回null,反正不会添加的 + if (StringUtils.isBlank(nameTextField.getText()) || iconImage == null) { + return null; + } + return new Icon(nameTextField.getText(), iconImage); + } + } } From 683ee67089bf8cc448dd9f0a7440005b187fe66a Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 15:48:19 +0800 Subject: [PATCH 116/187] =?UTF-8?q?REPORT-12974=20pc=E7=AB=AF=E3=80=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E3=80=81=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=8B=E6=89=AB=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=8B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=89=AB=E7=A0=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/WidgetPropertyPane.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index af17389be0..da3e56ec13 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -16,6 +16,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; +import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -173,7 +174,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { + XCreator xCreator = selection.getSelectedCreator(); embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); + if (xCreator instanceof XWScaleLayout + && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) + && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { + embeddedPropertyUIProviders = ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); + } } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); From 67e4444afcf3bdbf66f020553608b6deb20faefe Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 15:51:29 +0800 Subject: [PATCH 117/187] =?UTF-8?q?REPORT-12974=20pc=E7=AB=AF=E3=80=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E3=80=81=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=8B=E6=89=AB=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=8B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=89=AB=E7=A0=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/WidgetPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index da3e56ec13..d355c2420b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -175,7 +175,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { XCreator xCreator = selection.getSelectedCreator(); - embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); + embeddedPropertyUIProviders = xCreator.getWidgetPropertyUIProviders(); if (xCreator instanceof XWScaleLayout && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { From ac98b10c8090d476bb699946f862a2eca7f0d0e3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 5 Dec 2018 15:56:16 +0800 Subject: [PATCH 118/187] =?UTF-8?q?REPORT-11830=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA=E7=9A=84=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/export/AbstractExportAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 4d9c976ce9..536fc87ee5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -9,9 +9,9 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; -import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; +import com.fr.io.exporter.ExporterKey; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -178,7 +178,7 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), - null, + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); @@ -189,7 +189,7 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, - null, + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); From 8066d95cf7aae08451abac65d72659b42008daeb Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 16:50:08 +0800 Subject: [PATCH 119/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/WidgetPropertyPane.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index d355c2420b..5a25ad1ecf 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -174,18 +174,26 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { - XCreator xCreator = selection.getSelectedCreator(); - embeddedPropertyUIProviders = xCreator.getWidgetPropertyUIProviders(); - if (xCreator instanceof XWScaleLayout - && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) - && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { - embeddedPropertyUIProviders = ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); - } + embeddedPropertyUIProviders = getEmbeddedPropertyUIProviders(selection.getSelectedCreator()); } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); } + /** + * 获取当前控件扩展的属性tab + * @param xCreator + * @return + */ + private WidgetPropertyUIProvider[] getEmbeddedPropertyUIProviders(XCreator xCreator) { + if (xCreator instanceof XWScaleLayout + && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) + && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { + return ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); + } + return xCreator.getWidgetPropertyUIProviders(); + } + /** * 判断是将拓展的tab放入属性表还是将原来的tab放入属性表 * From b38901e8b13ed29e0842f37299bf9a95eaa7b528 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 19:20:18 +0800 Subject: [PATCH 120/187] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWScaleLayout.java | 13 +++++++++++++ .../fr/design/mainframe/WidgetPropertyPane.java | 17 +---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java index 2ffe6c6eb7..1db5e40451 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java @@ -10,6 +10,7 @@ import java.awt.event.ContainerEvent; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter; import com.fr.design.form.layout.FRScaleLayout; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; @@ -166,4 +167,16 @@ public class XWScaleLayout extends DedicateLayoutContainer { XCreator child = getXCreator(INDEX); child.firePropertyChange(); } + + /** + * 获取被包装的XCreator扩展的属性tab + * @return + */ + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + if (this.getXCreatorCount() > 0) { + return this.getXCreator(0).getWidgetPropertyUIProviders(); + } + return super.getWidgetPropertyUIProviders(); + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 5a25ad1ecf..af17389be0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -16,7 +16,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; -import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -174,26 +173,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { - embeddedPropertyUIProviders = getEmbeddedPropertyUIProviders(selection.getSelectedCreator()); + embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); } - /** - * 获取当前控件扩展的属性tab - * @param xCreator - * @return - */ - private WidgetPropertyUIProvider[] getEmbeddedPropertyUIProviders(XCreator xCreator) { - if (xCreator instanceof XWScaleLayout - && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) - && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { - return ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); - } - return xCreator.getWidgetPropertyUIProviders(); - } - /** * 判断是将拓展的tab放入属性表还是将原来的tab放入属性表 * From 1e3fb2584ca2d5ef808df331763ab34d8acf99bc Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 5 Dec 2018 20:08:35 +0800 Subject: [PATCH 121/187] =?UTF-8?q?REPORT-11611=20=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=B8=89=E6=9C=9F=3D>=E4=BA=A4=E4=BA=92=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/AbstractNativePrintSettingPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index f32e0c1153..2b22297837 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -373,7 +373,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { {customPageRadioButton, specifiedAreaField, areaFieldTip}, {doublePrintRadioButton, doublePrintComboBox, new JPanel()} }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 8); } private JPanel getScalePane() { From 82c1c501287dc8d6a815c2ad1526ce9f85d5fce0 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 6 Dec 2018 15:41:47 +0800 Subject: [PATCH 122/187] =?UTF-8?q?REPORT-13276=20release=E4=BC=A0?= =?UTF-8?q?=E4=B8=80=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/bbs/BBSLoginUtils.java | 60 +--- .../com/fr/design/extra/LoginWebBridge.java | 83 +----- .../com/fr/design/extra/PluginWebBridge.java | 4 +- .../design/extra/ucenter/AbstractClient.java | 120 -------- .../com/fr/design/extra/ucenter/Client.java | 264 ------------------ .../fr/design/extra/ucenter/XMLHelper.java | 41 --- 6 files changed, 17 insertions(+), 555 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java diff --git a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java index ea24c49da0..9e2ba9a733 100644 --- a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java +++ b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java @@ -1,14 +1,8 @@ package com.fr.design.bbs; -import com.fr.config.BBSAttr; -import com.fr.config.Configuration; -import com.fr.config.MarketConfig; +import com.fr.base.passport.FinePassportManager; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; -import java.util.List; /** * Created by ibm on 2017/8/21. @@ -16,62 +10,14 @@ import java.util.List; public class BBSLoginUtils { public static void bbsLogin(final String username, final String password) { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); try { - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - public static void bbsLogin(List list) { - try { - String uid = list.get(0); - String username = list.get(1); - String password = list.get(2); - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); - bbsAttr.setBbsUid(Integer.parseInt(uid)); - bbsAttr.setInShowBBsName(username); - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - + FinePassportManager.getInstance().login(username, password); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } public static void bbsLogout() { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(StringUtils.EMPTY); - bbsAttr.setBbsPassword(StringUtils.EMPTY); - bbsAttr.setBbsUid(0); - bbsAttr.setInShowBBsName(StringUtils.EMPTY); - try { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + FinePassportManager.getInstance().logout(); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java index a89a4df031..43bb8131a4 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java @@ -1,23 +1,18 @@ package com.fr.design.extra; -import com.fr.base.FRContext; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.PluginLoginExecutor; -import com.fr.design.extra.ucenter.Client; -import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.gui.ilable.UILabel; import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; -import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; - import javax.swing.JDialog; import javax.swing.SwingUtilities; import java.awt.Color; @@ -25,8 +20,6 @@ import java.awt.Desktop; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; -import java.util.LinkedList; -import java.util.List; /** * @author vito @@ -150,7 +143,7 @@ public class LoginWebBridge { try { Thread.sleep(millis); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -161,7 +154,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -172,7 +165,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -202,35 +195,16 @@ public class LoginWebBridge { if (!testConnection()) { return NET_FAILED; } - List loginResult = frPassport(userInfo, password); - String uid = loginResult.get(0); - String username = loginResult.get(1); - if (Integer.parseInt(uid) > 0) { - loginSuccess(username); - } - return uid; - } - - private List frPassport(String username, String password) { - LinkedList list = new LinkedList<>(); + int uid = 0; try { - Client uc = new Client(); - String result = uc.ucUserLogin(username, password); - result = new String(result.getBytes("iso-8859-1"), "gbk"); - list = XMLHelper.ucUnserialize(result); - if (list.size() > 0) { - int uid = Integer.parseInt(list.get(0)); - if (uid > 0) { - BBSLoginUtils.bbsLogin(list); - } - } else { - list.push(NET_FAILED); - } + uid = FinePassportManager.getInstance().login(userInfo, password); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - list.push(UNKNOWN_ERROR); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (uid > 0) { + loginSuccess(MarketConfig.getInstance().getBbsUsername()); } - return list; + return String.valueOf(uid); } /** @@ -276,39 +250,6 @@ public class LoginWebBridge { } } - /** - * 获取用户信息 - * - * @param userInfo - */ - public void getLoginInfo(String userInfo) { - try { - JSONObject jo = new JSONObject(userInfo); - String status = jo.get("status").toString(); - if (ComparatorUtils.equals(status, LOGIN_SUCCESS)) { - String username = jo.get("username").toString(); - int uid = Integer.parseInt(jo.get("uid") == null ? StringUtils.EMPTY : jo.get("uid").toString()); - closeQQWindow(); - loginSuccess(username); - - LinkedList list = new LinkedList<>(); - list.add(String.valueOf(uid)); - list.add(username); - list.add(StringUtils.EMPTY); - BBSLoginUtils.bbsLogin(list); - } else if (ComparatorUtils.equals(status, LOGIN_FAILED)) { - //账号没有QQ授权 - closeQQWindow(); - try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("QQ_binding"))); - } catch (Exception ignored) { - // ignored - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { if (url.indexOf("qqLogin.html") > 0) { diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index 33d5276453..903418ec93 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -1,8 +1,8 @@ package com.fr.design.extra; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; import com.fr.design.RestartHelper; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor; @@ -554,7 +554,7 @@ public class PluginWebBridge { */ public void clearUserInfo() { MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); - BBSLoginUtils.bbsLogout(); + FinePassportManager.getInstance().logout(); uiLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn")); } diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java deleted file mode 100644 index 855e5a96e6..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.Base64; -import com.fr.base.FRContext; -import com.fr.stable.StringUtils; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Map; - -/** - * @author lp - * @date 2016/9/9 - */ -public abstract class AbstractClient { - - static final String UC_API_MYSQL = "ucApiMysql"; - static final String UC_API_POST = "ucApiPost"; - - protected String urlEncode(String value) { - return URLEncoder.encode(value); - } - - protected String md5(String input) { - MessageDigest md; - try { - md = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - return byte2hex(md.digest(input.getBytes())); - } - - protected String md5(long input) { - return md5(String.valueOf(input)); - } - - protected String base64Decode(String input) { - try { - return new String(Base64.decode(input)); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String base64Encode(String input) { - try { - return Base64.encode(input.getBytes("iso-8859-1")); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String byte2hex(byte[] b) { - StringBuilder hs = new StringBuilder(); - String stmp = ""; - for (byte aB : b) { - stmp = (Integer.toHexString(aB & 0XFF)); - if (stmp.length() == 1) { - hs.append("0").append(stmp); - } else { - hs.append(stmp); - } - } - return hs.toString(); - } - - protected String subStr(String input, int begin, int length) { - return input.substring(begin, begin + length); - } - - protected String subStr(String input, int begin) { - if (begin > 0) { - return input.substring(begin); - } else { - return input.substring(input.length() + begin); - } - } - - protected long microTime() { - return System.currentTimeMillis(); - } - - protected long time() { - return System.currentTimeMillis() / 1000; - } - - protected String sprintf(String format, long input) { - String temp = "0000000000" + input; - return temp.substring(temp.length() - 10); - } - - protected String callUserFunc(String function, String model, String action, Map args) { - if (UC_API_MYSQL.equals(function)) { - return this.ucApiMysql(model, action, args); - } - if (UC_API_POST.equals(function)) { - return this.ucApiPost(model, action, args); - } - return StringUtils.EMPTY; - } - - public abstract String ucApiPost(String module, String action, Map arg); - - public abstract String ucApiMysql(String model, String action, Map args); - - protected String urlEncode(String value, String code) { - try { - return URLEncoder.encode(value, code); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().info(e.getMessage()); - } - return ""; - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java deleted file mode 100644 index 903286476e..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.fr.general.CloudCenter; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * - * @author lp - * @date 2016/9/9 - */ -public class Client extends AbstractClient { - - private static String UC_IP = ""; - private static String UC_API = ""; - private static String UC_CONNECT = ""; - private static String UC_KEY = "Rc85U37411p4zdvcedm8D4t4D3l9Sa42H0kd98Gbd82aA99a61S2Z5LbQ9u430M0"; - private static String UC_APPID = "4"; - private static String UC_CLIENT_RELEASE = "20090212"; - public static String UC_ROOT = ""; - private static String UC_API_FUNC = "mysql".equals(UC_CONNECT) ? UC_API_MYSQL : UC_API_POST; - - public String ucUserLogin(String username, String password) { - return ucUserLogin(username, password, 0, 0); - } - - public String ucUserLogin(String username, String password, int isUid, int checkQues) { - return ucUserLogin(username, password, isUid, checkQues, "", ""); - } - - /** - * 用户登录 - * - * @param username 用户名 - * @param password 密码 - * @param isUid 是否为uid - * @param checkQues 是否使用安全问题 - * @param questionId 安全提问 - * @param answer 安全提问答案 - * @return array (uid/status, username, password, email) - */ - public String ucUserLogin(String username, String password, int isUid, int checkQues, String questionId, String answer) { - Map args = new HashMap<>(6); - args.put("username", username); - args.put("password", password); - args.put("isUid", isUid); - args.put("checkQues", checkQues); - args.put("questionId", questionId); - args.put("answer", answer); - String res = callUserFunc(UC_API_FUNC, "user", "login", args); - return "mysql".equals(UC_CONNECT) ? res : res; - } - - /** - * 拼接发送的post请求 - * - * @param module 模块 - * @param action 操作模式 - * @param arg 参数 - * @return 发送的请求加密内容 - */ - @Override - public String ucApiPost(String module, String action, Map arg) { - StringBuilder str = new StringBuilder(); - String sep = ""; - for (String k : arg.keySet()) { - Object v = arg.get(k); - k = urlEncode(k); - if (v.getClass().isAssignableFrom(Map.class)) { - StringBuilder s2 = new StringBuilder(); - String sep2 = ""; - for (String k2 : ((Map) v).keySet()) { - Object v2 = ((Map) v).get(k2); - k2 = urlEncode(k2); - s2.append(sep2).append("{").append(k).append("}[").append(k2).append("]=").append(urlEncode(String.valueOf(v2))); - sep2 = "&"; - } - str.append(sep).append(s2); - } else { - str.append(sep).append(k).append("=").append(urlEncode(String.valueOf(v), "GBK")); - } - sep = "&"; - } - String postData = ucApiRequestdata(module, action, str.toString(), ""); - UC_API = CloudCenter.getInstance().acquireUrlByKind("bbs.ucapi"); - UC_IP = CloudCenter.getInstance().acquireUrlByKind("bbs.ip"); - return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true); - } - - @Override - public String ucApiMysql(String model, String action, Map args) { - return ""; - } - - public String ucApiInput(String data) { - return urlEncode(ucAuthCode(data + "&agent=" + md5("") + "&time=" + time(), "ENCODE", UC_KEY), "GBK"); - } - - protected String ucApiRequestdata(String module, String action, String arg, String extra) { - String input = ucApiInput(arg); - return "m=" + module + "&a=" + action + "&inajax=2&release=" + UC_CLIENT_RELEASE + "&input=" + input + "&appid=" + UC_APPID + extra; - } - - public String ucAuthCode(String string, String operation, String key) { - return ucAuthCode(string, operation, key, 0); - } - - /** - * 内容加密 - * - * @param string 原文 - * @param operation decode或者encode - * @param key 密钥 - * @param expiry 密文有效时限 - * @return 加密之后的原文 - */ - public String ucAuthCode(String string, String operation, String key, int expiry) { - int ckeyLength = 4; - key = md5(key != null ? key : UC_KEY); - String keya = md5(subStr(key, 0, 16)); - String keyb = md5(subStr(key, 16, 16)); - String keyc = "DECODE".equals(operation) ? subStr(string, 0, ckeyLength) : subStr(md5(microTime()), -ckeyLength); - String cryptkey = keya + md5(keya + keyc); - int keyLength = cryptkey.length(); - string = "DECODE".equals(operation) ? base64Decode(subStr(string, ckeyLength)) : sprintf("%010d", expiry > 0 ? expiry + time() : 0) + subStr(md5(string + keyb), 0, 16) + string; - int stringLength = string.length(); - StringBuilder result1 = new StringBuilder(); - int[] box = new int[256]; - for (int i = 0; i < 256; i++) { - box[i] = i; - } - int[] rndkey = new int[256]; - for (int i = 0; i <= 255; i++) { - rndkey[i] = (int) cryptkey.charAt(i % keyLength); - } - int j = 0; - for (int i = 0; i < 256; i++) { - j = (j + box[i] + rndkey[i]) % 256; - int tmp = box[i]; - box[i] = box[j]; - box[j] = tmp; - } - j = 0; - int a = 0; - for (int i = 0; i < stringLength; i++) { - a = (a + 1) % 256; - j = (j + box[a]) % 256; - int tmp = box[a]; - box[a] = box[j]; - box[j] = tmp; - result1.append((char) (((int) string.charAt(i)) ^ (box[(box[a] + box[j]) % 256]))); - } - if ("DECODE".equals(operation)) { - String result = result1.toString(); - try { - result = new String(result.getBytes("iso-8859-1"), "gbk"); - } catch (Exception e) { - result = result1.substring(0, result1.length()); - } - if ((Integer.parseInt(subStr(result, 0, 10)) == 0 || Long.parseLong(subStr(result, 0, 10)) - time() > 0) && subStr(result, 10, 16).equals(subStr(md5(subStr(result, 26) + keyb), 0, 16))) { - return subStr(result, 26); - } else { - return ""; - } - } else { - return keyc + base64Encode(result1.toString()).replaceAll("=", ""); - } - } - - protected String ucFopen2(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - url += url.indexOf("?") > 0 ? "&" : "?" + "__times__=1"; - return ucFopen(url, limit, post, cookie, bysocket, ip, timeout, block); - } - - /** - * 本地模网络请求取数据 - * - * @param url 打开的url - * @param limit 取返回的数据的长度 - * @param post 要发送的 POST 数据,如uid=1&password=1234 - * @param cookie 要模拟的 COOKIE 数据,如uid=123&auth=a2323sd2323 - * @param bysocket TRUE/FALSE 是否通过SOCKET打开 - * @param ip IP地址 - * @param timeout 连接超时时间 - * @param block 是否为阻塞模式 defaul valuet:true - * @return 取到的字符串 - */ - private String ucFopen(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - StringBuilder result = new StringBuilder(); - URL matches; - String host = ""; - String path = ""; - int port = 80; - try { - matches = new URL(url); - host = matches.getHost(); - path = matches.getPath() != null ? matches.getPath() + (matches.getQuery() != null ? "?" + matches.getQuery() : "") : "/"; - if (matches.getPort() > 0) port = matches.getPort(); - } catch (Exception e1) { - FRContext.getLogger().info(e1.getMessage()); - } - StringBuilder out = new StringBuilder(); - if (post != null && post.length() > 0) { - out.append("POST ").append(path).append(" HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("Content-Type: application/x-www-form-urlencoded\r\n"); - out.append("User-Agent: \r\n"); - out.append("Host: ").append(host).append("\r\n"); - out.append("Content-Length: ").append(post.length()).append("\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cache-Control: no-cache\r\n"); - out.append("Cookie: \r\n\r\n"); - out.append(post); - } else { - out.append("GET $path HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("User-Agent: Java/1.5.0_01\r\n"); - out.append("Host: $host\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cookie: $cookie\r\n\r\n"); - } - try { - Socket fp = new Socket(ip != null && ip.length() > 10 ? ip : host, port); - if (!fp.isConnected()) { - return ""; - } else { - OutputStream os = fp.getOutputStream(); - os.write(out.toString().getBytes()); - InputStream ins = fp.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "iso-8859-1")); - while (true) { - String header = reader.readLine(); - if (header == null || "".equals(header) || Objects.equals(header, "\r\n") || Objects.equals(header, "\n")) { - break; - } - } - while (true) { - String data = reader.readLine(); - if (data == null || "".equals(data)) { - break; - } else { - result.append(data); - } - } - fp.close(); - } - } catch (IOException e) { - FRContext.getLogger().info(e.getMessage()); - } - return result.toString(); - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java deleted file mode 100644 index 697da6c56c..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.sun.org.apache.xerces.internal.parsers.DOMParser; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.StringReader; -import java.util.LinkedList; - -/** - * @author lp - * @date 2016/9/9 - */ -public class XMLHelper { - - public static LinkedList ucUnserialize(String input) { - - LinkedList result = new LinkedList(); - DOMParser parser = new DOMParser(); - try { - parser.parse(new InputSource(new StringReader(input))); - Document doc = parser.getDocument(); - NodeList nl = doc.getChildNodes().item(0).getChildNodes(); - int length = nl.getLength(); - for (int i = 0; i < length; i++) { - if (nl.item(i).getNodeType() == Document.ELEMENT_NODE) { - result.add(nl.item(i).getTextContent()); - } - } - } catch (SAXException e) { - FRContext.getLogger().info(e.getMessage()); - } catch (IOException e1) { - FRContext.getLogger().info(e1.getLocalizedMessage()); - } - return result; - } -} \ No newline at end of file From 3f7908f36ddc0e70e5f087567c9a700a9f39b53e Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Thu, 6 Dec 2018 17:53:42 +0800 Subject: [PATCH 123/187] =?UTF-8?q?CHART-3252=20=E8=B0=83=E8=8A=82?= =?UTF-8?q?=E8=BD=AE=E6=92=ADGis=E5=9C=B0=E5=9B=BE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E7=95=8C=E9=9D=A2=E6=8E=A7=E4=BB=B6=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/extended/chart/ExtendedCustomFieldComboBoxPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java index ff1c9db411..ceeea71c2d 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.stable.StringUtils; @@ -49,7 +50,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane Date: Thu, 6 Dec 2018 18:58:00 +0800 Subject: [PATCH 124/187] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/LogMessageBar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 73f9ce9bdf..6209152433 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -68,4 +68,10 @@ public class LogMessageBar extends JPanel { public Dimension getPreferredSize() { return new Dimension(width, 24); } + + public void disposeLogDialog() { + if (dlg != null) { + dlg.dispose(); + } + } } \ No newline at end of file From b5a7103d22ddb908582bbb8c353faeebe506d846 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:10:24 +0800 Subject: [PATCH 125/187] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E7=AE=80=E5=8D=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 71 +++++++++++-------- .../FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index c2c69299d1..e994bc1053 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -63,21 +63,21 @@ import java.util.Locale; */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; - protected RSyntaxTextArea formulaTextArea; - protected UITextField keyWordTextField = new UITextField(18); - protected int currentPosition = 0; - protected int beginPosition = 0; - protected int insertPosition = 0; - protected JList tipsList; + private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; + private RSyntaxTextArea formulaTextArea; + private UITextField keyWordTextField = new UITextField(18); + private int currentPosition = 0; + private int beginPosition = 0; + private int insertPosition = 0; + private JList tipsList; protected DefaultListModel listModel = new DefaultListModel(); - protected int ifHasBeenWriten = 0; - protected DefaultListModel functionTypeListModel = new DefaultListModel(); - protected QuickList functionTypeList; - protected DefaultListModel functionNameModel; - protected JList functionNameList; + private int ifHasBeenWriten = 0; + private DefaultListModel functionTypeListModel = new DefaultListModel(); + private QuickList functionTypeList; + private DefaultListModel functionNameModel; + private JList functionNameList; - public FormulaPane() { + FormulaPane() { initComponents(); } @@ -184,6 +184,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected void initComponents() { this.setLayout(new BorderLayout(4, 4)); + + initTextPane(); + initTipsPane(); + initVariableTreeAndDescriptionArea(); + } + + private void initVariableTreeAndDescriptionArea() { + variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); + this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); + } + + private void initTextPane() { // text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); @@ -199,7 +211,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); - initTipsPane(); UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); checkValidButton.addActionListener(checkValidActionListener); @@ -209,8 +220,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); extendCheckBoxPane(checkBoxPane); - variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); - this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); } @@ -218,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected void configFormulaArea() { + private void configFormulaArea() { formulaTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_FORMULA); formulaTextArea.setAnimateBracketMatching(true); formulaTextArea.setAntiAliasingEnabled(true); @@ -313,7 +322,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } - protected void fixFunctionNameList() { + private void fixFunctionNameList() { if (tipsList.getSelectedValue() != null) { int signOfContinue = 1; int indexOfFunction = 0; @@ -346,7 +355,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected int getBeginPosition() { + private int getBeginPosition() { int i = currentPosition; String textArea = formulaTextArea.getText(); for (; i > 0; i--) { @@ -361,7 +370,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return i; } - protected void firstStepToFindTips(int theBeginPosition) { + private void firstStepToFindTips(int theBeginPosition) { String textArea = formulaTextArea.getText(); if (currentPosition > 0 && theBeginPosition < currentPosition) { @@ -443,7 +452,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { /** * Apply text. */ - public void applyText(String text) { + private void applyText(String text) { if (text == null || text.length() <= 0) { return; } @@ -541,7 +550,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } // check valid - protected ActionListener checkValidActionListener = new ActionListener() { + private ActionListener checkValidActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { // Execute Formula default cell element. @@ -579,7 +588,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JTree variablesTree; private UITextArea descriptionTextArea; - public VariableTreeAndDescriptionArea() { + VariableTreeAndDescriptionArea() { this.initComponents(); } @@ -802,13 +811,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initComponents() { this.setLayout(new BorderLayout(4, 4)); - // Function + initVariablesTree(); + initFunctionPane(); + } + + private void initFunctionPane() { JPanel functionPane = new JPanel(new BorderLayout(4, 4)); this.add(functionPane, BorderLayout.WEST); initFunctionTypeList(functionPane); initFunctionNameList(functionPane); - initVariablesTree(); - // 选择: functionTypeList.setSelectedIndex(0); } @@ -959,7 +970,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private Icon icon; private String[] subNodes = new String[0]; - public TextFolderUserObject(String text, Icon icon, String[] subNodes) { + TextFolderUserObject(String text, Icon icon, String[] subNodes) { this.text = text; this.icon = icon; this.subNodes = subNodes; @@ -986,11 +997,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static class TextUserObject { - public TextUserObject(String text) { + TextUserObject(String text) { this(text, text); } - public TextUserObject(String text, String displayText) { + TextUserObject(String text, String displayText) { this.text = text; this.displayText = displayText; } @@ -999,7 +1010,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return this.text; } - public String getDisplayText() { + String getDisplayText() { return this.displayText; } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index e08f7e3b40..d689c54df9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - public FormulaPaneWhenReserveFormula() { + FormulaPaneWhenReserveFormula() { super(); } From b9b04e753d832a343f4dfe5bde559997cb30118e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:11:14 +0800 Subject: [PATCH 126/187] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 4595b04ac0..0abc2f46e7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; import com.fr.stable.OperatingSystem; @@ -225,39 +226,48 @@ public abstract class FunctionConstants { String pkgName = "com.fr.function"; Class iface = Function.class; ClassLoader classloader = iface.getClassLoader(); - URL url = classloader.getResource(pkgName.replace('.', '/')); - String classFilePath = url.getFile(); - - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ + Enumeration urlEnumeration = null; try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { + if (EMBFUNCTIONS[fi].test(inst)) { + break; + } } + } - + } catch (ClassNotFoundException e) { + } catch (InstantiationException e) { + } catch (IllegalAccessException e) { } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } } } From 4dccaabbbfc8a8c55cb996358a04c4d2b036d783 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 7 Dec 2018 11:13:53 +0800 Subject: [PATCH 127/187] =?UTF-8?q?REPORT-13280=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E3=80=91=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/CellElementPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java index 42d4f1d397..7324300eba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java @@ -67,7 +67,7 @@ public class CellElementPropertyPane extends DockingView { } - public synchronized static CellElementPropertyPane getInstance() { + public static CellElementPropertyPane getInstance() { if (singleton == null) { synchronized (CellElementPropertyPane.class) { if (singleton == null) { From b8455e82a40a05e5030fc9f165ae0954ccc50f0d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 13:53:04 +0800 Subject: [PATCH 128/187] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>FunctionConstants=20?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 315 ++++++++++-------- .../design/formula/FunctionConstantsTest.java | 40 +++ 2 files changed, 208 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0abc2f46e7..750df1bad1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -35,13 +35,75 @@ import java.util.zip.ZipFile; import javax.swing.DefaultListModel; -public abstract class FunctionConstants { - +public final class FunctionConstants { + + public static FunctionGroup PLUGIN = getPluginFunctionGroup(); + public static FunctionGroup CUSTOM = getCustomFunctionGroup(); + static NameAndFunctionList COMMON = getCommonFunctionList(); + static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static FunctionGroup ALL = getAllFunctionGroup(); + + static { + loadEmbededFunctions(); + } + + /** + * Don't let anyone instantiate this class. + */ + private FunctionConstants() {} + + private static void loadEmbededFunctions() { + String pkgName = "com.fr.function"; + Class iface = Function.class; + ClassLoader classloader = iface.getClassLoader(); + Enumeration urlEnumeration = null; + try { + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + return; + } + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ + try { + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { + if (EMBFUNCTION.test(inst)) { + break; + } + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } + } + } + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ @@ -75,107 +137,15 @@ public abstract class FunctionConstants { } }; } - - public static FunctionGroup PLUGIN = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); - int count = fs.length; - FunctionDefNAD[] nads = new FunctionDefNAD[count]; - for (int i = 0; i < count; i ++) { - nads[i] = new FunctionDefNAD(fs[i]); - } - return nads; - } - }; - - public static FunctionGroup CUSTOM = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionConfig funtionManager = FunctionConfig.getInstance(); - if (funtionManager != null) { - int functionDefCount = funtionManager.getFunctionDefCount(); - - FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; - for (int i = 0; i < functionDefCount; i++) { - nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); - } - - return nads; - } - - return new NameAndDescription[0]; - } - }; - - public static NameAndFunctionList COMMON = new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { - new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() - }); - - public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) - }; - - public static FunctionGroup ALL = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); - } - - @Override - public NameAndDescription[] getDescriptions() { - List all = new ArrayList(); - for (int i = 0; i < EMBFUNCTIONS.length; i++) { - all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); - } - Collections.addAll(all, PLUGIN.getDescriptions()); - Collections.addAll(all, CUSTOM.getDescriptions()); - //hugh:自定义函数分组 - Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); - if(!containers.isEmpty()){ - for(Mutable container : containers){ - Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); - } - } - java.util.Collections.sort(all, NameAndDescriptionComparator); - - return all.toArray(new NameAndDescription[all.size()]); - } - }; - - private static Comparator NameAndDescriptionComparator = new Comparator() { - @Override - public int compare(NameAndDescription o1, NameAndDescription o2) { - return ComparatorUtils.compare(o1.getName(), o2.getName()); - } - }; - private static String[] findClassNamesUnderFilePath(String filePath) { java.util.List classNameList = new ArrayList(); /* * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.indexOf("!/") >= 0) { + if (filePath.contains("!/")) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; @@ -198,7 +168,7 @@ public abstract class FunctionConstants { } String entryName = entry.getName(); - if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) { + if (!entryName.contains(classPath) || !entryName.endsWith(".class")) { continue; } @@ -209,66 +179,117 @@ public abstract class FunctionConstants { } } else { File dir = new File(filePath); - - for (File f : dir.listFiles()) { - String fileName = f.getName(); - if (fileName.endsWith(".class")) { - classNameList.add(fileName); + File[] files = dir.listFiles(); + if (files != null) { + for (File f : files) { + String fileName = f.getName(); + if (fileName.endsWith(".class")) { + classNameList.add(fileName); + } } } } - return classNameList.toArray(new String[classNameList.size()]); + return classNameList.toArray(new String[0]); } - - // alex:读取com.fr.script.function包下面所有的Function类 - static { - String pkgName = "com.fr.function"; - Class iface = Function.class; - ClassLoader classloader = iface.getClassLoader(); - Enumeration urlEnumeration = null; - try { - urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - while (urlEnumeration.hasMoreElements()) { - URL url = urlEnumeration.nextElement(); - String classFilePath = url.getFile(); - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ - try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + private static FunctionGroup getPluginFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { - try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; - } - } + @Override + public NameAndDescription[] getDescriptions() { + FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); + int count = fs.length; + FunctionDefNAD[] nads = new FunctionDefNAD[count]; + for (int i = 0; i < count; i ++) { + nads[i] = new FunctionDefNAD(fs[i]); + } + return nads; + } + }; + } + + private static FunctionGroup getCustomFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); + } + + @Override + public NameAndDescription[] getDescriptions() { + FunctionConfig funtionManager = FunctionConfig.getInstance(); + if (funtionManager != null) { + int functionDefCount = funtionManager.getFunctionDefCount(); + + FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; + for (int i = 0; i < functionDefCount; i++) { + nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); + } + + return nads; + } + + return new NameAndDescription[0]; + } + }; + } + + private static NameAndFunctionList getCommonFunctionList() { + return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { + new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() + }); + } + + private static NameAndTypeAndFunctionList[] getEmbededFunctionListArray() { + return new NameAndTypeAndFunctionList[] { + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) + }; + } + + private static FunctionGroup getAllFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); + } + + @Override + public NameAndDescription[] getDescriptions() { + List all = new ArrayList(); + for (int i = 0; i < EMBFUNCTIONS.length; i++) { + all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); + } + Collections.addAll(all, PLUGIN.getDescriptions()); + Collections.addAll(all, CUSTOM.getDescriptions()); + //hugh:自定义函数分组 + Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); + if(!containers.isEmpty()){ + for(Mutable container : containers){ + Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } + + Collections.sort(all, new Comparator() { + @Override + public int compare(NameAndDescription o1, NameAndDescription o2) { + return ComparatorUtils.compare(o1.getName(), o2.getName()); + } + }); + + return all.toArray(new NameAndDescription[0]); } - } + }; } } diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java new file mode 100644 index 0000000000..33cfd577da --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -0,0 +1,40 @@ +package com.fr.design.formula; + +import org.junit.Test; + +import static junit.framework.Assert.fail; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +/** + * Created by plough on 2018/12/7. + */ +public class FunctionConstantsTest { + @Test + public void testNewInstanceFail() throws Exception { + try { + FunctionConstants.class.newInstance(); + fail("Not allowed to instantiate FunctionConstants!"); + } catch (IllegalAccessException e) { + assertTrue(true); + } + } + + @Test + public void testEmbedFuntionsAfterStaticInit() { + NameAndTypeAndFunctionList[] embFunctionLists = FunctionConstants.EMBFUNCTIONS; + // 一共有 8 个分类 + assertEquals(8, embFunctionLists.length); + for (NameAndTypeAndFunctionList embFunctionsList : embFunctionLists) { + // 每个分类下都有函数 + NameAndDescription[] nameAndDescriptions = embFunctionsList.getDescriptions(); + assertTrue(nameAndDescriptions.length > 0); + } + } + + @Test + public void testCommonFuntionsAfterStaticInit() { + NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; + assertEquals(9, commonFunctionList.getDescriptions().length); + } +} From 8559c8ee12f8d9b86963d53b124899f4792512d4 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:14:19 +0800 Subject: [PATCH 129/187] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20,=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8C=E6=AD=A510.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/RightSelectionHandlerProvider.java | 55 +++++++++++++++++++ ...AbstractRightSelectionHandlerProvider.java | 45 +++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 2 +- .../form/parameter/FormParaDesigner.java | 8 ++- .../com/fr/design/mainframe/FormDesigner.java | 29 ++++++++-- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../cell/clipboard/CellElementsClip.java | 48 ++++++++++++++-- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../java/com/fr/grid/selection/Selection.java | 27 +++++++-- 9 files changed, 199 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java new file mode 100644 index 0000000000..5e7d414236 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java @@ -0,0 +1,55 @@ +package com.fr.design.fun; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.mark.Mutable; + +import java.util.List; + +/** + * 设计器右键菜单接口 + */ +public interface RightSelectionHandlerProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "RightSelectionHandlerProvider"; + + + /** + * 对单元格或者悬浮元素的右键菜单项进行增删改 + * + * @param ePane 选择的元素 + * @param popupMenu 右键主菜单 + */ + void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu); + + + /** + * 当前实现是否可以作用于当前元素 + * + * @param selectableElement 当前选中元素分为CellSelection和FloatSelection(单元格和悬浮元素) + * @return + */ + boolean accept(SelectableElement selectableElement); + + + /** + * 对表单,参数面板内置的右键选项进行增删改处理 + * + * @param actions 默认的action集合 注意:主体代码要求这边的action必须是UndoableAction 的子类而非updateAction + */ + void dmlUpdateActions(BaseFormDesigner formDesigner, List actions); + + /** + * 当前实现是否可以作用于当前元素 + * + * @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件) + * @return + */ + boolean accept(BaseFormDesigner formDesigner); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java new file mode 100644 index 0000000000..6ec8282ed8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java @@ -0,0 +1,45 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.List; + +@API(level = RightSelectionHandlerProvider.CURRENT_LEVEL) +public abstract class AbstractRightSelectionHandlerProvider extends AbstractProvider implements RightSelectionHandlerProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void dmlUpdateActions(BaseFormDesigner formDesigner, List actions) { + + } + + @Override + public boolean accept(BaseFormDesigner formDesigner) { + return false; + } + + @Override + public void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu) { + + } + + @Override + public boolean accept(SelectableElement selectableElement) { + return false; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c2557a5b9c..fa9b181a57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -419,7 +419,7 @@ public abstract class JTemplate> fireSuperTargetModified(); } - protected boolean accept(Object o) { + public boolean accept(Object o) { return true; } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 0895d4c1dc..62cea356d6 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -11,6 +11,7 @@ import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.swing.BorderFactory; @@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), - new FormDeleteAction(this)}; + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + new FormDeleteAction(this)})); + dmlActions(designerActions); } - return designerActions; + return designerActions.toArray(new UpdateAction[designerActions.size()]); } private boolean searchQueryCreators(XLayoutContainer rootContainer) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index b313bc1433..fd0de4b257 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,9 +1,11 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -39,6 +41,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; @@ -89,6 +92,7 @@ import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; /** * 设计界面组件。该组件是界面设计工具的核心,主要负责的是被设计界面的显示,界面设计操作状态的 显示,编辑状态的显示等等。 @@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection private int resolution = ScreenResolution.getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; - protected UpdateAction[] designerActions; + protected List designerActions; private FormDesignerModeForSpecial desigerMode; private Action switchAction; private FormElementCaseContainerProvider elementCaseContainer; @@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this), - new MoveUpAction(this), new MoveDownAction(this)}; + new MoveUpAction(this), new MoveDownAction(this)})); + dmlActions(designerActions); + } + return designerActions.toArray(new UpdateAction[designerActions.size()]); + } + /** + * 扩展菜单项 + * @param actions + */ + public void dmlActions(List actions) { + try { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlUpdateActions(this,actions); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); } - return designerActions; } // 当前选中控件可以上移一层吗? diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ec8020fd21..cc3ba96f5c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -160,7 +160,7 @@ public class JForm extends JTemplate implements BaseJForm { } @Override - protected boolean accept(Object o) { + public boolean accept(Object o) { return !(o instanceof FloatElementsProvider); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java index 2579e37c2e..84edad71fb 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java +++ b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java @@ -3,9 +3,6 @@ */ package com.fr.design.cell.clipboard; -import java.util.Arrays; -import java.util.Iterator; - import com.fr.base.FRContext; import com.fr.grid.selection.CellSelection; import com.fr.report.cell.CellElement; @@ -15,6 +12,9 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; +import java.util.Arrays; +import java.util.Iterator; + /** * The clip of CellElement. */ @@ -39,7 +39,47 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.clips = clips; } - public String compateExcelPaste() { + public int getColumnSpan() { + return columnSpan; + } + + public void setColumnSpan(int columnSpan) { + this.columnSpan = columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public void setRowSpan(int rowSpan) { + this.rowSpan = rowSpan; + } + + public FU[] getColumnWidth() { + return columnWidth; + } + + public void setColumnWidth(FU[] columnWidth) { + this.columnWidth = columnWidth; + } + + public FU[] getRowHeight() { + return rowHeight; + } + + public void setRowHeight(FU[] rowHeight) { + this.rowHeight = rowHeight; + } + + public TemplateCellElement[] getClips() { + return clips; + } + + public void setClips(TemplateCellElement[] clips) { + this.clips = clips; + } + + public String compateExcelPaste() { Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); // 排序 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index c47b142c1c..4112ac6c44 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -663,7 +663,7 @@ public abstract class ElementCasePane extends Tar } } - private Object getClipObject() { + public Object getClipObject() { // 需要检查是否可以编辑。 Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Transferable clipData = clipboard.getContents(this); diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 6787e36a5c..1d7a8b3fcf 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -1,19 +1,22 @@ package com.fr.grid.selection; -import java.io.Serializable; - -import javax.swing.JPopupMenu; - import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.design.selection.SelectableElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.FCloneable; +import javax.swing.JPopupMenu; +import java.io.Serializable; +import java.util.Set; + /* * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * @@ -65,6 +68,20 @@ public abstract class Selection implements FCloneable, Serializable , Selectable // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); + /** + * 添加插件菜单(增删改都可以) + * @param ePane + * @param popupMenu + */ + public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlMenu(ePane, popupMenu); + } + } + } + // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); From 350665eab47b8b6e853aef73c270e36cae2f29da Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:16:49 +0800 Subject: [PATCH 130/187] rt --- .../src/main/java/com/fr/grid/selection/Selection.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 1d7a8b3fcf..6adcd49643 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -27,10 +27,8 @@ import java.util.Set; public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract boolean isSelectedOneCell(ElementCasePane ePane); - // ///////////////////////////////copy///////////////////////////////// public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); - // ///////////////////////////////paste//////////////////////////////// public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { FloatElementsClip floatElementClip; try { @@ -56,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); - // ///////////////////////////////merge//////////////////////////////// public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane); @@ -65,7 +62,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean unMergeCells(ElementCasePane ePane); - // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); /** @@ -82,15 +78,12 @@ public abstract class Selection implements FCloneable, Serializable , Selectable } } - // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); - // //////////////////////////////////////////////////////////////////// public abstract int[] getSelectedRows(); public abstract int[] getSelectedColumns(); - // //////////////////////////////move////////////////////////////////// public abstract void moveLeft(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane); @@ -99,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract void moveDown(ElementCasePane ePane); - // //////////////////////////DeleteAction/////////////////////////////// public abstract boolean triggerDeleteAction(ElementCasePane ePane); - // //////////////////////////Just4CellSelection/////////////////////////////// public abstract boolean containsColumnRow(ColumnRow cr); public abstract void populatePropertyPane(ElementCasePane ePane); From 474aafec64d445e69dcfe5b4e46efae2a3c6042d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 16:46:04 +0800 Subject: [PATCH 131/187] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 2 +- .../com/fr/design/formula/FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index e994bc1053..bff2080e46 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -77,7 +77,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private DefaultListModel functionNameModel; private JList functionNameList; - FormulaPane() { + public FormulaPane() { initComponents(); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index d689c54df9..e08f7e3b40 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - FormulaPaneWhenReserveFormula() { + public FormulaPaneWhenReserveFormula() { super(); } From 3c0a90601d03b25ae3819c7ffee9514b5c830698 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 7 Dec 2018 16:47:20 +0800 Subject: [PATCH 132/187] =?UTF-8?q?MOBILE-18551=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E3=80=8B?= =?UTF-8?q?tab=E6=A0=B7=E5=BC=8F=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtab=E7=9A=84=E5=AD=97=E7=AC=A6=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E3=80=81=E6=96=9C=E4=BD=93=E9=A2=9C=E8=89=B2=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/MobileTemplateStyleDefinePane.java | 4 +++- .../mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index b499e18d78..feb19463da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Fri, 7 Dec 2018 17:49:45 +0800 Subject: [PATCH 133/187] =?UTF-8?q?REPORT-13176=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E9=BB=98=E8=AE=A4=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E3=80=8B=E9=A2=84=E8=A7=88=E5=A4=84=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=A4=AA=E5=B0=8F=EF=BC=8C=E5=A6=82=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 6b2ecec669..2a14bea078 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -12,6 +12,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { @@ -84,6 +85,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 1a0472cbb5..70499f3028 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; @@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java index a4cf4e3339..a3c1382130 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -24,6 +24,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { private NewColorSelectBox initDotColor; @@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { Dimension dimension = this.getSize(); int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); g2d.setFont(frFont); g2d.setColor(frFont.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ea0dba6590..003dd04bf7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -171,6 +172,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); From 4e40e10c53650cdaedbb01d2eab453e0b6055b22 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 8 Dec 2018 10:45:38 +0800 Subject: [PATCH 134/187] =?UTF-8?q?REPORT-13340=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E6=BB=91=E5=8A=A8=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F=20=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8C=BA=E5=9F=9F=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 +- .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 2a14bea078..7ffd0abe21 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -86,7 +86,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index 003dd04bf7..ddd4c202d0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -173,7 +173,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); From e5d23733bacfea9711f85d80deb170830c4eea4f Mon Sep 17 00:00:00 2001 From: abel Date: Sat, 8 Dec 2018 11:00:15 +0800 Subject: [PATCH 135/187] =?UTF-8?q?REPORT-13029=20JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/JNDIDefPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java index 32bc4d4b71..e99d99ca4d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java @@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel { } // Properties. - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY); this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : INITIAL_CONTEXT_FACTORY); @@ -148,7 +148,7 @@ public class JNDIDefPane extends JPanel { populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET); } - private void populateContextAttributes(Hashtable properties, UITextField textField, String contextAttr) { + private void populateContextAttributes(Map properties, UITextField textField, String contextAttr) { String PROVIDER_URL = properties.get(contextAttr); if (PROVIDER_URL != null) { textField.setText(PROVIDER_URL); @@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel { jndiDatabase.setJNDIName(this.jndiNameTextField.getText()); - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem(); if (factoryString != null && factoryString.trim().length() > 0) { @@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel { return jndiDatabase; } - private void updateContextAttributes(Hashtable contextHashtable, UITextField textField, String contextAttr) { + private void updateContextAttributes(Map contextHashtable, UITextField textField, String contextAttr) { String tValue = textField.getText(); if (tValue != null && tValue.trim().length() > 0) { contextHashtable.put(contextAttr, tValue); From 30de22f58db92499d5be7c30ea44511a0d74d32a Mon Sep 17 00:00:00 2001 From: Hades Date: Sat, 8 Dec 2018 15:30:29 +0800 Subject: [PATCH 136/187] =?UTF-8?q?REPORT-13310=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9D=A5=E5=9B=9E=E5=88=87=E6=8D=A2=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?,=20=E9=9D=9E=E5=B8=B8=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/imenu/UIBasicMenuItemUI.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 74c65e8eed..61587beef2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -667,18 +667,10 @@ public class UIBasicMenuItemUI extends MenuItemUI { } private void installFont(final String prefix, final JComponent menuItem) { - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - if (menuItem == null) { - return; - } - LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); - } - }); - thread.setName("UIBasicMenuItemUI"); - thread.setDaemon(true); - thread.start(); + if (menuItem == null) { + return; + } + LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); } protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, From de75ef5d1f0ad1acfad68e88897a2c12cfa5584b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 8 Dec 2018 15:43:19 +0800 Subject: [PATCH 137/187] =?UTF-8?q?REPORT-12854=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9=20bug?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0f52a4c5c7..0b37855c92 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:00:43 +0800 Subject: [PATCH 138/187] rt --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0b37855c92..fc2045161c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -73,7 +73,7 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:29:56 +0800 Subject: [PATCH 139/187] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index fc2045161c..fc666f15fd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -85,7 +85,6 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:44:40 +0800 Subject: [PATCH 140/187] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=E8=A2=AB=E5=8F=A6=E5=AD=98=E6=96=87=E4=BB=B6icon=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=81=E5=AE=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itree/filetree/EnvFileTree.java | 4 +--- .../fr/design/gui/itree/filetree/FileTreeIcon.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 550ba715e5..d5a9044d5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -69,10 +69,8 @@ public class EnvFileTree extends RefreshableJTree { if (treeNode.hasFullAuthority()) { if (lock != null && !node.getUserID().equals(lock)) { name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")"); - this.setIcon(FileTreeIcon.getIcon(node)); - } else { - this.setIcon(FileTreeIcon.getIcon(node, false)); } + this.setIcon(FileTreeIcon.getIcon(node)); } else { this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 130240aead..b0e26cc80e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.BaseUtils; import com.fr.design.icon.LockIcon; import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -125,8 +126,16 @@ public class FileTreeIcon { return FOLDER_HALF_IMAGE_ICON; } + /** + * 获取文件节点对应的图标 + * + * @param node 文件节点 + * @return 文件节点的图标 + */ public static Icon getIcon(FileNode node) { - return getIcon(node, node.getLock() != null); + // 如果文件节点锁不为空且不是当前用户锁定的该模板,那么模板ICON 提示用户当前文件节点被锁 + boolean showLock = node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock()); + return getIcon(node, showLock); } public static Icon getIcon(FileNode node, boolean isShowLock) { From 3f3bb397cc785c97acc079dccce95d3d789bafc4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 20:10:18 +0800 Subject: [PATCH 141/187] =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index b6f18a1882..2a00df0720 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent { openedTemplate.remove(jTemplate); closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); + closeAndFreeLock(jTemplate); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent { if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } - return closeOther; } @@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent { private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); + closeAndFreeLock(specifiedTemplate); activeTemplate(fileName); } + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + } + } + /** * 关闭模板 * From fa38f5327954c87da6e0d1a73a76864de0b9fb2f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 21:11:42 +0800 Subject: [PATCH 142/187] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E6=97=B6=E7=9A=84=E6=96=87=E4=BB=B6=E9=94=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MutilTempalteTabPane.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2a00df0720..ab4f2aae32 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -705,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index fa9b181a57..7b80c3fd74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -32,6 +32,7 @@ import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.itree.filetree.TemplateFileTree; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; @@ -56,6 +57,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -587,6 +590,8 @@ public abstract class JTemplate> if (isCancelOperation(chooseResult)) { return false; } + // 源文件 + FILE sourceFile = editingFILE; if (isOkOperation(chooseResult)) { boolean access = false; @@ -596,13 +601,33 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (!access) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); return false; } + // 目标文件 editingFILE = fileChooser.getSelectedFILE(); } - return saveNewFile(editingFILE, oldName); + boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + if (lockedTarget) { + boolean saved = saveNewFile(editingFILE, oldName); + // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 + if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + } + return saved; + } else { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); + return false; + } } protected boolean saveNewFile(FILE editingFILE, String oldName) { From c6679a32832db047bafdd06b58df77f70f2238e1 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 10 Dec 2018 11:39:50 +0800 Subject: [PATCH 143/187] =?UTF-8?q?REPORT-13418=2010.0=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=BB=98=E8=AE=A4=E8=AF=AD=E8=A8=80=E6=94=B9?= =?UTF-8?q?=E6=88=90=E8=B7=9F9=E4=B8=80=E6=A0=B7,=20=E5=8F=96=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=BB=98=E8=AE=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index d054ab959f..73da53d4b8 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -112,7 +112,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private Color paginationLineColor = Color.black; // line color of paper private boolean supportCellEditorDef = false; private boolean isDragPermited = false; - private Locale language = Locale.SIMPLIFIED_CHINESE; + private Locale language = Locale.getDefault(); //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 private boolean useOracleSystemSpace = true; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; From 17031ef1b2d2026ccd20e6e2d417fbad7ddf3926 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 12:43:48 +0800 Subject: [PATCH 144/187] =?UTF-8?q?REPORT-12698=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=9B=BE?= =?UTF-8?q?=E6=A1=88,=20=E5=85=B3=E9=97=AD=E6=A8=A1=E6=9D=BF=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E6=89=93=E5=BC=80,=20=E4=BC=9A=E5=8F=98=E6=88=90?= =?UTF-8?q?=E7=BA=AF=E9=BB=91=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index d965151cb8..bb8038ac4a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -52,7 +52,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - + foregroundColorPane.setSelectObject(Color.lightGray); + foregroundColorPane.setSelectObject(Color.black); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -219,7 +220,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(null); - backgroundColorPane.setSelectObject(null); + foregroundColorPane.setSelectObject(Color.lightGray); + backgroundColorPane.setSelectObject(Color.black); } } From 8456349de848306cf1dfed55a3fa6fcfcd852689 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 13:36:16 +0800 Subject: [PATCH 145/187] =?UTF-8?q?=E5=8A=A0=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index bb8038ac4a..5e69d9f829 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -30,6 +30,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { private int patternIndex = 0; // pattern setIndex. private final static int DEFAULT_DIM_HEIGHT = 210; + private final static Color DEFAULT_FOREGROUND = Color.lightGray; + private final static Color DEFAULT_BACKGROUND = Color.black; private ColorSelectBox foregroundColorPane; private ColorSelectBox backgroundColorPane; private PatternButton[] patternButtonArray; @@ -52,8 +54,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - foregroundColorPane.setSelectObject(Color.lightGray); - foregroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + foregroundColorPane.setSelectObject(DEFAULT_BACKGROUND); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -220,7 +222,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(Color.lightGray); - backgroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + backgroundColorPane.setSelectObject(DEFAULT_BACKGROUND); } } From d88f4f9dd8c9388f06db45c37e9cc4bf2e08b012 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 16:41:28 +0800 Subject: [PATCH 146/187] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=20=E6=8D=A2=E7=94=A8multiple?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=90=88=E5=B9=B6=E5=A4=9A=E6=9D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 6f3c9bdea7..4dafbeccd6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -104,6 +104,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_TITLE = "title"; private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; + private static final String ATTR_FUNCTION_ARRAY = "functionArray"; private static InformationCollector collector; @@ -232,21 +233,23 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - ArrayList> content = null; - content = getFunctionsContent(current, new Date(lastTime)); + JSONArray content = null; + try { + content = getFunctionsContent(current, new Date(lastTime)); + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.size() > 0){ - for(int i=0; i 0){ + success = sendFunctionRecord(url, content); //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); + FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } } - FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -265,12 +268,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { // } } - private boolean sendFunctionRecord(String url, Map record) { + private boolean sendFunctionRecord(String url, JSONArray record) { boolean success = false; try { - String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+URLEncoder.encode(new JSONObject(record).toString(), EncodeConstants.ENCODING_UTF_8); - String res = HttpToolbox.get(recordUrl); - success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", record); + String res = HttpToolbox.post(url, para); + success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -437,33 +442,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static ArrayList getFunctionsContent(Date current, Date last){ - ArrayList> records = new ArrayList>(); + public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - String bbsUserName = MarketConfig.getInstance().getBbsUsername(); - String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ for(FocusPoint focusPoint : focusPoints.getList()){ - Map record = new HashMap<>(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); record.put(ATTR_ID, focusPoint.getId()); record.put(ATTR_TEXT, focusPoint.getText()); record.put(ATTR_SOURCE, focusPoint.getSource()); record.put(ATTR_TIME, focusPoint.getTime().getTime()); record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, bbsUserName); - record.put(ATTR_UUID, uuid); - records.add(record); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + record.put(ATTR_FUNCTION_ARRAY, functionArray); + functionArray.put(record); } } + } catch (MetricException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return records; + return functionArray; } private class StartStopTime implements XMLReadable, XMLWriter { From 560b0fb626b90e7d46fe23b08d9709f6bd0e59e8 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 19:02:52 +0800 Subject: [PATCH 147/187] =?UTF-8?q?=E6=AF=8F=E8=BE=BE=E5=88=B0200=E6=9D=A1?= =?UTF-8?q?=E6=97=B6=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 4dafbeccd6..047ffc6717 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -105,6 +105,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; private static final String ATTR_FUNCTION_ARRAY = "functionArray"; + private static final int MAX_EACH_REQUEST_RECORD_COUNT = 200; private static InformationCollector collector; @@ -242,14 +243,22 @@ public class InformationCollector implements XMLReadable, XMLWriter { boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.length() > 0){ - success = sendFunctionRecord(url, content); + try { + for(int i=0;i 0){ + success = sendFunctionRecord(url, functionArray); + } + } //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } + }catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -443,34 +452,52 @@ public class InformationCollector implements XMLReadable, XMLWriter { } public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + //记录当前条数,达到200条合并成一个请求 + int count = 0; JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - + JSONArray temp = new JSONArray(); if(!focusPoints.isEmpty()){ - for(FocusPoint focusPoint : focusPoints.getList()){ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - record.put(ATTR_FUNCTION_ARRAY, functionArray); - functionArray.put(record); + for(int i=0;i< focusPoints.getList().size();i++){ + FocusPoint focusPoint = focusPoints.getList().get(i); + if(focusPoint != null){ + if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ + temp.put(getOneRecord(focusPoint)); + } else { + count = 0; + functionArray.put(temp); + temp = new JSONArray(); + temp.put(getOneRecord(focusPoint)); + } + if(i == (focusPoints.getList().size() -1)){ + functionArray.put(temp); + } + } } } - } catch (MetricException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return functionArray; } + private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + return record; + } + private class StartStopTime implements XMLReadable, XMLWriter { private String startDate; From a6bab815bcca3db158fb53aeab3e023f968d7893 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:02:11 +0800 Subject: [PATCH 148/187] REPORT-13441 & REPORT-13442 --- .../design/condition/LiteConditionPane.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index 36fa874ccf..b14c8cde12 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -121,7 +121,7 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition newJoinCondition = new JoinCondition(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR, liteCondition); ExpandMutableTreeNode parentTreeNode = getParentTreeNode(); - boolean result = isExistedInParentTreeNode(parentTreeNode, newJoinCondition); + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); @@ -162,7 +162,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public void mouseExited(MouseEvent evt) { - GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); + GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); } }; @@ -596,6 +596,8 @@ public abstract class LiteConditionPane extends BasicBeanPa oldJoinCondition.setJoin(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR); Condition oldLiteCondition = oldJoinCondition.getCondition(); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); // peter:如果当前选中的是ListCondition,只要改变Join为AND或者OR,直接返回. if (oldLiteCondition != null && !(oldLiteCondition instanceof ListCondition)) { // peter:先获得当前的LiteCondition. @@ -605,13 +607,18 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } + //修改的时候加入判断条件类型 REPORT-13441 + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); + if (result) { + JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); + return; + } oldJoinCondition.setCondition(liteCondition); } // peter:需要reload parent - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); defaultTreeModel.reload(parentTreeNode); parentTreeNode.expandCurrentTreeNode(conditionsTree); conditionsTree.setSelectionPath(GUICoreUtils.getTreePath(selectedTreeNode)); @@ -745,22 +752,31 @@ public abstract class LiteConditionPane extends BasicBeanPa return parentTreeNode; } - private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, JoinCondition newJoinCondition) { + private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, Condition liteCondition, boolean isModify) { if (parentTreeNode == null) { return false; } JoinCondition parentJoinCondition = (JoinCondition) parentTreeNode.getUserObject(); Condition parentLiteCondition = parentJoinCondition.getCondition(); + Object oldJoinCondition = null; + //获取当前选中的条件用于修改判断 + TreePath selectedTreePath = conditionsTree.getSelectionPath(); + if (selectedTreePath != null) { + ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); + oldJoinCondition = selectedTreeNode.getUserObject(); + } if (parentLiteCondition instanceof ListCondition) { // peter:在添加UserObject的节点. for (int i = 0; i < parentTreeNode.getChildCount(); i++) { ExpandMutableTreeNode tempTreeNode = (ExpandMutableTreeNode) parentTreeNode.getChildAt(i); Object tempObject = tempTreeNode.getUserObject(); - if (tempObject instanceof JoinCondition) { + //修改的时候需要排除所选条件,和其他条件比较。增加的时候全盘比较 + if (tempObject instanceof JoinCondition && isModify ? (!tempObject.equals(oldJoinCondition)) : true) { JoinCondition tempJoinCondition = (JoinCondition) tempObject; - if (ComparatorUtils.equals(tempJoinCondition, newJoinCondition)) { + //条件内容一样就视为相同条件,join类型无关 + if (ComparatorUtils.equals(tempJoinCondition.getCondition(), liteCondition)) { return true; } } @@ -941,7 +957,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public Condition updateBean() { // Samuel:先按modifybutton - modify(); + //modify(); REPORT-13442 需要点修改按钮才能修改 // peter: 先删除所有的节点 DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.conditionsTree.getModel(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); @@ -963,9 +979,9 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition joinCondition = (JoinCondition) rootTreeNode.getUserObject(); Condition newCondition = joinCondition.getCondition(); //clone(),防止多个条件分组使用同一个condition对象 - try{ - newCondition = (Condition)joinCondition.getCondition().clone(); - }catch (CloneNotSupportedException e){ + try { + newCondition = (Condition) joinCondition.getCondition().clone(); + } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return newCondition; From aabedeaa0b495c352b1891f2e50676ded9e98466 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:04:07 +0800 Subject: [PATCH 149/187] REPORT-13441 & REPORT-13442 --- .../main/java/com/fr/design/condition/LiteConditionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index b14c8cde12..193c35775a 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -607,7 +607,7 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } - //修改的时候加入判断条件类型 REPORT-13441 + //修改的时候加入判断条件重复 REPORT-13441 boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), From cee61dfe26bab4fd5168fdb9b9077983a3226c75 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:34:57 +0800 Subject: [PATCH 150/187] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 750df1bad1..9df15fd8f9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; @@ -66,7 +67,6 @@ public final class FunctionConstants { while (urlEnumeration.hasMoreElements()) { URL url = urlEnumeration.nextElement(); String classFilePath = url.getFile(); - /* * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 @@ -77,10 +77,9 @@ public final class FunctionConstants { FRContext.getLogger().error(e1.getMessage(), e1); } FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ + if (isCustomFormulaPath(classFilePath)) { + continue; + } for (String fileName : findClassNamesUnderFilePath(classFilePath)) { try { Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); @@ -94,11 +93,19 @@ public final class FunctionConstants { } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } catch (Throwable e) { + // 不要因为个别公式加载失败,而导致整个函数面板无法启动 + FineLoggerFactory.getLogger().error(e.getMessage()); } } } } + private static boolean isCustomFormulaPath(String classFilePath) { + // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 + return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel From 8ec239644ff9ef04cb7fc01277b9f79d7fb0aa8d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:42:31 +0800 Subject: [PATCH 151/187] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FunctionConstants.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 9df15fd8f9..0166c269be 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,18 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 - return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + return !isJarPath(classFilePath) && isDebugMode(); } - /** + private static boolean isDebugMode() { + return !GeneralUtils.readBuildNO().contains("-"); + } + + private static boolean isJarPath(String classFilePath) { + return classFilePath.contains("!/"); + } + + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ @@ -152,7 +159,7 @@ public final class FunctionConstants { * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.contains("!/")) { + if (isJarPath(filePath)) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; From 40f367e1d2b3fff16568dd4cdaa18dffb7edc9a8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 11:22:49 +0800 Subject: [PATCH 152/187] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 6 ++-- .../design/formula/FunctionConstantsTest.java | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0166c269be..eee75a2220 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,11 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - return !isJarPath(classFilePath) && isDebugMode(); + return !isJarPath(classFilePath) && isNotDebugMode(); } - private static boolean isDebugMode() { - return !GeneralUtils.readBuildNO().contains("-"); + private static boolean isNotDebugMode() { + return GeneralUtils.readBuildNO().contains("-"); } private static boolean isJarPath(String classFilePath) { diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java index 33cfd577da..75c9c9e5ba 100644 --- a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -1,14 +1,24 @@ package com.fr.design.formula; +import com.fr.general.GeneralUtils; +import com.fr.invoke.Reflect; +import org.easymock.EasyMock; import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import static junit.framework.Assert.fail; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertFalse; /** * Created by plough on 2018/12/7. */ +@RunWith(PowerMockRunner.class) +@PrepareForTest(GeneralUtils.class) public class FunctionConstantsTest { @Test public void testNewInstanceFail() throws Exception { @@ -37,4 +47,30 @@ public class FunctionConstantsTest { NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; assertEquals(9, commonFunctionList.getDescriptions().length); } + + @Test + public void testIsCustomFormulaPathRunWithCode() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("不是安装版本").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "/Users/plough/.m2/repository/com/fr/core/fine-core/10.0-RELEASE-SNAPSHOT/fine-core-10.0-RELEASE-20181211.024527-499.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Users/plough/work/new_10_release_finereport/engine-settings/env/webroot/WEB-INF/classes/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } + + @Test + public void testIsCustomFormulaPathRunWithJar() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("Build#release-2018.12.10.12.11.09.95").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "file:/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/lib/fine-report-engine-10.0.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/classes/com/fr/function"; + assertTrue(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } } From 1537cf742b7498f1f073e91d61546a2f3a4372d7 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 17:08:09 +0800 Subject: [PATCH 153/187] =?UTF-8?q?REPORT-13363=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 756cd12623..ca32ff565d 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -59,6 +59,7 @@ import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import javax.swing.JComponent; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.MatteBorder; import java.awt.Component; @@ -121,6 +122,9 @@ public class Designer extends BaseDesigner { try { designerRoot.start(); } catch (LifecycleFatalError fatal) { + SplashContext.getInstance().hide(); + JOptionPane.showMessageDialog(null, fatal.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().error(fatal.getMessage(), fatal); System.exit(0); } From a5a4dc4db6e501187ac58340735969589815c6d2 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 12 Dec 2018 10:10:29 +0800 Subject: [PATCH 154/187] =?UTF-8?q?REPORT-13477=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E3=80=8Btab=E6=A0=B7=E5=BC=8F=E3=80=8Btab=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E8=BF=87=E9=95=BF=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F/=E4=B8=8B=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=BC=8F=E7=9A=84=E9=A2=84=E8=A7=88=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 6 +++--- .../mobile/ui/DownMenuStyleDefinePane.java | 6 +++--- .../mobile/ui/UpMenuStyleDefinePane.java | 6 +++--- .../preview/MobileTemplatePreviewPane.java | 21 ++++++++++++++++--- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 7ffd0abe21..10fc42e8f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -95,9 +95,9 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 70499f3028..ff76e5fed5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -163,8 +163,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); @@ -173,7 +173,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } Icon icon = new Icon(PAINT_ICON, ICON_PATH); g2d.drawImage(IconManager.getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { g2d.setColor(splitLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ddd4c202d0..be8ff823a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -188,15 +188,15 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); g2d.fillRect(0, 0 ,eachWidth, panelHeight - 2); g2d.setColor(oldColor); } - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); Stroke oldStroke = g2d.getStroke(); if (i == 0) { g2d.setColor(this.underLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java index d5ddbb6b9f..73f09f04e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java @@ -5,6 +5,7 @@ import com.fr.general.cardtag.mobile.TabFontConfig; import javax.swing.JPanel; import java.awt.Color; +import java.awt.FontMetrics; public abstract class MobileTemplatePreviewPane extends JPanel { private Color initialColor; @@ -35,18 +36,32 @@ public abstract class MobileTemplatePreviewPane extends JPanel { this.tabFontConfig = tabFontConfig; } - public MobileTemplatePreviewPane(){ + public MobileTemplatePreviewPane() { } - public void populateConfig(MobileTemplateStyle templateStyle){ + public void populateConfig(MobileTemplateStyle templateStyle) { this.setInitialColor(templateStyle.getInitialColor()); this.setBackground(templateStyle.getInitialColor()); this.setSelectColor(templateStyle.getSelectColor()); this.setTabFontConfig(templateStyle.getTabFontConfig()); } - public void repaint (){ + protected String calculateDisplayName(String widgetName, FontMetrics fm, int eachWidth) { + StringBuffer buffer = new StringBuffer(); + String result; + for (int i = 0; i < widgetName.length(); i++) { + result = buffer.toString(); + buffer.append(widgetName.charAt(i)); + if (fm.stringWidth(buffer.toString()) > eachWidth) { + return result; + } + } + return buffer.toString(); + + } + + public void repaint() { super.repaint(); } From b749d6115ef64057b211900d6510dfb5f44aa3b8 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 12 Dec 2018 11:58:04 +0800 Subject: [PATCH 155/187] =?UTF-8?q?REPORT-13457=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98=20&=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8B=96=E6=8B=BD=E5=9C=BA=E6=99=AF=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E6=8C=87=E9=92=88=E5=92=8C=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E6=B3=9B=E5=9E=8B=E6=94=B9=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 170 +++++++++--- .../fr/design/designer/TargetComponent.java | 5 +- .../design/file/HistoryTemplateListCache.java | 5 + .../design/file/HistoryTemplateListPane.java | 5 + .../com/fr/design/mainframe/BaseJForm.java | 11 +- .../com/fr/design/mainframe/JTemplate.java | 2 +- .../design/mainframe/JTemplateProvider.java | 6 +- .../designer/beans/models/StateModel.java | 66 +++-- .../designer/creator/XCreatorUtils.java | 8 +- .../fr/design/mainframe/ComponentTree.java | 30 ++- .../com/fr/design/mainframe/FormDesigner.java | 8 +- .../fr/design/mainframe/FormModelAdapter.java | 187 +++++++------- .../java/com/fr/design/mainframe/JForm.java | 4 +- .../actions/report/ReportParameterAction.java | 22 +- .../fr/design/mainframe/ElementCasePane.java | 1 + .../com/fr/design/mainframe/JWorkBook.java | 11 +- .../mainframe/WorkBookModelAdapter.java | 244 +++++++++--------- 17 files changed, 480 insertions(+), 305 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 251ee7af86..4ebc64103d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -3,6 +3,8 @@ package com.fr.design; import com.fr.base.Parameter; import com.fr.base.io.BaseBook; import com.fr.data.TableDataSource; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateProvider; import com.fr.form.ui.Widget; @@ -14,68 +16,159 @@ import java.util.List; import java.util.Map; /** - * 当前的设计器模式 + * 设计器模式 FormModel or WorkBookModel + *

+ * 指的是编辑的模板是普通报表还是决策报表 * * @author zhou * @since 2012-7-26上午11:24:54 */ -public abstract class DesignModelAdapter { +public abstract class DesignModelAdapter> { + /** + * 当前的设计模式 FormModel or WorkBookModel + */ private static DesignModelAdapter currentModelAdapter; + /** + * 模板 + */ protected S jTemplate; + /** + * 全部的参数,包括全局参数,模板参数和数据集参数 + */ + private Parameter[] parameters; + + /** + * 数据集参数 + */ + private Parameter[] tableDataParameters; + + /** + * 模板参数 + */ + private Parameter[] templateParameters; + + public DesignModelAdapter(S jTemplate) { this.jTemplate = jTemplate; - setCurrentModelAdapter(this); + updateCachedParameter(); + setCurrentModelAdapter(this); + } + + public static void setCurrentModelAdapter(DesignModelAdapter model) { + currentModelAdapter = model; + } + + public static DesignModelAdapter getCurrentModelAdapter() { + return currentModelAdapter; } + /** + * 获取当前编辑的模板 + * + * @return template + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @see HistoryTemplateListCache#getCurrentEditingTemplate() + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public S getjTemplate() { return jTemplate; } + /** + * 设置当前编辑的模板 + * 不要脱离上下文直接调用 + * + * @param jTemplate jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public void setjTemplate(S jTemplate) { this.jTemplate = jTemplate; } public T getBook() { - return (T) ((JTemplate) jTemplate).getTarget(); + return jTemplate.getTarget(); } - public static void setCurrentModelAdapter(DesignModelAdapter model) { - currentModelAdapter = model; - } - - public static DesignModelAdapter getCurrentModelAdapter() { - return currentModelAdapter; - } /** - * 响应目标改变事件. + * 响应正在编辑的模板改变事件. */ public void fireTargetModified() { - ((JTemplate) this.jTemplate).fireTargetModified(); + this.jTemplate.fireTargetModified(); } + /** + * 获取悬浮元素名称数组 + * + * @return String[] 悬浮元素名称数组 + */ public String[] getFloatNames() { return new String[0]; } + /** + * 获取编辑模板的所有参数 + *

+ * 由于在参数面板拖动过程中频繁获取 + * 远程设计时数据集参数rpc 调用需要考虑网络等因素,因此会比较缓慢,引起参数面板拖动卡顿, + * 所以缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板的所有参数 + */ public Parameter[] getParameters() { - return new Parameter[0]; + return parameters == null ? new Parameter[0] : parameters; } - // 报表参数 + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + * @deprecated use {@link DesignModelAdapter#getTemplateParameters()} instead + */ + @Deprecated public Parameter[] getReportParameters() { - return new Parameter[0]; + return getTableDataParameters(); + } + + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + */ + public Parameter[] getTemplateParameters() { + return templateParameters == null ? new Parameter[0] : templateParameters; } /** * 数据源参数 + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 * - * @return + * @return Parameter[] 数据源参数 */ public Parameter[] getTableDataParameters() { - return new Parameter[0]; + return tableDataParameters == null ? new Parameter[0] : tableDataParameters; + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字. + * @return 返回是否名字一样. + */ + public boolean renameTableData(String oldName, String newName) { + return renameTableData(oldName, newName, true); } /** @@ -101,17 +194,6 @@ public abstract class DesignModelAdapter getWidgetsName(); + /** + * 更新缓存的参数 + */ + public void updateCachedParameter() { + // 全部参数 + this.parameters = getLatestParameters(); + // 数据及参数 + this.tableDataParameters = getLatestTableDataParameters(); + // 模板参数 + this.templateParameters = getLatestTemplateParameters(); + + } + /** * 环境改变. */ @@ -146,4 +241,19 @@ public abstract class DesignModelAdapter extends JComponent { +public abstract class TargetComponent extends JComponent implements JTemplateProvider { private T target; public TargetComponent(T t) { @@ -34,6 +35,7 @@ public abstract class TargetComponent extends JComponent { public abstract void stopEditing(); + @Override public T getTarget() { return target; } @@ -82,6 +84,7 @@ public abstract class TargetComponent extends JComponent { /** * Fire template modified listeners. */ + @Override public void fireTargetModified() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index b73805ee66..e4bd1db952 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; @@ -99,6 +100,10 @@ public class HistoryTemplateListCache implements CallbackEvent { return this.editingTemplate; } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { this.editingTemplate = jt; //如果当前历史面板中没有 diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index a51735f641..2dc56cc9da 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -60,6 +61,10 @@ public class HistoryTemplateListPane implements CallbackEvent { return instead().getCurrentEditingTemplate(); } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { instead().setCurrentEditingTemplate(jt); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java index 559387b208..d3cff1ff95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java @@ -1,16 +1,16 @@ package com.fr.design.mainframe; -import javax.swing.JComponent; - import com.fr.form.FormElementCaseContainerProvider; +import javax.swing.JComponent; + /** * Author : Shockway * Date: 13-7-15 * Time: 上午10:28 */ -public interface BaseJForm extends JTemplateProvider { +public interface BaseJForm extends JTemplateProvider { String XML_TAG = "JForm"; int FORM_TAB = 0; @@ -32,11 +32,6 @@ public interface BaseJForm extends JTemplateProvider { */ void refreshSelectedWidget(); - /** - * 获取当前的Target - */ - Object getTarget(); - /** * 执行撤销 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7b80c3fd74..7f5cab7448 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -75,7 +75,7 @@ import java.util.regex.Pattern; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, JTemplateProvider, DesignerProxy { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; private FILE editingFILE = null; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java index 7df132d6e9..fb87f7f049 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe; -public interface JTemplateProvider { +public interface JTemplateProvider { - public void fireTargetModified(); + void fireTargetModified(); + + T getTarget(); } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java index 5eee1aca8d..1e7badb8a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java @@ -7,12 +7,22 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Location; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XConnector; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.utils.ComponentUtils; -import java.awt.*; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -94,8 +104,11 @@ public class StateModel { return; } - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { + return; + } + XCreator creator = selectionModel.getSelection().getSelectedCreator(); Component creatorContainer = XCreatorUtils.getParentXLayoutContainer(creator); if (creatorContainer != null && creatorContainer != container @@ -141,11 +154,8 @@ public class StateModel { * @param mouseReleasedY 鼠标释放位置Y */ private void adding(int mouseReleasedX, int mouseReleasedY) { - // 当前鼠标所在的组件 - XCreator hoveredComponent = designer.getComponentAt(mouseReleasedX, mouseReleasedY, selectionModel.getSelection().getSelectedCreators()); - - // 获取该组件所在的焦点容器 - XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); + // 当前鼠标所在组件的容器 + XLayoutContainer container = getMouseLocationContainer(mouseReleasedX, mouseReleasedY); boolean success = false; @@ -166,6 +176,33 @@ public class StateModel { designer.setPainter(null); } + /** + * 获取鼠标所在位置组件的容器 + * + * @param e MouseEvent + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(MouseEvent e) { + return getMouseLocationContainer(e.getX(), e.getY()); + } + + /** + * 获取鼠标所在位置组件的容器 + * + * @param x x 鼠标所在位置x + * @param y y 鼠标所在位置y + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(int x, int y) { + // 当前鼠标所在的组件 + XCreator hoveredComponent = designer.getComponentAt(x, y, selectionModel.getSelection().getSelectedCreators()); + if (hoveredComponent == null) { + return null; + } + // 获取该组件所在的焦点容器 + return XCreatorUtils.getHotspotContainer(hoveredComponent); + } + /** * 是否拖拽 * @@ -246,7 +283,7 @@ public class StateModel { if (p != null) { try { designer.setCursor(XConnector.connectorCursor); - } catch (Exception e) { + } catch (Exception ignored) { } } else { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); @@ -433,11 +470,11 @@ public class StateModel { // 拖拽时画依附线用到的painter private void setDependLinePainter(MouseEvent e) { - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - if (comp == null) { + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { return; } - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XCreator creator = selectionModel.getSelection().getSelectedCreator(); HoverPainter painter = AdapterBus.getContainerPainter(designer, container); designer.setPainter(painter); @@ -479,9 +516,8 @@ public class StateModel { * @return xy值 */ public Point getMouseXY(MouseEvent e) { - Point p1 = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + return new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + designer.getArea().getVerticalValue()); - return p1; } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 748c377836..774010136c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -66,9 +66,11 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; +import com.fr.third.javax.annotation.Nonnull; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import java.awt.Container; +import java.awt.Dimension; /** * XCreator的相关处理 @@ -284,7 +286,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(XCreator creator) { + public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 02abef0105..a2f295f87d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -3,19 +3,28 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DropMode; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTree; +import javax.swing.SwingUtilities; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; @@ -118,7 +127,9 @@ public class ComponentTree extends JTree { public void setAndScrollSelectionPath(TreePath[] treepath) { setSelectionPaths(treepath); - scrollPathToVisible(treepath[0]); + if (treepath.length > 0) { + scrollPathToVisible(treepath[0]); + } } @Override @@ -330,8 +341,7 @@ public class ComponentTree extends JTree { return contentPane; } - private BufferedImage componentToImage(Component comp) throws IOException - { + private BufferedImage componentToImage(Component comp) throws IOException { BufferedImage im = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_ARGB); comp.paint(im.getGraphics()); return im; @@ -341,14 +351,14 @@ public class ComponentTree extends JTree { private void updateSize() { int width = compImage.getWidth(); int height = compImage.getHeight(); - double aspectRatio = (double)width / height; + double aspectRatio = (double) width / height; if (width > MAX_WIDTH) { width = MAX_WIDTH; - height = (int)(width / aspectRatio); + height = (int) (width / aspectRatio); } if (height > MAX_HEIGHT) { height = MAX_HEIGHT; - width = (int)(height * aspectRatio); + width = (int) (height * aspectRatio); } this.setPreferredSize(new Dimension(width, height)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index fd0de4b257..5dd42de8d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -65,6 +65,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; +import com.fr.third.javax.annotation.Nullable; import javax.swing.Action; import javax.swing.JComponent; @@ -918,7 +919,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 是则返回true */ public boolean isRoot(XCreator comp) { - return comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class); + return comp != null && (comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class)); } // 计算鼠标事件e所发生的位置相对根组件的位置关系 @@ -980,6 +981,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection return getComponentAt(x, y, null); } + @Nullable public XCreator getComponentAt(int x, int y, XCreator[] except) { XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; XCreator comp = xCreatorAt(x + formArea.getHorizontalValue(), y + formArea.getVerticalValue(), container, @@ -1191,8 +1193,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection } return designerActions.toArray(new UpdateAction[designerActions.size()]); } + /** * 扩展菜单项 + * * @param actions */ public void dmlActions(List actions) { @@ -1200,7 +1204,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { if (handler.accept(this)) { - handler.dmlUpdateActions(this,actions); + handler.dmlUpdateActions(this, actions); } } } catch (Exception e) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index 3c1233fab0..670c2fa489 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -12,7 +12,6 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; -import com.fr.main.parameter.ReportParameterAttr; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; import com.fr.stable.js.WidgetName; @@ -20,35 +19,38 @@ import com.fr.stable.js.WidgetName; import java.util.ArrayList; import java.util.List; -public class FormModelAdapter extends DesignModelAdapter { +public class FormModelAdapter extends DesignModelAdapter> { - public FormModelAdapter(BaseJForm jForm) { - super(jForm); - } + public FormModelAdapter(BaseJForm jForm) { + super(jForm); + } /** * 环境改变. */ - public void envChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void envChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + + } /** * 参数改变. */ - public void parameterChanged() { - //实时更新参数 - jTemplate.populateParameter(); - } + public void parameterChanged() { + //实时更新参数 + jTemplate.populateParameter(); + // 更新缓存的参数 + updateCachedParameter(); + } /** * 控件配置改变. */ - public void widgetConfigChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void widgetConfigChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + } /** * 重命名TableData后的一些操作 @@ -57,81 +59,80 @@ public class FormModelAdapter extends DesignModelAdapter { * @param newName 新名字. * @return 返回是否名字一样. */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - jTemplate.refreshSelectedWidget(); - return true; - } - return false; - } - - @Override - public List getWidgetsName() { - final List list = new ArrayList(); - Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { - - @Override - public void dealWith(Widget widget) { - if (widget instanceof DataControl || widget instanceof MultiFileEditor) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - }); - return list; - } - - /** - * 获取可以被超链的对象,表单主体中的所有控件 - */ - public Widget[] getLinkableWidgets() { - final ArrayList linkAbleList = new ArrayList(); + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + jTemplate.refreshSelectedWidget(); + return true; + } + return false; + } + + @Override + public List getWidgetsName() { + final List list = new ArrayList(); + Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { + + @Override + public void dealWith(Widget widget) { + if (widget instanceof DataControl || widget instanceof MultiFileEditor) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + }); + return list; + } + + /** + * 获取可以被超链的对象,表单主体中的所有控件 + */ + public Widget[] getLinkableWidgets() { + final ArrayList linkAbleList = new ArrayList(); final JForm currentJForm = ((JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { - - @Override - public boolean dealWithAllCards() { - return true; - } - - public void dealWith(Widget widget) { - boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); - //可以超链的对象不包含本身; 目前只有图表和报表块可以 - // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 - if (isSupportAsHypelink) { - linkAbleList.add(widget); - } - } - }, Widget.class); - - return linkAbleList.toArray(new Widget[linkAbleList.size()]); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - Parameter[] rpa = this.getBook().getTemplateParameters(); - return rpa == null ? new Parameter[0] : rpa; - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } + Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { + + @Override + public boolean dealWithAllCards() { + return true; + } + + public void dealWith(Widget widget) { + boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); + //可以超链的对象不包含本身; 目前只有图表和报表块可以 + // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 + if (isSupportAsHypelink) { + linkAbleList.add(widget); + } + } + }, Widget.class); + + return linkAbleList.toArray(new Widget[linkAbleList.size()]); + } + + + @Override + protected Parameter[] getLatestTemplateParameters() { + Parameter[] rpa = this.getBook().getTemplateParameters(); + return rpa == null ? new Parameter[0] : rpa; + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index cc3ba96f5c..06f7632265 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -86,7 +86,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -public class JForm extends JTemplate implements BaseJForm { +public class JForm extends JTemplate implements BaseJForm { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; @@ -139,7 +139,7 @@ public class JForm extends JTemplate implements BaseJForm { return DesignState.JFORM; } - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JFormProcessInfo(template); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java index 5a72fd13c8..1d044909cb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java @@ -3,25 +3,25 @@ */ package com.fr.design.actions.report; -import java.awt.event.ActionEvent; - -import javax.swing.SwingUtilities; - import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.design.DesignModelAdapter; import com.fr.design.actions.JWorkBookAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterArrayPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.main.TemplateWorkBook; import com.fr.main.parameter.ReportParameterAttr; +import javax.swing.SwingUtilities; +import java.awt.event.ActionEvent; + /** * Report Parameter */ -public class ReportParameterAction extends JWorkBookAction{ +public class ReportParameterAction extends JWorkBookAction { public ReportParameterAction(JWorkBook jwb) { super(jwb); @@ -37,7 +37,7 @@ public class ReportParameterAction extends JWorkBookAction{ * @return 是否执行成功 */ public void actionPerformed(ActionEvent evt) { - final JWorkBook jwb = getEditingComponent(); + JWorkBook jwb = getEditingComponent(); if (jwb == null) { return; } @@ -59,10 +59,8 @@ public class ReportParameterAction extends JWorkBookAction{ for (int i = 0; i < parameters.length; i++) { copyReportParameterAttr.addParameter(parameters[i]); } - jwb.fireTargetModified(); - jwb.updateReportParameterAttr(); - jwb.populateReportParameterAttr(); - + DesignModelAdapter.getCurrentModelAdapter().fireTargetModified(); + DesignModelAdapter.getCurrentModelAdapter().parameterChanged(); } }); parameterArrayDialog.setVisible(true); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 4112ac6c44..5bc5cd791d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -862,6 +862,7 @@ public abstract class ElementCasePane extends Tar /** * 响应目标变动. */ + @Override public void fireTargetModified() { // marks:自动计算 TemplateElementCase report = this.getEditingElementCase(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 569f02bb6f..58ecb1ea85 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -204,7 +204,7 @@ public class JWorkBook extends JTemplate { } @Override - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JWorkBookProcessInfo(template); } @@ -309,10 +309,10 @@ public class JWorkBook extends JTemplate { centerPane.setUpPaneHeight(hasParameterPane() ? parameterPane.getPreferredSize().height : 0); } - @Override /** * */ + @Override public void setComposite() { super.setComposite(); reportComposite.setComponents(); @@ -544,10 +544,11 @@ public class JWorkBook extends JTemplate { // //////////////////////OLD BELOW///////////////////////// // //////////////////////////////////////////////////////// - @Override + /** * set target */ + @Override public void setTarget(WorkBook book) { if (book == null) { return; @@ -1098,7 +1099,7 @@ public class JWorkBook extends JTemplate { FILE newFile = createNewEmptyFile(); //如果文件已经打开, 那么就覆盖关闭掉他 MutilTempalteTabPane.getInstance().closeFileTemplate(newFile); - final TemplateWorkBook tpl = this.getTarget(); + final WorkBook tpl = this.getTarget(); // 弹出输入参数 java.util.Map parameterMap = inputParameters(tpl); @@ -1106,7 +1107,7 @@ public class JWorkBook extends JTemplate { String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath()); FileOutputStream fileOutputStream = new FileOutputStream(fullPath); EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter(); - exporter.export(fileOutputStream, (WorkBook) tpl, parameterMap); + exporter.export(fileOutputStream, tpl, parameterMap); } catch (Exception e1) { FRContext.getLogger().error(e1.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index d84090b181..1e55d3c9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -25,132 +25,134 @@ import java.util.Iterator; import java.util.List; /** - * * @author zhou * @since 2012-7-26下午2:03:12 */ public class WorkBookModelAdapter extends DesignModelAdapter { - public WorkBookModelAdapter(JWorkBook jworkbook) { - super(jworkbook); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); - return rpa == null ? new Parameter[0] : rpa.getParameters(); - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - /** - * 重命名TableData后的一些操作 - * @param oldName 旧名字 - * @param newName 新名字 - * @return 返回是否刷新. - */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - if (this.getBook().getTableData(oldName) == null) { - jTemplate.refreshParameterPane4TableData(oldName,newName); - } - return true; - } - return false; - } - - /** - * 环境改变. - */ - public void envChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 参数改变. - */ - public void parameterChanged() { - jTemplate.updateReportParameterAttr(); - jTemplate.populateReportParameterAttr(); - } - - /** - * 控件改变. - */ - public void widgetConfigChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 返回控件的名字 - * @return widgetName 控件列表. - */ - public List getWidgetsName() { - List list = new ArrayList(); - WorkBook wb = this.getBook(); - for (int i = 0, len = wb.getReportCount(); i < len; i++) { - Report report = wb.getReport(i); - Iterator it = report.iteratorOfElementCase(); - while (it.hasNext()) { - ElementCase ec = (ElementCase)it.next(); - Iterator cs = ec.cellIterator(); - while (cs.hasNext()) { - CellElement ce = (CellElement)cs.next(); - if (ce instanceof DefaultTemplateCellElement) { - Widget widget = ((DefaultTemplateCellElement)ce).getWidget(); - if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - } - } - } - return list; - } - - /** - * 返回悬浮元素的名字数组 - * @return 返回数组. - */ - public String[] getFloatNames() { - TemplateElementCase elementCase = jTemplate.getEditingElementCase(); - - List nameList = new ArrayList(); - Iterator it = elementCase.floatIterator(); - while (it.hasNext()) { - nameList.add(it.next().getName()); - } - return nameList.toArray(new String[nameList.size()]); - } + public WorkBookModelAdapter(JWorkBook jworkbook) { + super(jworkbook); + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字 + * @return 返回是否刷新. + */ + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + if (this.getBook().getTableData(oldName) == null) { + jTemplate.refreshParameterPane4TableData(oldName, newName); + } + return true; + } + return false; + } + + /** + * 环境改变. + */ + public void envChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + /** + * 参数改变. + */ + public void parameterChanged() { + jTemplate.updateReportParameterAttr(); + jTemplate.populateReportParameterAttr(); + updateCachedParameter(); + } + + /** + * 控件改变. + */ + public void widgetConfigChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + @Override + protected Parameter[] getLatestTemplateParameters() { + ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); + return rpa == null ? new Parameter[0] : rpa.getParameters(); + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } + + /** + * 返回控件的名字 + * + * @return widgetName 控件列表. + */ + public List getWidgetsName() { + List list = new ArrayList(); + WorkBook wb = this.getBook(); + for (int i = 0, len = wb.getReportCount(); i < len; i++) { + Report report = wb.getReport(i); + Iterator it = report.iteratorOfElementCase(); + while (it.hasNext()) { + ElementCase ec = (ElementCase) it.next(); + Iterator cs = ec.cellIterator(); + while (cs.hasNext()) { + CellElement ce = (CellElement) cs.next(); + if (ce instanceof DefaultTemplateCellElement) { + Widget widget = ((DefaultTemplateCellElement) ce).getWidget(); + if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + } + } + } + return list; + } + + /** + * 返回悬浮元素的名字数组 + * + * @return 返回数组. + */ + public String[] getFloatNames() { + TemplateElementCase elementCase = jTemplate.getEditingElementCase(); + + List nameList = new ArrayList(); + Iterator it = elementCase.floatIterator(); + while (it.hasNext()) { + nameList.add(it.next().getName()); + } + return nameList.toArray(new String[nameList.size()]); + } public Widget[] getLinkableWidgets() { From a515a01364cc684cba27e8814b8ee977214f5488 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 13 Dec 2018 09:42:04 +0800 Subject: [PATCH 156/187] =?UTF-8?q?REPORT-12885=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=B5=E8=84=91=E5=9C=A8=E7=BD=91=E7=BB=9C=E7=95=85=E9=80=9A?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B3=E7=A7=92=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/SplashContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 2e5467557c..a8a542a581 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,7 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; - private static final int FETCH_ONLINE_MAX_TIMES = 10; + private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); From 2c50f3d1dd33482648882b64543c3c4b895d9531 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 14 Dec 2018 15:52:34 +0800 Subject: [PATCH 157/187] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8E=9F=E5=85=88=E6=94=B6=E9=9B=86=E5=9C=A8feedback?= =?UTF-8?q?=EF=BC=8C10.0=E9=9C=80=E8=A6=81=E9=80=82=E9=85=8D=202.=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=82=B9=E4=BB=8Emetric=E5=8F=96=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=BC=A0=E5=85=A5Date=E4=BB=8E12=E6=9C=8810?= =?UTF-8?q?=E5=8F=B7=E5=BC=80=E5=A7=8B=E5=B0=B1=E6=8B=BF=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BA=86=EF=BC=8C=E6=8D=A2=E7=94=A8long?= =?UTF-8?q?=E6=98=AF=E5=8F=AF=E4=BB=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 047ffc6717..0398189d9c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -170,7 +170,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } - private byte[] getJSONContentAsByte(){ + private JSONObject getJSONContentAsByte(){ JSONObject content = new JSONObject(); JSONArray startStopArray = new JSONArray(); @@ -192,13 +192,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { FRContext.getLogger().error(e.getMessage(), e); } } - - try { - return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); - return ArrayUtils.EMPTY_BYTE_ARRAY; - } + return content; } private void sendUserInfo(){ @@ -208,19 +202,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - byte[] content = getJSONContentAsByte(); - HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("user.info")); - hc.setContent(content); - if (!hc.isServerAlive()) { - return; - } - String res = hc.getResponseText(); - //服务器返回true,说明已经取得成功,清空当前记录的信息 + JSONObject content = getJSONContentAsByte(); + String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); boolean success = false; try { + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", content); + String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success){ this.reset(); @@ -236,7 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } JSONArray content = null; try { - content = getFunctionsContent(current, new Date(lastTime)); + content = getFunctionsContent(currentTime, lastTime); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -451,7 +443,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); From 9d2d79d44c3e250131c7c8f63fbd3cde43ed4033 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 09:38:46 +0800 Subject: [PATCH 158/187] =?UTF-8?q?REPORT-13548=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91tab=E5=9D=97=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E5=90=8E=E7=82=B9=E5=87=BB=E4=BC=9A=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardLayout.java | 10 ++++ .../design/mainframe/FormSelectionUtils.java | 58 ++++++++++++------- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 53a72e9112..107e31ed12 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -106,6 +106,16 @@ public class XWCardLayout extends XLayoutContainer { return new Dimension(500, 300); } + /** + * 重置组件的名称 + * @param name 名称 + */ + public void resetCreatorName(String name) { + super.resetCreatorName(name); + changeRelateSwitchCardName(name); + } + + @Override protected void initLayoutManager() { cardLayout = new FRCardLayout(toData().getHgap(), toData().getVgap()); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index 9a6a5d546e..f88b9e5400 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -14,12 +14,11 @@ import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; +import com.fr.form.main.Form; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - - import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; @@ -97,8 +96,7 @@ public class FormSelectionUtils { Rectangle rec = clipboard.getSelctionBounds(); for (XCreator creator : clipboard.getSelectedCreators()) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedCreator = copyXcreator(designer.getTarget(), creator); // 获取位置 Point point = getPasteLocation((AbstractLayoutAdapter) adapter, copiedCreator, @@ -181,8 +179,7 @@ public class FormSelectionUtils { private static void relativePasteXCreator(FormDesigner designer, XCreator creator, LayoutAdapter adapter, Rectangle tabContainerRect, int x, int y) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedXCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedXCreator = copyXcreator(designer.getTarget(), creator); if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) { if (!adapter.accept(copiedXCreator, x - tabContainerRect.x, y - tabContainerRect.y)) { designer.showMessageDialog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Too_Small_To_Paste")); @@ -235,33 +232,52 @@ public class FormSelectionUtils { return new Point(x, y); } - /** * 拷贝组件 + * @param form 当前表单 + * @param xCreator 待拷贝的组件 + * @return XCreator 拷贝的组件 */ - private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws - CloneNotSupportedException { - ArrayList nameSpace = new ArrayList<>(); + public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{ Widget copied = (Widget) xCreator.toData().clone(); - //重命名拷贝的组件 - String name = getCopiedName(formDesigner, copied, nameSpace); - if (copied instanceof WTitleLayout) { - XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize()); - xwTitleLayout.resetCreatorName(name); - } else { - copied.setWidgetName(name); + XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize()); + ArrayList nameSpace = new ArrayList<>(); + copyWidgetName(form, nameSpace, copiedCreator); + return copiedCreator; + } + + /** + * 拷贝组件 + * @param form 当前表单 + * @param nameSpace 命名空间 + * @param xCreator 拷贝的组件 + */ + private static void copyWidgetName(Form form, ArrayList nameSpace, XCreator xCreator){ + String copyName = FormSelectionUtils.getCopiedName(form, xCreator.toData(), nameSpace); + if (xCreator.toData() instanceof WTitleLayout) { + XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) xCreator.toData(), xCreator.getSize()); + xwTitleLayout.resetCreatorName(copyName); + return; + } + xCreator.resetCreatorName(copyName); + int count = xCreator.getComponentCount(); + for(int a = 0; a nameSpace) { + private static String getCopiedName(Form form, Widget copied, ArrayList nameSpace) { StringBuilder name = new StringBuilder(copied.getWidgetName()); do { name.append(POSTFIX); - } while (formDesigner.getTarget().isNameExist(name.toString()) || nameSpace.contains(name.toString())); + } while (form.isNameExist(name.toString()) || nameSpace.contains(name.toString())); nameSpace.add(name.toString()); return name.toString(); } @@ -308,4 +324,4 @@ public class FormSelectionUtils { } } } -} +} \ No newline at end of file From 0b837ebfb2ef0f8523b5db9655abccc2024b9409 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 11:38:40 +0800 Subject: [PATCH 159/187] =?UTF-8?q?REPORT-13626=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E4=BF=9D=E5=AD=98=E6=A8=A1=E7=89=88-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itextfield/UIAutoCompletionField.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java index de6bccd865..5672a8502d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java @@ -1,11 +1,9 @@ package com.fr.design.gui.itextfield; import com.fr.design.gui.imenu.UIListPopup; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; -import com.fr.stable.OperatingSystem; - -import javax.swing.*; +import javax.swing.JList; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; @@ -13,10 +11,12 @@ import javax.swing.event.ListSelectionListener; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.Document; - -import java.awt.Dimension; -import java.awt.LayoutManager; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.util.ArrayList; public class UIAutoCompletionField extends UITextField implements DocumentListener, MouseListener, ListSelectionListener, ActionListener, KeyListener { @@ -82,9 +82,6 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen } private void textChanged() { - if (OperatingSystem.isMacOS()) { - return; - } if (!popup.isVisible()) { showPopup(); requestFocus(); From 62c14cfe072e138ee0874d651b7b1520f78d6f6d Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 17 Dec 2018 14:51:11 +0800 Subject: [PATCH 160/187] REPORT-13629 & REPORT-13572 --- .../src/main/java/com/fr/design/mainframe/JForm.java | 5 +++-- .../main/java/com/fr/design/mainframe/SheetNameTabPane.java | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index cc3ba96f5c..fb58e21eff 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,7 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; @@ -496,9 +497,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 3ecd2caf42..09f1ff9e1b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -335,7 +335,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse checkButton(showCount < widthArray.length); // richie:当linearray不为空时,说明有了鼠标拖动,下面画由于鼠标拖动产生的效果. - if (!lineArray.isEmpty()) { + //REPORT-13572 点击切换会出现重影,保证:此时鼠标点击是没有放开的,才会绘制轨迹 + if (!lineArray.isEmpty() && !isReleased) { paintDragTab(g2d, textHeight, charWidth, textAscent); } @@ -568,6 +569,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse * @param evt 鼠标事件 */ public void mousePressed(MouseEvent evt) { + isReleased = false; int reportcount = reportComposite.getEditingWorkBook().getReportCount(); if (scrollIndex < 0 || scrollIndex >= reportcount) { return; @@ -749,7 +751,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse /** * exchange workSheet * - * @param workBook + * @param * @param index1 * @param index2 * @return workBook From e10d3b580abbda023f6dd149e5e55299eacf7da8 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 17 Dec 2018 14:53:21 +0800 Subject: [PATCH 161/187] =?UTF-8?q?CHART-2554=20=E6=BC=8F=E6=96=97?= =?UTF-8?q?=E5=9B=BE=20=E7=95=8C=E9=9D=A2=20=E9=A3=8E=E6=A0=BC=2010.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/funnel/designer/style/VanChartFunnelSeriesPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index a6a8dcb9a9..8a02cd5f44 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -44,7 +44,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { //设置色彩面板内容 protected void setColorPaneContent (JPanel panel) { if (stylePane != null) { - panel.add(createStylePane(), BorderLayout.CENTER); + panel.add(stylePane, BorderLayout.CENTER); } panel.add(createAlphaPane(), BorderLayout.SOUTH); } From 31088893d87d2830e25a9a3e543bdd37159e1c58 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 17 Dec 2018 16:18:03 +0800 Subject: [PATCH 162/187] =?UTF-8?q?REPORT-13614=20=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E9=A2=84=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 +++++++-- .../main/java/com/fr/design/mainframe/FormParaPane.java | 5 ++++- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index 40490702de..d57875e38c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,14 +9,19 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; + private Widget widget; - public UserDefinedWidgetOption(String name) { + public UserDefinedWidgetOption(String name, Widget widget) { this.widgetConfigName = name; + this.widget = widget; } @Override public Widget createWidget() { - return new NameWidget(widgetConfigName); + Widget widget = new NameWidget(widgetConfigName); + widget.setEnabled(this.widget.isEnabled()); + widget.setVisible(this.widget.isVisible()); + return widget; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 647a0dd8a5..1d990aeb69 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,10 +1,12 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; +import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -25,6 +27,7 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; /** @@ -154,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 1958056b35..76cf264397 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } From 84d6fdb7ec249916cec6038941e095526feac668 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:56:27 +0800 Subject: [PATCH 163/187] =?UTF-8?q?=E7=9C=9F=E6=AD=A3=E6=88=90=E5=9B=A0:?= =?UTF-8?q?=20XNameWidegt=E6=BC=8F=E5=8A=A0setEnable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 ++------- .../java/com/fr/design/designer/creator/XNameWidget.java | 4 +++- .../main/java/com/fr/design/mainframe/FormParaPane.java | 2 +- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index d57875e38c..40490702de 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,19 +9,14 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; - private Widget widget; - public UserDefinedWidgetOption(String name, Widget widget) { + public UserDefinedWidgetOption(String name) { this.widgetConfigName = name; - this.widget = widget; } @Override public Widget createWidget() { - Widget widget = new NameWidget(widgetConfigName); - widget.setEnabled(this.widget.isEnabled()); - widget.setVisible(this.widget.isVisible()); - return widget; + return new NameWidget(widgetConfigName); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java index b886ad6c49..2671017878 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java @@ -68,7 +68,9 @@ public class XNameWidget extends XWidgetCreator { Widget widget; if (wc != null && (widget= wc.toWidget()) != null) { editor = XCreatorUtils.createXCreator(widget); - toData().setVisible(widget.isVisible()); + Widget currentWidget = toData(); + currentWidget.setVisible(widget.isVisible()); + currentWidget.setEnabled(widget.isEnabled()); this.setBorder(null); } else { this.setBorder(DEFALUTBORDER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 1d990aeb69..9de2484202 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -157,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 76cf264397..1958056b35 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } From 582c2890c99f42745d0a6ff4358f1a30a2d2e96f Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:58:58 +0800 Subject: [PATCH 164/187] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormParaPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 9de2484202..647a0dd8a5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,12 +1,10 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; -import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -27,7 +25,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; /** From 82517ab7436bddd1277b62dd8f3cff16ceb22c17 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 19 Dec 2018 10:27:04 +0800 Subject: [PATCH 165/187] =?UTF-8?q?REPORT-13528=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84jar=EF=BC=8C=E5=9B=BE=E7=89=87=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8F=96=E5=88=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/impl/FormHyperlinkNorthPane.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java index 63d94bbb2a..5159e318cf 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java @@ -110,12 +110,14 @@ public class FormHyperlinkNorthPane extends BasicBeanPane } String editorName = formHyperlink.getRelateEditorName(); //防止初始的时候有空白选项 - if (editorName == null) { - return; + String[] formHyperlinkEditNames = getFormHyperlinkEditNames(); + if (editorName == null && formHyperlinkEditNames.length > 0) { + editorName = formHyperlinkEditNames[0]; + formHyperlink.setRelateEditorName(editorName); } if (targetFrameComboBox != null) { //noinspection unchecked - targetFrameComboBox.setModel(new DefaultComboBoxModel(getFormHyperlinkEditNames())); + targetFrameComboBox.setModel(new DefaultComboBoxModel(formHyperlinkEditNames)); targetFrameComboBox.setSelectedItem(editorName); } } From 630ad3cf0c223ffa29132528d2baf177b4a39b86 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Dec 2018 14:56:48 +0800 Subject: [PATCH 166/187] =?UTF-8?q?MOBILE-18837=E3=80=90RN=E3=80=91?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=8Btabpane=E3=80=8B=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=A0=B7=E5=BC=8F=E6=A8=A1=E6=9D=BF=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=EF=BC=8Ctabpane=E4=B8=80=E4=BA=9B=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=B1=9E=E6=80=A7=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/DefaultMobileStyleDefinePane.java | 15 ++++++++++++--- .../mobile/ui/TemplateStyleDefinePaneFactory.java | 5 +++-- .../designer/layout/WCardTagLayoutDefinePane.java | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 10fc42e8f1..860a0c9fb9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -7,7 +7,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + import java.awt.BasicStroke; +import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; @@ -41,17 +44,17 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane @Override public MobileTemplateStyle updateBean() { - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } public MobileTemplateStyle updateConfig(){ - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } @Override protected MobileTemplateStyle getDefaultTemplateStyle() { - return new DefaultMobileTemplateStyle(); + return new DefaultMobileTemplateStyle(new TabFontConfig(getTagLayout().getTitleFont())); } @Override @@ -74,6 +77,10 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); } + public Color getInitialColor() { + return DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR; + } + public void repaint() { super.repaint(); } @@ -94,11 +101,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int fontHeight = fm.getHeight(); int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setColor(frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); int width = fm.stringWidth(displayName); g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { + g2d.setColor(Color.BLACK); g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java index 9b287de07f..dab5a03ba7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -24,9 +24,10 @@ public class TemplateStyleDefinePaneFactory { public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); - Class> clazz = styleDefinePaneUI.getaClass(); - if (clazz == null) { + if(styleDefinePaneUI == null){ + styleDefinePaneUI = defineMap.get(DefaultMobileTemplateStyle.STYLE_NAME); } + Class> clazz = styleDefinePaneUI.getaClass(); BasicBeanPane quickPane = null; try { quickPane = Reflect.on(clazz).create(tagLayout).get(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index d1e68baf39..41ea1c1c7d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -115,6 +115,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify templateStyleEditor.setValue(ob.getTemplateStyle()); FRFont frFont = layoutBorderStyle.getTitle().getFrFont(); if (frFont != null) { + ob.setTitleFont(frFont); frFontPane.populateBean(frFont); } } @@ -126,8 +127,10 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); - layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont)); + FRFont titleFont = frFontPane.update(frFont); + layoutBorderStyle.getTitle().setFrFont(titleFont); WCardTagLayout layout = (WCardTagLayout) creator.toData(); + layout.setTitleFont(titleFont); boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType(); if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) { layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex())); From 42f0405e0c6f27667820027e9bf24f837612a442 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Dec 2018 16:04:10 +0800 Subject: [PATCH 167/187] =?UTF-8?q?REPORT-13654=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8D=A2=E4=B8=8A12=E5=8F=B7=E7=9A=84release?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B0=83=E8=89=B2=E6=9D=BF=E5=87=BA=E4=B8=8D?= =?UTF-8?q?=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/color/NewColorSelectPane.java | 21 +++++++++++----- .../style/color/PickColorButtonFactory.java | 24 ++++++++++++------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 0f5e629e28..d532324165 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +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; @@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) + customButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!customButton.isEnabled()) { + return; + } customButtonPressed(); } }); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 67d99819d7..f394801c89 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; -import javax.swing.*; -import javax.swing.plaf.ButtonUI; -import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; /** * Created by plough on 2016/12/22. @@ -28,7 +32,7 @@ class PickColorButtonFactory { * @return SpecialUIButton 屏幕取色按钮 */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { - SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); + final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; if (iconType == IconType.ICON16) { @@ -42,9 +46,13 @@ class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) + pickColorButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!pickColorButton.isEnabled()) { + return; + } new ColorPicker(colorSelectable, setColorRealTime); } }); From 6b7bb5b6c3fc4c1e58a41da6fae0ad629e11ab7d Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 09:47:40 +0800 Subject: [PATCH 168/187] =?UTF-8?q?REPORT-10829=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E5=A4=A7=E8=B5=9B=E6=94=AF=E6=92=91,=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=90=8C=E6=AD=A510.0=20,=E6=9C=89=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/selection/CellSelection.java | 4 ++++ .../src/main/java/com/fr/grid/selection/FloatSelection.java | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index e6eb983c6b..ee80f22a24 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -508,6 +508,10 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getInsertMenu(ePane)); popup.add(DeprecatedActionManager.getDeleteMenu(ePane)); popup.add(DeprecatedActionManager.getClearMenu(ePane)); + + popup.addSeparator(); + + addExtraMenu(ePane, popup); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index c982934a03..6ce0d736fc 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -1,6 +1,5 @@ package com.fr.grid.selection; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; @@ -27,7 +26,6 @@ import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.selection.QuickEditor; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; - import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; @@ -149,6 +147,10 @@ public class FloatSelection extends Selection { popup.add(new EditFloatElementNameAction(ePane).createMenuItem()); + popup.addSeparator(); + + addExtraMenu(ePane, popup); + return popup; } From 553f5172645e30f3f58d1f0d887d1be01e624168 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 20 Dec 2018 14:07:10 +0800 Subject: [PATCH 169/187] =?UTF-8?q?REPORT-13717=20=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E5=90=8D=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 3 ++ .../fr/design/file/MutilTempalteTabPane.java | 47 ++++++++----------- .../fr/design/mainframe/DesignerFrame.java | 31 ++++++------ 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..6d069eba81 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -183,10 +183,13 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 判断是否打开过该模板 + * 由于切换环境不会关闭模板,可能存在同名的模板,所以该方法不能准确找到所选的模板, * * @param filename 文件名 * @return 文件位置 + * @deprecated use HistoryTemplateListCache#contains(com.fr.design.mainframe.JTemplate) instead */ + @Deprecated public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { String historyPath = historyList.get(i).getPath(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index ab4f2aae32..65989dfccf 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -18,7 +18,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -674,9 +673,6 @@ public class MutilTempalteTabPane extends JComponent { return; } - //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getPath(); - filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", @@ -684,20 +680,20 @@ public class MutilTempalteTabPane extends JComponent { if (returnVal == JOptionPane.YES_OPTION) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } else if (returnVal == JOptionPane.NO_OPTION) { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } else { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } - private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { + private void closeTpl(@Nonnull JTemplate specifiedTemplate) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); closeAndFreeLock(specifiedTemplate); - activeTemplate(fileName); + activePrevTemplateAfterClose(); } private void closeAndFreeLock(@Nonnull JTemplate template) { @@ -729,11 +725,9 @@ public class MutilTempalteTabPane extends JComponent { } /** - * 关闭掉一个模板之后该激活的Tab - * - * @param fileName 关闭掉一个模板之后该激活的Tab的文件名,绝对路径 + * 关闭掉一个模板之后激活新的待显示模板 */ - private void activeTemplate(String fileName) { + private void activePrevTemplateAfterClose() { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); @@ -742,23 +736,20 @@ public class MutilTempalteTabPane extends JComponent { temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); } else { - //如果关闭的模板是当前选中的模板,则重新激活 - if (closeIconIndex == selectedIndex) { - if (closeIconIndex == maxPaintIndex) { + // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; + // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 + if (closeIconIndex == selectedIndex || isCloseCurrent) { + // 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 + if (closeIconIndex >= maxPaintIndex) { + // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true selectedIndex--; } - } else if (isCloseCurrent) { - //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 - if (selectedIndex > openedTemplate.size() - 1) { - selectedIndex -= 1; - if (selectedIndex < 0) { - selectedIndex = 0; - } - isCloseCurrent = false; - } - } else { - //如果关闭的模板不是当前选中的模板,则激活的模板不变 - selectedIndex = HistoryTemplateListCache.getInstance().contains(fileName); + isCloseCurrent = false; + } + // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index + else { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + selectedIndex = HistoryTemplateListCache.getInstance().contains(template); } //如果是已后台关闭的模板,则重新打开文件 openedTemplate.get(selectedIndex).activeOldJTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 5c262da9de..72994fca77 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -29,6 +29,7 @@ import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -76,7 +77,6 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -160,9 +160,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //用于判断设计器是否打开了 private boolean designerOpened = false; - private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { @@ -849,18 +849,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } @@ -957,8 +957,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog( + this, + Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), + ProductConstants.PRODUCT_NAME, + JOptionPane.INFORMATION_MESSAGE + ); DesignerFrameFileDealerPane.getInstance().refresh(); return; } @@ -968,7 +972,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } catch (DecryptTemplateException e) { JOptionPane.showMessageDialog( this, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), + Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") @@ -1027,7 +1031,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta MutilTempalteTabPane.getInstance().setTemTemplate( HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } else { - activeTemplate(tplFile, jt); + activeTemplate(jt); } opened = true; break; @@ -1042,13 +1046,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 激活指定的模板 * - * @param tplFile 模板文件 - * @param jt 当前报表 + * @param jt 当前报表 * @date 2014-10-14-下午6:31:23 */ - private void activeTemplate(FILE tplFile, JTemplate jt) { + private void activeTemplate(JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); + int index = HistoryTemplateListPane.getInstance().contains(jt); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); From fcb58a3448c87d95554f99c2dfada0eeda64a693 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 15:26:44 +0800 Subject: [PATCH 170/187] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/loghandler/LogMessageBar.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 6209152433..bf815e1d74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -73,5 +73,6 @@ public class LogMessageBar extends JPanel { if (dlg != null) { dlg.dispose(); } + THIS = null; } } \ No newline at end of file From ef2d65581066c301ae265f881e778a63a59a26b9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Thu, 20 Dec 2018 16:30:52 +0800 Subject: [PATCH 171/187] REPORT-13689 & REPORT-13733 & REPORT-13716 & REPORT-13720 --- .../design/file/HistoryTemplateListCache.java | 5 ++ .../fr/design/mainframe/DesignerFrame.java | 26 ++++--- .../mainframe/EastRegionContainerPane.java | 2 + .../actions/server/StyleListAction.java | 77 ++++++++++--------- .../com/fr/design/present/StyleArrayPane.java | 16 ++-- 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..b41e15e80c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,6 +2,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent { public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); + //直接关闭模板的时候退出权限编辑 + if (DesignModeContext.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().closeAuthorityEditing(); + } if (contains(selected) == -1) { return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 5c262da9de..d7c40e6bdd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -10,6 +10,7 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; @@ -224,16 +226,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMAL); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); + if (DesignModeContext.isAuthorityEditing()) { + closeAuthorityEditing(); } } @@ -332,6 +326,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } + public void closeAuthorityEditing(){ + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + /** * 注册app. * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a49d66791f..97ce22814d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { propertyCard.show(rightPane, tabName); propertyItem.setTabButtonSelected(); + //从单元格菜单过来也要关闭弹出窗 + hideCurrentPopupPane(); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 61276163d5..4f57bdc2ac 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerCallBack; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import java.awt.event.ActionEvent; @@ -21,16 +24,17 @@ import java.awt.event.ActionEvent; * StyleList Action */ public class StyleListAction extends UpdateAction { - public StyleListAction() { + public StyleListAction() { this.setMenuKeySet(PREDEFINED_STYLES); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); - this.generateAndSetSearchText(StyleManagerPane.class.getName()); - } + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.generateAndSetSearchText(StyleManagerPane.class.getName()); + } /** * 动作 + * * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { @@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { styleListPane.update(ServerPreferenceConfig.getInstance()); } + }.addCallBack(new CallBackAdaptor(){ + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); + } + })); - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); - - } + } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); - styleListDialog.setVisible(true); - - } - - @Override - public void update() { - this.setEnabled(true); - } + ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); + styleListPane.populate(mirror); + styleListDialog.setVisible(true); + } + + @Override + public void update() { + this.setEnabled(true); + } - public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'K'; - } + public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'K'; + } - @Override - public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); - } + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); + } - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; } diff --git a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java index bd7602ee79..76c1e72617 100644 --- a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.present; import com.fr.base.Style; import com.fr.config.ServerPreferenceConfig; +import com.fr.config.StyleMap; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -13,6 +14,8 @@ import com.fr.design.style.StylePane; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; import java.util.ArrayList; import java.util.Iterator; @@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ServerPreferenceConfig configManager) { - configManager.clearAllStyle(); + public void update(final ServerPreferenceConfig configManager) { + //configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] nameables = this.update(); - + final StyleMap styleMap = new StyleMap(); for (int i = 0; i < nameables.length; i++) { - configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); + styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); } - DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); - } - + configManager.setStyleMap(styleMap); + } } From 3ed78faa5143aacd59c59cd984c1a7492fddf72b Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:11:33 +0800 Subject: [PATCH 172/187] =?UTF-8?q?CHART-3169=20=E6=96=B0=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E5=9B=BE=E8=A1=A8=20=E6=A0=B7=E5=BC=8F=E7=B3=BB?= =?UTF-8?q?=E5=88=97=E9=A2=9C=E8=89=B2=E9=A3=8E=E6=A0=BC=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA'=E6=B8=90=E5=8F=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/component/VanChartBeautyPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java index 44c0e1a551..f6642bd710 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -28,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, } ; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -36,8 +37,8 @@ public class VanChartBeautyPane extends BasicBeanPane { } protected String[] getNameArray(){ - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Top_Down_Shade") + return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), + Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") }; } @Override From 67ab9101f53ef4b1ae9091623dcdd2c0c39bf3c4 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:15:31 +0800 Subject: [PATCH 173/187] =?UTF-8?q?CHART-3573=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B0=E7=9A=84key=E6=9D=A5=E5=8C=BA=E5=88=AB=E5=BC=80'?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E6=96=AD=E5=BC=80'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/series/CustomDefaultSeriesPane.java | 2 +- .../chart/gui/style/series/CustomTypeConditionSeriesPane.java | 2 +- .../design/mainframe/chart/gui/style/series/LineSeriesPane.java | 2 +- .../mainframe/chart/gui/style/series/RadarSeriesPane.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java index d31aad3b38..d0507acc02 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java @@ -240,7 +240,7 @@ public class CustomDefaultSeriesPane extends BasicPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java index 7b6bb36571..3c2f52349f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java @@ -449,7 +449,7 @@ public class CustomTypeConditionSeriesPane extends BasicBeanPane{ lineStyle.setPreferredSize(new Dimension(150,20)); markerPane.setPreferredSize(new Dimension(150,20)); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java index 9fbbb11970..612e89b481 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java @@ -49,7 +49,7 @@ public class LineSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java index 8943473270..a5a3fb4d61 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java @@ -45,7 +45,7 @@ public class RadarSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); From 2dcaaef7ed49bffdd039ffbd5c4daea63aaab0fe Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 20:11:23 +0800 Subject: [PATCH 174/187] =?UTF-8?q?CHART-3575=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E9=9C=80=E8=A6=81=E7=9A=84'=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=90=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartDatapointLabelPane.java | 2 +- .../component/format/CategoryNameFormatPaneWithCheckBox.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 48585ae5b1..8e198ea6c5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -96,7 +96,7 @@ public class ChartDatapointLabelPane extends BasicPane{ boolean isGuidline = plot.isSupportLeadLine(); if(plot.isSupportCategoryFilter()) { - isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name")); + isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name")); } isSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); isValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java index 2e0d55a41f..575143a625 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.format; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -18,6 +19,7 @@ public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCh @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); + //"分类名" 图表(新特性)标签、提示时有用到 + return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); } } From f2d684e167b360eeb42abded516b511611d5eef5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 21 Dec 2018 10:37:25 +0800 Subject: [PATCH 175/187] MOBILE-18801 --- .../fr/design/actions/FormMobileAttrAction.java | 16 ++++++++++++++++ .../designer/layout/FRFitLayoutDefinePane.java | 11 +++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index 033ba5ea57..d77078fad6 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -3,11 +3,15 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JTemplateAction; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.form.mobile.FormMobileAttrPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.menu.MenuKeySet; @@ -73,6 +77,9 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } @@ -80,6 +87,15 @@ public class FormMobileAttrAction extends JTemplateAction { dialog.setVisible(true); } + private void doChangeBodyLayout(){ + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); + } + @Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED) private void recordFunction() { // do nothing diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 0f3e0aba0a..dd19d7c812 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -137,14 +137,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); if (rootLayout != formDesigner.getRootComponent() && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { - //原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式 - Form form = formDesigner.getTarget(); - if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) { - ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); - } else { - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); - } + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + } paddingBound.populate(ob); layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); From ba5b8fe1674e6edb30affd980001ab9254972092 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:43:05 +0800 Subject: [PATCH 176/187] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BA=8F=E5=88=97=E5=8C=96=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20SerilizationException=20,=20WorkspaceNoteHitException=202.?= =?UTF-8?q?=20=E5=8A=A0=E5=85=A5=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E6=A3=80=E6=B5=8B=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 46 ++++++++++++++++ .../main/java/com/fr/env/RemoteEnvPane.java | 37 ++++++++----- .../java/com/fr/env/TestConnectionResult.java | 55 +++++++++++++++++++ 3 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/TestConnectionResult.java diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 76ae528949..725272a153 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; @@ -15,19 +16,25 @@ import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.QUESTION_MESSAGE; public class EnvChangeEntrance { @@ -90,6 +97,11 @@ public class EnvChangeEntrance { }); return false; } + + if (versionCheck(selectedEnv)) { + return false; + } + WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -138,6 +150,40 @@ public class EnvChangeEntrance { return true; } + /** + * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当选择 ok 时,才继续。 + * + * @param selectedEnv 选择的环境 + * @return 是否一致 + * @throws Exception 异常 + */ + private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + + if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + + WorkspaceConnectionInfo info = selectedEnv.getConnection(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); + + return result.size() != 0 && result.get(0) == 1; + } + } + return false; + } + /** * 编辑items * diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 769c843cc5..21b5d2b2ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -511,14 +511,14 @@ public class RemoteEnvPane extends BasicBeanPane { } private void tryConnectRemoteEnv() { + final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); + final WorkspaceConnectionInfo connection = remoteEnv.getConnection(); + final SwingWorker worker = new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); - - WorkspaceConnectionInfo connection = remoteEnv.getConnection(); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); try { @@ -532,23 +532,33 @@ public class RemoteEnvPane extends BasicBeanPane { protected void done() { okButton.setEnabled(true); try { - Boolean result = get(); - if (result == null) { + + TestConnectionResult result = TestConnectionResult.parse(get(), connection); + if (result == TestConnectionResult.Fully_Success) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Partly_Sucess) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Fully_Failed) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } + + if (result == TestConnectionResult.Auth_Failed) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } else { - if (result) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - } else { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } } } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); @@ -596,6 +606,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java new file mode 100644 index 0000000000..3aaf594ecb --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -0,0 +1,55 @@ +package com.fr.env; + +import com.fr.stable.AssistUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; + +/** + * created by Harrison on 2018/12/20 + **/ +public enum TestConnectionResult { + /** + * 完全成功, 版本匹配,测试连接成功。 + */ + Fully_Success(0), + + /** + * 不完全成功,版本不匹配,但测试连接成功。 + */ + Partly_Sucess(1), + + /** + * 完全失败,直接没连上 + */ + Fully_Failed(2), + + /** + * 验证 Token 失败 + */ + Auth_Failed(3); + + private int sign; + + TestConnectionResult(int i) { + this.sign = i; + } + + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + if (value == null) { + return Auth_Failed; + } + + if (!value) { + return Fully_Failed; + } + + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } + + return Partly_Sucess; + } +} From 1380b31b6467f8f0c400e4af279227416df9de12 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:58:13 +0800 Subject: [PATCH 177/187] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +- .../java/com/fr/env/TestConnectionResult.java | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 21b5d2b2ca..742b6cc16b 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -541,7 +541,7 @@ public class RemoteEnvPane extends BasicBeanPane { if (result == TestConnectionResult.Partly_Sucess) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } if (result == TestConnectionResult.Fully_Failed) { @@ -557,8 +557,6 @@ public class RemoteEnvPane extends BasicBeanPane { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 3aaf594ecb..357d4f38cb 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,41 +1,40 @@ package com.fr.env; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; /** + * 测试连接的结果。 + * 不改变原有逻辑的情况下,加入一层转化。 + * 根据这里的转化结果,判断需要提示哪些内容。 + * * created by Harrison on 2018/12/20 **/ public enum TestConnectionResult { /** * 完全成功, 版本匹配,测试连接成功。 */ - Fully_Success(0), + Fully_Success, /** * 不完全成功,版本不匹配,但测试连接成功。 */ - Partly_Sucess(1), + Partly_Sucess, /** * 完全失败,直接没连上 */ - Fully_Failed(2), + Fully_Failed, /** * 验证 Token 失败 */ - Auth_Failed(3); + Auth_Failed; - private int sign; - - TestConnectionResult(int i) { - this.sign = i; - } - - public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { if (value == null) { return Auth_Failed; } @@ -43,13 +42,21 @@ public enum TestConnectionResult { if (!value) { return Fully_Failed; } + try { - String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } - if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { - return Fully_Success; + return Partly_Sucess; + } catch (Exception e) { + + // 发生异常,说明没连接上。返回完全失败。 + FineLoggerFactory.getLogger().error(e.getMessage()); + return Fully_Failed; } - return Partly_Sucess; + } } From fcdb68c2fcedd59e37749bef190d8341f640497e Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:24:24 +0800 Subject: [PATCH 178/187] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=8B=E9=80=BB=E8=BE=91=E3=80=82?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B9=E4=BE=BF=E7=90=86=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 725272a153..58f22d1b64 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -98,7 +98,8 @@ public class EnvChangeEntrance { return false; } - if (versionCheck(selectedEnv)) { + // 如果版本不一致,且确认 不继续 连接,这里返回 false. + if (!versionCheckAndConfirm(selectedEnv)) { return false; } @@ -151,37 +152,47 @@ public class EnvChangeEntrance { } /** - * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 - * 当选择 ok 时,才继续。 + * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当用户确认选择 ok 时,才继续。 * * @param selectedEnv 选择的环境 * @return 是否一致 + * 1. 非远程环境 , 返回 true + * 2. 远程环境 + * 2.1 不匹配, + * 2.1.1 当选择 ok , 返回 true + * 2.1.2 当选择 no, 返回 false + * 2.2 匹配, 返回 true * @throws Exception 异常 */ - private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + private boolean versionCheckAndConfirm(DesignerWorkspaceInfo selectedEnv) throws Exception { if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { WorkspaceConnectionInfo info = selectedEnv.getConnection(); String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); - if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return true; + } - final List result = new ArrayList<>(1); - PopTipStrategy.NOW.showTip(new PopTip() { - @Override - public void show() { - String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; - int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), - UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); - result.add(choice); - } - }); + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); - return result.size() != 0 && result.get(0) == 1; - } + // 只有选择 yes , 这里的值才为 0, 返回 true + // 否着返回 false, 将不进行下面的连接操作。 + return result.size() != 0 && result.get(0) == 0; } - return false; + + return true; } /** From 02dd1b00793e08c381d26f541d47f7ce2e94aac8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:43:14 +0800 Subject: [PATCH 179/187] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=BF=98=E4=BA=86=E6=B3=A8=E9=87=8A=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 742b6cc16b..dc764153ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -604,7 +604,6 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); - //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); From b912d85688410664c67e612bb6ca13762dbc5d39 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 21 Dec 2018 14:02:44 +0800 Subject: [PATCH 180/187] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E5=8F=91=E9=80=81=E5=89=8D?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=202.SEND=5FDELAY=E5=8E=9F=E5=85=88=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=9C=89=E8=AF=AF=EF=BC=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 157 +++++++++++++----- 1 file changed, 118 insertions(+), 39 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 0398189d9c..61b583c615 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -5,11 +5,6 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.config.MarketConfig; -import com.fr.data.core.db.DBUtils; -import com.fr.data.core.db.dialect.DialectFactory; -import com.fr.data.core.db.dml.Delete; -import com.fr.data.core.db.dml.Select; -import com.fr.data.core.db.dml.Table; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; @@ -19,18 +14,13 @@ import com.fr.general.DateUtils; import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; import com.fr.general.http.HttpToolbox; import com.fr.intelli.record.FocusPoint; -import com.fr.intelli.record.MetricException; import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.log.message.ParameterMessage; -import com.fr.record.DBRecordXManager; -import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -58,17 +48,15 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /** * @author neil @@ -79,7 +67,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { // 24小时上传一次 private static final long DELTA = 24 * 3600 * 1000L; - private static final long SEND_DELAY = 30 * 1000L; + private static final long SEND_DELAY = 300 * 1000L; private static final String FILE_NAME = "fr.info"; private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP = "StartStop"; @@ -226,12 +214,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - JSONArray content = null; - try { - content = getFunctionsContent(currentTime, lastTime); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONArray content = getFunctionsContent(currentTime, lastTime); boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); @@ -443,7 +426,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ + public JSONArray getFunctionsContent(long current, long last) { //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); @@ -452,21 +435,20 @@ public class InformationCollector implements XMLReadable, XMLWriter { .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - JSONArray temp = new JSONArray(); + TreeSet focusPointsList = new TreeSet<>(); if(!focusPoints.isEmpty()){ for(int i=0;i< focusPoints.getList().size();i++){ FocusPoint focusPoint = focusPoints.getList().get(i); if(focusPoint != null){ if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ - temp.put(getOneRecord(focusPoint)); + focusPointsList.add(getOneRecord(focusPoint)); } else { count = 0; - functionArray.put(temp); - temp = new JSONArray(); - temp.put(getOneRecord(focusPoint)); + functionArray.put(setToJSONArray(focusPointsList)); + focusPointsList.add(getOneRecord(focusPoint)); } if(i == (focusPoints.getList().size() -1)){ - functionArray.put(temp); + functionArray.put(setToJSONArray(focusPointsList)); } } } @@ -478,16 +460,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { return functionArray; } - private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - return record; + private FunctionRecord getOneRecord(FocusPoint focusPoint) { + FunctionRecord functionRecord = new FunctionRecord(); + functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); + functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); + functionRecord.setSource(focusPoint.getSource()); + functionRecord.setTime(focusPoint.getTime().getTime()); + functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); + functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); + functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); + return functionRecord; + } + + private JSONArray setToJSONArray(Set set) throws JSONException { + JSONArray jsonArray = new JSONArray(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + FunctionRecord functionRecord = (FunctionRecord)iter.next(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, functionRecord.getId()); + record.put(ATTR_TEXT, functionRecord.getText()); + record.put(ATTR_SOURCE, functionRecord.getSource()); + record.put(ATTR_TIME, functionRecord.getTime()); + record.put(ATTR_TITLE, functionRecord.getTitle()); + record.put(ATTR_USER_NAME, functionRecord.getUsername()); + record.put(ATTR_UUID, functionRecord.getUuid()); + jsonArray.put(record); + } + return jsonArray; } private class StartStopTime implements XMLReadable, XMLWriter { @@ -529,4 +528,84 @@ public class InformationCollector implements XMLReadable, XMLWriter { } + private class FunctionRecord implements Comparable{ + private String id; + private String text; + private int source; + private long time; + private String title; + private String username; + private String uuid; + + public FunctionRecord(){ + + } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getSource() { + return source; + } + + public void setSource(int source) { + this.source = source; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public int compareTo(Object o) { + FunctionRecord functionRecord = (FunctionRecord) o; + if(this.getId().equals((functionRecord.getId())) && this.getText().equals(functionRecord.getText()) + && this.getSource() == functionRecord.getSource() && this.getTime() == functionRecord.getTime() + && this.getTitle().equals(functionRecord.getTitle()) && this.getUsername().equals(functionRecord.getUsername()) + && this.getUuid().equals(functionRecord.getUuid())){ + return 0; + } + return 1; + } + } } \ No newline at end of file From 0fcdd85bdb2801154a85c4f1c6452df57663bedb Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 16:26:57 +0800 Subject: [PATCH 181/187] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=B0=86=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5=E5=92=8C=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E8=BF=9E=E6=8E=A5=E6=8F=90=E7=A4=BA=E5=88=86=E5=BC=80?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index dc764153ca..d2953eeb6a 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -540,7 +540,7 @@ public class RemoteEnvPane extends BasicBeanPane { } if (result == TestConnectionResult.Partly_Sucess) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test")); uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } From bce83a67feec1a409d8c0c289cd7aa535603c7a1 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 24 Dec 2018 13:41:27 +0800 Subject: [PATCH 182/187] =?UTF-8?q?REPORT-13626=20=E6=98=A8=E5=A4=A9?= =?UTF-8?q?=E4=BC=A0=E7=9A=84=E6=B2=A1=E5=90=88=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itextfield/UIAutoCompletionField.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java index 5672a8502d..967aeddbb9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java @@ -2,6 +2,8 @@ package com.fr.design.gui.itextfield; import com.fr.design.gui.imenu.UIListPopup; import com.fr.general.ComparatorUtils; +import com.fr.stable.OperatingSystem; + import javax.swing.JList; import javax.swing.UIManager; import javax.swing.event.DocumentEvent; @@ -82,6 +84,9 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen } private void textChanged() { + if (OperatingSystem.isMacOS()) { + return; + } if (!popup.isVisible()) { showPopup(); requestFocus(); From db4aca22e43cff97c53e077bbfb76b9ff30b82d2 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 24 Dec 2018 15:56:19 +0800 Subject: [PATCH 183/187] 1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 408bc7be85..7be92004bb 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ - 4.0.0 + 4.0.0 com.fr.report From e80551f3cb4bc2f9422807227da7e5fdceb58555 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 24 Dec 2018 15:56:49 +0800 Subject: [PATCH 184/187] . --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7be92004bb..408bc7be85 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ - 4.0.0 + 4.0.0 com.fr.report From 9eead4389df6551742e65a70223f67e108557647 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 27 Dec 2018 15:29:06 +0800 Subject: [PATCH 185/187] . --- .../design/fun/JavaScriptActionProvider.java | 17 ++--------------- .../impl/AbstractJavaScriptActionProvider.java | 18 +++++------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java index 5f1f1aa5aa..93b6cab2fe 100644 --- a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java @@ -2,12 +2,11 @@ package com.fr.design.fun; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.mark.Mutable; /** - * 控件的事件扩展接口 + * Created by zack on 2015/8/14. */ public interface JavaScriptActionProvider extends Mutable{ @@ -15,21 +14,9 @@ public interface JavaScriptActionProvider extends Mutable{ int CURRENT_LEVEL = 1; - /** - * 事件的界面 - */ FurtherBasicBeanPane getJavaScriptActionPane(); - /** - * 这个界面在哪些类型模板设计的时候会出现 - * @see com.fr.design.mainframe.JWorkBook - * @see com.fr.design.mainframe.JForm - */ - boolean accept(JTemplate template); - - @Deprecated FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane); - @Deprecated - boolean isSupportType(); + boolean isSupportType(); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java index 7f57f35a5d..9928124cfb 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java @@ -3,8 +3,6 @@ package com.fr.design.fun.impl; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -28,17 +26,11 @@ public abstract class AbstractJavaScriptActionProvider extends AbstractProvider public FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane) { return getJavaScriptActionPane(); } - - @Override - public boolean accept(JTemplate template) { - // 这里只是为了兼容原来的isSupportType方法 - boolean result = isSupportType(); - if (result) { - return true; - } - return true; - } - + + /** + * 判断是否是支持的类型(cpt,frm),默认是 + * @return + */ @Override public boolean isSupportType(){ return true; From cc9aec02ff5957f4fd5d0657a02bfde94900e83a Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 27 Dec 2018 15:30:28 +0800 Subject: [PATCH 186/187] . --- .../java/com/fr/design/javascript/JavaScriptActionPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java index 3b025ae1fa..fb19c89d7f 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java @@ -7,9 +7,9 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.write.submit.DBManipulationPane; import com.fr.form.ui.WebContentUtils; + import com.fr.js.JavaScript; import javax.swing.BorderFactory; @@ -46,7 +46,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { Set javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); if (javaScriptActionProviders != null) { for (JavaScriptActionProvider jsp : javaScriptActionProviders) { - if(jsp.accept(DesignerContext.getDesignerFrame().getSelectedJTemplate())){ + if(jsp.isSupportType()){ paneList.add(jsp.getJavaScriptActionPane(this)); } } From 8c7b7ec9f366a1007b894ee9453a674eb1202075 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 27 Dec 2018 15:31:47 +0800 Subject: [PATCH 187/187] . --- .../AbstractExtendedChartReportDataPane.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index e42707a62a..aa6bbf1a04 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -6,14 +6,13 @@ import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.Component; -import java.awt.BorderLayout; +import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -50,17 +49,16 @@ public abstract class AbstractExtendedChartReportDataPane