kerry 8 years ago
parent
commit
14ab8a4969
  1. 3
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  2. 4
      designer_base/src/com/fr/design/locale/designer.properties
  3. 4
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  4. 4
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  5. 4
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  6. 12
      designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java
  7. 28
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java
  8. 11
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  9. 10
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  10. 51
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

3
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -13,6 +13,7 @@ import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript; import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup; import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.PluginManager; import com.fr.plugin.PluginManager;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,7 +35,7 @@ public class HyperlinkGroupPane extends JListControlPane {
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new TreeMap<String, NameableCreator>(); Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
for (NameableCreator creator : creators) { for (NameableCreator creator : creators) {
nameCreators.put(creator.menuName(), creator); nameCreators.put(creator.menuName(), creator);

4
designer_base/src/com/fr/design/locale/designer.properties

@ -566,5 +566,5 @@ FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
FR-Designer_WidgetOrder=Widget Order FR-Designer_WidgetOrder=Widget Order
FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP.
FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid.

4
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -567,5 +567,5 @@ FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
FR-Designer_WidgetOrder=Widget Order FR-Designer_WidgetOrder=Widget Order
FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP.
FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid.

4
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -571,5 +571,5 @@ FR-Designer_DS_TableData=\u6570\u636E\u96C6
FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Parameter-Formula=\u516C\u5F0F
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6
FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F
FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002
FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA\: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548. FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA\: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002

4
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -559,5 +559,5 @@ FR-Designer_DS_TableData=\u8CC7\u6599\u96C6
FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Parameter-Formula=\u516C\u5F0F
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u904E\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8ACB\u806F\u7E6B\u958B\u767C\u8005\u5347\u7D1A\u63D2\u4EF6 FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u904E\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8ACB\u806F\u7E6B\u958B\u767C\u8005\u5347\u7D1A\u63D2\u4EF6
FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F
FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002
FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002

12
designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java

@ -161,26 +161,37 @@ public class UIEditLabel extends JPanel implements UIObserver{
return text; return text;
} }
protected boolean appendOriginalLabel() {
return true;
}
private void stopEditing(){ private void stopEditing(){
isEditingStopped = true; isEditingStopped = true;
this.removeAll(); this.removeAll();
if(appendOriginalLabel()) {
String text = this.showLabel.getText(); String text = this.showLabel.getText();
text = StringUtils.cutStringEndWith(text, ":"); text = StringUtils.cutStringEndWith(text, ":");
text = !ComparatorUtils.equals(text, this.originalLabel) ? text = !ComparatorUtils.equals(text, this.originalLabel) ?
StringUtils.perfectEnd(text, "(" + this.originalLabel + ")") : this.originalLabel; StringUtils.perfectEnd(text, "(" + this.originalLabel + ")") : this.originalLabel;
showLabel.setText(StringUtils.perfectEnd(text, ":")); showLabel.setText(StringUtils.perfectEnd(text, ":"));
}
this.add(showLabel, BorderLayout.CENTER); this.add(showLabel, BorderLayout.CENTER);
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
} }
public String getText(){ public String getText(){
if(appendOriginalLabel()) {
String text = this.showLabel.getText(); String text = this.showLabel.getText();
text = StringUtils.cutStringEndWith(text, ":"); text = StringUtils.cutStringEndWith(text, ":");
return StringUtils.cutStringEndWith(text, "(" + this.originalLabel + ")"); return StringUtils.cutStringEndWith(text, "(" + this.originalLabel + ")");
} else {
return this.showLabel.getText();
}
} }
public void setText(String text){ public void setText(String text){
if(appendOriginalLabel()) {
if (text == null || StringUtils.isEmpty(text)) { if (text == null || StringUtils.isEmpty(text)) {
this.showLabel.setText(this.originalLabel); this.showLabel.setText(this.originalLabel);
return; return;
@ -190,6 +201,7 @@ public class UIEditLabel extends JPanel implements UIObserver{
text = StringUtils.perfectEnd(text, "(" + originalLabel + ")"); text = StringUtils.perfectEnd(text, "(" + originalLabel + ")");
} }
text = StringUtils.perfectEnd(text, ":"); text = StringUtils.perfectEnd(text, ":");
}
this.showLabel.setText(text); this.showLabel.setText(text);
} }

28
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java

@ -2,9 +2,11 @@ package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -34,7 +36,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
protected static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小 protected static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小
protected int trisectAreaDirect = 0; protected int trisectAreaDirect = 0;
protected int crossPointAreaDirect = 0; private int crossPointAreaDirect = 0;
// 增加删除拉伸控件用的临时list // 增加删除拉伸控件用的临时list
protected java.util.List<Component> rightComps; protected java.util.List<Component> rightComps;
protected java.util.List<Component> leftComps; protected java.util.List<Component> leftComps;
@ -49,6 +51,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
protected int minHeight = 0; protected int minHeight = 0;
protected int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 protected int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑
protected PaddingMargin margin; // 布局容器边距 protected PaddingMargin margin; // 布局容器边距
/** /**
* 在添加组件状态时当鼠标移动到某个容器上方时如果该容器有布局管理器则会调用该布局 * 在添加组件状态时当鼠标移动到某个容器上方时如果该容器有布局管理器则会调用该布局
* 管理适配器的accept来决定当前位置是否可以放置并提供特殊的标识比如红色区域标识 * 管理适配器的accept来决定当前位置是否可以放置并提供特殊的标识比如红色区域标识
@ -76,6 +79,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 交叉点区域时能否对应位置放入组件 * 交叉点区域时能否对应位置放入组件
*
* @param comp 待放置组件 * @param comp 待放置组件
* @param x x * @param x x
* @param y y * @param y y
@ -129,6 +133,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 三等分区域时能否对应位置放入组件 * 三等分区域时能否对应位置放入组件
*
* @param comp 待放置组件 * @param comp 待放置组件
* @param x x * @param x x
* @param y y * @param y y
@ -367,6 +372,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 判断是否鼠标在组件的三等分区域如果组件在布局管理器中间上下左右都可能会三等分 * 判断是否鼠标在组件的三等分区域如果组件在布局管理器中间上下左右都可能会三等分
*
* @param parentComp 鼠标所在区域的组件 * @param parentComp 鼠标所在区域的组件
* @param x 坐标x * @param x 坐标x
* @param y 坐标y * @param y 坐标y
@ -407,6 +413,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 是否为组件交叉点区域 或者是相邻三组建中间点 * 是否为组件交叉点区域 或者是相邻三组建中间点
*
* @param currentComp 当前组件 * @param currentComp 当前组件
* @param x 坐标x * @param x 坐标x
* @param y 坐标y * @param y 坐标y
@ -513,6 +520,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 平分正常情况拖入组件时按照上1/4区域下1/4区域为上下平分中左侧1/2区域中右侧1/2区域为左右平分 * 平分正常情况拖入组件时按照上1/4区域下1/4区域为上下平分中左侧1/2区域中右侧1/2区域为左右平分
*
* @param currentComp 当前位置组件 * @param currentComp 当前位置组件
* @param child 待放置组件 * @param child 待放置组件
* @param x x * @param x x
@ -624,8 +632,21 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
XLayoutContainer cardLayout = ((XWCardMainBorderLayout) currentCreator).getCardPart(); XLayoutContainer cardLayout = ((XWCardMainBorderLayout) currentCreator).getCardPart();
XLayoutContainer container = (XLayoutContainer) cardLayout.getComponent(0); XLayoutContainer container = (XLayoutContainer) cardLayout.getComponent(0);
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(container);
/*
* 为了获取到鼠标drop位置的控件
* 我们之前已经将y值变为相对坐标值
* 由于在x轴上没有偏移所以x值一直等于相对坐标值最多差一个边界值1
* 在进行新添加的控件位置计算时
* 又通过ComponentUtils.getRelativeBounds()方法获取到了绝对坐标
* 再次计算相对坐标所以将y值重新变成绝对坐标
* */
if (currentCreator.getBackupParent().getLocation().y == WBorderLayout.DEFAULT_SIZE) {
y = y + WCardMainBorderLayout.TAB_HEIGHT + WBorderLayout.DEFAULT_SIZE;
} else {
y = y + WCardMainBorderLayout.TAB_HEIGHT;
}
int tempX = x - rect.x; int tempX = x - rect.x;
int tempY = y - rect.y + WCardMainBorderLayout.TAB_HEIGHT; int tempY = y - rect.y;
int containerX = container.getX(); int containerX = container.getX();
int containerY = container.getY(); int containerY = container.getY();
int containerWidth = container.getWidth(); int containerWidth = container.getWidth();
@ -658,6 +679,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
* 组件交叉区域进行插入时调整受到变动的其他组件,之前是交叉区域插入也按照三等分逻辑后面测试中发现有bug改为和bi一样的鼠标所在侧平分 * 组件交叉区域进行插入时调整受到变动的其他组件,之前是交叉区域插入也按照三等分逻辑后面测试中发现有bug改为和bi一样的鼠标所在侧平分
* 默认左上角右下角区域是垂直方向插入组件 * 默认左上角右下角区域是垂直方向插入组件
* 右上角和左下角是水平方向插入组件这样避免田字块时重复 * 右上角和左下角是水平方向插入组件这样避免田字块时重复
*
* @param currentComp 当前位置组件 * @param currentComp 当前位置组件
* @param child 待放置组件 * @param child 待放置组件
* @param x x * @param x x
@ -900,6 +922,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 三等分区域时调整相关联的组件 * 三等分区域时调整相关联的组件
*
* @param currentComp 鼠标所在组件 * @param currentComp 鼠标所在组件
* @param child 待插入组件 * @param child 待插入组件
*/ */
@ -1122,6 +1145,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{
/** /**
* 不调整只计算位置 * 不调整只计算位置
*
* @return child的位置 * @return child的位置
*/ */
public int[] getChildPosition(Component currentComp, XCreator child, int x, int y) { public int[] getChildPosition(Component currentComp, XCreator child, int x, int y) {

11
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -7,6 +7,7 @@ package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
@ -14,6 +15,7 @@ import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -31,6 +33,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
/** /**
* 构造函数 * 构造函数
*
* @param container XWTabFitLayout容器 * @param container XWTabFitLayout容器
*/ */
public FRTabFitLayoutAdapter(XLayoutContainer container) { public FRTabFitLayoutAdapter(XLayoutContainer container) {
@ -49,6 +52,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
/** /**
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的 * 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能 * addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
*
* @param creator 被添加的新组件 * @param creator 被添加的新组件
* @param x 添加的位置x该位置是相对于container的 * @param x 添加的位置x该位置是相对于container的
* @param y 添加的位置y该位置是相对于container的 * @param y 添加的位置y该位置是相对于container的
@ -84,11 +88,16 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
// tab布局的纵坐标受到tab高度的影响,判断的上边界取得是里面XWTabFitLayout的上边界, // tab布局的纵坐标受到tab高度的影响,判断的上边界取得是里面XWTabFitLayout的上边界,
// 实际计算的时候的纵坐标用了外层的CardMainBorerLayout,需要将tab高度减掉 // 实际计算的时候的纵坐标用了外层的CardMainBorerLayout,需要将tab高度减掉
//将y值变为相对坐标以实现获取到鼠标drop位置的控件
//TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了
private int adjustY(int y, XWTabFitLayout tabLayout) { private int adjustY(int y, XWTabFitLayout tabLayout) {
XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent(); XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); LayoutBorderStyle style = cardLayout.toData().getBorderStyle();
if (container.getLocation().y == WBorderLayout.DEFAULT_SIZE) {
y = y - WBorderLayout.DEFAULT_SIZE;
}
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
y -= WCardMainBorderLayout.TAB_HEIGHT; y = y - WCardMainBorderLayout.TAB_HEIGHT;
} }
return y; return y;
} }

10
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -48,7 +48,6 @@ public class XCardSwitchButton extends XButton {
//设置的图片类型 //设置的图片类型
private static final String COLOR_BACKGROUND_TYPE = "ColorBackground"; private static final String COLOR_BACKGROUND_TYPE = "ColorBackground";
private static final String DEFAULT_TYPE = "default"; private static final String DEFAULT_TYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色 //默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color NORMAL_GRAL = new Color(236,236,236);
@ -67,7 +66,6 @@ public class XCardSwitchButton extends XButton {
private static final int FONT_SIZE_ADJUST = 2; private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57; private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout; private XWCardTagLayout tagLayout;
@ -345,10 +343,7 @@ public class XCardSwitchButton extends XButton {
// 标题部分 // 标题部分
WidgetTitle title = style.getTitle(); WidgetTitle title = style.getTitle();
FRFont font = button.getFont(); FRFont font = title.getFrFont();
if (font == null) {
font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
@ -427,9 +422,6 @@ public class XCardSwitchButton extends XButton {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData(); CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont(); FRFont frFont = cardSwitchButton.getFont();
if (frFont == null) {
frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
UILabel label = temp.getContentLabel(); UILabel label = temp.getContentLabel();
label.setSize(dimension); label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution())); label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));

51
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -1,11 +1,5 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import java.awt.*;
import java.beans.IntrospectionException;
import javax.swing.border.Border;
import com.fr.base.ScreenResolution;
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.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
@ -16,25 +10,25 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.FontEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.beans.IntrospectionException;
/** /**
* @author focus * @author focus
@ -46,14 +40,10 @@ public class XWTabFitLayout extends XWFitLayout {
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份 // 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236); private static final Color NORMAL_GRAL = new Color(236,236,236);
private static final String DEFAULT_FONT_NAME = "SimSun";
public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12);
public final static FRFont DEFAULT_FRFT = FRFont.getInstance(DEFAULT_FONT_NAME, 0, 9);
private Dimension referDim; private Dimension referDim;
private Background initialBackground; private Background initialBackground;
private Background overBackground; private Background overBackground;
private Background clickBackground; private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton; private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() { public Dimension getReferDim() {
@ -88,15 +78,6 @@ public class XWTabFitLayout extends XWFitLayout {
this.clickBackground = clickBackground; this.clickBackground = clickBackground;
} }
@Override
public FRFont getFont() {
return font;
}
public void setFont(FRFont font) {
this.font = font;
}
public XCardSwitchButton getxCardSwitchButton() { public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton; return xCardSwitchButton;
} }
@ -164,21 +145,7 @@ public class XWTabFitLayout extends XWFitLayout {
cardSwitchButton.setClickBackground(clickBackground); cardSwitchButton.setClickBackground(clickBackground);
} }
} }
), )
//字体
creatNonListenerStyle(4).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
font = ((WTabFitLayout) data).getFont();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setFont(font);
UILabel uiLabel = xCardSwitchButton.getLabel();
uiLabel.setFont(font.applyResolutionNP(ScreenResolution.getScreenResolution()));
uiLabel.setForeground(font.getForeground());
xCardSwitchButton.setLabel(uiLabel);
}
}),
}; };
} }
@ -210,9 +177,6 @@ public class XWTabFitLayout extends XWFitLayout {
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue( ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced") XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
return crPropertyDescriptors[i]; return crPropertyDescriptors[i];
@ -243,20 +207,15 @@ public class XWTabFitLayout extends XWFitLayout {
if (!isStyle) { if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false); this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.getLabel().setFont(DEFAULTFT);
cardSwitchButton.setInitialBackground(null); cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null); cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null); cardSwitchButton.setOverBackground(null);
cardSwitchButton.setFont(DEFAULT_FRFT);
} else { } else {
Background initialBackground = cardSwitchButton.getInitialBackground(); Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground; bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true); this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true); cardSwitchButton.setCustomStyle(true);
if (font != null) {
cardSwitchButton.setFont(font);
}
if (this.initialBackground != null){ if (this.initialBackground != null){
this.xCardSwitchButton.setSelectBackground(this.initialBackground); this.xCardSwitchButton.setSelectBackground(this.initialBackground);
cardSwitchButton.setInitialBackground(this.initialBackground); cardSwitchButton.setInitialBackground(this.initialBackground);

Loading…
Cancel
Save