forked from fanruan/design
Fangjie Hu
8 years ago
17 changed files with 473 additions and 97 deletions
@ -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 |
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
/** |
||||
* Coder: zack |
||||
* Date: 2016/11/3 |
||||
* Time: 10:43 |
||||
*/ |
||||
public interface HelpDialogHandler { |
||||
/** |
||||
* 销毁 |
||||
*/ |
||||
void destroyHelpDialog(); |
||||
} |
@ -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(); |
||||
} |
||||
} |
||||
} |
@ -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 |
||||
|
@ -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 |
||||
|
@ -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);
} |
@ -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); |
||||
} |
||||
} |
Loading…
Reference in new issue