Fangjie Hu 8 years ago
parent
commit
241acf8c27
  1. 70
      designer_base/build.dev.gradle
  2. 9
      designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java
  3. 6
      designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java
  4. 13
      designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java
  5. 44
      designer_base/src/com/fr/design/mainframe/HelpDialogManager.java
  6. 66
      designer_chart/build.dev.gradle
  7. 4
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  8. 89
      designer_form/build.dev.gradle
  9. 7
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  10. 23
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  11. 3
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  12. 4
      designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java
  13. 2
      designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
  14. 97
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  15. 52
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  16. 15
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  17. 58
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

70
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

9
designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java

@ -1,8 +1,8 @@
package com.fr.design.fun; 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.stable.fun.ReportFitAttrProvider;
import com.fr.form.main.Form;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
@ -16,10 +16,7 @@ public interface FormElementCaseEditorProvider extends Mutable {
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, FormProvider formProvider, ElementCaseEditorProvider editor);
//加个provider返回tab的接口
//design_base依赖了form
PropertyDescriptor[] createPropertyDescriptor (Class<?> temp, Form form, ElementCaseEditor editor);
/** /**
* 生成属性表 * 生成属性表

6
designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java

@ -1,8 +1,8 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.form.main.Form; import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.API; import com.fr.stable.fun.mark.API;
@ -24,7 +24,7 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme
} }
@Override @Override
public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, Form reportAttr, ElementCaseEditor editor) { public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, FormProvider reportAttr, ElementCaseEditorProvider editor) {
return new PropertyDescriptor[0]; return new PropertyDescriptor[0];
} }

13
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();
}

44
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();
}
}
}

66
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

4
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -79,8 +79,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public static WidgetOption[] initWidgetOption(){ public static WidgetOption[] initWidgetOption(){
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
//异步加载 //异步加载
new Thread(new Runnable() { new Thread(new Runnable() {

89
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

7
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.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import javax.swing.*; import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.designer.beans.events.DesignerEditor; 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.BaseChartEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null); editor.setLayout(null);
editor.setOpaque(false); editor.setOpaque(false);
coverPanel = new CoverReportPane(); coverPanel = new CoverPane();
coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setPreferredSize(this.getPreferredSize());
coverPanel.setBounds(this.getBounds()); coverPanel.setBounds(this.getBounds());

23
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.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; 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.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.form.main.Form;
import com.fr.stable.fun.FitProvider; import com.fr.stable.fun.FitProvider;
import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.ReportFitAttrProvider;
@ -100,7 +98,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
//这边有个插件兼容问题,之后还是要改回process才行 //这边有个插件兼容问题,之后还是要改回process才行
@ -110,8 +108,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
continue; continue;
} }
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Form form = designer.getTarget(); FormProvider formProvider = designer.getTarget();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData()); ElementCaseEditorProvider elementCaseEditorProvider = this.toData();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider);
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
} }
@ -201,6 +200,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
editor.repaint(); editor.repaint();
} }
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){ public JComponent getCoverPane(){
return coverPanel; return coverPanel;
} }
@ -280,6 +286,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (this.isHelpBtnOnFocus()) { if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e); coverPanel.setMsgDisplay(e);
}else { }else {
coverPanel.destroyHelpDialog();
switchTab(e,editingMouseListener); switchTab(e,editingMouseListener);
} }
} }

3
designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -116,9 +116,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
moveComponents2FitLayout(xfl); moveComponents2FitLayout(xfl);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl); formDesigner.getSelectionModel().setSelectedCreator(xfl);
xfl.convert();
LayoutUtils.layoutContainer(xfl);
xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0);
for (int i = 0; i < components.length; i++) { for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i); Component comp = xfl.getComponent(i);

4
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 class FRLayoutTypeItems implements ItemProvider{
public static final Item[] ITEMS = new Item[] { public static final Item[] ITEMS = new Item[] {
new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue())/*, new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()),
new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())*/}; new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())};
public Item[] getItems() { public Item[] getItems() {
return ITEMS; return ITEMS;

2
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<? extends Widget> 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); } 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<? extends Widget> 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); }

97
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);
}
}

52
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.form.share.ShareConstants;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -16,15 +15,13 @@ import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
* Created with IntelliJ IDEA. * 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
* User: zx * Coder: zack
* Date: 14-7-24 * Date: 2016/11/2
* Time: 上午9:09 * Time: 11:32
*/ */
public class CoverReportPane extends JPanel { public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
private JComponent controlButton = new JComponent() { private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel {
private ElementCaseHelpDialog helpDialog = null; private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() { public CoverReportPane() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
} }
public CoverReportPane(String helpMsg) { public CoverReportPane(String helpMsg) {
super();
this.helpMsg = helpMsg; 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); add(controlButton);
if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel {
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow(); helpDialog.showWindow();
HelpDialogManager.getInstance().setPane(this);
} else { } else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint(); controlButton.repaint();
@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
UIButton editButton = getEditButton();
int width = parent.getParent().getWidth(); int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight(); int height = parent.getParent().getHeight();
int preferWidth = editButton.getPreferredSize().width; 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() { public void destroyHelpDialog() {
if (helpDialog != null) { if (helpDialog != null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
@ -159,4 +132,11 @@ public class CoverReportPane extends JPanel {
} }
} }
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (aFlag) {
HelpDialogManager.getInstance().setPane(this);
}
}
} }

15
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e); XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, false);
if(processTopLayoutMouseMove(component, e)){ if(processTopLayoutMouseMove(component, e)){
return; return;
@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint(); designer.repaint();
} }
private void setCoverPaneNotDisplay(){ private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null) { 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); xElementCase.displayCoverPane(false);
} }
if (xChartEditor != null){ if (xChartEditor != null){
@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getDefaultCursor()); designer.setCursor(Cursor.getDefaultCursor());
} }
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }

58
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -1,47 +1,35 @@
package com.fr.design.mainframe; 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.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.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.ShopDialog; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.WebManagerPaneFactory; 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.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton; 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.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
import com.fr.general.Inter; 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. * Created with IntelliJ IDEA.
* User: zx * User: zx
@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIButton deleteButton; private UIButton deleteButton;
private static final int OFFSET_X = 140; private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26; private static final int OFFSET_Y = 26;
private SwingWorker sw;
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
reuWidgetPanel.setBorder(null); reuWidgetPanel.setBorder(null);
if (elCaseBindInfoList == null) { if (elCaseBindInfoList == null) {
elCaseBindInfoList = new ElCaseBindInfo[0];
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
initReuWidgetPanel(); initReuWidgetPanel();
createRefreshButton(); createRefreshButton();
@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
refreshShareMoudule(); if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false); refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
}); });

Loading…
Cancel
Save