diff --git a/designer_base/build.dev.gradle b/designer_base/build.dev.gradle new file mode 100644 index 0000000000..b02f751e7c --- /dev/null +++ b/designer_base/build.dev.gradle @@ -0,0 +1,70 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.7 +//指定生成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/${branchName}",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_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index 191f7fa998..92a1a835f4 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -1,8 +1,8 @@ package com.fr.design.fun; -import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.FormProvider; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.stable.fun.ReportFitAttrProvider; -import com.fr.form.main.Form; import com.fr.stable.fun.mark.Mutable; import java.beans.PropertyDescriptor; @@ -16,10 +16,7 @@ public interface FormElementCaseEditorProvider extends Mutable { int CURRENT_LEVEL = 1; - - //加个provider返回tab的接口 - //design_base依赖了form - PropertyDescriptor[] createPropertyDescriptor (Class temp, Form form, ElementCaseEditor editor); + PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider formProvider, ElementCaseEditorProvider editor); /** * 生成属性表 diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index f65107e2eb..8764eaf898 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -1,8 +1,8 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProvider; -import com.fr.form.main.Form; -import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.FormProvider; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; @@ -24,7 +24,7 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme } @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, Form reportAttr, ElementCaseEditor editor) { + public PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider reportAttr, ElementCaseEditorProvider editor) { return new PropertyDescriptor[0]; } diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java b/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java new file mode 100644 index 0000000000..dec93e6588 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe; + +/** + * Coder: zack + * Date: 2016/11/3 + * Time: 10:43 + */ +public interface HelpDialogHandler { + /** + * 销毁 + */ + void destroyHelpDialog(); +} diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java new file mode 100644 index 0000000000..9cae023ea7 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe; + +/** + * 帮助信息的面板由于需要滚动条所以采用了很挫的dialog做,dialog很多情况下不能主动关闭,这边控制一下 + * Coder: zack + * Date: 2016/11/2 + * Time: 16:34 + */ +public class HelpDialogManager { + private static HelpDialogManager THIS; + private HelpDialogHandler handler; + + private HelpDialogManager() { + + } + + public HelpDialogHandler getPane() { + return handler; + } + + public void setPane(HelpDialogHandler dialog) { + if (dialog == this.handler) { + return; + } + //只允许一个dialog存在 + if (this.handler != null) { + handler.destroyHelpDialog(); + } + this.handler = dialog; + } + + public static HelpDialogManager getInstance() { + if (THIS == null) { + THIS = new HelpDialogManager(); + } + return THIS; + } + + public void destroyDialog() { + if (handler != null) { + handler.destroyHelpDialog(); + } + } +} diff --git a/designer_chart/build.dev.gradle b/designer_chart/build.dev.gradle new file mode 100644 index 0000000000..ba6df992bd --- /dev/null +++ b/designer_chart/build.dev.gradle @@ -0,0 +1,66 @@ + +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-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/${branchName}",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/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 873a967501..2af5af799b 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -79,8 +79,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public static WidgetOption[] initWidgetOption(){ - ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; //异步加载 new Thread(new Runnable() { diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle new file mode 100644 index 0000000000..2b727caac9 --- /dev/null +++ b/designer_form/build.dev.gradle @@ -0,0 +1,89 @@ + +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) + +//显示依赖jar包 +FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") +f.each{File file-> + println "----${file.path}" +} + +//声明外部依赖 +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/src/com/fr/design/designer/creator/XChartEditor.java b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java index 49d193199e..28926f6c82 100644 --- a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java @@ -2,26 +2,21 @@ package com.fr.design.designer.creator; import java.awt.*; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import javax.swing.*; -import com.fr.base.BaseUtils; -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.*; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.module.DesignModuleFactory; import com.fr.design.designer.beans.events.DesignerEditor; -import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.Widget; import com.fr.design.form.util.XCreatorConstants; @@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { editor.setLayout(null); editor.setOpaque(false); - coverPanel = new CoverReportPane(); + coverPanel = new CoverPane(); coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setBounds(this.getBounds()); diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 39caec435c..2ba11975f5 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -9,10 +9,7 @@ import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.CoverReportPane; -import com.fr.design.mainframe.EditingMouseListener; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.*; import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; @@ -20,12 +17,13 @@ import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; +import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.form.main.Form; import com.fr.stable.fun.FitProvider; import com.fr.stable.fun.ReportFitAttrProvider; @@ -100,7 +98,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) .setI18NName(Inter.getLocText("Form-EC_toolbar")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }; //这边有个插件兼容问题,之后还是要改回process才行 @@ -110,8 +108,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - Form form = designer.getTarget(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData()); + FormProvider formProvider = designer.getTarget(); + ElementCaseEditorProvider elementCaseEditorProvider = this.toData(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } @@ -201,6 +200,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme editor.repaint(); } + /** + * 销毁帮助提示框 + */ + public void destroyHelpDialog(){ + coverPanel.destroyHelpDialog(); + } + public JComponent getCoverPane(){ return coverPanel; } @@ -280,6 +286,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme if (this.isHelpBtnOnFocus()) { coverPanel.setMsgDisplay(e); }else { + coverPanel.destroyHelpDialog(); switchTab(e,editingMouseListener); } } diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index ab22986161..6b29a172e5 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -116,9 +116,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr moveComponents2FitLayout(xfl); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreator(xfl); - xfl.convert(); - LayoutUtils.layoutContainer(xfl); - xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0); for (int i = 0; i < components.length; i++) { Component comp = xfl.getComponent(i); diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java index cd9ddb439c..a19d975170 100644 --- a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java +++ b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java @@ -7,8 +7,8 @@ import com.fr.form.ui.container.WBodyLayoutType; */ public class FRLayoutTypeItems implements ItemProvider{ public static final Item[] ITEMS = new Item[] { - new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue())/*, - new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())*/}; + new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()), + new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())}; public Item[] getItems() { return ITEMS; diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java index 545ffadf73..b3fa73a26d 100644 --- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java +++ b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java @@ -1 +1 @@ -package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER/*, ABSOLUTELAYOUTCONTAINER*/}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file +package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/CoverPane.java b/designer_form/src/com/fr/design/mainframe/CoverPane.java new file mode 100644 index 0000000000..b6cdd472a2 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/CoverPane.java @@ -0,0 +1,97 @@ +package com.fr.design.mainframe; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.icon.IconPathConstants; +import com.fr.general.IOUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created with IntelliJ IDEA. + * User: zx + * Date: 14-7-24 + * Time: 上午9:09 + */ +public class CoverPane extends JPanel { + + private UIButton editButton; + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); + + public CoverPane() { + setLayout(getCoverLayout()); + setBackground(null); + setOpaque(false); + + editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { + @Override + public Dimension getPreferredSize() { + return new Dimension(60, 24); + } + }; + editButton.setBorderPainted(false); + editButton.setExtraPainted(false); + editButton.setBackground(new Color(176, 196, 222)); + add(editButton); + } + + public AlphaComposite getComposite() { + return composite; + } + + public void setComposite(AlphaComposite composite) { + this.composite = composite; + } + + public UIButton getEditButton() { + return editButton; + } + + public void setEditButton(UIButton editButton) { + this.editButton = editButton; + } + + protected LayoutManager getCoverLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return parent.getPreferredSize(); + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getParent().getWidth(); + int height = parent.getParent().getHeight(); + int preferWidth = editButton.getPreferredSize().width; + int preferHeight = editButton.getPreferredSize().height; + editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(composite); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(oldComposite); + super.paint(g); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 63ec66f5a5..f996338562 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -8,7 +8,6 @@ import com.fr.design.icon.IconPathConstants; import com.fr.form.share.ShareConstants; import com.fr.general.FRScreen; import com.fr.general.IOUtils; -import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; @@ -16,15 +15,13 @@ import java.awt.*; import java.awt.event.MouseEvent; /** - * Created with IntelliJ IDEA. - * User: zx - * Date: 14-7-24 - * Time: 上午9:09 + * 报表块的封面(如果后面所有的组件都有帮助信息的话就抽接口吧) + * Coder: zack + * Date: 2016/11/2 + * Time: 11:32 */ -public class CoverReportPane extends JPanel { - - private UIButton editButton; - private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); +public class CoverReportPane extends CoverPane implements HelpDialogHandler{ + private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); private JComponent controlButton = new JComponent() { protected void paintComponent(Graphics g) { g.setColor(UIConstants.NORMAL_BACKGROUND); @@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel { private ElementCaseHelpDialog helpDialog = null; - private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); - public CoverReportPane() { this(StringUtils.EMPTY); } public CoverReportPane(String helpMsg) { + super(); this.helpMsg = helpMsg; - setLayout(getCoverLayout()); - setBackground(null); - setOpaque(false); - - editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { - @Override - public Dimension getPreferredSize() { - return new Dimension(60, 24); - } - }; - editButton.setBorderPainted(false); - editButton.setExtraPainted(false); - editButton.setBackground(new Color(176, 196, 222)); - add(editButton); add(controlButton); if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { @@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel { int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.showWindow(); + HelpDialogManager.getInstance().setPane(this); } else { controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlButton.repaint(); @@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel { @Override public void layoutContainer(Container parent) { + UIButton editButton = getEditButton(); int width = parent.getParent().getWidth(); int height = parent.getParent().getHeight(); int preferWidth = editButton.getPreferredSize().width; @@ -139,17 +123,6 @@ public class CoverReportPane extends JPanel { }; } - - public void paint(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - g2d.setComposite(composite); - g2d.setColor(Color.white); - g2d.fillRect(0, 0, getWidth(), getHeight()); - g2d.setComposite(oldComposite); - super.paint(g); - } - public void destroyHelpDialog() { if (helpDialog != null) { controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); @@ -159,4 +132,11 @@ public class CoverReportPane extends JPanel { } } -} \ No newline at end of file + @Override + public void setVisible(boolean aFlag) { + super.setVisible(aFlag); + if (aFlag) { + HelpDialogManager.getInstance().setPane(this); + } + } +} diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index 0aa77281d1..869ec2077f 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter { public void mouseMoved(MouseEvent e) { XCreator component = designer.getComponentAt(e); - setCoverPaneNotDisplay(); + setCoverPaneNotDisplay(e, false); if(processTopLayoutMouseMove(component, e)){ return; @@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter { designer.repaint(); } - private void setCoverPaneNotDisplay(){ - if (xElementCase != null){ + private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) { + if (xElementCase != null) { + int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); + int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); + Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight()); + if (rect.contains(e.getPoint())) { + return; + } + if(isLinkedHelpDialog){ + xElementCase.destroyHelpDialog(); + } xElementCase.displayCoverPane(false); } if (xChartEditor != null){ @@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter { designer.setCursor(Cursor.getDefaultCursor()); } - setCoverPaneNotDisplay(); + setCoverPaneNotDisplay(e, true); cancelPromptWidgetForbidEnter(); } diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 6bcc9a2661..a1fb5f1476 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,47 +1,35 @@ package com.fr.design.mainframe; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.util.*; -import java.util.List; - -import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.filechooser.FileNameExtensionFilter; - import com.fr.base.BaseUtils; -import com.fr.design.actions.file.WebPreviewUtils; -import com.fr.design.constants.UIConstants; 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.file.HistoryTemplateListPane; -import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIPreviewButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.parameter.ParameterPropertyPane; 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.IOUtils; import com.fr.general.Inter; +import javax.swing.*; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; + /** * Created with IntelliJ IDEA. * User: zx @@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UIButton deleteButton; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; + private SwingWorker sw; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + elCaseBindInfoList = new ElCaseBindInfo[0]; + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); } initReuWidgetPanel(); createRefreshButton(); @@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{ refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - refreshShareMoudule(); - refreshDownPanel(false); + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); } });