Fangjie Hu
8 years ago
39 changed files with 1243 additions and 573 deletions
@ -1,86 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
sourceCompatibility=1.7 |
||||
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}/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") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.selection.SelectionEvent; |
||||
import com.fr.design.selection.SelectionListener; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
/** |
||||
* Created by daniel on 2016/10/10. |
||||
*/ |
||||
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> { |
||||
|
||||
protected SelectionListenerAction(ElementCasePane elementCasePane) { |
||||
super(elementCasePane); |
||||
} |
||||
|
||||
protected SelectionListener createSelectionListener () { |
||||
return new SelectionListener() { |
||||
|
||||
@Override |
||||
public void selectionChanged(SelectionEvent e) { |
||||
update(); |
||||
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { |
||||
Selection selection = getEditingComponent().getSelection(); |
||||
if (selection instanceof CellSelection) { |
||||
CellSelection cellselection = (CellSelection) selection; |
||||
//样式处理
|
||||
getEditingComponent().setCellNeedTOFormat(cellselection); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -1,70 +0,0 @@
|
||||
|
||||
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',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 |
||||
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.fr.design.hyperlink; |
||||
|
||||
/** |
||||
* Created by ibm on 2016/10/13. |
||||
*/ |
||||
public enum HyperlinkTargetFrame { |
||||
BLANK_FRAME("_blank", 0), DIALOG_FRAME("_dialog", 1), SELF_FRAME("_self", 2); |
||||
|
||||
private String name; |
||||
private int index; |
||||
private static HyperlinkTargetFrame[] arrayOfValues; |
||||
|
||||
HyperlinkTargetFrame(String name, int index) { |
||||
this.name = name; |
||||
this.index = index; |
||||
} |
||||
|
||||
public static HyperlinkTargetFrame parse(int index) { |
||||
if (arrayOfValues == null) { |
||||
arrayOfValues = HyperlinkTargetFrame.values(); |
||||
} |
||||
for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) { |
||||
if (hyperlinkTargetFrame.getIndex() == index) { |
||||
return hyperlinkTargetFrame; |
||||
} |
||||
} |
||||
return BLANK_FRAME; |
||||
} |
||||
|
||||
|
||||
public int getIndex() { |
||||
return index; |
||||
} |
||||
|
||||
public void setIndex(int index) { |
||||
this.index = index; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
|
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
||||
|
@ -1,66 +0,0 @@
|
||||
|
||||
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',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 |
||||
|
@ -1,83 +0,0 @@
|
||||
|
||||
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${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 |
||||
|
@ -0,0 +1,14 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/9/18. |
||||
*/ |
||||
public class LayoutTypeRenderer extends EncoderCellRenderer { |
||||
|
||||
public LayoutTypeRenderer() { |
||||
super(new LayoutTypeWrapper()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
import com.fr.design.designer.properties.items.FRLayoutTypeItems; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/9/18. |
||||
*/ |
||||
public class LayoutTypeWrapper extends ItemWrapper{ |
||||
|
||||
public LayoutTypeWrapper() { |
||||
super(new FRLayoutTypeItems()); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fr.design.designer.properties.items; |
||||
|
||||
import com.fr.form.ui.container.WBodyLayoutType; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/9/18. |
||||
*/ |
||||
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())}; |
||||
|
||||
public Item[] getItems() { |
||||
return ITEMS; |
||||
} |
||||
} |
@ -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_AbsoluteLayout"), 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_CardLayout"), 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);
} |
@ -0,0 +1,192 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
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.layout.FRGUIPaneFactory; |
||||
import com.fr.form.share.ShareLoader; |
||||
import com.fr.form.ui.ElCaseBindInfo; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.datatransfer.DataFlavor; |
||||
import java.awt.datatransfer.Transferable; |
||||
import java.awt.datatransfer.UnsupportedFlavorException; |
||||
import java.awt.dnd.*; |
||||
import java.awt.event.MouseEvent; |
||||
import java.awt.event.MouseListener; |
||||
import java.awt.event.MouseMotionListener; |
||||
import java.awt.image.BufferedImage; |
||||
import java.io.IOException; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* Coder: zack |
||||
* Date: 2016/10/9 |
||||
* Time: 16:14 |
||||
*/ |
||||
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { |
||||
private ElCaseBindInfo bindInfo; |
||||
private MouseEvent lastPressEvent; |
||||
|
||||
public ShareWidgetButton(ElCaseBindInfo bindInfo) { |
||||
this.bindInfo = bindInfo; |
||||
initUI(); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); |
||||
this.addMouseListener(this); |
||||
this.addMouseMotionListener(this); |
||||
new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); |
||||
} |
||||
|
||||
|
||||
private void initUI() { |
||||
this.setBackground(Color.WHITE); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
setPreferredSize(new Dimension(110, 70)); |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); |
||||
|
||||
this.add(imagePanel, BorderLayout.NORTH); |
||||
JPanel panel = new JPanel(); |
||||
UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); |
||||
panel.setBackground(new Color(184, 220, 242)); |
||||
panel.add(label); |
||||
this.add(panel, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
private class ImagePanel extends JPanel { |
||||
|
||||
private BufferedImage image; |
||||
|
||||
public ImagePanel(BufferedImage image) { |
||||
this.image = image; |
||||
this.setPreferredSize(new Dimension(110, 50)); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
g.drawImage(image, 0, 0, 110, 70, null); |
||||
} |
||||
|
||||
} |
||||
|
||||
public ElCaseBindInfo getBindInfo() { |
||||
return bindInfo; |
||||
} |
||||
|
||||
public void setBindInfo(ElCaseBindInfo bindInfo) { |
||||
this.bindInfo = bindInfo; |
||||
} |
||||
|
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void mousePressed(MouseEvent e) { |
||||
lastPressEvent = e; |
||||
} |
||||
|
||||
@Override |
||||
public void mouseReleased(MouseEvent e) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void mouseEntered(MouseEvent e) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void mouseExited(MouseEvent e) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void mouseDragged(MouseEvent e) { |
||||
if (BaseUtils.isAuthorityEditing()) { |
||||
return; |
||||
} |
||||
if (lastPressEvent == null) { |
||||
return; |
||||
} |
||||
Object source = e.getSource(); |
||||
Widget creatorSource = null; |
||||
String shareId = StringUtils.EMPTY; |
||||
if (source instanceof ShareWidgetButton) { |
||||
ShareWidgetButton no = (ShareWidgetButton) e.getSource(); |
||||
if (no == null) { |
||||
return; |
||||
} |
||||
shareId = no.getBindInfo().getId(); |
||||
creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); |
||||
} |
||||
if (creatorSource != null) { |
||||
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); |
||||
xCreator.setShareId(shareId); |
||||
WidgetToolBarPane.getTarget().startDraggingBean(xCreator); |
||||
lastPressEvent = null; |
||||
this.setBorder(null); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void mouseMoved(MouseEvent e) { |
||||
|
||||
} |
||||
|
||||
public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { |
||||
private DragSource source; |
||||
|
||||
public DragAndDropDragGestureListener(ShareWidgetButton tt, int actions) { |
||||
source = new DragSource(); |
||||
source.createDefaultDragGestureRecognizer(tt, actions, this); |
||||
} |
||||
|
||||
public void dragGestureRecognized(DragGestureEvent dge) { |
||||
ShareWidgetButton shareWidgetButton = (ShareWidgetButton) dge.getComponent(); |
||||
if (shareWidgetButton != null) { |
||||
Widget widget = ShareLoader.getLoader().getElCaseEditorById(shareWidgetButton.getBindInfo().getId()); |
||||
DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); |
||||
dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void dragEnter(DragSourceDragEvent dragSourceDragEvent) { |
||||
|
||||
} |
||||
} |
||||
|
||||
public class DragAndDropTransferable implements Transferable { |
||||
private Widget widget; |
||||
|
||||
public DragAndDropTransferable(Widget widget) { |
||||
this.widget = widget; |
||||
} |
||||
|
||||
DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; |
||||
|
||||
public DataFlavor[] getTransferDataFlavors() { |
||||
return flavors; |
||||
} |
||||
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) { |
||||
for (DataFlavor df : flavors) { |
||||
if (ComparatorUtils.equals(df, flavor)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException { |
||||
return widget; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
|
||||
import com.fr.form.ui.ElCaseBindInfo; |
||||
|
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
/** |
||||
* Created by xiaxiang on 2016/10/10. |
||||
*/ |
||||
public class ShareWidgetPane extends JPanel { |
||||
public ShareWidgetPane(ArrayList<ElCaseBindInfo> elCaseBindInfoList) { |
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离
|
||||
int rowCount = (elCaseBindInfoList.size() + 1)/2; |
||||
this.setLayout(new GridLayout(rowCount, 2, 10, 10)); |
||||
for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { |
||||
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); |
||||
this.add(widgetButton); |
||||
} |
||||
if (elCaseBindInfoList.size() == 1) { |
||||
this.add(new JPanel()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,291 @@
|
||||
package com.fr.design.mainframe.widget; |
||||
|
||||
/** |
||||
* Created by xiaxiang on 2016/9/30. |
||||
*/ |
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
import javax.swing.*; |
||||
import javax.swing.plaf.*; |
||||
import javax.swing.plaf.basic.*; |
||||
import javax.swing.plaf.metal.*; |
||||
import javax.swing.tree.*; |
||||
|
||||
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.mainframe.ComponentTree; |
||||
import com.sun.java.swing.plaf.motif.*; |
||||
import com.sun.java.swing.plaf.windows.*; |
||||
|
||||
/** |
||||
* 控件树下拉列表框 |
||||
*/ |
||||
public class UITreeComboBox extends JComboBox{ |
||||
/** |
||||
* 显示用的树 |
||||
*/ |
||||
private ComponentTree tree; |
||||
|
||||
public UITreeComboBox(ComponentTree componentTree){ |
||||
this.setTree(componentTree); |
||||
tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); |
||||
// for(int i=0; i<tree.getRowCount(); i++)
|
||||
// {
|
||||
// tree.expandRow(i);
|
||||
// }
|
||||
setPreferredSize(new Dimension(200, 20)); |
||||
} |
||||
|
||||
/** |
||||
* 设置树 |
||||
* @param tree ComponentTree |
||||
*/ |
||||
public void setTree(ComponentTree tree){ |
||||
this.tree = tree; |
||||
if(tree != null){ |
||||
this.setSelectedItem(tree.getSelectionPath()); |
||||
this.setRenderer(new UITreeComboBoxRenderer()); |
||||
} |
||||
this.updateUI(); |
||||
} |
||||
|
||||
/** |
||||
* 取得树 |
||||
* @return JTree |
||||
*/ |
||||
public ComponentTree getTree(){ |
||||
return tree; |
||||
} |
||||
|
||||
/** |
||||
* 设置当前选择的树路径 |
||||
* @param o Object |
||||
*/ |
||||
public void setSelectedItem(Object o){ |
||||
tree.setSelectionPath((TreePath)o); |
||||
getModel().setSelectedItem(o); |
||||
} |
||||
|
||||
public void updateUI(){ |
||||
ComboBoxUI cui = (ComboBoxUI)UIManager.getUI(this); |
||||
if(cui instanceof MetalComboBoxUI){ |
||||
cui = new MetalJTreeComboBoxUI(); |
||||
} else if(cui instanceof MotifComboBoxUI){ |
||||
cui = new MotifJTreeComboBoxUI(); |
||||
} else { |
||||
cui = new WindowsJTreeComboBoxUI(); |
||||
} |
||||
setUI(cui); |
||||
} |
||||
|
||||
// UI Inner classes -- one for each supported Look and Feel
|
||||
class MetalJTreeComboBoxUI extends MetalComboBoxUI{ |
||||
protected ComboPopup createPopup() { |
||||
return new TreePopup(comboBox); |
||||
} |
||||
} |
||||
|
||||
class WindowsJTreeComboBoxUI extends WindowsComboBoxUI{ |
||||
protected ComboPopup createPopup() { |
||||
return new TreePopup(comboBox); |
||||
} |
||||
} |
||||
|
||||
class MotifJTreeComboBoxUI extends MotifComboBoxUI{ |
||||
protected ComboPopup createPopup() { |
||||
return new TreePopup(comboBox); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* <p>Title: UITreeComboBoxRenderer</p> |
||||
* <p>Description: 树形结构而来的DefaultListCellRenderer </p> |
||||
*/ |
||||
class UITreeComboBoxRenderer extends DefaultListCellRenderer { |
||||
public Component getListCellRendererComponent(JList list, Object value, |
||||
int index, boolean isSelected, boolean cellHasFocus){ |
||||
if(value != null){ |
||||
TreePath path = (TreePath)value; |
||||
Object node = path.getLastPathComponent(); |
||||
value = node; |
||||
TreeCellRenderer r = tree.getCellRenderer(); |
||||
JLabel lb = (JLabel)r.getTreeCellRendererComponent( |
||||
tree, value, isSelected, false, false, index, |
||||
cellHasFocus); |
||||
return lb; |
||||
} |
||||
return super.getListCellRendererComponent(list, value, index, |
||||
isSelected, cellHasFocus); |
||||
} |
||||
} |
||||
|
||||
|
||||
private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener { |
||||
|
||||
@Override |
||||
public void fireCreatorModified(DesignerEvent evt) { |
||||
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { |
||||
TreePath[] paths = tree.getSelectedTreePath(); |
||||
|
||||
if (paths.length == 1) { |
||||
tree.setAndScrollSelectionPath(paths[0]); |
||||
} else { |
||||
tree.setSelectionPaths(paths); |
||||
} |
||||
setSelectedItem(paths[0]); |
||||
MenuSelectionManager.defaultManager().clearSelectedPath(); |
||||
} else { |
||||
return; |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) { |
||||
return o.getClass() == this.getClass(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 测试 |
||||
*/ |
||||
// public static void main(String args[]){
|
||||
// JFrame frame = new JFrame("UITreeComboBox");
|
||||
// final UITreeComboBox box = new UITreeComboBox(new ComponentTree(new FormDesigner()));
|
||||
// box.setPreferredSize(new Dimension(300, 28));
|
||||
// frame.getContentPane().add(box);
|
||||
// frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
// frame.pack();
|
||||
// frame.setVisible(true);
|
||||
// }
|
||||
} |
||||
|
||||
/** |
||||
* <p>Title: UITreeComboBox</p> |
||||
* <p>Description: TreePopup</p> |
||||
*/ |
||||
class TreePopup extends JPopupMenu implements ComboPopup{ |
||||
protected UITreeComboBox comboBox; |
||||
protected JScrollPane scrollPane; |
||||
|
||||
protected MouseMotionListener mouseMotionListener; |
||||
protected MouseListener mouseListener; |
||||
|
||||
|
||||
public void popupMenu(MouseEvent e) { |
||||
TreePath path = comboBox.getTree().getSelectionPath(); |
||||
if (path == null) { |
||||
return; |
||||
} |
||||
Component component = (Component) path.getLastPathComponent(); |
||||
if (!(component instanceof XCreator)) { |
||||
return; |
||||
} |
||||
com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(comboBox.getTree().getDesigner(), (XCreator) component); |
||||
JPopupMenu menu = adapter.getContextPopupMenu(e); |
||||
menu.show(comboBox, e.getX(), e.getY()); |
||||
} |
||||
|
||||
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); |
||||
add(scrollPane, BorderLayout.CENTER); |
||||
} |
||||
} |
||||
|
||||
public void show(){ |
||||
updatePopup(); |
||||
show(comboBox, 0, comboBox.getHeight()); |
||||
comboBox.getTree().requestFocus(); |
||||
} |
||||
|
||||
public void hide(){ |
||||
setVisible(false); |
||||
comboBox.firePropertyChange("popupVisible", true, false); |
||||
} |
||||
|
||||
protected JList list = new JList(); |
||||
public JList getList(){ |
||||
return list; |
||||
} |
||||
|
||||
public MouseMotionListener getMouseMotionListener(){ |
||||
if(mouseMotionListener == null){ |
||||
mouseMotionListener = new MouseMotionAdapter(){}; |
||||
} |
||||
return mouseMotionListener; |
||||
} |
||||
|
||||
public KeyListener getKeyListener(){ |
||||
return null; |
||||
} |
||||
|
||||
public void uninstallingUI(){} |
||||
|
||||
/** |
||||
* Implementation of ComboPopup.getMouseListener(). |
||||
* |
||||
* @return a <code>MouseListener</code> or null |
||||
* @see ComboPopup#getMouseListener |
||||
*/ |
||||
public MouseListener getMouseListener(){ |
||||
if(mouseListener == null){ |
||||
mouseListener = new InvocationMouseHandler(); |
||||
} |
||||
return mouseListener; |
||||
} |
||||
|
||||
protected void togglePopup(){ |
||||
if(isVisible()){ |
||||
hide(); |
||||
} else{ |
||||
show(); |
||||
} |
||||
} |
||||
protected void updatePopup(){ |
||||
setPreferredSize(new Dimension(comboBox.getSize().width, 200)); |
||||
Object selectedObj = comboBox.getSelectedItem(); |
||||
if(selectedObj != null){ |
||||
TreePath tp = (TreePath)selectedObj; |
||||
((UITreeComboBox)comboBox).getTree().setSelectionPath(tp); |
||||
} |
||||
} |
||||
|
||||
protected class InvocationMouseHandler extends MouseAdapter{ |
||||
public void mousePressed(MouseEvent e){ |
||||
if(!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled()){ |
||||
return; |
||||
} |
||||
if(comboBox.isEditable()){ |
||||
Component comp = comboBox.getEditor().getEditorComponent(); |
||||
if((!(comp instanceof JComponent)) || |
||||
((JComponent)comp).isRequestFocusEnabled()){ |
||||
comp.requestFocus(); |
||||
} |
||||
} else if(comboBox.isRequestFocusEnabled()){ |
||||
comboBox.requestFocus(); |
||||
} |
||||
togglePopup(); |
||||
} |
||||
|
||||
public void mouseClicked (MouseEvent e){ |
||||
if (e.isMetaDown()) { |
||||
popupMenu(e); |
||||
} else { |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.mainframe.widget.editors; |
||||
|
||||
import com.fr.design.designer.properties.EnumerationEditor; |
||||
import com.fr.design.designer.properties.items.FRLayoutTypeItems; |
||||
|
||||
/** |
||||
* Created by zhouping on 2016/9/18. |
||||
*/ |
||||
public class LayoutTypeEditor extends EnumerationEditor { |
||||
|
||||
public LayoutTypeEditor() { |
||||
super(new FRLayoutTypeItems()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue