diff --git a/build.master.gradle b/build.master.gradle new file mode 100644 index 0000000000..c5cc1b92da --- /dev/null +++ b/build.master.gradle @@ -0,0 +1,86 @@ +apply plugin: "java" +tasks.withType(JavaCompile){ + options.encoding = "UTF-8" +} + +def basicDir="../../" +def libDir="${basicDir}/finereport-lib-stable" +//获取什么分支名 +FileTree files =fileTree(dir:"./",include:"build.*.gradle") +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) +def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) + +task appletJar<<{ + + ant{ + mkdir(dir:"${libDir}/tmp-${branchName}") + mkdir(dir:"build/classes/") + copy(todir:"build/classes/"){ + fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") + + } + unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + jar(jarfile:"build/libs/fr-applet-8.0.jar"){ + fileset(dir:"build/classes"){ + exclude(name:"*.*") + exclude(name:"bin/*.*") + exclude(name:"classes/**") + exclude(name:"com/fr/schedule/**") + exclude(name:"com/fr/cell/**") + exclude(name:"com/fr/dialog/**") + exclude(name:"com/fr/view/**") + exclude(name:"com/fr/web/**") + exclude(name:"com/fr/fs/**") + exclude(name:"com/fr/design/**") + exclude(name:"com/fr/start/**") + exclude(name:"com/fr/process/**") + } + fileset(dir:"${libDir}/tmp-${branchName}"){ + include(name:"javax/mail/**") + include(name:"javax/servlet/**") + include(name:"org/freehep/**") + include(name:"com/fr/third/JAI/**") + include(name:"com/fr/third/antlr/**") + include(name:"com/fr/third/javax/**") + include(name:"com/sun/xml/**") + include(name:"javax/xml/**") + + } + fileset(dir:"build/classes"){ + include(name:"com/fr/web/*.class") + include(name:"com/fr/web/attr/*.class") + } + } + delete(dir:"${libDir}/tmp-${branchName}") + def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" + def keystore="frapplet.store" + def keycert="fr.cert" + def keypassword="123456" + def keyalias="fr" + + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") + } + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") + } + + exec(executable:"${jdk6home}/bin/jarsigner"){ + arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") + } + delete(file:"${keystore}") + delete(file:"${keycert}") + delete(dir:"build/classes") + + } + +} \ No newline at end of file diff --git a/build.release.gradle b/build.release.gradle new file mode 100644 index 0000000000..44aacadb4d --- /dev/null +++ b/build.release.gradle @@ -0,0 +1,85 @@ +apply plugin: "java" +tasks.withType(JavaCompile){ + options.encoding = "UTF-8" +} +def basicDir="../../" +def libDir="${basicDir}/finereport-lib-stable/master" +//获取什么分支名 +FileTree files =fileTree(dir:"./",include:"build.*.gradle") +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) +def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) + +task appletJar<<{ + + ant{ + mkdir(dir:"${libDir}/tmp-${branchName}") + mkdir(dir:"build/classes/") + copy(todir:"build/classes/"){ + fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") + + } + unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + jar(jarfile:"build/libs/fr-applet-8.0.jar"){ + fileset(dir:"build/classes"){ + exclude(name:"*.*") + exclude(name:"bin/*.*") + exclude(name:"classes/**") + exclude(name:"com/fr/schedule/**") + exclude(name:"com/fr/cell/**") + exclude(name:"com/fr/dialog/**") + exclude(name:"com/fr/view/**") + exclude(name:"com/fr/web/**") + exclude(name:"com/fr/fs/**") + exclude(name:"com/fr/design/**") + exclude(name:"com/fr/start/**") + exclude(name:"com/fr/process/**") + } + fileset(dir:"${libDir}/tmp-${branchName}"){ + include(name:"javax/mail/**") + include(name:"javax/servlet/**") + include(name:"org/freehep/**") + include(name:"com/fr/third/JAI/**") + include(name:"com/fr/third/antlr/**") + include(name:"com/fr/third/javax/**") + include(name:"com/sun/xml/**") + include(name:"javax/xml/**") + + } + fileset(dir:"build/classes"){ + include(name:"com/fr/web/*.class") + include(name:"com/fr/web/attr/*.class") + } + } + delete(dir:"${libDir}/tmp-${branchName}") + def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" + def keystore="frapplet.store" + def keycert="fr.cert" + def keypassword="123456" + def keyalias="fr" + + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") + } + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") + } + + exec(executable:"${jdk6home}/bin/jarsigner"){ + arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") + } + delete(file:"${keystore}") + delete(file:"${keycert}") + delete(dir:"build/classes") + + } + +} \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java index 2bf3856908..f5fd94a321 100644 --- a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -57,9 +57,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { @Override - public char getMnemonic() { - return 'P'; - } + public char getMnemonic() { return 'P'; } @Override public String getMenuName() { diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 79c60d2dc2..a3df2ba3e8 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.fun.MenuHandler; import com.fr.design.menu.KeySetUtils; -import com.fr.design.parameter.ParameterPropertyPane; import com.fr.general.Inter; import com.fr.page.ReportSettingsProvider; import com.fr.design.file.HistoryTemplateListPane; @@ -103,7 +102,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { // 插入菜单 private MenuDef createInsertMenuDef() { - MenuDef menuDef = new MenuDef(Inter.getLocText("M-Insert"), 'I'); + MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Insert"), 'I'); menuDef.setAnchor(MenuHandler.INSERT); // 单元格菜单 menuDef.addShortCut(DeprecatedActionManager.getCellMenu(this)); diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index 4b8572b710..43fc3c6fc4 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -20,9 +20,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityToolBarPane; -import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JWorkBook; -import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.*; import com.fr.design.module.DesignModuleFactory; @@ -246,7 +244,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus isdelayItem.setSelected(reportParameterAttr.isDelayPlaying()); isshowWindowItem.setSelected(reportParameterAttr.isShowWindow()); isEditing = true; - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); ParameterBridge bridge = paraDesignEditor.getParaComponent(); if (parameterUI != null) { bridge.setDelayDisplayContent(reportParameterAttr.isDelayPlaying()); diff --git a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java index 43471b751d..2b1f44f389 100644 --- a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java +++ b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java @@ -19,8 +19,6 @@ public class AppFitBrowserPane extends BasicBeanPane { private MobileRadioGroupPane horizionPane; //竖屏设置面板 private MobileRadioGroupPane verticalPane; - //缩放选项面板 - private MobileRadioCheckPane radioCheckPane; //效果预览面板 private AppFitPreviewPane appFitPreviewPane; @@ -36,16 +34,13 @@ public class AppFitBrowserPane extends BasicBeanPane { JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); - radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom")); ActionListener actionListener = getAppPreviewActionListener(); horizionPane.addActionListener(actionListener); verticalPane.addActionListener(actionListener); fitOpsPane.add(horizionPane, BorderLayout.NORTH); - fitOpsPane.add(verticalPane, BorderLayout.CENTER); - fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH); + fitOpsPane.add(verticalPane, BorderLayout.SOUTH); borderPane.add(fitOpsPane); this.add(borderPane); - } public void setAppFitPreviewPane(AppFitPreviewPane appFitPreviewPane) { @@ -54,7 +49,7 @@ public class AppFitBrowserPane extends BasicBeanPane { //纵向和横向独立设置 public int[] getCurrentFitOptions() { - return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()}; + return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()}; } @Override @@ -64,7 +59,7 @@ public class AppFitBrowserPane extends BasicBeanPane { } horizionPane.populateBean(ob.getHorziontalAttr()); verticalPane.populateBean(ob.getVerticalAttr()); - radioCheckPane.populateBean(ob.isZoom()); +// radioCheckPane.populateBean(ob.isZoom()); appFitPreviewPane.refreshPreview(getCurrentFitOptions()); } @@ -73,8 +68,9 @@ public class AppFitBrowserPane extends BasicBeanPane { public ElementCaseMobileAttr updateBean() { MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean(); - boolean isZoom = radioCheckPane.updateBean(); - return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); +// boolean isZoom = radioCheckPane.updateBean(); +// return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); + return new ElementCaseMobileAttr(horizonState, verticalState); } @Override diff --git a/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java b/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java new file mode 100644 index 0000000000..bea0745cb5 --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java @@ -0,0 +1,70 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.mobile.MobileRadioCheckPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.report.mobile.ElementCaseMobileAttr; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by 方磊 on 2016/11/8. + */ +public class MobileToolBarPane extends BasicBeanPane { + //缩放选项面板 + private MobileRadioCheckPane zoomCheckPane; + + //刷新选项面板 + private MobileRadioCheckPane refreshCheckPane; + + public MobileToolBarPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + UILabel uiLabel = new UILabel("html5"); + uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15)); + zoomCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom")); + refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh")); + + toobarsPane.add(uiLabel, BorderLayout.WEST); + toobarsPane.add(zoomCheckPane, BorderLayout.CENTER); + toobarsPane.add(refreshCheckPane, BorderLayout.EAST); + borderPane.add(toobarsPane); + this.add(borderPane); + } + + @Override + public void populateBean(ElementCaseMobileAttr ob) { + if (ob == null) { + ob = new ElementCaseMobileAttr(); + } + this.zoomCheckPane.populateBean(ob.isZoom()); + this.refreshCheckPane.populateBean(ob.isRefresh()); + } + + @Override + public ElementCaseMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(ElementCaseMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setZoom(this.zoomCheckPane.updateBean()); + mobileAttr.setRefresh(this.refreshCheckPane.updateBean()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Toolbar"); + } +} diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index 3c00232194..5b97137102 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -1,6 +1,7 @@ package com.fr.design.report.mobile; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.general.Inter; import com.fr.report.mobile.ElementCaseMobileAttr; @@ -16,22 +17,30 @@ public class ReportMobileAttrPane extends BasicBeanPane{ private MobileUseHtmlGroupPane htmlGroupPane; + //工具栏容器 + private MobileToolBarPane mobileToolBarPane; + public ReportMobileAttrPane() { initComponents(); } private void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); AppFitPreviewPane appFitPreviewPane = new AppFitPreviewPane(); - + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + JPanel jPanel = new JPanel(); + jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); + jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); appFitBrowserPane = new AppFitBrowserPane(); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); - this.add(appFitBrowserPane); + jPanel.add(appFitBrowserPane); - this.add(htmlGroupPane = new MobileUseHtmlGroupPane()); + jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane()); - this.add(appFitPreviewPane); + jPanel.add(mobileToolBarPane = new MobileToolBarPane()); + + jPanel.add(appFitPreviewPane); + UIScrollPane scrollPane = new UIScrollPane(jPanel); + this.add(scrollPane); } @Override @@ -40,7 +49,7 @@ public class ReportMobileAttrPane extends BasicBeanPane{ ob = new ElementCaseMobileAttr(); } appFitBrowserPane.populateBean(ob); - + mobileToolBarPane.populateBean(ob); htmlGroupPane.populateBean(ob); } @@ -48,7 +57,7 @@ public class ReportMobileAttrPane extends BasicBeanPane{ @Override public ElementCaseMobileAttr updateBean() { ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); - + mobileToolBarPane.updateBean(caseMobileAttr); htmlGroupPane.updateBean(caseMobileAttr); return caseMobileAttr; diff --git a/designer_base/build.release.gradle b/designer_base/build.release.gradle new file mode 100644 index 0000000000..4ed4ba12b0 --- /dev/null +++ b/designer_base/build.release.gradle @@ -0,0 +1,70 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成jar包版本 +version='8.0' +//生成jar包重命名 +jar{ + baseName='fr-designer-core' +} + + +def srcDir="." + +//指定源码路径 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//声明外部依赖 +dependencies{ + +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//复制非.java文件到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + into 'build/classes/main' + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + + + diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java similarity index 83% rename from designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java rename to designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java index 9264619d32..ee38557612 100644 --- a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java +++ b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java @@ -1,4 +1,4 @@ -package com.fr.design.report.mobile; +package com.fr.design.dialog.mobile; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -13,6 +13,9 @@ import java.awt.*; import java.util.ArrayList; import java.util.List; +/** + * 这个类要被复用,移动到design_base中去 + */ public class MobileRadioCheckPane extends BasicBeanPane { private List checkBoxes = new ArrayList(); @@ -26,16 +29,16 @@ public class MobileRadioCheckPane extends BasicBeanPane { double[] rowSize = {p}; double[] columnSize = {p,p}; - UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open")); - checkBox.setSelected(true); + UICheckBox checkBox = new UICheckBox(title); + checkBox.setSelected(false); checkBoxes.add(checkBox); Component[][] components = new Component[][]{ - new Component[]{new UILabel(title), checkBox} + new Component[]{checkBox} }; JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); this.add(fitOpsPane); } diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 0f5cb509d5..ce7e531fa8 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -31,8 +31,7 @@ import com.fr.plugin.Plugin; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLoader; -import com.fr.plugin.dependence.PluginServiceCreator; -import com.fr.plugin.dependence.PluginServiceManager; +import com.fr.share.ShareConstants; import com.fr.stable.*; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; @@ -1539,6 +1538,7 @@ public class RemoteEnv implements Env { para.put("op", "fr_remote_design"); para.put("cmd", "design_save_resource"); para.put("resource", mgr.fileName()); + para.put("class_name", mgr.getClass().getName()); para.put("current_uid", this.createUserID()); para.put("currentUsername", this.getUser()); @@ -2107,4 +2107,108 @@ public class RemoteEnv implements Env { public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception { } + + @Override + public File[] loadREUFile() throws Exception { + File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), + ShareConstants.DIR_SHARE_CACHE); + StableUtils.deleteFile(target); + StableUtils.mkdirs(target); + File cacheDir = null; + File zip = null; + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_read_reufile"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = client.getResponseStream(); + zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); + cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); + StableUtils.deleteFile(cacheDir); + StableUtils.mkdirs(cacheDir); + StableUtils.makesureFileExist(zip); + FileOutputStream out = new FileOutputStream(zip); + IOUtils.copyBinaryTo(input, out); + out.flush(); + out.close(); + IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录 + if (cacheDir.exists() && cacheDir.isDirectory()) { + return cacheDir.listFiles(new FilenameFilter() { + public boolean accept(File file, String s) { + return s.endsWith("reu"); + } + }); + } + + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } finally { + StableUtils.deleteFile(zip); + } + return new File[0]; + } + + @Override + public boolean installREUFile(File reuFile) { +// if (reuFile == null) { +// return false; +// } +// try { +// HashMap para = new HashMap(); +// para.put("op", "fr_remote_design"); +// para.put("cmd", "design_install_reufile"); +// para.put("current_uid", this.createUserID()); +// para.put("currentUsername", this.getUser()); +// para.put("reuFileName", reuFile.getName()); +// +// HttpClient client = createHttpMethod(para); +// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile))); +// InputStream input = execute4InputStream(client); +// return ComparatorUtils.equals(stream2String(input), "true"); +// } catch (Exception e) { +// return false; +// } + return false; + } + + @Override + public boolean removeREUFilesByName(String fileName) { + if (StringUtils.isEmpty(fileName)) { + return true; + } + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_remove_reufile"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + para.put("reuFileName", fileName); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + return ComparatorUtils.equals(stream2String(input), "true"); + } catch (Exception e) { + return false; + } + } + + @Override + public String getSharePath() { + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_get_share_path"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + return stream2String(input); + } catch (Exception e) { + return StringUtils.EMPTY; + } + } } \ No newline at end of file diff --git a/designer_chart/build.release.gradle b/designer_chart/build.release.gradle new file mode 100644 index 0000000000..e97176e24c --- /dev/null +++ b/designer_chart/build.release.gradle @@ -0,0 +1,66 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成jar包的版本 +version='8.0' + +def srcDir="." + +//对生成的jar包进行重命名 + +jar{ + baseName='fr-designer-chart' +} + +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//指定外部依赖 +dependencies{ +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//将非.java 文件复制到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + + } + into 'build/classes/main' + } + +} + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 7fc3c79d93..464d6aaf96 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -15,6 +15,9 @@ import javax.swing.*; import java.awt.*; public class ChartDataPane extends AbstractChartAttrPane { + + public static final int LABEL_WIDTH = 85; + public static final int LABEL_HEIGHT = 20; protected DataContentsPane contentsPane; protected AttributeChangeListener listener; diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index d5aa2d93ec..cae7afc39a 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -57,7 +57,7 @@ public class NormalChartDataPane extends DataContentsPane { JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE,0)); northPane.add(jcb, BorderLayout.CENTER); UILabel label1 = new UILabel(Inter.getLocText("Chart-Data_Resource") + ":", SwingConstants.RIGHT); - label1.setPreferredSize(new Dimension(75,20)); + label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 2bed0cb2d4..3b6c71ef1e 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -32,7 +32,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ private void initDataPane() { UILabel label = new BoldFontTextLabel(Inter.getLocText("Chart-DS_TableData") + ":", SwingConstants.RIGHT) ; - label.setPreferredSize(new Dimension(75,20)); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); tableDataPane = new DatabaseTableDataPane(label) { @Override protected void userEvent() { diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java index 3f1e532681..a8c1bc1f87 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java @@ -42,7 +42,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa JPanel categoryPane = new JPanel(new BorderLayout(4,0)); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); UILabel label1 = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; - label1.setPreferredSize(new Dimension(75,20)); + label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); categoryCombox.setPreferredSize(new Dimension(100,20)); categoryCombox.addItem(Inter.getLocText("Chart-Use_None")); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java index 2d5099db4d..1ef6972a96 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; 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.CalculateComboBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -76,12 +77,12 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane { this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); JPanel northPane = new JPanel(new BorderLayout(4, 0)); UILabel label1 = new UILabel(Inter.getLocText("ChartF-Series_Name_From") + ":", SwingConstants.RIGHT); - label1.setPreferredSize(new Dimension(75, 20)); + label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); this.add(northPane, BorderLayout.NORTH); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java index 85e7e693c4..a715643e0b 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.chartattr.Chart; import com.fr.design.dialog.MultiTabPane; +import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; @@ -15,6 +16,7 @@ import java.awt.*; public abstract class ChartTabPane extends MultiTabPane { private static final long serialVersionUID = 8633385688766835240L; + private boolean setTooltip = true; @Override protected void initLayout() { @@ -26,6 +28,26 @@ public abstract class ChartTabPane extends MultiTabPane { this.add(centerPane, BorderLayout.CENTER); } + //日文环境下,显示不全的,用tooltip + private void setSomeTooltipText() { + for(int i = 0, size = paneList.size(); i button.getSize().getWidth()) { + button.setToolTipText(tooltip); + } + } + } + + @Override + public void paint(Graphics g) { + super.paint(g); + if(setTooltip) { + setSomeTooltipText(); + setTooltip = false; + } + } + @Override public boolean accept(Object ob) { return false; diff --git a/designer_form/build.master.gradle b/designer_form/build.master.gradle new file mode 100644 index 0000000000..9c9764727c --- /dev/null +++ b/designer_form/build.master.gradle @@ -0,0 +1,83 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.7 +//指定生成的jar包版本 +version='8.0' + +def srcDir="." + + +//指明生成jar包的名字 +jar{ + baseName='fr-designer-report' +} +//源码所在位置 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src", +"${srcDir}/../designer/src"] + } + } +} + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//声明外部依赖 +dependencies{ +compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} + +//指明无法编译文件所在路径 +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + +//将非.java文件复制到classes文件夹下 参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") + into ('build/classes/main') + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + + } + fileset (dir:"${srcDir}/../designer/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + diff --git a/designer_form/build.release.gradle b/designer_form/build.release.gradle new file mode 100644 index 0000000000..90abcb81ee --- /dev/null +++ b/designer_form/build.release.gradle @@ -0,0 +1,83 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成的jar包版本 +version='8.0' + +def srcDir="." + + +//指明生成jar包的名字 +jar{ + baseName='fr-designer-report' +} +//源码所在位置 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src", +"${srcDir}/../designer/src"] + } + } +} + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) +//声明外部依赖 +dependencies{ +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} + +//指明无法编译文件所在路径 +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + +//将非.java文件复制到classes文件夹下 参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") + into ('build/classes/main') + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + + } + fileset (dir:"${srcDir}/../designer/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + diff --git a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java index 9f53dddcce..f69771a54a 100644 --- a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java @@ -21,6 +21,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.general.ComparatorUtils; public class WidgetPropertyTable extends AbstractPropertyTable { @@ -71,7 +72,7 @@ public class WidgetPropertyTable extends AbstractPropertyTable { if (size == 0 || size == 1) { XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection() .getSelectedCreator(); - if (designer.isRoot(creator)) { + if (ComparatorUtils.equals(creator, designer.getRootComponent())) { groups = designer.getDesignerMode().createRootDesignerPropertyGroup(); } else { groups = getCreatorPropertyGroup(designer, creator); diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java new file mode 100644 index 0000000000..0aafd8258c --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -0,0 +1,55 @@ +package com.fr.design.form.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by fanglei on 2016/11/17. + */ +public class FormMobileAttrPane extends BasicBeanPane{ + //工具栏容器 + private MobileToolBarPane mobileToolBarPane; + + static final int paddingHeight = 10; + + public FormMobileAttrPane() { + this.initComponents(); + } + + private void initComponents() { + JPanel jPanel = new JPanel(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.mobileToolBarPane = new MobileToolBarPane(); + //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 + jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); + jPanel.add("North", mobileToolBarPane); + this.add(jPanel); + } + + @Override + public void populateBean(FormMobileAttr ob) { + if (ob == null) { + ob = new FormMobileAttr(); + } + this.mobileToolBarPane.populateBean(ob); + } + + @Override + public FormMobileAttr updateBean() { + FormMobileAttr caseMobileAttr = new FormMobileAttr(); + this.mobileToolBarPane.updateBean(caseMobileAttr); + return caseMobileAttr; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } +} diff --git a/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java b/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java new file mode 100644 index 0000000000..c46c98ec27 --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java @@ -0,0 +1,64 @@ +package com.fr.design.form.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.mobile.MobileRadioCheckPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by 方磊 on 2016/11/8. + */ +public class MobileToolBarPane extends BasicBeanPane { + //刷新选项面板 + private MobileRadioCheckPane refreshCheckPane; + + public MobileToolBarPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + UILabel uiLabel = new UILabel("html5"); + uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15)); + this.refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh")); + + toobarsPane.add(uiLabel, BorderLayout.WEST); + toobarsPane.add(refreshCheckPane, BorderLayout.EAST); + borderPane.add(toobarsPane); + this.add(borderPane); + } + + @Override + public void populateBean(FormMobileAttr ob) { + if (ob == null) { + ob = new FormMobileAttr(); + } + this.refreshCheckPane.populateBean(ob.isRefresh()); + } + + @Override + public FormMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(FormMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setRefresh(this.refreshCheckPane.updateBean()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Toolbar"); + } + +} diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index ca84e44c03..f31a64eedf 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -37,30 +37,6 @@ public class ComponentTree extends JTree { this.setTransferHandler(new TreeTransferHandler()); this.refreshTreeRoot(); addTreeSelectionListener(designer); - - this.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - - @Override - public void mousePressed(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - }); setEditable(true); } @@ -121,20 +97,6 @@ public class ComponentTree extends JTree { scrollPathToVisible(treepath); } - private void popupMenu(MouseEvent e) { - TreePath path = this.getSelectionPath(); - if (path == null) { - return; - } - Component component = (Component) path.getLastPathComponent(); - if (!(component instanceof XCreator)) { - return; - } - ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); - JPopupMenu menu = adapter.getContextPopupMenu(e); - menu.show(this, e.getX(), e.getY()); - } - /** * 刷新 */ @@ -241,12 +203,14 @@ public class ComponentTree extends JTree { creator.notShowInComponentTree(path); } //绝对布局作为body的时候不显示自适应布局父层 - if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class) - && (parent.getParent() != null) - && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ - parent = parent.getParent().getParent(); - continue; + if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class)) { + if ((parent.getParent() != null) + && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ + parent = parent.getParent().getParent(); + continue; + } } + parent = parent.getParent(); } Object[] components = path.toArray(); diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 1d8277c461..196d8752a1 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -3,7 +3,7 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; -import com.fr.form.share.ShareConstants; +import com.fr.share.ShareConstants; import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index cd3b5b448e..b24b2d96fc 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -853,7 +853,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection * @return 是则返回true */ public boolean isRoot(XCreator comp) { - return comp == rootComponent; + return comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class); } // 计算鼠标事件e所发生的位置相对根组件的位置关系 diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 5beea605c8..c33e1b113b 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,11 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginWebBridge; -import com.fr.design.extra.ShopDialog; -import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -16,11 +11,13 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; +import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.SiteCenter; +import com.fr.share.ShareConstants; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -44,16 +41,20 @@ import java.net.URISyntaxException; public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; - private UIScrollPane downPanel; + private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; - private UIButton downloadButton; - private UIButton refreshButton; private UIButton deleteButton; + private UIButton resetButton; + private JPanel editPanel; + private JPanel resetPanel; + private JPanel menutPanel; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; private SwingWorker sw; + //组件面板是否可以编辑 + private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -99,7 +100,6 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { - elCaseBindInfoList = new ElCaseBindInfo[0]; if (sw != null) { sw.cancel(true); } @@ -114,8 +114,6 @@ public class FormWidgetDetailPane extends FormDockView{ sw.execute(); } initReuWidgetPanel(); - createRefreshButton(); - createDownloadButton(); initMenuPanel(); tabbedPane = new UITabbedPane(); tabbedPane.setOpaque(true); @@ -131,38 +129,74 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); - reuWidgetPanel.add(downPanel); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); + reuWidgetPanel.add(downPane); } /** * 初始化菜单栏面板 */ private void initMenuPanel() { - JPanel menutPane = new JPanel(); - menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPane.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); - menutPane.setPreferredSize(new Dimension(240, 48)); - menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + menutPanel = new JPanel(); + menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); + menutPanel.setPreferredSize(new Dimension(240, 48)); + menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - buttonPanel.add(refreshButton, BorderLayout.WEST); - buttonPanel.add(downloadButton, BorderLayout.EAST); - menutPane.add(buttonPanel, BorderLayout.EAST); - menutPane.add(new JPanel(), BorderLayout.CENTER); + + menutPanel.add(initEditButtonPane(), BorderLayout.EAST); + menutPanel.add(new JPanel(), BorderLayout.CENTER); comboBox = new UIComboBox(getFormCategories()); comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); - menutPane.add(comboBox, BorderLayout.SOUTH); - reuWidgetPanel.add(menutPane, BorderLayout.NORTH); + menutPanel.add(comboBox, BorderLayout.SOUTH); + reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); + + } + /** + * 创建菜单栏按钮面板 + */ + private JPanel initEditButtonPane() { + editPanel = new JPanel(); + editPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + editPanel.add(createRefreshButton(), BorderLayout.WEST); + editPanel.add(createDownloadButton(), BorderLayout.EAST); + return editPanel; } + /** + * 创建取消删除面板 + */ + private JPanel initResetButtonPane() { + resetPanel = new JPanel(); + resetButton = new UIButton(Inter.getLocText("FR-Designer_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.set4ToolbarButton(); + resetButton.setOpaque(true); + resetButton.setBackground(new Color(184, 220, 242)); + resetButton.setForeground(Color.WHITE); + resetButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshDownPanel(false); + replaceButtonPanel(false); + reuWidgetPanel.remove(deleteButton); + } + }); + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + return resetPanel; + + } + + private void initComboBoxSelectedListener() { comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); int filterIndex = comboBox.getSelectedIndex(); if (filterIndex == 0) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); @@ -170,14 +204,17 @@ public class FormWidgetDetailPane extends FormDockView{ String filterName = comboBox.getSelectedItem().toString(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); } - refreshDownPanel(false); + refreshDownPanel(isEdit); } }); } - private void createRefreshButton() { - refreshButton = new UIButton(); + /** + * 创建刷新按钮 + */ + private UIButton createRefreshButton() { + UIButton refreshButton = new UIButton(); refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); refreshButton.set4ToolbarButton(); @@ -192,6 +229,7 @@ public class FormWidgetDetailPane extends FormDockView{ protected Object doInBackground() throws Exception { ShareLoader.getLoader().refreshModule(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboxData(); refreshDownPanel(false); return null; } @@ -199,99 +237,106 @@ public class FormWidgetDetailPane extends FormDockView{ sw.execute(); } }); + return refreshButton; + + } + private void refreshComboxData() { + comboBox.setSelectedIndex(0); + comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); } /** * 创建下载模板的按钮 */ - private void createDownloadButton() { - downloadButton = new UIButton(); + private UIButton createDownloadButton() { + UIButton downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.set4ToolbarButton(); downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template")); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - UIPopupMenu menu = new UIPopupMenu(); - UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); - UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); - - menu.add(downloadItem); - menu.add(installItem); - menu.add(deleteItem); - - downloadItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - } catch (Exception exp) { - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - FRContext.getLogger().error("Can not open the browser for URL: " + url); - } - - } - }); - - installItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new JLabel(), Inter.getLocText("FR-Designer_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - - } - } - }); - - deleteItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - deleteFromDiskZipFile(); - } - }); - - GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); + initPopMenu(); + } + }); + return downloadButton; + } + /** + * 初始化下拉面板 + */ + private void initPopMenu() { + UIPopupMenu menu = new UIPopupMenu(); + UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); + menu.add(downloadItem); + menu.add(installItem); + menu.add(deleteItem); + downloadItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FRContext.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (Exception exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + FRContext.getLogger().error("Can not open the browser for URL: " + url); + } } }); + installItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + }); + deleteItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + deleteFromDiskZipFile(); + } + }); + GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); } private void deleteFromDiskZipFile() { deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); - deleteButton.setOpaque(true); deleteButton.setBackground(Color.red); + deleteButton.repaint(); deleteButton.setPreferredSize(new Dimension(240, 40)); reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH); deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if(ShareLoader.getLoader().removeModulesFromList()) { + if (ShareLoader.getLoader().removeModulesFromList()) { refreshShareMoudule(); reuWidgetPanel.remove(deleteButton); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); refreshDownPanel(false); + replaceButtonPanel(false); + refreshComboxData(); } else { - reuWidgetPanel.remove(deleteButton); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); - refreshDownPanel(false); } } @@ -300,25 +345,44 @@ public class FormWidgetDetailPane extends FormDockView{ } - private void installFromDiskZipFile(File chosenFile) { - try { - ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); - } catch (IOException e) { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); - e.printStackTrace(); + private void replaceButtonPanel(boolean isEdit) { + this.isEdit = isEdit; + if (isEdit) { + menutPanel.remove(editPanel); + menutPanel.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menutPanel.remove(resetPanel); + menutPanel.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); } + + } + + private void installFromDiskZipFile(File chosenFile) { + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + refreshComboxData(); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + FRLogger.getLogger().error(e.getMessage(), e); + } + } } private void refreshShareMoudule() { try { ShareLoader.getLoader().refreshModule(); } catch (Exception e) { - e.printStackTrace(); + FRLogger.getLogger().error(e.getMessage(), e); } } @@ -326,15 +390,15 @@ public class FormWidgetDetailPane extends FormDockView{ * 获取报表块组件分类 */ public String[] getFormCategories() { - return ShareConstants.WIDGET_CATEGORIES; + return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); } public void refreshDownPanel(boolean isEdit) { - reuWidgetPanel.remove(downPanel); - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); - reuWidgetPanel.add(downPanel); + reuWidgetPanel.remove(downPane); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); + reuWidgetPanel.add(downPane); repaintContainer(); } diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 4c015811c0..7c912ede0b 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.DesignState; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.WebPreviewUtils; +import com.fr.design.mainframe.actions.FormMobileAttrAction; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.actions.FormDeleteAction; @@ -71,6 +72,7 @@ public class JForm extends JTemplate implements BaseJForm { private JComponent editingComponent; private FormECCompositeProvider reportComposite; + //FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示 protected int index = FORM_TAB; public JForm() { @@ -383,11 +385,13 @@ public class JForm extends JTemplate implements BaseJForm { public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ - new TemplateParameterAction(this) + new TemplateParameterAction(this), + new FormMobileAttrAction(this) }, new ShortCut[0]); } else { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ - new TemplateParameterAction(this) + new TemplateParameterAction(this), + new FormMobileAttrAction(this) }, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index ec663176e9..12e5302b05 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,12 +1,10 @@ package com.fr.design.mainframe; import com.fr.base.*; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.icon.IconPathConstants; -import com.fr.form.share.ShareConstants; +import com.fr.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index cd04300bf1..c5659d9bc1 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe; - import com.fr.form.ui.ElCaseBindInfo; + import javax.swing.*; import java.awt.*; @@ -14,15 +14,15 @@ public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.length + 1) / 2; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); - for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { - ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); - widgetButton.setElementCaseEdit(isEdit); - this.add(widgetButton); + if (elCaseBindInfoList != null) { + int rowCount = (elCaseBindInfoList.length + 1) / 2; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); + for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { + ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); + widgetButton.setElementCaseEdit(isEdit); + this.add(widgetButton); + } + this.setPreferredSize(new Dimension(240, rowCount * 80)); } - this.setPreferredSize(new Dimension(240, rowCount * 80)); - } - } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index cc7f1d7690..860f9f52db 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -38,7 +38,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper private EventPropertyTable eventTable; private List widgetPropertyTables; private FormDesigner designer; - private ComponentTree componentTree; private JPanel wsp; private MobileWidgetTable mobileWidgetTable; private MobileBodyWidgetTable mobileBodyWidgetTable; @@ -122,8 +121,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper clearDockingView(); return; } - - componentTree = new ComponentTree(designer); widgetPropertyTables = new ArrayList(); propertyTable = new WidgetPropertyTable(designer); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); diff --git a/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java new file mode 100644 index 0000000000..4f67187085 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java @@ -0,0 +1,73 @@ +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.JTemplateAction; +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.JForm; +import com.fr.design.menu.MenuKeySet; +import com.fr.form.main.Form; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * Created by fanglei on 2016/11/14. + */ +public class FormMobileAttrAction extends JTemplateAction { + + public FormMobileAttrAction(JForm jf) { + super(jf); + this.setMenuKeySet(REPORT_APP_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/mobile.png")); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + @Override + public void actionPerformed(ActionEvent e) { + final JForm jf = getEditingComponent(); + if (jf == null) { + return; + } + final Form formTpl = jf.getTarget(); + FormMobileAttr mobileAttr = formTpl.getFormMobileAttr(); + + final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); + mobileAttrPane.populateBean(mobileAttr); + BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + formTpl.setFormMobileAttr(mobileAttrPane.updateBean()); + jf.fireTargetModified(); + } + }); + dialog.setVisible(true); + } + + private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 38b62a99a1..0d7b224f64 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,6 +15,7 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; @@ -116,7 +117,6 @@ public class UITreeComboBox extends JComboBox{ JLabel lb = (JLabel)r.getTreeCellRendererComponent( tree, value, isSelected, false, false, index, cellHasFocus); - return lb; } return super.getListCellRendererComponent(list, value, index, @@ -129,7 +129,7 @@ public class UITreeComboBox extends JComboBox{ @Override public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { TreePath[] paths = tree.getSelectedTreePath(); if (tree != null && paths.length > 0) { tree.setAndScrollSelectionPath(paths[0]); @@ -137,7 +137,19 @@ public class UITreeComboBox extends JComboBox{ MenuSelectionManager.defaultManager().clearSelectedPath(); } - } else { + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + tree.refreshUI(); + TreePath[] paths = tree.getSelectedTreePath(); + if (tree != null && paths.length > 0) { + tree.setAndScrollSelectionPath(paths[0]); + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { + tree.refreshUI(); + setSelectedItem(null); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } else { tree.refreshUI(); repaint(); } @@ -192,13 +204,12 @@ class TreePopup extends JPopupMenu implements ComboPopup{ public TreePopup(JComboBox comboBox){ this.comboBox = (UITreeComboBox)comboBox; - setBorder(BorderFactory.createLineBorder(Color.black)); setLayout(new BorderLayout()); setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); JTree tree = this.comboBox.getTree(); if(tree != null){ - scrollPane = new JScrollPane(tree); - scrollPane.setBorder(null); + scrollPane = new UIScrollPane(tree); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); add(scrollPane, BorderLayout.CENTER); } } diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index e1decfe2b4..9a3f8b563f 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -33,6 +33,7 @@ public class ParameterToolBarPane extends BasicBeanPane { private static final int GAP_H = 4; private static final int GAP_V = 6; private static final int GAP_BV = 4; + private static final int BUTTON_HEIGHT = 20; private static final int WIDTH = 225; private static final int L_H = 18; @@ -48,12 +49,12 @@ public class ParameterToolBarPane extends BasicBeanPane { return new Dimension(super.getPreferredSize().width, 18); } }; - label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":"); + label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":"); label.setHorizontalAlignment(SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); this.add(label); - addAll = new UIButton(Inter.getLocText("Add-all")); + addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all")); this.add(addAll); } @@ -132,7 +133,7 @@ public class ParameterToolBarPane extends BasicBeanPane { layoutContainer(parent); - int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (20 + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); + int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); return new Dimension(w, h); } @@ -160,7 +161,7 @@ public class ParameterToolBarPane extends BasicBeanPane { x += (dim.width + GAP_H); } - addAll.setBounds(0, y + GAP_V+ 20, width, addAll.getPreferredSize().height); + addAll.setBounds(0, y + GAP_V + BUTTON_HEIGHT, width, addAll.getPreferredSize().height); } }