From 7afeb646a28a9367cac208a582af43004d992ed1 Mon Sep 17 00:00:00 2001 From: zhouping Date: Wed, 21 Sep 2016 17:31:17 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-341:=E8=A1=A8=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E8=BE=B9=E8=B7=9D=E8=AE=BE=E7=BD=AE=E6=AF=94=E8=BE=83=E5=A4=A7?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99,=20=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BA=8C=E5=88=86=E5=87=BA=E6=9D=A5=E6=95=88=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/designer/creator/XWFitLayout.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 8f4df6e74..20b12d888 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -53,6 +53,8 @@ public class XWFitLayout extends XLayoutContainer { super(widget, initSize); initPercent(); + + widget.setResolutionScaling(containerPercent); } //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% From 8ac23ad7c7c318f3062a93190e3ba8f02014ed43 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 22 Sep 2016 16:02:14 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DownLoadDependenceUI.java | 71 +++++++++++++++++-- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java index 5b0de740c..67d3a0354 100644 --- a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java +++ b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java @@ -20,12 +20,14 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; +import java.io.*; import java.net.HttpURLConnection; -import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; + +import org.apache.tools.zip.ZipEntry; +import org.apache.tools.zip.ZipFile; + /** * Created by hufan on 2016/9/5. */ @@ -198,7 +200,7 @@ public class DownLoadDependenceUI implements ActionListener { } //安装文件 - IOUtils.unzip(new File(temp), FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); + unZipFiles(temp, FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); } else { result = false; @@ -254,14 +256,12 @@ public class DownLoadDependenceUI implements ActionListener { int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Plugin_Plugin") + Inter.getLocText("FR-Designer-Need") + Inter.getLocText("FR-Designer-Dependence") + Inter.getLocText("FR-Designer-Support") + "," + Inter.getLocText("FR-Designer-Dependence_Need_Install") + "(" + showFileLength() + " m)?", "install tooltip", JOptionPane.YES_NO_OPTION); if (choose == 0) {//下载安装 if (!connectToServer()) { - //JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error"), "alert", JOptionPane.ERROR_MESSAGE); throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error")); } //安装依赖环境 if (install()) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Dependence_Install_Succeed") + "!!"); } else { - //JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Dependence_Install_Failed") + "!!", "alert", JOptionPane.ERROR_MESSAGE); throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed")); } }else {//不选择下载,则不安装图标插件 @@ -272,4 +272,61 @@ public class DownLoadDependenceUI implements ActionListener { private String showFileLength() { return totalSize == -1 ? "NAN" : totalSize / Math.pow(10, 6) + ""; } + + + @SuppressWarnings("unchecked") + public static boolean unZipFiles(String zipFileName, String extPlace) throws Exception { + System.setProperty("sun.zip.encoding", System.getProperty("sun.jnu.encoding")); + try { + (new File(extPlace)).mkdirs(); + File f = new File(zipFileName); + ZipFile zipFile = new ZipFile(zipFileName,"GBK"); //处理中文文件名乱码的问题 + if((!f.exists()) && (f.length() <= 0)) { + throw new Exception("no zip file!"); + } + String strPath, gbkPath, strtemp; + File tempFile = new File(extPlace); + strPath = tempFile.getAbsolutePath(); + Enumeration e = zipFile.getEntries(); + while(e.hasMoreElements()){ + ZipEntry zipEnt = (ZipEntry) e.nextElement(); + gbkPath=zipEnt.getName(); + if(zipEnt.isDirectory()){ + strtemp = strPath + File.separator + gbkPath; + File dir = new File(strtemp); + dir.mkdirs(); + continue; + } else { + //读写文件 + InputStream is = zipFile.getInputStream(zipEnt); + BufferedInputStream bis = new BufferedInputStream(is); + gbkPath=zipEnt.getName(); + strtemp = strPath + File.separator + gbkPath; + + //建目录 + String strsubdir = gbkPath; + for(int i = 0; i < strsubdir.length(); i++) { + if(strsubdir.substring(i, i + 1).equalsIgnoreCase("/")) { + String temp = strPath + File.separator + strsubdir.substring(0, i); + File subdir = new File(temp); + if(!subdir.exists()) + subdir.mkdir(); + } + } + FileOutputStream fos = new FileOutputStream(strtemp); + BufferedOutputStream bos = new BufferedOutputStream(fos); + int c; + while((c = bis.read()) != -1) { + bos.write((byte) c); + } + bos.close(); + fos.close(); + } + } + return true; + } catch(Exception e) { + FRContext.getLogger().info(e.getMessage()); + return false; + } + } } From 3ace747624f84006b0ff2d932e284160bdf87ab5 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 22 Sep 2016 16:18:23 +0800 Subject: [PATCH 3/7] update --- .../DownLoadDependenceUI.java | 59 +------------------ 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java index 67d3a0354..9edfc21fe 100644 --- a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java +++ b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java @@ -200,7 +200,7 @@ public class DownLoadDependenceUI implements ActionListener { } //安装文件 - unZipFiles(temp, FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); + IOUtils.unZipFilesGBK(temp, FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); } else { result = false; @@ -272,61 +272,4 @@ public class DownLoadDependenceUI implements ActionListener { private String showFileLength() { return totalSize == -1 ? "NAN" : totalSize / Math.pow(10, 6) + ""; } - - - @SuppressWarnings("unchecked") - public static boolean unZipFiles(String zipFileName, String extPlace) throws Exception { - System.setProperty("sun.zip.encoding", System.getProperty("sun.jnu.encoding")); - try { - (new File(extPlace)).mkdirs(); - File f = new File(zipFileName); - ZipFile zipFile = new ZipFile(zipFileName,"GBK"); //处理中文文件名乱码的问题 - if((!f.exists()) && (f.length() <= 0)) { - throw new Exception("no zip file!"); - } - String strPath, gbkPath, strtemp; - File tempFile = new File(extPlace); - strPath = tempFile.getAbsolutePath(); - Enumeration e = zipFile.getEntries(); - while(e.hasMoreElements()){ - ZipEntry zipEnt = (ZipEntry) e.nextElement(); - gbkPath=zipEnt.getName(); - if(zipEnt.isDirectory()){ - strtemp = strPath + File.separator + gbkPath; - File dir = new File(strtemp); - dir.mkdirs(); - continue; - } else { - //读写文件 - InputStream is = zipFile.getInputStream(zipEnt); - BufferedInputStream bis = new BufferedInputStream(is); - gbkPath=zipEnt.getName(); - strtemp = strPath + File.separator + gbkPath; - - //建目录 - String strsubdir = gbkPath; - for(int i = 0; i < strsubdir.length(); i++) { - if(strsubdir.substring(i, i + 1).equalsIgnoreCase("/")) { - String temp = strPath + File.separator + strsubdir.substring(0, i); - File subdir = new File(temp); - if(!subdir.exists()) - subdir.mkdir(); - } - } - FileOutputStream fos = new FileOutputStream(strtemp); - BufferedOutputStream bos = new BufferedOutputStream(fos); - int c; - while((c = bis.read()) != -1) { - bos.write((byte) c); - } - bos.close(); - fos.close(); - } - } - return true; - } catch(Exception e) { - FRContext.getLogger().info(e.getMessage()); - return false; - } - } } From b9e4c576f49232ef8d344cb25276be32239afa8e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 22 Sep 2016 16:19:16 +0800 Subject: [PATCH 4/7] update --- .../design/extra/plugindependence/DownLoadDependenceUI.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java index 9edfc21fe..eb7af116b 100644 --- a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java +++ b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java @@ -22,12 +22,8 @@ import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.*; import java.net.HttpURLConnection; -import java.util.Enumeration; import java.util.List; -import org.apache.tools.zip.ZipEntry; -import org.apache.tools.zip.ZipFile; - /** * Created by hufan on 2016/9/5. */ From 5ec25e6264a8e582dffcc36c10fec37ed207a457 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 22 Sep 2016 20:19:01 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E6=8C=89=E9=92=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/DesignerFrameUpButtonProvider.java | 24 +++++++++++++++++++ .../AbstractDsinFrameUpButtonProvider.java | 23 ++++++++++++++++++ .../fr/design/mainframe/DesignerFrame.java | 19 +++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 24 ++++++++++++++++++- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java diff --git a/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java b/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java new file mode 100644 index 000000000..b6a86ae81 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java @@ -0,0 +1,24 @@ +package com.fr.design.fun; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.stable.fun.mark.Mutable; + +/** + * 设计器面板最上方的按钮接口(保存,赋值,撤销同级) + * Coder: zack + * Date: 2016/9/22 + * Time: 15:40 + */ +public interface DesignerFrameUpButtonProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "DesignerFrameUpButtonProvider"; + + /** + * 根据当前的设计状态返回最上层工具按钮 + * @param menuState 现在设计器的设计状态 + * @return 按钮 + */ + UIButton[] getUpButtons(int menuState); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java new file mode 100644 index 000000000..bd1f70829 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java @@ -0,0 +1,23 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.DesignerFrameUpButtonProvider; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.stable.fun.mark.API; + +/** + * Coder: zack + * Date: 2016/9/22 + * Time: 15:50 + */ +@API(level = DesignerFrameUpButtonProvider.CURRENT_LEVEL) +public abstract class AbstractDsinFrameUpButtonProvider implements DesignerFrameUpButtonProvider { + @Override + public UIButton[] getUpButtons(int menuState) { + return new UIButton[0]; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index a1f5f16a4..329b63155 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -464,9 +464,28 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //添加分享按钮 addShareButton(); + + //添加插件中的按钮 + addExtraButtons(); return combineUp; } + + private void addExtraButtons(){ + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if(jt == null){ + return; + } + + + UIButton[] extraButtons = jt.createExtraButtons(); + for (int i = 0; i < extraButtons.length; i++) { + combineUp.add(extraButtons[i]); + } + if (extraButtons.length > 0) { + combineUp.addSeparator(new Dimension(2, 16)); + } + } private void addShareButton(){ JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 8478e2500..58060d91a 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -8,8 +8,8 @@ import com.fr.base.io.IOFile; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.TableDataSourceAction; -import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.UndoAction; import com.fr.design.actions.file.SaveAsTemplateAction; @@ -19,6 +19,7 @@ import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.TemplateTreePane; +import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.PreviewProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -37,9 +38,12 @@ import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.FileNodeFILE; import com.fr.file.MemFILE; +import com.fr.form.ui.NoneWidget; +import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -51,6 +55,7 @@ import java.awt.*; import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.Set; import java.util.regex.Pattern; /** @@ -505,6 +510,9 @@ public abstract class JTemplate> ex public boolean saveShareFile(){ return true; } + public Widget getSelectElementCase(){ + return new NoneWidget(); + } protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){ return new FILEChooserPane(true, isShowLoc); @@ -957,4 +965,18 @@ public abstract class JTemplate> ex public boolean acceptToolbarItem(Class clazz) { return true; } + + /** + * 加载插件中的按钮 + * @return 按钮组 + */ + public UIButton[] createExtraButtons() { + Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); + UIButton[] uiButtons = new UIButton[0]; + for (DesignerFrameUpButtonProvider provider : providers) { + uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState())); + } + + return uiButtons; + } } \ No newline at end of file From 4fb11bb9f29b1ee5b7b361b6aab9ebed0f7a303f Mon Sep 17 00:00:00 2001 From: fr_shine Date: Fri, 23 Sep 2016 10:05:50 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=86=85=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E4=B9=9F=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/area/ChartAreaPane.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java index 673ac0194..d10cb182b 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java @@ -45,13 +45,8 @@ public class ChartAreaPane extends ThirdTabPane implements AutoSelectedPa if(parent instanceof ChartStylePane) { plotPane.setParentPane((ChartStylePane)parent); } - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jTemplate.isJWorkBook() || jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) { - //表单中的图表组件的图表区挪到控件属性表的样式中了 - paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane)); - }else if(jTemplate.isChartBook()){ - paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane)); - } + + paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane)); if(plot.isSupportPlotBackground()) { paneList.add(new NamePane(plotPane.title4PopupWindow(), plotPane)); From 32046b798f090c98b527481d1d3fe6fe8d9ce838 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 23 Sep 2016 11:05:42 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E6=BC=8F=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/src/com/fr/design/mainframe/JForm.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 848f0da4c..ef18f0713 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -10,6 +10,7 @@ import com.fr.design.designer.beans.actions.FormDeleteAction; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XComponent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; @@ -35,6 +36,7 @@ import com.fr.file.FILE; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; +import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; @@ -756,4 +758,10 @@ public class JForm extends JTemplate implements BaseJForm { return WorkBookSupportable.class.isAssignableFrom(clazz); } + @Override + public Widget getSelectElementCase() { + FormSelection selection = formDesign.getSelectionModel().getSelection(); + XCreator creator = selection.getSelectedCreator(); + return creator.toData(); + } } \ No newline at end of file