daniel 8 years ago
parent
commit
cdb5e7515c
  1. 10
      designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java
  2. 2
      designer_base/build.gradle
  3. 4
      designer_base/build.gradle.bak
  4. 22
      designer_base/src/com/fr/design/beans/location/MoveUtils.java
  5. 2
      designer_chart/build.gradle
  6. 4
      designer_chart/build.gradle.bak
  7. 2
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  8. 2
      designer_form/build.gradle
  9. 20
      designer_form/build.gradle.bak
  10. 36
      designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java
  11. 34
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  12. 4
      designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java
  13. 10
      designer_form/src/com/fr/design/designer/beans/location/Inner.java
  14. 7
      designer_form/src/com/fr/design/designer/beans/models/AddingModel.java
  15. 3
      designer_form/src/com/fr/design/designer/beans/painters/FRFitLayoutPainter.java
  16. 17
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  17. 20
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  18. 5
      designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java
  19. 30
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  20. 2
      designer_form/src/com/fr/design/form/parameter/XFormSubmit.java
  21. 2
      designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
  22. 18
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

10
designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java

@ -183,6 +183,16 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
public Point getDesignerLocationOnScreen() { public Point getDesignerLocationOnScreen() {
return null; return null;
} }
@Override
public int getDesignerScrollVerticalValue() {
return 0;
}
@Override
public int getDesignerScrollHorizontalValue() {
return 0;
}
}; };
private RectangleIterator getRectangleIt(){ private RectangleIterator getRectangleIt(){

2
designer_base/build.gradle

@ -33,7 +33,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }

4
designer_base/build.gradle.bak

@ -33,7 +33,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/*/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
@ -56,7 +56,7 @@ task compressJS{
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') 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'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')

22
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -3,8 +3,6 @@
*/ */
package com.fr.design.beans.location; package com.fr.design.beans.location;
import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -98,6 +96,18 @@ public class MoveUtils {
* @param line 吸附线 * @param line 吸附线
*/ */
void setEquidistantLine(Absorptionline line); void setEquidistantLine(Absorptionline line);
/**
* 获取设计器垂直滚动条的值
* @return 滚动条的值
*/
int getDesignerScrollVerticalValue();
/**
* 获取设计器水平滚动条的值
* @return 滚动条的值
*/
int getDesignerScrollHorizontalValue();
} }
public interface RectangleIterator { public interface RectangleIterator {
@ -457,7 +467,13 @@ public class MoveUtils {
right = equidistantLines.get(i).getReference(); right = equidistantLines.get(i).getReference();
} }
} }
line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle, top, left, bottom, right); operatingRectangle.x -= designer.getDesignerScrollHorizontalValue();
operatingRectangle.y -= designer.getDesignerScrollVerticalValue();
line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle,
top - designer.getDesignerScrollVerticalValue(),
left - designer.getDesignerScrollHorizontalValue(),
bottom - designer.getDesignerScrollVerticalValue(),
right - designer.getDesignerScrollHorizontalValue());
} }
designer.setEquidistantLine(line); designer.setEquidistantLine(line);
} }

2
designer_chart/build.gradle

@ -31,7 +31,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
// //
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }

4
designer_chart/build.gradle.bak

@ -31,7 +31,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
// //
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/*/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
@ -54,7 +54,7 @@ task compressJS{
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') 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'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')

2
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -316,7 +316,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution());
g2d.drawImage(chartImage, 0, 0, chartWidth, chartHeight, null); g2d.drawImage(chartImage, 0, 0, null);
} }
} }

2
designer_form/build.gradle

@ -33,7 +33,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
// //
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")//,exclude:"finereport-design-stable/${branchName}/build/libs/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }

20
designer_form/build.gradle.bak

@ -3,19 +3,19 @@ apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.8
//jar包版本 //jar包版本
version='8.0' version='8.0'
def srcDir="." def srcDir="."
//jar包的名字 //jar包的名字
jar{ jar{
baseName='fr-designer-report' baseName='fr-designer-report'
} }
// //
sourceSets{ sourceSets{
main{ main{
java{ java{
@ -25,20 +25,20 @@ sourceSets{
} }
} }
// //
FileTree files =fileTree(dir:'./',include:'build.gradle') FileTree files =fileTree(dir:'./',include:'build.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
// //
dependencies{ dependencies{
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")//,exclude:"finereport-design-stable/${branchName}/build/libs/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/*/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
// //
def dataContent ={def dir -> def dataContent ={def dir ->
copySpec{ copySpec{
from ("${dir}"){ from ("${dir}"){
@ -47,7 +47,7 @@ def dataContent ={def dir ->
} }
} }
//.java文件复制到classes文件夹下 //.java文件复制到classes文件夹下
task copyFile(type:Copy,dependsOn:compileJava){ task copyFile(type:Copy,dependsOn:compileJava){
copy{ copy{
with dataContent.call("${srcDir}/src") with dataContent.call("${srcDir}/src")
@ -58,7 +58,7 @@ task copyFile(type:Copy,dependsOn:compileJava){
} }
//js文件 //js文件
task compressJS{ task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath { classpath {

36
designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java

@ -1,38 +1,31 @@
package com.fr.design.designer.beans.adapters.component; package com.fr.design.designer.beans.adapters.component;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JPopupMenu;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.gui.xtable.PropertyGroupModel;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.actions.ChangeNameAction; import com.fr.design.designer.beans.actions.ChangeNameAction;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.xtable.PropertyGroupModel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
public class CompositeComponentAdapter implements ComponentAdapter { public class CompositeComponentAdapter implements ComponentAdapter {
@ -81,7 +74,8 @@ public class CompositeComponentAdapter implements ComponentAdapter {
} }
//底层布局或者是自适应布局都不能删除 //底层布局或者是自适应布局都不能删除
boolean isRootComponent = ComponentUtils.isRootComponent(xCreator) || designer.isRoot(xCreator); boolean isRootComponent = ComponentUtils.isRootComponent(xCreator) || designer.isRoot(xCreator);
changeVarNameAction.setEnabled(!isRootComponent); //bug103155 有的布局的重命名(tab布局)涉及到其他非子节点的属性修改,支持起来比较麻烦,先屏蔽了控件树面板的修改,强制使用属性面板修改
changeVarNameAction.setEnabled(!isRootComponent && xCreator.supportRenameInWidgetTree());
popupMenu.add(changeVarNameAction); popupMenu.add(changeVarNameAction);
Action[] actions = designer.getActions(); Action[] actions = designer.getActions();

34
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -46,6 +46,10 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
* @param y 坐标y * @param y 坐标y
* @return 能则返回true * @return 能则返回true
*/ */
//这个地方的逻辑非常复杂,
// 1.当前绝对布局是不可编辑且是最外层,那么其他控件添加在它周围,
// 2.当前绝对布局是不可编辑且不是最外层,那么控件不可添加,(嵌套)
// 3.当前绝对布局可编辑,那么控件添加
@Override @Override
public boolean accept(XCreator creator, int x, int y) { public boolean accept(XCreator creator, int x, int y) {
Component comp = container.getComponentAt(x, y); Component comp = container.getComponentAt(x, y);
@ -55,11 +59,29 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
if (comp == null){ if (comp == null){
return false; return false;
} }
//判断下组件能不能拖入绝对布局
if (!creator.canEnterIntoAbsolutePane()){
return false;
}
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout();
if(topLayout != null){ if(topLayout != null){
if (topLayout.isEditable()){ if (topLayout.isEditable()){
//判断有没有和当前控件重叠 //判断有没有和当前控件重叠
Rectangle curRec = new Rectangle(x, y, creator.getWidth(), creator.getHeight()); //先计算当前控件的位置
int creatorX, creatorY;
if (XCreatorUtils.getParentXLayoutContainer(creator) != null) {
Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator);
creatorX = creatorRectangle.x;
creatorY = creatorRectangle.y;
} else {
int w = creator.getWidth() / 2;
int h = creator.getHeight() / 2;
creatorX = x - w;
creatorY = y - h;
}
//再判断和布局中其他控件重叠
Rectangle curRec = new Rectangle(creatorX, creatorY, creator.getWidth(), creator.getHeight());
WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout)topLayout.toData(); WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout)topLayout.toData();
for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) { for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) {
WAbsoluteLayout.BoundsWidget temp = (WAbsoluteLayout.BoundsWidget) wAbsoluteLayout.getWidget(i); WAbsoluteLayout.BoundsWidget temp = (WAbsoluteLayout.BoundsWidget) wAbsoluteLayout.getWidget(i);
@ -68,9 +90,19 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
return false; return false;
} }
} }
if (creatorX < 0
|| creatorX + creator.getWidth() > container.getWidth()
|| creatorY < 0
|| creatorY + creator.getHeight() > container.getHeight()) {
return false;
}
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight()
&& creator.getWidth() <= container.getWidth(); && creator.getWidth() <= container.getWidth();
} }
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) {
return false;
}
else { else {
return acceptWidget(creator, x, y); return acceptWidget(creator, x, y);
} }

4
designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java

@ -53,9 +53,9 @@ public abstract class AccessDirection implements Direction {
//参数面板可以无下限拉长 //参数面板可以无下限拉长
if (y < 0) { if (y < 0) {
y = 0; y = 0;
} else if (y > designer.getRootComponent().getHeight() && designer.getSelectionModel().hasSelectionComponent() } else if (y > designer.getRootComponent().getHeight() + designer.getParaHeight() && designer.getSelectionModel().hasSelectionComponent()
&& !designer.getSelectionModel().getSelection().getSelectedCreator().acceptType(XWParameterLayout.class)) { && !designer.getSelectionModel().getSelection().getSelectedCreator().acceptType(XWParameterLayout.class)) {
y = designer.getRootComponent().getHeight(); y = designer.getRootComponent().getHeight() + designer.getParaHeight();
} }
return new Point(x, y); return new Point(x, y);
} }

10
designer_form/src/com/fr/design/designer/beans/location/Inner.java

@ -119,6 +119,16 @@ public class Inner extends AccessDirection {
public void setEquidistantLine(Absorptionline line) { public void setEquidistantLine(Absorptionline line) {
designer.getStateModel().setEquidistantLine(line); designer.getStateModel().setEquidistantLine(line);
} }
@Override
public int getDesignerScrollHorizontalValue() {
return designer.getArea().getHorizontalValue();
}
@Override
public int getDesignerScrollVerticalValue() {
return designer.getArea().getVerticalValue();
}
}; };
//判断当前操作的是不是参数面板,要特殊处理 //判断当前操作的是不是参数面板,要特殊处理
boolean isParameterLayout = ((XCreator)(designer.getSelectionModel().getSelection().getSelectedCreator().getParent())).acceptType(XWParameterLayout.class); boolean isParameterLayout = ((XCreator)(designer.getSelectionModel().getSelection().getSelectedCreator().getParent())).acceptType(XWParameterLayout.class);

7
designer_form/src/com/fr/design/designer/beans/models/AddingModel.java

@ -2,6 +2,7 @@ package com.fr.design.designer.beans.models;
import java.awt.Rectangle; import java.awt.Rectangle;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
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;
@ -115,6 +116,12 @@ public class AddingModel {
* @return 成功返回true * @return 成功返回true
*/ */
public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) { public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) {
//考虑不同布局嵌套的情况,获取顶层容器
XLayoutContainer xLayoutContainer = container.getTopLayout();
if(xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)){
container = xLayoutContainer;
}
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(container);
if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){ if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){
return added = container.getLayoutAdapter().addBean(creator,x,y); return added = container.getLayoutAdapter().addBean(creator,x,y);

3
designer_form/src/com/fr/design/designer/beans/painters/FRFitLayoutPainter.java

@ -107,10 +107,9 @@ public class FRFitLayoutPainter extends AbstractPainter{
// 下边缘 // 下边缘
Rectangle bottomEdge = new Rectangle(containerX, bottomY, containerWidth, BORDER_PROPORTION); Rectangle bottomEdge = new Rectangle(containerX, bottomY, containerWidth, BORDER_PROPORTION);
if(bottomEdge.intersects(currentXY)){ if(bottomEdge.intersects(currentXY)){
hotspot_bounds.y -= WCardMainBorderLayout.TAB_HEIGHT/2; hotspot_bounds.y += (container.getHeight() - WCardMainBorderLayout.TAB_HEIGHT)/2;
hot_rec[WIDTH] = container.getWidth(); hot_rec[WIDTH] = container.getWidth();
hot_rec[HEIGHT] = (container.getHeight() + WCardMainBorderLayout.TAB_HEIGHT)/2; hot_rec[HEIGHT] = (container.getHeight() + WCardMainBorderLayout.TAB_HEIGHT)/2;
accept = false;
} }
//左右边缘的高度 -10*2 是为了不和上下边缘重合 //左右边缘的高度 -10*2 是为了不和上下边缘重合

17
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -316,6 +316,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return true; return true;
} }
/**
* 该组件是否可以拖入绝对布局
* @return 是则返回true
*/
public boolean canEnterIntoAbsolutePane() {
return true;
}
/** /**
* 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽)
* @return 是则返回true * @return 是则返回true
@ -536,4 +544,13 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[0]; return new WidgetPropertyUIProvider[0];
} }
/**
* 控件树面板中是否支持重命名选项
*
* @return 控件树面板中是否支持重命名选项
*/
public boolean supportRenameInWidgetTree() {
return true;
}
} }

20
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -78,6 +78,16 @@ public class XWAbsoluteLayout extends XLayoutContainer {
initPercent(); initPercent();
} }
/**
* 初始化时默认的组件大小
*
* @return 默认Dimension
*/
@Override
public Dimension initEditorSize() {
return new Dimension(500, 300);
}
//根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90%
private void initPercent(){ private void initPercent(){
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
@ -155,6 +165,9 @@ public class XWAbsoluteLayout extends XLayoutContainer {
if (xCreator.hasTitleStyle()) { if (xCreator.hasTitleStyle()) {
xCreator = (XLayoutContainer)xCreator.getParent(); xCreator = (XLayoutContainer)xCreator.getParent();
} }
if (xCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) xCreator).updateBoundsWidget();
}
BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData());
Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
} }
@ -186,6 +199,11 @@ public class XWAbsoluteLayout extends XLayoutContainer {
Rectangle rec = calculateBound(wgtBound, percentW, percentH); Rectangle rec = calculateBound(wgtBound, percentW, percentH);
wgt.setBounds(rec); wgt.setBounds(rec);
creator.setBounds(rec); creator.setBounds(rec);
//绝对布局嵌套,要更新内部的绝对布局
if (creator.acceptType(XWAbsoluteLayout.class)){
creator.setBackupBound(wgtBound);
((XWAbsoluteLayout) creator).updateBoundsWidget();
}
} }
} }
} }
@ -223,7 +241,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
@Override @Override
protected String getIconName() { protected String getIconName() {
return "layout_absolute.png"; return "layout_absolute_new.png";
} }
/** /**

5
designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -190,4 +190,9 @@ public class XWParameterLayout extends XWAbsoluteLayout {
@Override @Override
public void updateBoundsWidget() { public void updateBoundsWidget() {
} }
@Override
protected String getIconName() {
return "layout_absolute.png";
}
} }

30
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -3,33 +3,17 @@
*/ */
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ContainerEvent;
import java.beans.IntrospectionException;
import javax.swing.border.Border;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.form.layout.FRCardLayout; import com.fr.design.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.form.ui.CardAddButton; import com.fr.form.ui.*;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
@ -41,6 +25,11 @@ import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.ContainerEvent;
import java.beans.IntrospectionException;
/** /**
* @author richer * @author richer
* @since 6.5.3 * @since 6.5.3
@ -379,4 +368,9 @@ public class XWCardLayout extends XLayoutContainer {
public XLayoutContainer getTopLayout() { public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout(); return this.getBackupParent().getTopLayout();
} }
@Override
public boolean supportRenameInWidgetTree() {
return false;
}
} }

2
designer_form/src/com/fr/design/form/parameter/XFormSubmit.java

@ -1 +1 @@
package com.fr.design.form.parameter; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XCreator; import com.fr.form.parameter.FormSubmitButton; import java.awt.*; /** * 提交按钮 * @editor zhou * @since 2012-3-23下午3:36:00 */ public class XFormSubmit extends XButton { public XFormSubmit(FormSubmitButton widget, Dimension initSize) { super(widget, initSize); } /** * 是否有查询按钮 * @param xCreator 控件或容器 * @return 有无查询按钮 */ public boolean SearchQueryCreators(XCreator xCreator) { return true; } /** * 该组件是否可以拖入表单主体 * @return 是则返回true */ public boolean canEnterIntoAdaptPane(){ return false; } @Override protected String getIconName() { return "preview_16.png"; } } package com.fr.design.form.parameter; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XCreator; import com.fr.form.parameter.FormSubmitButton; import java.awt.*; /** * 提交按钮 * @editor zhou * @since 2012-3-23下午3:36:00 */ public class XFormSubmit extends XButton { public XFormSubmit(FormSubmitButton widget, Dimension initSize) { super(widget, initSize); } /** * 是否有查询按钮 * @param xCreator 控件或容器 * @return 有无查询按钮 */ public boolean SearchQueryCreators(XCreator xCreator) { return true; } /** * 该组件是否可以拖入表单主体 * @return 是则返回true */ public boolean canEnterIntoAdaptPane(){ return false; } /** * 该组件是否可以拖入绝对布局 * * @return 是则返回true */ @Override public boolean canEnterIntoAbsolutePane() { return false; } @Override protected String getIconName() { return "preview_16.png"; } }

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_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.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_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); }

18
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -20,11 +20,7 @@ import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.Painter;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
@ -135,8 +131,16 @@ public class FormCreatorDropTarget extends DropTarget {
// 取消前一个焦点容器的提示渲染器 // 取消前一个焦点容器的提示渲染器
designer.setPainter(null); designer.setPainter(null);
} }
//获取painter的时候要考虑布局之间嵌套的问题
painter = AdapterBus.getContainerPainter(designer, container); XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.getParent() != null
&& ((XLayoutContainer)xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)){
if(!xLayoutContainer.isEditable()){
xLayoutContainer = (XLayoutContainer)xLayoutContainer.getParent();
}
}
painter = AdapterBus.getContainerPainter(designer,
xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container);
// 为界面设计器设置提示渲染提示器 // 为界面设计器设置提示渲染提示器
designer.setPainter(painter); designer.setPainter(painter);

Loading…
Cancel
Save